summaryrefslogtreecommitdiff
path: root/libc/syscall/getinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/syscall/getinfo.c')
-rw-r--r--libc/syscall/getinfo.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/libc/syscall/getinfo.c b/libc/syscall/getinfo.c
new file mode 100644
index 0000000..a5ab89a
--- /dev/null
+++ b/libc/syscall/getinfo.c
@@ -0,0 +1,32 @@
+
+#define PERM_GETINFO 0x100
+#define PERM_GETGROUP 0x200
+
+struct {
+ int pid;
+ int ppid;
+ int uid;
+ int gid;
+ int euid;
+ int egid;
+}
+ __info_safe;
+
+getgroups(count, locn)
+int count;
+void * locn;
+{
+ if( count < 0 ) {errno = EINVAL; return -1; }
+ return __permissions(PERM_GETGROUP, count, locn);
+}
+
+getpid()
+{
+ __permissions(PERM_GETINFO, 6, &__info_safe);
+ return __info_safe.pid;
+}
+
+getppid()
+{
+ return __permissions(PERM_GETITEM(1) /*, 0, 0 */);
+}