diff --git a/lib/other/Makefile.in b/lib/other/Makefile.in index 6a278e29b..b7e6e10a9 100644 --- a/lib/other/Makefile.in +++ b/lib/other/Makefile.in @@ -14,6 +14,8 @@ libc_FILES=" \ _getdents.c \ _getdma.c \ _getnpid.c \ + _getnuid.c \ + _getngid.c \ _getnprocnr.c \ _getpprocnr.c \ _getprocnr.c \ @@ -29,6 +31,8 @@ libc_FILES=" \ _svrctl.c \ _sysuname.c \ _vm_dmacalls.c \ + _vm_set_priv.c \ + _vm_query_exit.c \ asynchio.c \ basename.c \ bcmp.c \ @@ -62,6 +66,7 @@ libc_FILES=" \ lrand.c \ lsearch.c \ memccpy.c \ + minix_rs.c \ mstats.c \ mtab.c \ nlist.c \ diff --git a/lib/other/_brk.c b/lib/other/_brk.c index 5ce5e0f63..c5df52c4f 100755 --- a/lib/other/_brk.c +++ b/lib/other/_brk.c @@ -20,7 +20,7 @@ char *addr; message m; if (addr != _brksize) { - m.m1_p1 = addr; + m.PMBRK_ADDR = addr; if (_syscall(MM, BRK, &m) < 0) return(-1); _brksize = m.m2_p1; } diff --git a/lib/other/_getngid.c b/lib/other/_getngid.c new file mode 100644 index 000000000..cabb7e3d0 --- /dev/null +++ b/lib/other/_getngid.c @@ -0,0 +1,11 @@ +#include +#define getngid _getngid +#include + +PUBLIC gid_t getngid(int proc_nr) +{ + message m; + m.m1_i1 = proc_nr; /* search gid for this process */ + if (_syscall(MM, GETGID, &m) < 0) return ( (gid_t) -1); + return( (gid_t) m.m2_i2); /* return search result */ +} diff --git a/lib/other/_getnpid.c b/lib/other/_getnpid.c index f9c03c27e..2f51b5a55 100644 --- a/lib/other/_getnpid.c +++ b/lib/other/_getnpid.c @@ -6,6 +6,6 @@ PUBLIC pid_t getnpid(int proc_nr) { message m; m.m1_i1 = proc_nr; /* search pid for this process */ - if (_syscall(MM, GETPID, &m) < 0) return ( (pid_t) -1); + if (_syscall(MM, MINIX_GETPID, &m) < 0) return ( (pid_t) -1); return( (pid_t) m.m2_i2); /* return search result */ } diff --git a/lib/other/_getnuid.c b/lib/other/_getnuid.c new file mode 100644 index 000000000..67244cff7 --- /dev/null +++ b/lib/other/_getnuid.c @@ -0,0 +1,11 @@ +#include +#define getnuid _getnuid +#include + +PUBLIC uid_t getnuid(int proc_nr) +{ + message m; + m.m1_i1 = proc_nr; /* search uid for this process */ + if (_syscall(MM, GETUID, &m) < 0) return ( (uid_t) -1); + return( (uid_t) m.m2_i2); /* return search result */ +} diff --git a/lib/other/_vm_query_exit.c b/lib/other/_vm_query_exit.c new file mode 100644 index 000000000..c6e85f17c --- /dev/null +++ b/lib/other/_vm_query_exit.c @@ -0,0 +1,24 @@ +#define _SYSTEM 1 +#include +#define vm_query_exit _vm_query_exit +#include + +/* return -1, when the query itself or the processing of query has errors. + * return 1, when there are more processes waiting to be queried. + * return 0, when there are no more processes. + * note that for the return value of 0 and 1, the 'endpt' is set accordingly. + */ +PUBLIC int vm_query_exit(int *endpt) +{ + message m; + int r; + + r = _syscall(VM_PROC_NR, VM_QUERY_EXIT, &m); + if (r != OK) + return -1; + if (endpt == NULL) + return -1; + + *endpt = m.VM_QUERY_RET_PT; + return (m.VM_QUERY_IS_MORE ? 1 : 0); +} diff --git a/lib/other/_vm_set_priv.c b/lib/other/_vm_set_priv.c new file mode 100644 index 000000000..a0e6980c2 --- /dev/null +++ b/lib/other/_vm_set_priv.c @@ -0,0 +1,11 @@ +#include +#define vm_set_priv _vm_set_priv +#include + +PUBLIC int vm_set_priv(int nr, void *buf) +{ + message m; + m.VM_RS_NR = nr; + m.VM_RS_BUF = (long) buf; + return _syscall(VM_PROC_NR, VM_RS_SET_PRIV, &m); +}