博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
syscall调用接口从2.6.19开始移到应用层
阅读量:2436 次
发布时间:2019-05-10

本文共 935 字,大约阅读时间需要 3 分钟。

转自:http://crquan.blogbus.com/logs/5618102.html

syscall调用接口从2.6.19开始移到应用层,原来内核中使用_syscallN宏的方式来声明函数原型的方法不再有效:

如声明:

_syscall1(int, sysinfo, struct sysinfo *, info);

不再需要,而是在程序中需要的时候直接调用:

int syscall(int number, ...);
  • 第一个number是后面要接的参数个数,不是该系统调用的参数个数;(注:关于这个number,man手册上说的是: syscall()  performs the system call whose assembly language interface has the specified number with the specified arguments.  Symbolic constants for system
           calls can be found in the header file <sys/syscall.h>.
  • number后面顺序接上该系统调用的所有参数即可

相应头文件包含也改变为

于是调用sysinfo就变为:

struct sysinfo s_info; syscall(2, __NR_sysinfo, &s_info);

可见新的调用方式变得更为简洁了。

References:

  • http://lxr.linux.no/source/include/asm-i386/unistd.h
  • http://lxr.linux.no/source/include/asm-i386/unistd.h?v=2.6.18
  • http://www.kernel.org/pub/linux/kernel/v2.6/snapshots/patch-2.6.19-git13.log
  • commit f5738ceed46782aea7663d62cb6398eb05fc4ce0 of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

转载地址:http://mbemb.baihongyu.com/

你可能感兴趣的文章
RMI
查看>>
J.U.C之Future
查看>>
缓存思想分析
查看>>
一致性hash
查看>>
J.U.C之ConcurrentHashMap分析
查看>>
J.U.C之CopyOnWriteArrayList
查看>>
J.U.C之Atomic&CAS
查看>>
类的生命周期
查看>>
Joda-Time学习
查看>>
Guava扩展工具包
查看>>
BeanFactory和FactoryBean
查看>>
用户态和内核态的概念区别
查看>>
Jsp连接数据库大全
查看>>
WebSphere Application Server 常见问题及解答:集群
查看>>
SOA 治理框架和解决方案架构
查看>>
使用 WebSphere Business Modeler 进行业务建模
查看>>
SOA 案例研究:Web 2.0 SOA 场景
查看>>
IBM BPM BlueWorks:一次 WebSphere 云试验
查看>>
websphere笔记
查看>>
最新最全的Portlet 通信过程详解
查看>>