unistd.h

来自「Linux Kernel 2.6.9 for OMAP1710」· C头文件 代码 · 共 1,168 行 · 第 1/3 页

H
1,168
字号
#define __NR_epoll_wait			(__NR_Linux + 209)#define __NR_remap_file_pages		(__NR_Linux + 210)#define __NR_rt_sigreturn		(__NR_Linux + 211)#define __NR_fcntl64			(__NR_Linux + 212)#define __NR_set_tid_address		(__NR_Linux + 213)#define __NR_restart_syscall		(__NR_Linux + 214)#define __NR_semtimedop			(__NR_Linux + 215)#define __NR_fadvise64			(__NR_Linux + 216)#define __NR_statfs64			(__NR_Linux + 217)#define __NR_fstatfs64			(__NR_Linux + 218)#define __NR_sendfile64			(__NR_Linux + 219)#define __NR_timer_create		(__NR_Linux + 220)#define __NR_timer_settime		(__NR_Linux + 221)#define __NR_timer_gettime		(__NR_Linux + 222)#define __NR_timer_getoverrun		(__NR_Linux + 223)#define __NR_timer_delete		(__NR_Linux + 224)#define __NR_clock_settime		(__NR_Linux + 225)#define __NR_clock_gettime		(__NR_Linux + 226)#define __NR_clock_getres		(__NR_Linux + 227)#define __NR_clock_nanosleep		(__NR_Linux + 228)#define __NR_tgkill			(__NR_Linux + 229)#define __NR_utimes			(__NR_Linux + 230)#define __NR_mbind			(__NR_Linux + 231)#define __NR_get_mempolicy		(__NR_Linux + 232)#define __NR_set_mempolicy		(__NR_Linux + 233)#define __NR_mq_open			(__NR_Linux + 234)#define __NR_mq_unlink			(__NR_Linux + 235)#define __NR_mq_timedsend		(__NR_Linux + 236)#define __NR_mq_timedreceive		(__NR_Linux + 237)#define __NR_mq_notify			(__NR_Linux + 238)#define __NR_mq_getsetattr		(__NR_Linux + 239)#define __NR_vserver			(__NR_Linux + 240)/* * Offset of the last N32 flavoured syscall */#define __NR_Linux_syscalls		240#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */#define __NR_N32_Linux			6000#define __NR_N32_Linux_syscalls		240#ifndef __ASSEMBLY__/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */#define _syscall0(type,name) \type name(void) \{ \	register unsigned long __a3 asm("$7"); \	unsigned long __v0; \	\	__asm__ volatile ( \	".set\tnoreorder\n\t" \	"li\t$2, %2\t\t\t# " #name "\n\t" \	"syscall\n\t" \	"move\t%0, $2\n\t" \	".set\treorder" \	: "=&r" (__v0), "=r" (__a3) \	: "i" (__NR_##name) \	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \	\	if (__a3 == 0) \		return (type) __v0; \	errno = __v0; \	return -1; \}/* * DANGER: This macro isn't usable for the pipe(2) call * which has a unusual return convention. */#define _syscall1(type,name,atype,a) \type name(atype a) \{ \	register unsigned long __a0 asm("$4") = (unsigned long) a; \	register unsigned long __a3 asm("$7"); \	unsigned long __v0; \	\	__asm__ volatile ( \	".set\tnoreorder\n\t" \	"li\t$2, %3\t\t\t# " #name "\n\t" \	"syscall\n\t" \	"move\t%0, $2\n\t" \	".set\treorder" \	: "=&r" (__v0), "=r" (__a3) \	: "r" (__a0), "i" (__NR_##name) \	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \	\	if (__a3 == 0) \		return (type) __v0; \	errno = __v0; \	return -1; \}#define _syscall2(type,name,atype,a,btype,b) \type name(atype a, btype b) \{ \	register unsigned long __a0 asm("$4") = (unsigned long) a; \	register unsigned long __a1 asm("$5") = (unsigned long) b; \	register unsigned long __a3 asm("$7"); \	unsigned long __v0; \	\	__asm__ volatile ( \	".set\tnoreorder\n\t" \	"li\t$2, %4\t\t\t# " #name "\n\t" \	"syscall\n\t" \	"move\t%0, $2\n\t" \	".set\treorder" \	: "=&r" (__v0), "=r" (__a3) \	: "r" (__a0), "r" (__a1), "i" (__NR_##name) \	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \	\	if (__a3 == 0) \		return (type) __v0; \	errno = __v0; \	return -1; \}#define _syscall3(type,name,atype,a,btype,b,ctype,c) \type name(atype a, btype b, ctype c) \{ \	register unsigned long __a0 asm("$4") = (unsigned long) a; \	register unsigned long __a1 asm("$5") = (unsigned long) b; \	register unsigned long __a2 asm("$6") = (unsigned long) c; \	register unsigned long __a3 asm("$7"); \	unsigned long __v0; \	\	__asm__ volatile ( \	".set\tnoreorder\n\t" \	"li\t$2, %5\t\t\t# " #name "\n\t" \	"syscall\n\t" \	"move\t%0, $2\n\t" \	".set\treorder" \	: "=&r" (__v0), "=r" (__a3) \	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name) \	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \	\	if (__a3 == 0) \		return (type) __v0; \	errno = __v0; \	return -1; \}#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \type name(atype a, btype b, ctype c, dtype d) \{ \	register unsigned long __a0 asm("$4") = (unsigned long) a; \	register unsigned long __a1 asm("$5") = (unsigned long) b; \	register unsigned long __a2 asm("$6") = (unsigned long) c; \	register unsigned long __a3 asm("$7") = (unsigned long) d; \	unsigned long __v0; \	\	__asm__ volatile ( \	".set\tnoreorder\n\t" \	"li\t$2, %5\t\t\t# " #name "\n\t" \	"syscall\n\t" \	"move\t%0, $2\n\t" \	".set\treorder" \	: "=&r" (__v0), "+r" (__a3) \	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name) \	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \	\	if (__a3 == 0) \		return (type) __v0; \	errno = __v0; \	return -1; \}#if (_MIPS_SIM == _MIPS_SIM_ABI32)/* * Using those means your brain needs more than an oil change ;-) */#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 unsigned long __a0 asm("$4") = (unsigned long) a; \	register unsigned long __a1 asm("$5") = (unsigned long) b; \	register unsigned long __a2 asm("$6") = (unsigned long) c; \	register unsigned long __a3 asm("$7") = (unsigned long) d; \	unsigned long __v0; \	\	__asm__ volatile ( \	".set\tnoreorder\n\t" \	"lw\t$2, %6\n\t" \	"subu\t$29, 32\n\t" \	"sw\t$2, 16($29)\n\t" \	"li\t$2, %5\t\t\t# " #name "\n\t" \	"syscall\n\t" \	"move\t%0, $2\n\t" \	"addiu\t$29, 32\n\t" \	".set\treorder" \	: "=&r" (__v0), "+r" (__a3) \	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name), \	  "m" ((unsigned long)e) \	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \	\	if (__a3 == 0) \		return (type) __v0; \	errno = __v0; \	return -1; \}#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 unsigned long __a0 asm("$4") = (unsigned long) a; \	register unsigned long __a1 asm("$5") = (unsigned long) b; \	register unsigned long __a2 asm("$6") = (unsigned long) c; \	register unsigned long __a3 asm("$7") = (unsigned long) d; \	unsigned long __v0; \	\	__asm__ volatile ( \	".set\tnoreorder\n\t" \	"lw\t$2, %6\n\t" \	"lw\t$8, %7\n\t" \	"subu\t$29, 32\n\t" \	"sw\t$2, 16($29)\n\t" \	"sw\t$8, 20($29)\n\t" \	"li\t$2, %5\t\t\t# " #name "\n\t" \	"syscall\n\t" \	"move\t%0, $2\n\t" \	"addiu\t$29, 32\n\t" \	".set\treorder" \	: "=&r" (__v0), "+r" (__a3) \	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name), \	  "m" ((unsigned long)e), "m" ((unsigned long)f) \	: "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \	\	if (__a3 == 0) \		return (type) __v0; \	errno = __v0; \	return -1; \}#endif /* (_MIPS_SIM == _MIPS_SIM_ABI32) */#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)#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 unsigned long __a0 asm("$4") = (unsigned long) a; \	register unsigned long __a1 asm("$5") = (unsigned long) b; \	register unsigned long __a2 asm("$6") = (unsigned long) c; \	register unsigned long __a3 asm("$7") = (unsigned long) d; \	register unsigned long __a4 asm("$8") = (unsigned long) e; \	unsigned long __v0; \	\	__asm__ volatile ( \	".set\tnoreorder\n\t" \	"li\t$2, %6\t\t\t# " #name "\n\t" \	"syscall\n\t" \	"move\t%0, $2\n\t" \	".set\treorder" \	: "=&r" (__v0), "+r" (__a3), "+r" (__a4) \	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name) \	: "$2","$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \	\	if (__a3 == 0) \		return (type) __v0; \	errno = __v0; \	return -1; \}#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 unsigned long __a0 asm("$4") = (unsigned long) a; \	register unsigned long __a1 asm("$5") = (unsigned long) b; \	register unsigned long __a2 asm("$6") = (unsigned long) c; \	register unsigned long __a3 asm("$7") = (unsigned long) d; \	register unsigned long __a4 asm("$8") = (unsigned long) e; \	register unsigned long __a5 asm("$9") = (unsigned long) f; \	unsigned long __v0; \	\	__asm__ volatile ( \	".set\tnoreorder\n\t" \	"li\t$2, %7\t\t\t# " #name "\n\t" \	"syscall\n\t" \	"move\t%0, $2\n\t" \	".set\treorder" \	: "=&r" (__v0), "+r" (__a3) \	: "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), "r" (__a5), \	  "i" (__NR_##name) \	: "$2","$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24"); \	\	if (__a3 == 0) \		return (type) __v0; \	errno = __v0; \	return -1; \}#endif /* (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) */#ifdef __KERNEL__#define __ARCH_WANT_IPC_PARSE_VERSION#define __ARCH_WANT_OLD_READDIR#define __ARCH_WANT_SYS_ALARM#define __ARCH_WANT_SYS_GETHOSTNAME#define __ARCH_WANT_SYS_PAUSE#define __ARCH_WANT_SYS_SGETMASK#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# ifndef __mips64#  define __ARCH_WANT_STAT64# endif#endif#ifdef __KERNEL_SYSCALLS__#include <linux/compiler.h>#include <linux/types.h>#include <linux/linkage.h>#include <asm/ptrace.h>#include <asm/sim.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. */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)struct rusage;static inline _syscall4(pid_t,wait4,pid_t,pid,int *,stat_addr,int,options,struct rusage *,ru)static inline pid_t waitpid(int pid, int * wait_stat, int flags){	return wait4(pid, wait_stat, flags, NULL);}asmlinkage unsigned long sys_mmap(				unsigned long addr, size_t len,				int prot, int flags,				int fd, off_t offset);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(nabi_no_regargs struct pt_regs regs);asmlinkage int sys_pipe(nabi_no_regargs struct pt_regs regs);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 /* __KERNEL_SYSCALLS__ */#endif /* !__ASSEMBLY__ *//* * "Conditional" syscalls * * What we want is __attribute__((weak,alias("sys_ni_syscall"))), * but it doesn't work on all toolchains, so we just do it by hand */#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall");#endif /* _ASM_UNISTD_H */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?