import from github

This commit is contained in:
2022-05-19 17:14:13 +00:00
parent 5247c34f50
commit ab32b30591
12612 changed files with 1905035 additions and 83 deletions

View 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
}

View 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
}

View 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
}

View 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

View 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
}

View 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
}

View 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
}

View 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
}

View 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
}

View 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
}

View 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 */

View 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
}

View 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
}

View 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
}

View 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
}

View 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
}

View 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
}

View 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
}