summaryrefslogtreecommitdiffstats
path: root/include/asm-alpha/unistd.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1995-11-14 08:00:00 +0000
committer <ralf@linux-mips.org>1995-11-14 08:00:00 +0000
commite7c2a72e2680827d6a733931273a93461c0d8d1b (patch)
treec9abeda78ef7504062bb2e816bcf3e3c9d680112 /include/asm-alpha/unistd.h
parentec6044459060a8c9ce7f64405c465d141898548c (diff)
Import of Linux/MIPS 1.3.0
Diffstat (limited to 'include/asm-alpha/unistd.h')
-rw-r--r--include/asm-alpha/unistd.h157
1 files changed, 106 insertions, 51 deletions
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h
index 6ee2843fa..11a940a57 100644
--- a/include/asm-alpha/unistd.h
+++ b/include/asm-alpha/unistd.h
@@ -12,83 +12,138 @@
#define _syscall0(type,name) \
type name(void) \
{ \
-long __res; \
-__asm__ __volatile__ (".long 131" \
- : "=a" (__res) \
- : "0" (__NR_##name)); \
-if (__res >= 0) \
- return (type) __res; \
-errno = -__res; \
-return -1; \
+ return (type) -1; \
}
#define _syscall1(type,name,type1,arg1) \
type name(type1 arg1) \
{ \
-long __res; \
-__asm__ __volatile__ (".long 131" \
- : "=a" (__res) \
- : "0" (__NR_##name),"b" ((long)(arg1))); \
-if (__res >= 0) \
- return (type) __res; \
-errno = -__res; \
-return -1; \
+ return (type) -1; \
}
#define _syscall2(type,name,type1,arg1,type2,arg2) \
type name(type1 arg1,type2 arg2) \
{ \
-long __res; \
-__asm__ __volatile__ (".long 131" \
- : "=a" (__res) \
- : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \
-if (__res >= 0) \
- return (type) __res; \
-errno = -__res; \
-return -1; \
+ return (type) -1; \
}
#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
type name(type1 arg1,type2 arg2,type3 arg3) \
{ \
-long __res; \
-__asm__ __volatile__ (".long 131" \
- : "=a" (__res) \
- : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
- "d" ((long)(arg3))); \
-if (__res>=0) \
- return (type) __res; \
-errno=-__res; \
-return -1; \
+ return (type) -1; \
}
#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
{ \
-long __res; \
-__asm__ __volatile__ (".long 131" \
- : "=a" (__res) \
- : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
- "d" ((long)(arg3)),"S" ((long)(arg4))); \
-if (__res>=0) \
- return (type) __res; \
-errno=-__res; \
-return -1; \
+ return (type) -1; \
}
#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
type5,arg5) \
type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
{ \
-long __res; \
-__asm__ __volatile__ (".long 131" \
- : "=a" (__res) \
- : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
- "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
-if (__res>=0) \
- return (type) __res; \
-errno=-__res; \
-return -1; \
+ return (type) -1; \
}
+#ifdef __KERNEL_SYSCALLS__
+
+extern unsigned long kernel_fork(void);
+static inline unsigned long fork(void)
+{
+ return kernel_fork();
+}
+
+extern void sys_idle(void);
+static inline void idle(void)
+{
+ sys_idle();
+}
+
+extern int sys_setup(void);
+static inline int setup(void)
+{
+ return sys_setup();
+}
+
+extern int sys_open(const char *, int, int);
+static inline int open(const char * name, int mode, int flags)
+{
+ return sys_open(name, mode, flags);
+}
+
+extern int sys_dup(int);
+static inline int dup(int fd)
+{
+ return sys_dup(fd);
+}
+
+static inline int close(int fd)
+{
+ return sys_close(fd);
+}
+
+extern int sys_exit(int);
+static inline int _exit(int value)
+{
+ return sys_exit(value);
+}
+
+#define exit(x) _exit(x)
+
+extern int sys_write(int, const char *, int);
+static inline int write(int fd, const char * buf, int nr)
+{
+ return sys_write(fd, buf, nr);
+}
+
+extern int sys_read(int, char *, int);
+static inline int read(int fd, char * buf, int nr)
+{
+ return sys_read(fd, buf, nr);
+}
+
+extern int do_execve(char *, char **, char **, struct pt_regs *);
+extern void ret_from_sys_call(void);
+static inline int execve(char * file, char ** argvp, char ** envp)
+{
+ int i;
+ struct pt_regs regs;
+
+ memset(&regs, 0, sizeof(regs));
+ i = do_execve(file, argvp, envp, &regs);
+ if (!i) {
+ __asm__ __volatile__("bis %0,%0,$30\n\t"
+ "bis %1,%1,$26\n\t"
+ "ret $31,($26),1\n\t"
+ : :"r" (&regs), "r" (ret_from_sys_call));
+ }
+ return -1;
+}
+
+extern int sys_setsid(void);
+static inline int setsid(void)
+{
+ return sys_setsid();
+}
+
+extern int sys_sync(void);
+static inline int sync(void)
+{
+ return sys_sync();
+}
+
+extern int sys_waitpid(int, int *, int);
+static inline pid_t waitpid(int pid, int * wait_stat, int flags)
+{
+ return sys_waitpid(pid,wait_stat,flags);
+}
+
+static inline pid_t wait(int * wait_stat)
+{
+ return waitpid(-1,wait_stat,0);
+}
+
+#endif
+
#endif /* _ALPHA_UNISTD_H */