#define VERBOSEBOOT_MAX 3
#define VERBOSEBOOTVARNAME "verbose"
+/* magic value to put in struct proc entries for sanity checks. */
+#define PMAGIC 0xC0FFEE1
+
#endif /* _MINIX_CONST_H */
#include <minix/type.h>
_PROTOTYPE( int getsysinfo, (endpoint_t who, int what, void *where) );
+_PROTOTYPE( int minix_getkproctab, (void *pr, int nprocs, int assert));
_PROTOTYPE( ssize_t getsysinfo_up, (endpoint_t who, int what, size_t size,
void *where));
#ifndef PROC_H
#define PROC_H
+#include <minix/const.h>
+
#ifndef __ASSEMBLY__
/* Here is the declaration of the process table. It contains all process
} p_vmrequest;
int p_found; /* consistency checking variables */
-#define PMAGIC 0xC0FFEE1
int p_magic; /* check validity of proc pointers */
#if DEBUG_TRACE
+
#include <lib.h>
+#include <unistd.h>
+#include <timers.h>
#include <minix/endpoint.h>
#define getsysinfo _getsysinfo
#define getsysinfo_up _getsysinfo_up
#include <minix/sysinfo.h>
+#include <minix/const.h>
+
+#include <minix/ipc.h>
+#include <minix/com.h>
+#include <minix/sysinfo.h>
+#include <minix/config.h>
+#include <minix/type.h>
+#include <minix/const.h>
+#include <stdio.h>
+#include <machine/archtypes.h>
+#include "../../../kernel/proc.h"
PUBLIC int getsysinfo(who, what, where)
endpoint_t who; /* from whom to request info */
return(0);
}
+PUBLIC int minix_getkproctab(void *vpr, int nprocs, int assert)
+{
+ int r, i, fail = 0;
+ struct proc *pr = vpr;
+
+ if((r=getsysinfo(PM_PROC_NR, SI_KPROC_TAB, pr)) < 0)
+ return r;
+
+ for(i = 0; i < nprocs; i++) {
+ if(pr[i].p_magic != PMAGIC) {
+ fail = 1;
+ break;
+ }
+ }
+
+ if(!fail)
+ return 0;
+
+ if(assert) {
+ fprintf(stderr, "%s: process table failed sanity check.\n", getprogname());
+ fprintf(stderr, "is kernel out of sync?\n");
+ exit(1);
+ }
+
+ errno = ENOSYS;
+
+ return -1;
+}
+
/* Unprivileged variant of getsysinfo. */
PUBLIC ssize_t getsysinfo_up(who, what, size, where)
endpoint_t who; /* from whom to request info */