flat assembler
Message board for the users of flat assembler.

Index > Linux > Reading allocated file size.

Author
Thread Post new topic Reply to topic
CandyMan



Joined: 04 Sep 2009
Posts: 414
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 17 Dec 2021, 18:12
Is there any system call returning the size of a disk cluster or the true allocated size of the file being taken up on the disk?

_________________
smaller is better
Post 17 Dec 2021, 18:12
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1043
Location: Russia
macomics 17 Dec 2021, 22:35
Try: man 2 ioctl_list
man 2 ioctl_list wrote:
IOCTL_LIST(2) Linux Programmer's Manual IOCTL_LIST(2)

NAME
ioctl_list - list of ioctl calls in Linux/i386 kernel

...

// <include/linux/fs.h>

0x0000125D BLKROSET const int *
0x0000125E BLKROGET int *
0x0000125F BLKRRPART void
0x00001260 BLKGETSIZE unsigned long *
0x00001261 BLKFLSBUF void
0x00001262 BLKRASET unsigned long
0x00001263 BLKRAGET unsigned long *
0x00000001 FIBMAP int * // I-O
0x00000002 FIGETBSZ int *
0x80086601 FS_IOC_GETFLAGS int *
0x40086602 FS_IOC_SETFLAGS int *
0x80087601 FS_IOC_GETVERSION int *
0x40087602 FS_IOC_SETVERSION int *
0xC020660B FS_IOC_FIEMAP struct fiemap *
0x40086602 FS_IOC32_SETFLAGS int *
0x40086602 FS_IOC32_SETFLAGS int *
0x80047601 FS_IOC32_GETVERSION int *
0x40047602 FS_IOC32_SETVERSION int *

...
Post 17 Dec 2021, 22:35
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20459
Location: In your JS exploiting you and your system
revolution 18 Dec 2021, 12:32
There is documentation around for du that describes the algorithm and calls it uses to calculate the disk usage.
Post 18 Dec 2021, 12:32
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.