|
OK,这些是继续阅读所必须的足够知识了。下面的表列出了那些最有意思的系统调用以及一些简短的注释。相信我,为了你能够真正的写出有用的LKM你必须确实懂得那些系统调用是怎么样工作的。
系统调用列表:
int sys_brk(unsigned long new_brk);
|
改变DS(数据段)的大小->这个系统调用会在1.4中讨论
int sys_fork(struct pt_regs regs);
|
著名的fork()所用的系统调用
int sys_getuid ()
int sys_setuid (uid_t uid)
|
用于管理UID等等的系统调用
int sys_get_kernel_sysms(struct kernel_sym *table)
|
用于存取系统函数表的系统调用(->1.3)
int sys_sethostname (char *name, int len);
int sys_gethostname (char *name, int len);
sys_sethostname是用来设置主机名(hostname)的,
sys_gethostname是用来取的
int sys_chdir (const char *path);
int sys_fchdir (unsigned int fd);
|
两个函数都是用于设置当前的目录的(cd ...)
int sys_chmod (const char *filename, mode_t mode);
int sys_chown (const char *filename, mode_t mode);
int sys_fchmod (unsigned int fildes, mode_t mode);
int sys_fchown (unsigned int fildes, mode_t mode);
|
用于管理权限的函数
int sys_chroot (const char *filename);
|
用于设置运行进程的根目录的
int sys_execve (struct pt_regs regs);
|
非常重要的系统调用->用于执行一个可执行文件的(pt_regs是堆栈寄存器)
long sys_fcntl
(unsigned int fd,
unsigned int cmd,
unsigned long arg);
|
改变fd(打开文件描述符)的属性的
|