]> Zhao Yanbai Git Server - minix.git/commitdiff
more pid queries; PM field macros; vm stubs
authorBen Gras <ben@minix3.org>
Mon, 21 Sep 2009 14:44:00 +0000 (14:44 +0000)
committerBen Gras <ben@minix3.org>
Mon, 21 Sep 2009 14:44:00 +0000 (14:44 +0000)
lib/other/Makefile.in
lib/other/_brk.c
lib/other/_getngid.c [new file with mode: 0644]
lib/other/_getnpid.c
lib/other/_getnuid.c [new file with mode: 0644]
lib/other/_vm_query_exit.c [new file with mode: 0644]
lib/other/_vm_set_priv.c [new file with mode: 0644]

index 6a278e29b9f9a0262623838781633dc310474949..b7e6e10a9f4d3f37e3dd6df7bef0c6c05c2b6f8a 100644 (file)
@@ -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 \
index 5ce5e0f638629bcbf8f169d9d594eb843d96bfcd..c5df52c4f3d1ede5d4200f343e083337f88e528c 100755 (executable)
@@ -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 (file)
index 0000000..cabb7e3
--- /dev/null
@@ -0,0 +1,11 @@
+#include <lib.h>
+#define getngid        _getngid
+#include <unistd.h>
+
+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 */
+}
index f9c03c27eb705f65b16cabdaea1537a5858f4f12..2f51b5a551cc6b3bc59402ef74d599fcb0dbd738 100644 (file)
@@ -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 (file)
index 0000000..67244cf
--- /dev/null
@@ -0,0 +1,11 @@
+#include <lib.h>
+#define getnuid        _getnuid
+#include <unistd.h>
+
+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 (file)
index 0000000..c6e85f1
--- /dev/null
@@ -0,0 +1,24 @@
+#define _SYSTEM 1
+#include <lib.h>
+#define vm_query_exit _vm_query_exit
+#include <unistd.h>
+
+/* 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 (file)
index 0000000..a0e6980
--- /dev/null
@@ -0,0 +1,11 @@
+#include <lib.h>
+#define vm_set_priv _vm_set_priv
+#include <unistd.h>
+
+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);
+}