当前位置: 技术问答>linux和unix
关于getdents函数的问题
来源: 互联网 发布时间:2015-09-17
本文导语: 系统是redhat9.0, 在帮助文档中可以查到getdents函数,但是在程序link时,却找不到函数定义 我在/usr/include下也没有找到函数的定义.不知道这是什么原因,请大家帮忙。谢谢。 | 找了找标准库还...
系统是redhat9.0, 在帮助文档中可以查到getdents函数,但是在程序link时,却找不到函数定义
我在/usr/include下也没有找到函数的定义.不知道这是什么原因,请大家帮忙。谢谢。
我在/usr/include下也没有找到函数的定义.不知道这是什么原因,请大家帮忙。谢谢。
|
找了找标准库还真是没有,getdents 是系统调用 调用号是141 ,所以可以直接进行系统调用,在程序段前加这么几句试试:
#include
#include
#include
#include
#include
#define __NR_getdents 141
long getdents(unsigned int fd,
struct linux_dirent __user *dirent,
unsigned int count);
_syscall3(long,getdents,unsigned int, fd,
struct linux_dirent __user *, dirent,
unsigned int, count);
//然后在再程序里正常调用getdents 试试,通过中断门直接进行系统调用了。
main(){
...
getdents(unsigned int fd,
struct linux_dirent __user *dirent,
unsigned int count);
...
}
#include
#include
#include
#include
#include
#define __NR_getdents 141
long getdents(unsigned int fd,
struct linux_dirent __user *dirent,
unsigned int count);
_syscall3(long,getdents,unsigned int, fd,
struct linux_dirent __user *, dirent,
unsigned int, count);
//然后在再程序里正常调用getdents 试试,通过中断门直接进行系统调用了。
main(){
...
getdents(unsigned int fd,
struct linux_dirent __user *dirent,
unsigned int count);
...
}
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。