+ -
当前位置:首页 → 问答吧 → Ubuntu10.04版本的内核头文件

Ubuntu10.04版本的内核头文件

时间:2010-08-12

来源:互联网

这是Ubuntu10.04版本的内核头文件 include/asm-generic/unistd.h 的部分源码,其中的
#ifndef __SYSCALL
#define __SYSCALL(x, y)
#endif
以及
#define __NR_io_setup 0
__SYSCALL(__NR_io_setup, sys_io_setup)
的宏定义看不懂,请教以上的两个宏是什么意思,有什么意义?不胜感激!

=============================
#if !defined(_ASM_GENERIC_UNISTD_H) || defined(__SYSCALL)
#define _ASM_GENERIC_UNISTD_H

#include <asm/bitsperlong.h>

/*
* This file contains the system call numbers, based on the
* layout of the x86-64 architecture, which embeds the
* pointer to the syscall in the table.
*
* As a basic principle, no duplication of functionality
* should be added, e.g. we don't use lseek when llseek
* is present. New architectures should use this file
* and implement the less feature-full calls in user space.
*/

#ifndef __SYSCALL
#define __SYSCALL(x, y)
#endif

#if __BITS_PER_LONG == 32
#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
#else
#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
#endif

#define __NR_io_setup 0
__SYSCALL(__NR_io_setup, sys_io_setup)
#define __NR_io_destroy 1
__SYSCALL(__NR_io_destroy, sys_io_destroy)
#define __NR_io_submit 2
__SYSCALL(__NR_io_submit, sys_io_submit)
#define __NR_io_cancel 3
__SYSCALL(__NR_io_cancel, sys_io_cancel)

作者: zsmwqebs   发布时间: 2010-08-12

#ifndef __SYSCALL
#define __SYSCALL(x, y)
#endif
这个应该防止是某些情况下编译不过吧,让他什么也不做。这个宏肯定是有的。

以及
#define __NR_io_setup 0
__SYSCALL(__NR_io_setup, sys_io_setup)
这个宏就是系统调用的宏,你自己去看看资料

作者: etoux   发布时间: 2010-08-13

热门下载

更多