mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-26 06:08:20 +00:00
2003-08-18 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
PR 449/rtems: * src/getegid.c: New (Copied from ../posix/src). * src/geteuid.c: New (Copied from ../posix/src). * src/getgid.c: New (Copied from ../posix/src). * src/getgroups.c: New (Copied from ../posix/src). * src/getlogin.c: New (Copied from ../posix/src). * src/getpgrp.c: New (Copied from ../posix/src). * src/getpid.c: New (Copied from ../posix/src). * src/getppid.c: New (Copied from ../posix/src). * src/getuid.c: New (Copied from ../posix/src). * src/setpgid.c: New (Copied from ../posix/src). * src/setsid.c: New (Copied from ../posix/src). * src/no_posix: Remove getpid and _getpid_r. * Makefile.am: Reflect changes above.
This commit is contained in:
@@ -1,7 +1,24 @@
|
||||
2003-08-18 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
|
||||
|
||||
PR 449/rtems:
|
||||
* src/getegid.c: New (Copied from ../posix/src).
|
||||
* src/geteuid.c: New (Copied from ../posix/src).
|
||||
* src/getgid.c: New (Copied from ../posix/src).
|
||||
* src/getgroups.c: New (Copied from ../posix/src).
|
||||
* src/getlogin.c: New (Copied from ../posix/src).
|
||||
* src/getpgrp.c: New (Copied from ../posix/src).
|
||||
* src/getpid.c: New (Copied from ../posix/src).
|
||||
* src/getppid.c: New (Copied from ../posix/src).
|
||||
* src/getuid.c: New (Copied from ../posix/src).
|
||||
* src/setpgid.c: New (Copied from ../posix/src).
|
||||
* src/setsid.c: New (Copied from ../posix/src).
|
||||
* src/no_posix: Remove getpid and _getpid_r.
|
||||
* Makefile.am: Reflect changes above.
|
||||
|
||||
2003-08-14 Joel Sherrill <joel@OARcorp.com>
|
||||
|
||||
* Makefile.am: Add fileio to list of interactive tests.
|
||||
* src/sync.c: New file.
|
||||
* src/sync.c: New (Copied from ../posix/src). New file.
|
||||
|
||||
2003-08-05 Till Strauman <strauman@slac.stanford.edu>
|
||||
|
||||
|
||||
@@ -123,6 +123,10 @@ DIRECTORY_SCAN_C_FILES = src/opendir.c src/closedir.c src/readdir.c \
|
||||
src/readdir_r.c src/rewinddir.c src/scandir.c src/seekdir.c \
|
||||
src/telldir.c src/getcwd.c
|
||||
|
||||
ID_C_FILES = src/getegid.c src/geteuid.c src/getgid.c src/getgroups.c \
|
||||
src/getlogin.c src/getpgrp.c \
|
||||
src/getpid.c src/getppid.c src/getuid.c src/setpgid.c src/setsid.c
|
||||
|
||||
MALLOC_C_FILES = src/malloc.c src/mallocfreespace.c src/__brk.c src/__sbrk.c
|
||||
|
||||
PASSWORD_GROUP_C_FILES = src/getpwent.c
|
||||
@@ -148,7 +152,7 @@ UNIX_C_FILES = $(UNIX_LIBC_C_FILES)
|
||||
|
||||
EMBEDDED_C_FILES = $(LIBC_GLUE_C_FILES) $(PASSWORD_GROUP_C_FILES) \
|
||||
$(TERMINAL_IDENTIFICATION_C_FILES) $(SYSTEM_CALL_C_FILES) \
|
||||
$(DIRECTORY_SCAN_C_FILES)
|
||||
$(DIRECTORY_SCAN_C_FILES) $(ID_C_FILES)
|
||||
|
||||
if UNIX
|
||||
C_FILES = $(COMMON_C_FILES) $(UNIX_C_FILES)
|
||||
|
||||
33
cpukit/libcsupport/src/getegid.c
Normal file
33
cpukit/libcsupport/src/getegid.c
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/seterr.h>
|
||||
#include <rtems/userenv.h>
|
||||
|
||||
/*
|
||||
* MACRO in userenv.h
|
||||
gid_t _POSIX_types_Egid = 0;
|
||||
*/
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
|
||||
* P1003.1b-1993, p. 84
|
||||
*/
|
||||
|
||||
gid_t getegid( void )
|
||||
{
|
||||
return _POSIX_types_Egid;
|
||||
}
|
||||
|
||||
33
cpukit/libcsupport/src/geteuid.c
Normal file
33
cpukit/libcsupport/src/geteuid.c
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
#include <rtems/userenv.h>
|
||||
|
||||
/*
|
||||
* MACRO in userenv.h
|
||||
uid_t _POSIX_types_Euid = 0;
|
||||
*/
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
|
||||
* P1003.1b-1993, p. 84
|
||||
*/
|
||||
|
||||
uid_t geteuid( void )
|
||||
{
|
||||
return _POSIX_types_Euid;
|
||||
}
|
||||
47
cpukit/libcsupport/src/getgid.c
Normal file
47
cpukit/libcsupport/src/getgid.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
#include <rtems/userenv.h>
|
||||
|
||||
/*
|
||||
* MACRO in userenv.h
|
||||
*
|
||||
gid_t _POSIX_types_Gid = 0;
|
||||
*/
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
|
||||
* P1003.1b-1993, p. 84
|
||||
*/
|
||||
|
||||
gid_t getgid( void )
|
||||
{
|
||||
return _POSIX_types_Gid;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.2 Set User and Group IDs, P1003.1b-1993, p. 84
|
||||
*/
|
||||
|
||||
int setgid(
|
||||
gid_t gid
|
||||
)
|
||||
{
|
||||
_POSIX_types_Gid = gid;
|
||||
return 0;
|
||||
}
|
||||
30
cpukit/libcsupport/src/getgroups.c
Normal file
30
cpukit/libcsupport/src/getgroups.c
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.3 Get Supplementary IDs, P1003.1b-1993, p. 86
|
||||
*/
|
||||
|
||||
int getgroups(
|
||||
int gidsetsize,
|
||||
gid_t grouplist[]
|
||||
)
|
||||
{
|
||||
return 0; /* no supplemental group ids */
|
||||
}
|
||||
|
||||
64
cpukit/libcsupport/src/getlogin.c
Normal file
64
cpukit/libcsupport/src/getlogin.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/seterr.h>
|
||||
#include <rtems/userenv.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.4 Get User Name, P1003.1b-1993, p. 87
|
||||
*
|
||||
* NOTE: P1003.1c/D10, p. 49 adds getlogin_r().
|
||||
*/
|
||||
|
||||
/*
|
||||
* MACRO in userenv.h
|
||||
*
|
||||
static char _POSIX_types_Getlogin_buffer[ LOGIN_NAME_MAX ];
|
||||
*/
|
||||
|
||||
char *getlogin( void )
|
||||
{
|
||||
(void) getlogin_r( _POSIX_types_Getlogin_buffer, LOGIN_NAME_MAX );
|
||||
return _POSIX_types_Getlogin_buffer;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.4 Get User Name, P1003.1b-1993, p. 87
|
||||
*
|
||||
* NOTE: P1003.1c/D10, p. 49 adds getlogin_r().
|
||||
*/
|
||||
|
||||
int getlogin_r(
|
||||
char *name,
|
||||
size_t namesize
|
||||
)
|
||||
{
|
||||
struct passwd *pw;
|
||||
if ( namesize < LOGIN_NAME_MAX )
|
||||
return ERANGE;
|
||||
|
||||
pw=getpwuid(getuid());
|
||||
if (!pw) {
|
||||
strcpy(name,"");
|
||||
} else {
|
||||
strncpy(name,pw->pw_name,LOGIN_NAME_MAX);
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
31
cpukit/libcsupport/src/getpgrp.c
Normal file
31
cpukit/libcsupport/src/getpgrp.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.3.1 Get Process Group IDs, P1003.1b-1993, p. 89
|
||||
*/
|
||||
|
||||
pid_t getpgrp( void )
|
||||
{
|
||||
/*
|
||||
* This always succeeds and returns the process group id. For rtems,
|
||||
* this will always be the local node;
|
||||
*/
|
||||
|
||||
return _Objects_Local_node;
|
||||
}
|
||||
45
cpukit/libcsupport/src/getpid.c
Normal file
45
cpukit/libcsupport/src/getpid.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.1.1 Get Process and Parent Process IDs, P1003.1b-1993, p. 83
|
||||
*/
|
||||
|
||||
pid_t getpid( void )
|
||||
{
|
||||
return _Objects_Local_node;
|
||||
}
|
||||
|
||||
/*
|
||||
* _getpid_r
|
||||
*
|
||||
* This is the Newlib dependent reentrant version of getpid().
|
||||
*/
|
||||
|
||||
#if defined(RTEMS_NEWLIB)
|
||||
|
||||
#include <reent.h>
|
||||
|
||||
pid_t _getpid_r(
|
||||
struct _reent *ptr
|
||||
)
|
||||
{
|
||||
return getpid();
|
||||
}
|
||||
#endif
|
||||
|
||||
29
cpukit/libcsupport/src/getppid.c
Normal file
29
cpukit/libcsupport/src/getppid.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
pid_t _POSIX_types_Ppid = 0;
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.1.1 Get Process and Parent Process IDs, P1003.1b-1993, p. 83
|
||||
*/
|
||||
|
||||
pid_t getppid( void )
|
||||
{
|
||||
return _POSIX_types_Ppid;
|
||||
}
|
||||
|
||||
47
cpukit/libcsupport/src/getuid.c
Normal file
47
cpukit/libcsupport/src/getuid.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
#include <rtems/userenv.h>
|
||||
|
||||
/*
|
||||
* MACRO in userenv.h
|
||||
*
|
||||
uid_t _POSIX_types_Uid = 0;
|
||||
*/
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs,
|
||||
* P1003.1b-1993, p. 84
|
||||
*/
|
||||
|
||||
uid_t getuid( void )
|
||||
{
|
||||
return _POSIX_types_Uid;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.2.2 Set User and Group IDs, P1003.1b-1993, p. 84
|
||||
*/
|
||||
|
||||
int setuid(
|
||||
uid_t uid
|
||||
)
|
||||
{
|
||||
_POSIX_types_Uid = uid;
|
||||
return 0;
|
||||
}
|
||||
11
cpukit/libcsupport/src/list
Normal file
11
cpukit/libcsupport/src/list
Normal file
@@ -0,0 +1,11 @@
|
||||
libcsupport/src/getegid.c
|
||||
libcsupport/src/geteuid.c
|
||||
libcsupport/src/getgid.c
|
||||
libcsupport/src/getgroups.c
|
||||
libcsupport/src/getlogin.c
|
||||
libcsupport/src/getpgrp.c
|
||||
libcsupport/src/getpid.c
|
||||
libcsupport/src/getppid.c
|
||||
libcsupport/src/getuid.c
|
||||
libcsupport/src/setpgid.c
|
||||
libcsupport/src/setsid.c
|
||||
@@ -2,8 +2,6 @@
|
||||
* Marginal implementations of some POSIX API routines
|
||||
* to be used when POSIX is disabled.
|
||||
*
|
||||
* + getpid
|
||||
* + _getpid_r
|
||||
* + kill
|
||||
* + _kill_r
|
||||
* + __kill
|
||||
@@ -28,25 +26,6 @@
|
||||
* These are directly supported (and completely correct) in the posix api.
|
||||
*/
|
||||
|
||||
#if !defined(RTEMS_POSIX_API)
|
||||
pid_t getpid(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(RTEMS_NEWLIB)
|
||||
#include <reent.h>
|
||||
|
||||
pid_t _getpid_r(
|
||||
struct _reent *ptr
|
||||
)
|
||||
{
|
||||
return getpid();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(RTEMS_POSIX_API)
|
||||
int kill( pid_t pid, int sig )
|
||||
{
|
||||
|
||||
29
cpukit/libcsupport/src/setpgid.c
Normal file
29
cpukit/libcsupport/src/setpgid.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.3.3 Set Process Group ID for Job Control, P1003.1b-1993, p. 89
|
||||
*/
|
||||
|
||||
int setpgid(
|
||||
pid_t pid,
|
||||
pid_t pgid
|
||||
)
|
||||
{
|
||||
rtems_set_errno_and_return_minus_one( ENOSYS );
|
||||
}
|
||||
28
cpukit/libcsupport/src/setsid.c
Normal file
28
cpukit/libcsupport/src/setsid.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 4.3.2 Create Session and Set Process Group ID, P1003.1b-1993, p. 88
|
||||
*/
|
||||
|
||||
pid_t setsid( void )
|
||||
{
|
||||
rtems_set_errno_and_return_minus_one( EPERM );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user