open怎么在unistd.h头文件中找不到对应的__NR_open系统调用号?
今天下了个2.6.37内核,本来向看看open()函数在设备驱动使用中要经过那么途径最终调用struct file_operation结构体里的.open 函数的。但是,我在这个2.6.37内核工程里没有找到open(const char* filename,int flags,mode_t mode)
而且在unistd.h也找不到__NR_open系统调用号 参考一下这个帖子:
http://linux.chinaunix.net/bbs/thread-1177485-1-1.html
高版本的定义方式发生了变化 我在2.6.36里面的 include/asm-generic/unistd.h 看到:
662 #define __NR_open 1024
663 __SYSCALL(__NR_open, sys_open)
难道37的没有? 2.6.37 中的
653 /*
654* All syscalls below here should go away really,
655* these are provided for both review and as a porting
656* help for the C library version.
657 *
658* Last chance: are any of these important enough to
659* enable by default?
660*/
661 #ifdef __ARCH_WANT_SYSCALL_NO_AT
662 #define __NR_open 1024
663 __SYSCALL(__NR_open, sys_open)
664 #define __NR_link 1025
665 __SYSCALL(__NR_link, sys_link)
不过这个定义是在条件宏 #ifdef __ARCH_WANT_SYSCALL_NO_AT 成立的条件下 我也遇到这个问题,@Godbach ,我在3.14 内核下, hook sys_open系统调用时候,加上 #define __ARCH_WANT_SYSCALL_NO_AT可以编译过去,但是sys_call_tab 拿到的 , sys_open地址不对, 我又测试了一下,在#ifdef __ARCH_WANT_SYSCALL_NO_AT宏定义中的所有系统调用函数,通过以上方式拿到的地址都不对,怎么解决呢, 我也遇到这个问题,我在3.14 内核下, hook sys_open系统调用时候,加上 #define __ARCH_WANT_SYSCALL_NO_AT可以编译过去,但是sys_call_tab 拿到的 , sys_open地址不对, 我又测试了一下,在#ifdef __ARCH_WANT_SYSCALL_NO_AT宏定义中的所有系统调用函数,通过以上方式拿到的地址都不对,怎么解决呢,回复 4# Godbach
回复 6# Jacob_linux
劫持系统调用的实践,也就当时研究过。这两年都没跟进了。
页:
[1]