unistd.h
来自「Linux Kernel 2.6.9 for OMAP1710」· C头文件 代码 · 共 534 行 · 第 1/2 页
H
534 行
#define __NR_clock_settime (__NR_timer_create+5)#define __NR_clock_gettime (__NR_timer_create+6)#define __NR_clock_getres (__NR_timer_create+7)#define __NR_clock_nanosleep (__NR_timer_create+8)#define NR_syscalls 268/* user-visible error numbers are in the range -1 - -122: see <asm-m68k/errno.h> */#define __syscall_return(type, res) \do { \ if ((unsigned long)(res) >= (unsigned long)(-125)) { \ /* avoid using res which is declared to be in register d0; \ errno might expand to a function call and clobber it. */ \ int __err = -(res); \ errno = __err; \ res = -1; \ } \ return (type) (res); \} while (0)#define _syscall0(type, name) \type name(void) \{ \ register long __res __asm__("er0"); \ __asm__ __volatile__ ("mov.l %1,er0\n\t" \ "trapa #0\n\t" \ : "=r" (__res) \ : "ir" (__NR_##name) \ : "cc"); \ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ errno = -__res; \ __res = -1; \ } \ return (type)__res; \}#define _syscall1(type, name, atype, a) \type name(atype a) \{ \ register long __res __asm__("er0"); \ __asm__ __volatile__ ("mov.l %2, er1\n\t" \ "mov.l %1, er0\n\t" \ "trapa #0\n\t" \ : "=r" (__res) \ : "ir" (__NR_##name), \ "g" ((long)a) \ : "cc", "er1"); \ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ errno = -__res; \ __res = -1; \ } \ return (type)__res; \}#define _syscall2(type, name, atype, a, btype, b) \type name(atype a, btype b) \{ \ register long __res __asm__("er0"); \ __asm__ __volatile__ ("mov.l %3, er2\n\t" \ "mov.l %2, er1\n\t" \ "mov.l %1, er0\n\t" \ "trapa #0\n\t" \ : "=r" (__res) \ : "ir" (__NR_##name), \ "g" ((long)a), \ "g" ((long)b) \ : "cc", "er1", "er2"); \ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ errno = -__res; \ __res = -1; \ } \ return (type)__res; \}#define _syscall3(type, name, atype, a, btype, b, ctype, c) \type name(atype a, btype b, ctype c) \{ \ register long __res __asm__("er0"); \ __asm__ __volatile__ ("mov.l %4, er3\n\t" \ "mov.l %3, er2\n\t" \ "mov.l %2, er1\n\t" \ "mov.l %1, er0\n\t" \ "trapa #0\n\t" \ : "=r" (__res) \ : "ir" (__NR_##name), \ "g" ((long)a), \ "g" ((long)b), \ "g" ((long)c) \ : "cc", "er1", "er2", "er3"); \ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ errno = -__res; \ __res = -1; \ } \ return (type)__res; \}#define _syscall4(type, name, atype, a, btype, b, ctype, c, dtype, d) \type name(atype a, btype b, ctype c, dtype d) \{ \ register long __res __asm__("er0"); \ __asm__ __volatile__ ("mov.l %5, er4\n\t" \ "mov.l %4, er3\n\t" \ "mov.l %3, er2\n\t" \ "mov.l %2, er1\n\t" \ "mov.l %1, er0\n\t" \ "trapa #0\n\t" \ : "=r" (__res) \ : "ir" (__NR_##name), \ "g" ((long)a), \ "g" ((long)b), \ "g" ((long)c), \ "g" ((long)d) \ : "cc", "er1", "er2", "er3", "er4"); \ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ errno = -__res; \ __res = -1; \ } \ return (type)__res; \}#define _syscall5(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e) \type name(atype a, btype b, ctype c, dtype d, etype e) \{ \ register long __res __asm__("er0"); \ __asm__ __volatile__ ("mov.l %6, er5\n\t" \ "mov.l %5, er4\n\t" \ "mov.l %4, er3\n\t" \ "mov.l %3, er2\n\t" \ "mov.l %2, er1\n\t" \ "mov.l %1, er0\n\t" \ "trapa #0\n\t" \ : "=r" (__res) \ : "ir" (__NR_##name), \ "g" ((long)a), \ "g" ((long)b), \ "g" ((long)c), \ "g" ((long)d), \ "m" ((long)e) \ : "cc", "er1", "er2", "er3", "er4", "er5"); \ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ errno = -__res; \ __res = -1; \ } \ return (type)__res; \} #define _syscall6(type, name, atype, a, btype, b, ctype, c, dtype, d, \ etype, e, ftype, f) \type name(atype a, btype b, ctype c, dtype d, etype e, ftype f) \{ \ register long __res __asm__("er0"); \ __asm__ __volatile__ ("mov.l er6,@-sp\n\t" \ "mov.l %7, er6\n\t" \ "mov.l %6, er5\n\t" \ "mov.l %5, er4\n\t" \ "mov.l %4, er3\n\t" \ "mov.l %3, er2\n\t" \ "mov.l %2, er1\n\t" \ "mov.l %1, er0\n\t" \ "trapa #0\n\t" \ "mov.l @sp+,er6" \ : "=r" (__res) \ : "ir" (__NR_##name), \ "g" ((long)a), \ "g" ((long)b), \ "g" ((long)c), \ "g" ((long)d), \ "m" ((long)e), \ "m" ((long)e) \ : "cc", "er1", "er2", "er3", "er4", "er5"); \ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ errno = -__res; \ __res = -1; \ } \ return (type)__res; \} #ifdef __KERNEL__#define __ARCH_WANT_IPC_PARSE_VERSION#define __ARCH_WANT_OLD_READDIR#define __ARCH_WANT_OLD_STAT#define __ARCH_WANT_STAT64#define __ARCH_WANT_SYS_ALARM#define __ARCH_WANT_SYS_GETHOSTNAME#define __ARCH_WANT_SYS_PAUSE#define __ARCH_WANT_SYS_SGETMASK#define __ARCH_WANT_SYS_SIGNAL#define __ARCH_WANT_SYS_TIME#define __ARCH_WANT_SYS_UTIME#define __ARCH_WANT_SYS_WAITPID#define __ARCH_WANT_SYS_SOCKETCALL#define __ARCH_WANT_SYS_FADVISE64#define __ARCH_WANT_SYS_GETPGRP#define __ARCH_WANT_SYS_LLSEEK#define __ARCH_WANT_SYS_NICE#define __ARCH_WANT_SYS_OLD_GETRLIMIT#define __ARCH_WANT_SYS_OLDUMOUNT#define __ARCH_WANT_SYS_SIGPENDING#define __ARCH_WANT_SYS_SIGPROCMASK#define __ARCH_WANT_SYS_RT_SIGACTION#endif#ifdef __KERNEL_SYSCALLS__#include <linux/compiler.h>#include <linux/types.h>/* * we need this inline - forking from kernel space will result * in NO COPY ON WRITE (!!!), until an execve is executed. This * is no problem, but for the stack. This is handled by not letting * main() use the stack at all after fork(). Thus, no function * calls - which means inline code for fork too, as otherwise we * would use the stack upon exit from 'fork()'. * * Actually only pause and fork are needed inline, so that there * won't be any messing with the stack from main(), but we define * some others too. */#define __NR__exit __NR_exitstatic inline _syscall0(int,pause)static inline _syscall0(int,sync)static inline _syscall0(pid_t,setsid)static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)static inline _syscall1(int,dup,int,fd)static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)static inline _syscall3(int,open,const char *,file,int,flag,int,mode)static inline _syscall1(int,close,int,fd)static inline _syscall1(int,_exit,int,exitcode)static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)static inline _syscall1(int,delete_module,const char *,name)static inline pid_t wait(int * wait_stat){ return waitpid(-1,wait_stat,0);}asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff);asmlinkage int sys_execve(char *name, char **argv, char **envp, int dummy, ...);asmlinkage int sys_pipe(unsigned long *fildes);asmlinkage int sys_ptrace(long request, long pid, long addr, long data);struct sigaction;asmlinkage long sys_rt_sigaction(int sig, const struct sigaction __user *act, struct sigaction __user *oact, size_t sigsetsize);#endif/* * "Conditional" syscalls */#define cond_syscall(name) \ asm (".weak\t_" #name "\n" \ ".set\t_" #name ",_sys_ni_syscall");#endif /* _ASM_H8300_UNISTD_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?