LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Troubles using fstat() on assembler... (https://www.linuxquestions.org/questions/programming-9/troubles-using-fstat-on-assembler-178457/)

Arelys Monge 05-06-2004 01:43 AM

Troubles using fstat() on assembler...
 
I have been trying to use fstat() to get info about files. I am using Gas as an assembler , but I guess it works the same way on NASM....I already have defined the buffer that the system calls needs, ( I declared it as .fill ). So.. I read the man page, anf it gives a "detailed" description of the things this returns in muy buffer,... The trouble I have is that I don't know how to access them, I have only a bunch a numbers on my data segment and I don't know how to relate them to the structure the man describes. How much bytes does each point on the structure have? How do I know which number is which point?I need the mode, the uid, gid, and the route of the file... I really need help on this.. I've been stuck for a hours and I need it for a homework.

Thanks ;)

infamous41md 05-06-2004 09:29 AM

look up the stat structure in the proper header file, and then write a C program that prints the offset of each member from the start of structure. and then in asm:

movl $addr_stat_structure, %eax
movl $offset_of_member(%eax), %ebx
print $ebx

obviously print is something u need to create.


All times are GMT -5. The time now is 09:07 AM.