import from github
This commit is contained in:
14
agbcc/libc/syscalls/sysclose.c
Normal file
14
agbcc/libc/syscalls/sysclose.c
Normal file
@ -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
|
||||
}
|
16
agbcc/libc/syscalls/sysexecve.c
Normal file
16
agbcc/libc/syscalls/sysexecve.c
Normal file
@ -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
|
||||
}
|
17
agbcc/libc/syscalls/sysfcntl.c
Normal file
17
agbcc/libc/syscalls/sysfcntl.c
Normal file
@ -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
|
||||
}
|
19
agbcc/libc/syscalls/sysfork.c
Normal file
19
agbcc/libc/syscalls/sysfork.c
Normal file
@ -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
|
16
agbcc/libc/syscalls/sysfstat.c
Normal file
16
agbcc/libc/syscalls/sysfstat.c
Normal file
@ -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
|
||||
}
|
13
agbcc/libc/syscalls/sysgetpid.c
Normal file
13
agbcc/libc/syscalls/sysgetpid.c
Normal file
@ -0,0 +1,13 @@
|
||||
/* connector for getpid */
|
||||
|
||||
#include <reent.h>
|
||||
|
||||
int
|
||||
getpid ()
|
||||
{
|
||||
#ifdef REENTRANT_SYSCALLS_PROVIDED
|
||||
return _getpid_r (_REENT);
|
||||
#else
|
||||
return _getpid ();
|
||||
#endif
|
||||
}
|
20
agbcc/libc/syscalls/sysgettod.c
Normal file
20
agbcc/libc/syscalls/sysgettod.c
Normal file
@ -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
|
||||
}
|
15
agbcc/libc/syscalls/syskill.c
Normal file
15
agbcc/libc/syscalls/syskill.c
Normal file
@ -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
|
||||
}
|
15
agbcc/libc/syscalls/syslink.c
Normal file
15
agbcc/libc/syscalls/syslink.c
Normal file
@ -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
|
||||
}
|
17
agbcc/libc/syscalls/syslseek.c
Normal file
17
agbcc/libc/syscalls/syslseek.c
Normal file
@ -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
|
||||
}
|
43
agbcc/libc/syscalls/sysopen.c
Normal file
43
agbcc/libc/syscalls/sysopen.c
Normal file
@ -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 */
|
17
agbcc/libc/syscalls/sysread.c
Normal file
17
agbcc/libc/syscalls/sysread.c
Normal file
@ -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
|
||||
}
|
18
agbcc/libc/syscalls/syssbrk.c
Normal file
18
agbcc/libc/syscalls/syssbrk.c
Normal file
@ -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
|
||||
}
|
16
agbcc/libc/syscalls/sysstat.c
Normal file
16
agbcc/libc/syscalls/sysstat.c
Normal file
@ -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
|
||||
}
|
15
agbcc/libc/syscalls/systimes.c
Normal file
15
agbcc/libc/syscalls/systimes.c
Normal file
@ -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
|
||||
}
|
14
agbcc/libc/syscalls/sysunlink.c
Normal file
14
agbcc/libc/syscalls/sysunlink.c
Normal file
@ -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
|
||||
}
|
14
agbcc/libc/syscalls/syswait.c
Normal file
14
agbcc/libc/syscalls/syswait.c
Normal file
@ -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
|
||||
}
|
17
agbcc/libc/syscalls/syswrite.c
Normal file
17
agbcc/libc/syscalls/syswrite.c
Normal file
@ -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
|
||||
}
|
Reference in New Issue
Block a user