[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1770469383193867.png (459 KB, 720x480)
459 KB
459 KB PNG
previous: >>108292753

#define __NR_truncate            76
#define __NR_ftruncate 77

https://man7.org/linux/man-pages/man2/truncate.2.html

tl;dr:
set a file to a specific length

that's all you're getting from me today because i'm in a rush
only other thing i will add is it's pretty bizarre (from a naming perspective) that you can "truncate" a file to a larger size

relevant resources:
man man

man syscalls

https://man7.org/linux/man-pages/
https://linux.die.net/man/
https://elixir.bootlin.com/linux/
https://elixir.bootlin.com/musl/
https://elixir.bootlin.com/glibc/
>>
The name is bizarre, but how else would you enlarge a file that you only ever map into your process? If you don't write() to it it never gets bigger.

Hence the ftruncate.
>>
Bump.
>>
>>108302139
It could feasibly creat a file with some specific length argument.
What you can actually do is lseek to some arbitrary location and then do a single write, although that is quite the hack.
>>
>>108301681
>only other thing i will add is it's pretty bizarre (from a naming perspective) that you can "truncate" a file to a larger size
This will also create a "sparse" file with "holes" that doesn't take up its full size on disk.
>>
bampu
>>
>>108302139
i would just rename it to like fsetsize lol
>>
>>108304766
Yeah. Sure. Issue two syscalls, with the second one potentially triggering a block.

Autism?
>>
>>108301681
do poll() tomorrow
>>
>>108307145
already did poll like a month and a half ago, sorry
>>
>>108304766
>It could feasibly creat a file with some specific length argument.
It could feasibly be done with/as capability of creat to create file with some specific length argument.
>>108307128
the other anon asked how else you could possibly size a file. There's your answer. The autism seems to be strong on your side, rather
>>108307145
what do you want to talk about
>>
>>108307919
>you're autistic because you mind mode switches and thread blocks
So not only autism on your side, but also retardation.
But then again your spelling gives it away.
>>
>>108308093
no, the autism is on your side because rather than actually talk about merits you instead opt to insult other people.
speaks very highly of you indeed, grow up. I can't really describe how pathetic I consider you and your ilk
>spelling gives it away
?
>>
i'll give us another bampu



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.