Add get-ID procedures from draft SRFI 170
This commit is contained in:
parent
ca8e23c079
commit
cfdb8f2928
|
@ -1 +1,10 @@
|
|||
value_t builtin_pid(value_t *args, uint32_t nargs);
|
||||
value_t builtin_parent_pid(value_t *args, uint32_t nargs);
|
||||
value_t builtin_process_group(value_t *args, uint32_t nargs);
|
||||
|
||||
value_t builtin_user_effective_gid(value_t *args, uint32_t nargs);
|
||||
value_t builtin_user_effective_uid(value_t *args, uint32_t nargs);
|
||||
value_t builtin_user_real_gid(value_t *args, uint32_t nargs);
|
||||
value_t builtin_user_real_uid(value_t *args, uint32_t nargs);
|
||||
|
||||
value_t builtin_read_ini_file(value_t *args, uint32_t nargs);
|
||||
|
|
|
@ -88,6 +88,15 @@ static struct builtin_procedure builtin_procedures[] = {
|
|||
|
||||
{ "read-ini-file", builtin_read_ini_file, UP_2019 },
|
||||
|
||||
{ "pid", builtin_pid, SRFI_170 | UP_2019 },
|
||||
{ "parent-pid", builtin_parent_pid, SRFI_170 | UP_2019 },
|
||||
{ "process-group", builtin_process_group, SRFI_170 | UP_2019 },
|
||||
|
||||
{ "user-effective-gid", builtin_user_effective_gid, SRFI_170 | UP_2019 },
|
||||
{ "user-effective-uid", builtin_user_effective_uid, SRFI_170 | UP_2019 },
|
||||
{ "user-real-gid", builtin_user_real_gid, SRFI_170 | UP_2019 },
|
||||
{ "user-real-uid", builtin_user_real_uid, SRFI_170 | UP_2019 },
|
||||
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
|
||||
|
|
76
c/os_unix.c
76
c/os_unix.c
|
@ -1,6 +1,33 @@
|
|||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "dtypes.h"
|
||||
#include "utils.h"
|
||||
#include "utf8.h"
|
||||
#include "ios.h"
|
||||
#include "socket.h"
|
||||
#include "timefuncs.h"
|
||||
#include "hashing.h"
|
||||
#include "htable.h"
|
||||
#include "htableh_inc.h"
|
||||
#include "bitvector.h"
|
||||
#include "os.h"
|
||||
#include "random.h"
|
||||
#include "llt.h"
|
||||
|
||||
#include "flisp.h"
|
||||
|
||||
#include "argcount.h"
|
||||
#include "os.h"
|
||||
|
||||
void path_to_dirname(char *path)
|
||||
|
@ -21,3 +48,52 @@ int set_cwd(char *buf)
|
|||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
value_t builtin_pid(value_t *args, uint32_t nargs)
|
||||
{
|
||||
(void)args;
|
||||
argcount("pid", nargs, 0);
|
||||
return fixnum(getpid());
|
||||
}
|
||||
|
||||
value_t builtin_parent_pid(value_t *args, uint32_t nargs)
|
||||
{
|
||||
(void)args;
|
||||
argcount("parent-pid", nargs, 0);
|
||||
return fixnum(getppid());
|
||||
}
|
||||
|
||||
value_t builtin_process_group(value_t *args, uint32_t nargs)
|
||||
{
|
||||
(void)args;
|
||||
argcount("process-group", nargs, 0);
|
||||
return fixnum(getpgid(0));
|
||||
}
|
||||
|
||||
value_t builtin_user_effective_gid(value_t *args, uint32_t nargs)
|
||||
{
|
||||
(void)args;
|
||||
argcount("user-effective-gid", nargs, 0);
|
||||
return fixnum(getegid());
|
||||
}
|
||||
|
||||
value_t builtin_user_effective_uid(value_t *args, uint32_t nargs)
|
||||
{
|
||||
(void)args;
|
||||
argcount("user-effective-uid", nargs, 0);
|
||||
return fixnum(geteuid());
|
||||
}
|
||||
|
||||
value_t builtin_user_real_gid(value_t *args, uint32_t nargs)
|
||||
{
|
||||
(void)args;
|
||||
argcount("user-real-gid", nargs, 0);
|
||||
return fixnum(getgid());
|
||||
}
|
||||
|
||||
value_t builtin_user_real_uid(value_t *args, uint32_t nargs)
|
||||
{
|
||||
(void)args;
|
||||
argcount("user-real-uid", nargs, 0);
|
||||
return fixnum(getuid());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue