From: http://crquan.blogbus.com/logs/5618102.html
Syscall calls the interface from 2.6.19 to the application layer. The original kernel uses the _ syscalln macro to declare the function prototype method is no longer valid:
As declared:
_syscall1(int, sysinfo, struct sysinfo *, info);
It is called directly when the program needs it:
int syscall(int number, ...);
- The first number is the number of parameters to be followed, not the number of parameters called by the system. (Note: The man manual describes the number as syscall () performs the system call whose assembly language interface has the specified number with the specified arguments. symbolic constants for System
Callcan be found in the header file <sys/syscall. h>.
)
- The number is followed by all the parameters called by the system.
The corresponding header file is also changed
Therefore, when sysinfo is called, it becomes:
struct sysinfo s_info;
syscall(2, __NR_sysinfo, &s_info);
It can be seen that the new call method is more concise.
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