From: Alan Cox Date: Fri, 2 Jan 2015 10:35:30 +0000 (+0000) Subject: ps.c: Update code to build with FUZIX userland X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=065a2928ee18cf0c8f67b74aa4722f745ed8c998;p=FUZIX.git ps.c: Update code to build with FUZIX userland From: Sergio L. Pascual (Removed fuzix.h: Alan Cox) FIXME: The proc size depends upon a kernel only define Should resize the proctab properly not hard code a max size (or print as it reads) --- diff --git a/Applications/util/ps.c b/Applications/util/ps.c index 1b12ea2d..349bc256 100644 --- a/Applications/util/ps.c +++ b/Applications/util/ps.c @@ -1,6 +1,9 @@ -#include +#include #include -#include +#include +#include +#include +#include #define F_a 0x01 /* all users flag */ #define F_h 0x02 /* no header flag */ @@ -27,10 +30,9 @@ char *mapstat(char s) int do_ps(void) { - ptptr pp; int i, j, uid, pfd, ptsize; - int open(), ioctl(), read(), close(), getuid(); struct passwd *pwd; + struct p_tab *pp; struct p_tab ptab[PTABSIZE]; char name[10], uname[20]; @@ -50,8 +52,8 @@ int do_ps(void) if (ptsize > PTABSIZE) ptsize = PTABSIZE; for (i = 0; i < ptsize; ++i) { - if (read(pfd, &ptab[i], sizeof(struct p_tab)) != - sizeof(struct p_tab)) { + if (read(pfd, (char * ) &ptab[i], sizeof(struct p_tab)) != + sizeof(struct p_tab)) { fprintf(stderr, "ps: error reading from /dev/proc\n"); close(pfd); return 1;