From 811fae12e9b824936e37abd512b789602f57e2e1 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 2 Nov 1999 19:24:38 +0000 Subject: Split types.s into individual files. --- c/src/exec/posix/src/Makefile.in | 5 +- c/src/exec/posix/src/getegid.c | 26 ++++++ c/src/exec/posix/src/geteuid.c | 25 ++++++ c/src/exec/posix/src/getgid.c | 38 +++++++++ c/src/exec/posix/src/getgroups.c | 26 ++++++ c/src/exec/posix/src/getlogin.c | 46 +++++++++++ c/src/exec/posix/src/getpgrp.c | 27 ++++++ c/src/exec/posix/src/getppid.c | 25 ++++++ c/src/exec/posix/src/getuid.c | 38 +++++++++ c/src/exec/posix/src/setpgid.c | 25 ++++++ c/src/exec/posix/src/setsid.c | 24 ++++++ c/src/exec/posix/src/types.c | 173 +-------------------------------------- 12 files changed, 306 insertions(+), 172 deletions(-) create mode 100644 c/src/exec/posix/src/getegid.c create mode 100644 c/src/exec/posix/src/geteuid.c create mode 100644 c/src/exec/posix/src/getgid.c create mode 100644 c/src/exec/posix/src/getgroups.c create mode 100644 c/src/exec/posix/src/getlogin.c create mode 100644 c/src/exec/posix/src/getpgrp.c create mode 100644 c/src/exec/posix/src/getppid.c create mode 100644 c/src/exec/posix/src/getuid.c create mode 100644 c/src/exec/posix/src/setpgid.c create mode 100644 c/src/exec/posix/src/setsid.c (limited to 'c') diff --git a/c/src/exec/posix/src/Makefile.in b/c/src/exec/posix/src/Makefile.in index 50cc10dd05..a815a6943a 100644 --- a/c/src/exec/posix/src/Makefile.in +++ b/c/src/exec/posix/src/Makefile.in @@ -30,6 +30,9 @@ CONDITION_VARIABLE_C_PIECES= cond condattrdestroy condattrgetpshared \ conddestroy condinit condmp condsignal condsignalsupp condtimedwait \ condwait condwaitsupp +ID_C_PIECES= getegid geteuid getgid getgroups getlogin getpgrp getpid getppid \ + getuid setpgid setsid + KEY_C_PIECES= key keycreate keydelete keygetspecific keyrundestructors \ keysetspecific @@ -78,7 +81,7 @@ TIME_C_PIECES= time posixtimespecsubtract posixtimespectointerval \ TIMER_C_PIECES=ptimer ptimer1 C_PIECES = adasupp $(CANCEL_C_PIECES) $(CONDITION_VARIABLE_C_PIECES) \ - getpid $(KEY_C_PIECES) $(MESSAGE_QUEUE_C_PIECES) \ + $(ID_C_PIECES) $(KEY_C_PIECES) $(MESSAGE_QUEUE_C_PIECES) \ $(MUTEX_C_PIECES) $(PTHREAD_C_PIECES) \ $(PSIGNAL_C_PIECES) sched $(SEMAPHORE_C_PIECES) \ $(TIME_C_PIECES) $(TIMER_C_PIECES) types unistd $(ENOSYS_C_PIECES) \ diff --git a/c/src/exec/posix/src/getegid.c b/c/src/exec/posix/src/getegid.c new file mode 100644 index 0000000000..f1169f14bc --- /dev/null +++ b/c/src/exec/posix/src/getegid.c @@ -0,0 +1,26 @@ +/* + * $Id$ + */ + +#include +#include +#include +#include + +#include +#include +#include + +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; +} + diff --git a/c/src/exec/posix/src/geteuid.c b/c/src/exec/posix/src/geteuid.c new file mode 100644 index 0000000000..f28d9387ae --- /dev/null +++ b/c/src/exec/posix/src/geteuid.c @@ -0,0 +1,25 @@ +/* + * $Id$ + */ + +#include +#include +#include +#include + +#include +#include +#include + +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; +} diff --git a/c/src/exec/posix/src/getgid.c b/c/src/exec/posix/src/getgid.c new file mode 100644 index 0000000000..6b65d12e99 --- /dev/null +++ b/c/src/exec/posix/src/getgid.c @@ -0,0 +1,38 @@ +/* + * $Id$ + */ + +#include +#include +#include +#include + +#include +#include +#include + +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; +} diff --git a/c/src/exec/posix/src/getgroups.c b/c/src/exec/posix/src/getgroups.c new file mode 100644 index 0000000000..e055c0bd9f --- /dev/null +++ b/c/src/exec/posix/src/getgroups.c @@ -0,0 +1,26 @@ +/* + * $Id$ + */ + +#include +#include +#include +#include + +#include +#include +#include + +/*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 */ +} + diff --git a/c/src/exec/posix/src/getlogin.c b/c/src/exec/posix/src/getlogin.c new file mode 100644 index 0000000000..729743696a --- /dev/null +++ b/c/src/exec/posix/src/getlogin.c @@ -0,0 +1,46 @@ +/* + * $Id$ + */ + +#include +#include +#include +#include + +#include +#include +#include + +/*PAGE + * + * 4.2.4 Get User Name, P1003.1b-1993, p. 87 + * + * NOTE: P1003.1c/D10, p. 49 adds getlogin_r(). + */ + +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 +) +{ + if ( namesize < LOGIN_NAME_MAX ) + return ERANGE; + + strcpy( name, "posixapp" ); + return 0; +} diff --git a/c/src/exec/posix/src/getpgrp.c b/c/src/exec/posix/src/getpgrp.c new file mode 100644 index 0000000000..6e69d0f33a --- /dev/null +++ b/c/src/exec/posix/src/getpgrp.c @@ -0,0 +1,27 @@ +/* + * $Id$ + */ + +#include +#include +#include +#include + +#include +#include +#include + +/*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; +} diff --git a/c/src/exec/posix/src/getppid.c b/c/src/exec/posix/src/getppid.c new file mode 100644 index 0000000000..46e49cd3bf --- /dev/null +++ b/c/src/exec/posix/src/getppid.c @@ -0,0 +1,25 @@ +/* + * $Id$ + */ + +#include +#include +#include +#include + +#include +#include +#include + +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; +} + diff --git a/c/src/exec/posix/src/getuid.c b/c/src/exec/posix/src/getuid.c new file mode 100644 index 0000000000..9c2a3425e2 --- /dev/null +++ b/c/src/exec/posix/src/getuid.c @@ -0,0 +1,38 @@ +/* + * $Id$ + */ + +#include +#include +#include +#include + +#include +#include +#include + +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; +} diff --git a/c/src/exec/posix/src/setpgid.c b/c/src/exec/posix/src/setpgid.c new file mode 100644 index 0000000000..46db5b29ed --- /dev/null +++ b/c/src/exec/posix/src/setpgid.c @@ -0,0 +1,25 @@ +/* + * $Id$ + */ + +#include +#include +#include +#include + +#include +#include +#include + +/*PAGE + * + * 4.3.3 Set Process Group ID for Job Control, P1003.1b-1993, p. 89 + */ + +int setpgid( + pid_t pid, + pid_t pgid +) +{ + set_errno_and_return_minus_one( ENOSYS ); +} diff --git a/c/src/exec/posix/src/setsid.c b/c/src/exec/posix/src/setsid.c new file mode 100644 index 0000000000..3954ae8fc7 --- /dev/null +++ b/c/src/exec/posix/src/setsid.c @@ -0,0 +1,24 @@ +/* + * $Id$ + */ + +#include +#include +#include +#include + +#include +#include +#include + +/*PAGE + * + * 4.3.2 Create Session and Set Process Group ID, P1003.1b-1993, p. 88 + */ + +pid_t setsid( void ) +{ + set_errno_and_return_minus_one( ENOSYS ); +} + + diff --git a/c/src/exec/posix/src/types.c b/c/src/exec/posix/src/types.c index 4386ad5292..88fc0f5af4 100644 --- a/c/src/exec/posix/src/types.c +++ b/c/src/exec/posix/src/types.c @@ -1,4 +1,6 @@ /* + * This file is the shell of what it initially was and is now misnamed. + * * $Id$ */ @@ -11,177 +13,6 @@ #include #include -pid_t _POSIX_types_Ppid = 0; -uid_t _POSIX_types_Uid = 0; -uid_t _POSIX_types_Euid = 0; -gid_t _POSIX_types_Gid = 0; -gid_t _POSIX_types_Egid = 0; - -/*PAGE - * - * 4.1.1 Get Process and Parent Process IDs, P1003.1b-1993, p. 83 - */ - -pid_t getppid( void ) -{ - return _POSIX_types_Ppid; -} - -/*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.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; -} - -/*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.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; -} - -/*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; -} - -/*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; -} - -/*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 */ -} - -/*PAGE - * - * 4.2.4 Get User Name, P1003.1b-1993, p. 87 - * - * NOTE: P1003.1c/D10, p. 49 adds getlogin_r(). - */ - -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 -) -{ - if ( namesize < LOGIN_NAME_MAX ) - return ERANGE; - - strcpy( name, "posixapp" ); - return 0; -} - -/*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; -} - -/*PAGE - * - * 4.3.2 Create Session and Set Process Group ID, P1003.1b-1993, p. 88 - */ - -pid_t setsid( void ) -{ - set_errno_and_return_minus_one( ENOSYS ); -} - -/*PAGE - * - * 4.3.3 Set Process Group ID for Job Control, P1003.1b-1993, p. 89 - */ - -int setpgid( - pid_t pid, - pid_t pgid -) -{ - set_errno_and_return_minus_one( ENOSYS ); -} - /* * TEMPORARY */ -- cgit v1.2.3