]>
Commit | Line | Data |
---|---|---|
6a5fa4e0 MG |
1 | /* |
2 | * ids.c | |
3 | * | |
4 | * Public-domain relatively quick-and-dirty implemenation of | |
5 | * ANSI library routine for System V Unix systems. | |
6 | * | |
7 | * It's written in old-style C for maximal portability. | |
8 | * | |
9 | * Arnold Robbins | |
10 | * January, February, 1991 | |
11 | * | |
12 | * Fixes from ado@elsie.nci.nih.gov | |
13 | * February 1991 | |
14 | *----------------------------------------------------------------------------- | |
15 | * $Id: ids.c,v 2.0 1992/10/16 04:52:16 markd Rel $ | |
16 | *----------------------------------------------------------------------------- | |
17 | */ | |
18 | ||
19 | /* | |
20 | * To avoid Unix version problems, this code has been simplified to avoid | |
21 | * const and size_t, however this can cause an incompatible definition on | |
22 | * ansi-C systems, so a game is played with defines to ignore a strftime | |
23 | * declaration in time.h | |
24 | */ | |
25 | ||
26 | #include <sys/types.h> | |
27 | ||
28 | static uid_t usrID = 100; | |
29 | static gid_t grpID = 10; | |
30 | ||
31 | static int procID = 12345; | |
32 | static int pgrpID = 10; | |
33 | ||
34 | ||
35 | /* getppid --- returns the process ID of the parent process */ | |
36 | ||
37 | int | |
38 | getppid() | |
39 | { | |
40 | return procID; | |
41 | } | |
42 | ||
43 | /* getpgrp --- returns the process group of the process indicated by pid */ | |
44 | ||
45 | int | |
46 | getpgrp(pid) | |
47 | int pid; | |
48 | { | |
49 | return pgrpID; | |
50 | } | |
51 | ||
52 | /* setpgrp --- sets the process group of the process indicated by pid */ | |
53 | ||
54 | int | |
55 | setpgrp(pid, pgrp) | |
56 | int pid; | |
57 | int pgrp; | |
58 | { | |
59 | pgrpID = pgrp; | |
60 | return pgrp; | |
61 | } | |
62 | ||
63 | /* setuid --- sets the real and effective user ID of the current process */ | |
64 | ||
65 | int setuid(uid) | |
66 | uid_t uid; | |
67 | { | |
68 | usrID = uid; | |
69 | return 0; | |
70 | } | |
71 | ||
72 | /* getgid --- gets the effective group ID of the current process */ | |
73 | ||
74 | uid_t setgid(gid) | |
75 | gid_t gid; | |
76 | { | |
77 | grpID = gid; | |
78 | return 0; | |
79 | } | |
80 |