summaryrefslogtreecommitdiff
path: root/libc/syscalls
diff options
context:
space:
mode:
Diffstat (limited to 'libc/syscalls')
-rw-r--r--libc/syscalls/sysclose.c14
-rw-r--r--libc/syscalls/sysexecve.c16
-rw-r--r--libc/syscalls/sysfcntl.c17
-rw-r--r--libc/syscalls/sysfork.c19
-rw-r--r--libc/syscalls/sysfstat.c16
-rw-r--r--libc/syscalls/sysgetpid.c13
-rw-r--r--libc/syscalls/sysgettod.c20
-rw-r--r--libc/syscalls/syskill.c15
-rw-r--r--libc/syscalls/syslink.c15
-rw-r--r--libc/syscalls/syslseek.c17
-rw-r--r--libc/syscalls/sysopen.c43
-rw-r--r--libc/syscalls/sysread.c17
-rw-r--r--libc/syscalls/syssbrk.c18
-rw-r--r--libc/syscalls/sysstat.c16
-rw-r--r--libc/syscalls/systimes.c15
-rw-r--r--libc/syscalls/sysunlink.c14
-rw-r--r--libc/syscalls/syswait.c14
-rw-r--r--libc/syscalls/syswrite.c17
18 files changed, 316 insertions, 0 deletions
diff --git a/libc/syscalls/sysclose.c b/libc/syscalls/sysclose.c
new file mode 100644
index 0000000..632364a
--- /dev/null
+++ b/libc/syscalls/sysclose.c
@@ -0,0 +1,14 @@
+/* connector for close */
+
+#include <reent.h>
+
+int
+close (fd)
+ int fd;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _close_r (_REENT, fd);
+#else
+ return _close (fd);
+#endif
+}
diff --git a/libc/syscalls/sysexecve.c b/libc/syscalls/sysexecve.c
new file mode 100644
index 0000000..c505047
--- /dev/null
+++ b/libc/syscalls/sysexecve.c
@@ -0,0 +1,16 @@
+/* connector for execve */
+
+#include <reent.h>
+
+int
+execve (name, argv, env)
+ char *name;
+ char **argv;
+ char **env;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _execve_r (_REENT, name, argv, env);
+#else
+ return _execve (name, argv, env);
+#endif
+}
diff --git a/libc/syscalls/sysfcntl.c b/libc/syscalls/sysfcntl.c
new file mode 100644
index 0000000..23e1d83
--- /dev/null
+++ b/libc/syscalls/sysfcntl.c
@@ -0,0 +1,17 @@
+/* connector for fcntl */
+/* only called from stdio/fdopen.c, so arg can be int. */
+
+#include <reent.h>
+
+int
+fcntl (fd, flag, arg)
+ int fd;
+ int flag;
+ int arg;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _fcntl_r (_REENT, fd, flag, arg);
+#else
+ return _fcntl (fd, flag, arg);
+#endif
+}
diff --git a/libc/syscalls/sysfork.c b/libc/syscalls/sysfork.c
new file mode 100644
index 0000000..9fe319f
--- /dev/null
+++ b/libc/syscalls/sysfork.c
@@ -0,0 +1,19 @@
+/* connector for fork */
+
+/* Don't define this if NO_FORK. See for example libc/sys/win32/spawn.c. */
+
+#ifndef NO_FORK
+
+#include <reent.h>
+
+int
+fork ()
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _fork_r (_REENT);
+#else
+ return _fork ();
+#endif
+}
+
+#endif
diff --git a/libc/syscalls/sysfstat.c b/libc/syscalls/sysfstat.c
new file mode 100644
index 0000000..f167b3c
--- /dev/null
+++ b/libc/syscalls/sysfstat.c
@@ -0,0 +1,16 @@
+/* connector for fstat */
+
+#include <reent.h>
+#include <unistd.h>
+
+int
+fstat (fd, pstat)
+ int fd;
+ struct stat *pstat;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _fstat_r (_REENT, fd, pstat);
+#else
+ return _fstat (fd, pstat);
+#endif
+}
diff --git a/libc/syscalls/sysgetpid.c b/libc/syscalls/sysgetpid.c
new file mode 100644
index 0000000..d7f7506
--- /dev/null
+++ b/libc/syscalls/sysgetpid.c
@@ -0,0 +1,13 @@
+/* connector for getpid */
+
+#include <reent.h>
+
+int
+getpid ()
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _getpid_r (_REENT);
+#else
+ return _getpid ();
+#endif
+}
diff --git a/libc/syscalls/sysgettod.c b/libc/syscalls/sysgettod.c
new file mode 100644
index 0000000..24849d5
--- /dev/null
+++ b/libc/syscalls/sysgettod.c
@@ -0,0 +1,20 @@
+/* connector for gettimeofday */
+
+#include <reent.h>
+#include <sys/types.h>
+#include <sys/times.h>
+
+struct timeval;
+struct timezone;
+
+int
+gettimeofday (ptimeval, ptimezone)
+ struct timeval *ptimeval;
+ struct timezone *ptimezone;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _gettimeofday_r (_REENT, ptimeval, ptimezone);
+#else
+ return _gettimeofday (ptimeval, ptimezone);
+#endif
+}
diff --git a/libc/syscalls/syskill.c b/libc/syscalls/syskill.c
new file mode 100644
index 0000000..4ee2f64
--- /dev/null
+++ b/libc/syscalls/syskill.c
@@ -0,0 +1,15 @@
+/* connector for kill */
+
+#include <reent.h>
+
+int
+kill (pid, sig)
+ int pid;
+ int sig;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _kill_r (_REENT, pid, sig);
+#else
+ return _kill (pid, sig);
+#endif
+}
diff --git a/libc/syscalls/syslink.c b/libc/syscalls/syslink.c
new file mode 100644
index 0000000..6abe184
--- /dev/null
+++ b/libc/syscalls/syslink.c
@@ -0,0 +1,15 @@
+/* connector for link */
+
+#include <reent.h>
+
+int
+link (old, new)
+ char *old;
+ char *new;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _link_r (_REENT, old, new);
+#else
+ return _link (old, new);
+#endif
+}
diff --git a/libc/syscalls/syslseek.c b/libc/syscalls/syslseek.c
new file mode 100644
index 0000000..57d6423
--- /dev/null
+++ b/libc/syscalls/syslseek.c
@@ -0,0 +1,17 @@
+/* connector for lseek */
+
+#include <reent.h>
+#include <unistd.h>
+
+off_t
+lseek (fd, pos, whence)
+ int fd;
+ off_t pos;
+ int whence;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _lseek_r (_REENT, fd, pos, whence);
+#else
+ return _lseek (fd, pos, whence);
+#endif
+}
diff --git a/libc/syscalls/sysopen.c b/libc/syscalls/sysopen.c
new file mode 100644
index 0000000..6b3836f
--- /dev/null
+++ b/libc/syscalls/sysopen.c
@@ -0,0 +1,43 @@
+/* connector for open */
+
+#include <reent.h>
+#include <fcntl.h>
+
+#ifdef _HAVE_STDC
+
+/* The prototype in <fcntl.h> uses ..., so we must correspond. */
+
+#include <stdarg.h>
+
+int
+open (const char *file, int flags, ...)
+{
+ va_list ap;
+ int ret;
+
+ va_start (ap, flags);
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ ret = _open_r (_REENT, file, flags, va_arg (ap, int));
+#else
+ ret = _open (file, flags, va_arg (ap, int));
+#endif
+ va_end (ap);
+ return ret;
+}
+
+#else /* ! _HAVE_STDC */
+
+int
+open (file, flags, mode)
+ const char *file;
+ int flags;
+ int mode;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _open_r (_REENT, file, flags, mode);
+#else
+ return _open (file, flags, mode);
+#endif
+}
+
+#endif /* ! _HAVE_STDC */
diff --git a/libc/syscalls/sysread.c b/libc/syscalls/sysread.c
new file mode 100644
index 0000000..821a91a
--- /dev/null
+++ b/libc/syscalls/sysread.c
@@ -0,0 +1,17 @@
+/* connector for read */
+
+#include <reent.h>
+#include <unistd.h>
+
+int
+read (fd, buf, cnt)
+ int fd;
+ void *buf;
+ size_t cnt;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _read_r (_REENT, fd, buf, cnt);
+#else
+ return _read (fd, buf, cnt);
+#endif
+}
diff --git a/libc/syscalls/syssbrk.c b/libc/syscalls/syssbrk.c
new file mode 100644
index 0000000..cee7ee1
--- /dev/null
+++ b/libc/syscalls/syssbrk.c
@@ -0,0 +1,18 @@
+/* connector for sbrk */
+
+#include <reent.h>
+#include <unistd.h>
+
+extern void *_sbrk_r (struct _reent *, size_t);
+extern void *_sbrk (size_t);
+
+void *
+sbrk (incr)
+ size_t incr;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _sbrk_r (_REENT, incr);
+#else
+ return _sbrk (incr);
+#endif
+}
diff --git a/libc/syscalls/sysstat.c b/libc/syscalls/sysstat.c
new file mode 100644
index 0000000..39a5061
--- /dev/null
+++ b/libc/syscalls/sysstat.c
@@ -0,0 +1,16 @@
+/* connector for stat */
+
+#include <reent.h>
+#include <unistd.h>
+
+int
+stat (file, pstat)
+ char *file;
+ struct stat *pstat;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _stat_r (_REENT, file, pstat);
+#else
+ return _stat (file, pstat);
+#endif
+}
diff --git a/libc/syscalls/systimes.c b/libc/syscalls/systimes.c
new file mode 100644
index 0000000..f74d6fa
--- /dev/null
+++ b/libc/syscalls/systimes.c
@@ -0,0 +1,15 @@
+/* connector for times */
+
+#include <reent.h>
+#include <sys/times.h>
+
+clock_t
+times (buf)
+ struct tms *buf;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _times_r (_REENT, buf);
+#else
+ return _times (buf);
+#endif
+}
diff --git a/libc/syscalls/sysunlink.c b/libc/syscalls/sysunlink.c
new file mode 100644
index 0000000..a910f96
--- /dev/null
+++ b/libc/syscalls/sysunlink.c
@@ -0,0 +1,14 @@
+/* connector for unlink */
+
+#include <reent.h>
+
+int
+unlink (file)
+ char *file;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _unlink_r (_REENT, file);
+#else
+ return _unlink (file);
+#endif
+}
diff --git a/libc/syscalls/syswait.c b/libc/syscalls/syswait.c
new file mode 100644
index 0000000..86544fa
--- /dev/null
+++ b/libc/syscalls/syswait.c
@@ -0,0 +1,14 @@
+/* connector for wait */
+
+#include <reent.h>
+
+int
+wait (status)
+ int *status;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _wait_r (_REENT, status);
+#else
+ return _wait (status);
+#endif
+}
diff --git a/libc/syscalls/syswrite.c b/libc/syscalls/syswrite.c
new file mode 100644
index 0000000..e73028e
--- /dev/null
+++ b/libc/syscalls/syswrite.c
@@ -0,0 +1,17 @@
+/* connector for write */
+
+#include <reent.h>
+#include <unistd.h>
+
+int
+write (fd, buf, cnt)
+ int fd;
+ const void *buf;
+ size_t cnt;
+{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+ return _write_r (_REENT, fd, buf, cnt);
+#else
+ return _write (fd, buf, cnt);
+#endif
+}