user1733552
user1733552

Reputation: 11

C Program: Get inode header fields and information by inode number

I need to write a program in C/C++ that request the user to put in an inode number and then return all of the inode header fields and information back. I am not familiar with linux systems and commands at all. I have found some commands and tried different things that didnt work like I needed.

find -inum inodenumber

will give me the path to the file that contains the specified number. All the information I need comes from istat (according to my research) but I cant get it to work. Im doing

istat FILENAME.jpg

I get the response:

Missing image name and/or address usage: istat[-B num] [-f fstype] [-i ingtype] [-b dev_sector_size] [-o imgoffset] [-z zone] [-s seconds] [ivV] image inum ...

What do I need to do?

Upvotes: 0

Views: 2957

Answers (3)

Alex Johnson
Alex Johnson

Reputation: 534

Try running find with the inode number and then use the filename it generates with stat.

Upvotes: 0

user149341
user149341

Reputation:

istat only works on disk images, not live filesystems.

There are no system calls in Linux which can look a file up in a live filesystem by its inode number.

Upvotes: 1

Alex Chamberlain
Alex Chamberlain

Reputation: 4207

Run man istat of course.

In general, you can always get help from the terminal itself by running man.

Upvotes: 0

Related Questions