diff --git a/mach/minix/libsys/brk.c b/mach/minix/libsys/brk.c index dac238afe..f6a037728 100644 --- a/mach/minix/libsys/brk.c +++ b/mach/minix/libsys/brk.c @@ -21,11 +21,11 @@ PUBLIC char *sbrk(incr) int incr; { char *newsize, *oldsize; - extern int endv, dorgv; oldsize = brksize; newsize = brksize + incr; - if (incr > 0 && newsize < oldsize) return( (char *) -1); + if (incr > 0 && newsize < oldsize || incr < 0 && newsize > oldsize) + return( (char *) -1); if (brk(newsize) == 0) return(oldsize); else diff --git a/mach/minix/libsys/exec.c b/mach/minix/libsys/exec.c index 26189e1dc..cb2be5520 100644 --- a/mach/minix/libsys/exec.c +++ b/mach/minix/libsys/exec.c @@ -1,6 +1,6 @@ #include "lib.h" -char *nullptr[1]; /* the EXEC calls need a zero pointer */ +extern char **environ; /* environment pointer */ #define PTRSIZE sizeof(char *) @@ -8,7 +8,7 @@ PUBLIC int execl(name, arg0) char *name; char *arg0; { - return execve(name, &arg0, nullptr); + return execve(name, &arg0, environ); } PUBLIC int execle(name, argv) @@ -23,7 +23,7 @@ char *name, *argv; PUBLIC int execv(name, argv) char *name, *argv[]; { - return execve(name, argv, nullptr); + return execve(name, argv, environ); } diff --git a/mach/minix/libsys/ioctl.c b/mach/minix/libsys/ioctl.c index a46a733eb..fbd0658f4 100644 --- a/mach/minix/libsys/ioctl.c +++ b/mach/minix/libsys/ioctl.c @@ -11,28 +11,29 @@ union { } u; { - int n; - long erase, kill, intr, quit, xon, xoff, eof, brk; + int n, ispeed, ospeed; + long erase, kill, intr, quit, xon, xoff, eof, brk, speed; M.TTY_REQUEST = request; M.TTY_LINE = fd; switch(request) { case TIOCSETP: - erase = u.argp->sg_erase & 0377; - kill = u.argp->sg_kill & 0377; + erase = u.argp->sg_erase & BYTE; + kill = u.argp->sg_kill & BYTE; M.TTY_SPEK = (erase << 8) | kill; M.TTY_FLAGS = u.argp->sg_flags; + M.TTY_SPEED = (u.argp->sg_ospeed << 8) | u.argp->sg_ispeed; n = callx(FS, IOCTL); return(n); case TIOCSETC: - intr = u.argt->t_intrc & 0377; - quit = u.argt->t_quitc & 0377; - xon = u.argt->t_startc & 0377; - xoff = u.argt->t_stopc & 0377; - eof = u.argt->t_eofc & 0377; - brk = u.argt->t_brkc & 0377; /* not used at the moment */ + intr = u.argt->t_intrc & BYTE; + quit = u.argt->t_quitc & BYTE; + xon = u.argt->t_startc & BYTE; + xoff = u.argt->t_stopc & BYTE; + eof = u.argt->t_eofc & BYTE; + brk = u.argt->t_brkc & BYTE; /* not used at the moment */ M.TTY_SPEK = (intr<<24) | (quit<<16) | (xon<<8) | (xoff<<0); M.TTY_FLAGS = (eof<<8) | (brk<<0); n = callx(FS, IOCTL); @@ -40,19 +41,22 @@ union { case TIOCGETP: n = callx(FS, IOCTL); - u.argp->sg_erase = (M.TTY_SPEK >> 8) & 0377; - u.argp->sg_kill = (M.TTY_SPEK >> 0) & 0377; - u.argp->sg_flags = M.TTY_FLAGS; + u.argp->sg_erase = (M.TTY_SPEK >> 8) & BYTE; + u.argp->sg_kill = (M.TTY_SPEK >> 0) & BYTE; + u.argp->sg_flags = M.TTY_FLAGS & 0xFFFF; + speed = (M.TTY_FLAGS >> 16) & 0xFFFFL; + u.argp->sg_ispeed = speed & BYTE; + u.argp->sg_ospeed = (speed >> 8) & BYTE; return(n); case TIOCGETC: n = callx(FS, IOCTL); - u.argt->t_intrc = (M.TTY_SPEK >> 24) & 0377; - u.argt->t_quitc = (M.TTY_SPEK >> 16) & 0377; - u.argt->t_startc = (M.TTY_SPEK >> 8) & 0377; - u.argt->t_stopc = (M.TTY_SPEK >> 0) & 0377; - u.argt->t_eofc = (M.TTY_FLAGS >> 8) & 0377; - u.argt->t_brkc = (M.TTY_FLAGS >> 8) & 0377; + u.argt->t_intrc = (M.TTY_SPEK >> 24) & BYTE; + u.argt->t_quitc = (M.TTY_SPEK >> 16) & BYTE; + u.argt->t_startc = (M.TTY_SPEK >> 8) & BYTE; + u.argt->t_stopc = (M.TTY_SPEK >> 0) & BYTE; + u.argt->t_eofc = (M.TTY_FLAGS >> 8) & BYTE; + u.argt->t_brkc = (M.TTY_FLAGS >> 8) & BYTE; return(n); default: diff --git a/mach/minix/libsys/syslib.c b/mach/minix/libsys/syslib.c index fd696bc0a..182b296ee 100644 --- a/mach/minix/libsys/syslib.c +++ b/mach/minix/libsys/syslib.c @@ -150,6 +150,18 @@ phys_clicks *basep, *sizep; /* base and size for free_mem() */ #endif +PUBLIC sys_kill(proc, sig) +int proc; /* which proc has exited */ +int sig; /* signal number: 1 - 16 */ +{ +/* A proc has to be signaled via MM. Tell the kernel. */ + + M.m6_i1 = proc; + M.m6_i2 = sig; + callx(SYSTASK, SYS_KILL); +} + + PUBLIC int tell_fs(what, p1, p2, p3) int what, p1, p2, p3; { diff --git a/mach/minix/libsys/wait.c b/mach/minix/libsys/wait.c index c1472a093..2d8728fd2 100644 --- a/mach/minix/libsys/wait.c +++ b/mach/minix/libsys/wait.c @@ -5,6 +5,6 @@ int *status; { int k; k = callm1(MM, WAIT, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR); - if (status != 0) *status = M.m2_i1; + if (k >= 0 && status != 0) *status = M.m2_i1; return(k); } diff --git a/mach/minixST/libsys/brk.c b/mach/minixST/libsys/brk.c index dac238afe..f6a037728 100644 --- a/mach/minixST/libsys/brk.c +++ b/mach/minixST/libsys/brk.c @@ -21,11 +21,11 @@ PUBLIC char *sbrk(incr) int incr; { char *newsize, *oldsize; - extern int endv, dorgv; oldsize = brksize; newsize = brksize + incr; - if (incr > 0 && newsize < oldsize) return( (char *) -1); + if (incr > 0 && newsize < oldsize || incr < 0 && newsize > oldsize) + return( (char *) -1); if (brk(newsize) == 0) return(oldsize); else diff --git a/mach/minixST/libsys/exec.c b/mach/minixST/libsys/exec.c index 26189e1dc..cb2be5520 100644 --- a/mach/minixST/libsys/exec.c +++ b/mach/minixST/libsys/exec.c @@ -1,6 +1,6 @@ #include "lib.h" -char *nullptr[1]; /* the EXEC calls need a zero pointer */ +extern char **environ; /* environment pointer */ #define PTRSIZE sizeof(char *) @@ -8,7 +8,7 @@ PUBLIC int execl(name, arg0) char *name; char *arg0; { - return execve(name, &arg0, nullptr); + return execve(name, &arg0, environ); } PUBLIC int execle(name, argv) @@ -23,7 +23,7 @@ char *name, *argv; PUBLIC int execv(name, argv) char *name, *argv[]; { - return execve(name, argv, nullptr); + return execve(name, argv, environ); } diff --git a/mach/minixST/libsys/ioctl.c b/mach/minixST/libsys/ioctl.c index a46a733eb..fbd0658f4 100644 --- a/mach/minixST/libsys/ioctl.c +++ b/mach/minixST/libsys/ioctl.c @@ -11,28 +11,29 @@ union { } u; { - int n; - long erase, kill, intr, quit, xon, xoff, eof, brk; + int n, ispeed, ospeed; + long erase, kill, intr, quit, xon, xoff, eof, brk, speed; M.TTY_REQUEST = request; M.TTY_LINE = fd; switch(request) { case TIOCSETP: - erase = u.argp->sg_erase & 0377; - kill = u.argp->sg_kill & 0377; + erase = u.argp->sg_erase & BYTE; + kill = u.argp->sg_kill & BYTE; M.TTY_SPEK = (erase << 8) | kill; M.TTY_FLAGS = u.argp->sg_flags; + M.TTY_SPEED = (u.argp->sg_ospeed << 8) | u.argp->sg_ispeed; n = callx(FS, IOCTL); return(n); case TIOCSETC: - intr = u.argt->t_intrc & 0377; - quit = u.argt->t_quitc & 0377; - xon = u.argt->t_startc & 0377; - xoff = u.argt->t_stopc & 0377; - eof = u.argt->t_eofc & 0377; - brk = u.argt->t_brkc & 0377; /* not used at the moment */ + intr = u.argt->t_intrc & BYTE; + quit = u.argt->t_quitc & BYTE; + xon = u.argt->t_startc & BYTE; + xoff = u.argt->t_stopc & BYTE; + eof = u.argt->t_eofc & BYTE; + brk = u.argt->t_brkc & BYTE; /* not used at the moment */ M.TTY_SPEK = (intr<<24) | (quit<<16) | (xon<<8) | (xoff<<0); M.TTY_FLAGS = (eof<<8) | (brk<<0); n = callx(FS, IOCTL); @@ -40,19 +41,22 @@ union { case TIOCGETP: n = callx(FS, IOCTL); - u.argp->sg_erase = (M.TTY_SPEK >> 8) & 0377; - u.argp->sg_kill = (M.TTY_SPEK >> 0) & 0377; - u.argp->sg_flags = M.TTY_FLAGS; + u.argp->sg_erase = (M.TTY_SPEK >> 8) & BYTE; + u.argp->sg_kill = (M.TTY_SPEK >> 0) & BYTE; + u.argp->sg_flags = M.TTY_FLAGS & 0xFFFF; + speed = (M.TTY_FLAGS >> 16) & 0xFFFFL; + u.argp->sg_ispeed = speed & BYTE; + u.argp->sg_ospeed = (speed >> 8) & BYTE; return(n); case TIOCGETC: n = callx(FS, IOCTL); - u.argt->t_intrc = (M.TTY_SPEK >> 24) & 0377; - u.argt->t_quitc = (M.TTY_SPEK >> 16) & 0377; - u.argt->t_startc = (M.TTY_SPEK >> 8) & 0377; - u.argt->t_stopc = (M.TTY_SPEK >> 0) & 0377; - u.argt->t_eofc = (M.TTY_FLAGS >> 8) & 0377; - u.argt->t_brkc = (M.TTY_FLAGS >> 8) & 0377; + u.argt->t_intrc = (M.TTY_SPEK >> 24) & BYTE; + u.argt->t_quitc = (M.TTY_SPEK >> 16) & BYTE; + u.argt->t_startc = (M.TTY_SPEK >> 8) & BYTE; + u.argt->t_stopc = (M.TTY_SPEK >> 0) & BYTE; + u.argt->t_eofc = (M.TTY_FLAGS >> 8) & BYTE; + u.argt->t_brkc = (M.TTY_FLAGS >> 8) & BYTE; return(n); default: diff --git a/mach/minixST/libsys/syslib.c b/mach/minixST/libsys/syslib.c index fd696bc0a..182b296ee 100644 --- a/mach/minixST/libsys/syslib.c +++ b/mach/minixST/libsys/syslib.c @@ -150,6 +150,18 @@ phys_clicks *basep, *sizep; /* base and size for free_mem() */ #endif +PUBLIC sys_kill(proc, sig) +int proc; /* which proc has exited */ +int sig; /* signal number: 1 - 16 */ +{ +/* A proc has to be signaled via MM. Tell the kernel. */ + + M.m6_i1 = proc; + M.m6_i2 = sig; + callx(SYSTASK, SYS_KILL); +} + + PUBLIC int tell_fs(what, p1, p2, p3) int what, p1, p2, p3; { diff --git a/mach/minixST/libsys/wait.c b/mach/minixST/libsys/wait.c index c1472a093..2d8728fd2 100644 --- a/mach/minixST/libsys/wait.c +++ b/mach/minixST/libsys/wait.c @@ -5,6 +5,6 @@ int *status; { int k; k = callm1(MM, WAIT, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR); - if (status != 0) *status = M.m2_i1; + if (k >= 0 && status != 0) *status = M.m2_i1; return(k); }