This commit was manufactured by cvs2svn to create branch 'rtems-4-6-branch'.

Cherrypick from master 2003-08-18 07:31:32 UTC Ralf Corsepius <ralf.corsepius@rtems.org> '2003-08-18	Ralf Corsepius <corsepiu@faw.uni-ulm.de>':
    cpukit/libcsupport/src/getegid.c
    cpukit/libcsupport/src/geteuid.c
    cpukit/libcsupport/src/getgid.c
    cpukit/libcsupport/src/getgroups.c
    cpukit/libcsupport/src/getlogin.c
    cpukit/libcsupport/src/getpgrp.c
    cpukit/libcsupport/src/getpid.c
    cpukit/libcsupport/src/getppid.c
    cpukit/libcsupport/src/getuid.c
    cpukit/libcsupport/src/setpgid.c
    cpukit/libcsupport/src/setsid.c
This commit is contained in:
cvs2git
2003-08-18 07:31:33 +00:00
parent ba312810c7
commit c2eba811f4
11 changed files with 416 additions and 0 deletions

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

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

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

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

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

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

View 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

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

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

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

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