OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [reent/] [execr.c] - Diff between revs 1010 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 1010 Rev 1765
/* Reentrant versions of execution system calls.  These
/* Reentrant versions of execution system calls.  These
   implementations just call the usual system calls.  */
   implementations just call the usual system calls.  */
 
 
#include <reent.h>
#include <reent.h>
#include <unistd.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/wait.h>
#include <_syslist.h>
#include <_syslist.h>
 
 
/* Some targets provides their own versions of these functions.  Those
/* Some targets provides their own versions of these functions.  Those
   targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS.  */
   targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS.  */
 
 
#ifdef _REENT_ONLY
#ifdef _REENT_ONLY
#ifndef REENTRANT_SYSCALLS_PROVIDED
#ifndef REENTRANT_SYSCALLS_PROVIDED
#define REENTRANT_SYSCALLS_PROVIDED
#define REENTRANT_SYSCALLS_PROVIDED
#endif
#endif
#endif
#endif
 
 
/* If NO_EXEC is defined, we don't need these functions.  */
/* If NO_EXEC is defined, we don't need these functions.  */
 
 
#if defined (REENTRANT_SYSCALLS_PROVIDED) || defined (NO_EXEC)
#if defined (REENTRANT_SYSCALLS_PROVIDED) || defined (NO_EXEC)
 
 
int _dummy_exec_syscalls = 1;
int _dummy_exec_syscalls = 1;
 
 
#else
#else
 
 
/* We use the errno variable used by the system dependent layer.  */
/* We use the errno variable used by the system dependent layer.  */
#undef errno
#undef errno
extern int errno;
extern int errno;
 
 
/*
/*
FUNCTION
FUNCTION
        <<_execve_r>>---Reentrant version of execve
        <<_execve_r>>---Reentrant version of execve
INDEX
INDEX
        _execve_r
        _execve_r
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <reent.h>
        #include <reent.h>
        int _execve_r(struct _reent *<[ptr]>, char *<[name]>,
        int _execve_r(struct _reent *<[ptr]>, char *<[name]>,
                      char **<[argv]>, char **<[env]>);
                      char **<[argv]>, char **<[env]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <reent.h>
        #include <reent.h>
        int _execve_r(<[ptr]>, <[name]>, <[argv]>, <[env]>)
        int _execve_r(<[ptr]>, <[name]>, <[argv]>, <[env]>)
        struct _reent *<[ptr]>;
        struct _reent *<[ptr]>;
        char *<[name]>;
        char *<[name]>;
        char **<[argv]>;
        char **<[argv]>;
        char **<[env]>;
        char **<[env]>;
 
 
DESCRIPTION
DESCRIPTION
        This is a reentrant version of <<execve>>.  It
        This is a reentrant version of <<execve>>.  It
        takes a pointer to the global data block, which holds
        takes a pointer to the global data block, which holds
        <<errno>>.
        <<errno>>.
*/
*/
 
 
int
int
_execve_r (ptr, name, argv, env)
_execve_r (ptr, name, argv, env)
     struct _reent *ptr;
     struct _reent *ptr;
     char *name;
     char *name;
     char **argv;
     char **argv;
     char **env;
     char **env;
{
{
  int ret;
  int ret;
 
 
  errno = 0;
  errno = 0;
  if ((ret = _execve (name, argv, env)) == -1 && errno != 0)
  if ((ret = _execve (name, argv, env)) == -1 && errno != 0)
    ptr->_errno = errno;
    ptr->_errno = errno;
  return ret;
  return ret;
}
}
 
 
 
 
/*
/*
FUNCTION
FUNCTION
        <<_fork_r>>---Reentrant version of fork
        <<_fork_r>>---Reentrant version of fork
 
 
INDEX
INDEX
        _fork_r
        _fork_r
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <reent.h>
        #include <reent.h>
        int _fork_r(struct _reent *<[ptr]>);
        int _fork_r(struct _reent *<[ptr]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <reent.h>
        #include <reent.h>
        int _fork_r(<[ptr]>)
        int _fork_r(<[ptr]>)
        struct _reent *<[ptr]>;
        struct _reent *<[ptr]>;
 
 
DESCRIPTION
DESCRIPTION
        This is a reentrant version of <<fork>>.  It
        This is a reentrant version of <<fork>>.  It
        takes a pointer to the global data block, which holds
        takes a pointer to the global data block, which holds
        <<errno>>.
        <<errno>>.
*/
*/
 
 
#ifndef NO_FORK
#ifndef NO_FORK
 
 
int
int
_fork_r (ptr)
_fork_r (ptr)
     struct _reent *ptr;
     struct _reent *ptr;
{
{
  int ret;
  int ret;
 
 
  errno = 0;
  errno = 0;
  if ((ret = _fork ()) == -1 && errno != 0)
  if ((ret = _fork ()) == -1 && errno != 0)
    ptr->_errno = errno;
    ptr->_errno = errno;
  return ret;
  return ret;
}
}
 
 
#endif
#endif
 
 
/*
/*
FUNCTION
FUNCTION
        <<_wait_r>>---Reentrant version of wait
        <<_wait_r>>---Reentrant version of wait
 
 
INDEX
INDEX
        _wait_r
        _wait_r
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <reent.h>
        #include <reent.h>
        int _wait_r(struct _reent *<[ptr]>, int *<[status]>);
        int _wait_r(struct _reent *<[ptr]>, int *<[status]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <reent.h>
        #include <reent.h>
        int _wait_r(<[ptr]>, <[status]>)
        int _wait_r(<[ptr]>, <[status]>)
        struct _reent *<[ptr]>;
        struct _reent *<[ptr]>;
        int *<[status]>;
        int *<[status]>;
 
 
DESCRIPTION
DESCRIPTION
        This is a reentrant version of <<wait>>.  It
        This is a reentrant version of <<wait>>.  It
        takes a pointer to the global data block, which holds
        takes a pointer to the global data block, which holds
        <<errno>>.
        <<errno>>.
*/
*/
 
 
int
int
_wait_r (ptr, status)
_wait_r (ptr, status)
     struct _reent *ptr;
     struct _reent *ptr;
     int *status;
     int *status;
{
{
  int ret;
  int ret;
 
 
  errno = 0;
  errno = 0;
  if ((ret = _wait (status)) == -1 && errno != 0)
  if ((ret = _wait (status)) == -1 && errno != 0)
    ptr->_errno = errno;
    ptr->_errno = errno;
  return ret;
  return ret;
}
}
 
 
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.