Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > C/C++: Программирование под Unix/Linux > getdents


Автор: 500mhz 10.9.2012, 10:52
Собственно вопрос
Пытаюсь вызвать getdents (на С) , все компилится но линкер ругается.
Цитата

undefined reference to `getdents'


На ассемблере 141 функция прекрасно вызывается

вывод strace
Цитата

getdents(3, /* 5 entries */, 100)       = 80


Что я делаю не так?

пс
readdir мне не подходит

Автор: boostcoder 10.9.2012, 11:24
хм...
Цитата

This is not the function you are interested in.  Look at readdir(3) for the POSIX conforming C library interface.  This page documents the bare kernel system call interface.

http://www.kernel.org/doc/man-pages/online/pages/man2/getdents.2.html

Добавлено через 1 минуту и 35 секунд
Цитата(500mhz @  10.9.2012,  10:52 Найти цитируемый пост)
На ассемблере 141 функция прекрасно вызывается

from user space code?

Автор: 500mhz 10.9.2012, 12:16
Да из под юсера 

mov eax,141   ;getdents
int 0x80

прекрасно работает

Автор: bsa 10.9.2012, 12:43
http://www.kernel.org/doc/man-pages/online/pages/man2/getdents.2.html
Цитата
       Glibc does not provide a wrapper for this system call; call it using
       syscall(2).  You will need to define the linux_dirent structure yourself.

       This call supersedes readdir(2).

       The original Linux getdents() system call did not handle large file systems
       and large file offsets.  Consequently, Linux 2.4 added getdents64(), with
       wider types for the d_ino and d_off fields employed in the linux_dirent
       structure.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)