From 48bfee4e5b72db021da3538c97ef68ce2308f12b Mon Sep 17 00:00:00 2001 From: rsc Date: Tue, 4 Jan 2005 22:30:15 +0000 Subject: in with the new --- src/lib9/_p9proc-Linux.c | 5 -- src/lib9/_p9proc-getpid.c | 113 ---------------------------------------------- src/lib9/_p9proc.c | 113 ---------------------------------------------- src/lib9/execl.c | 29 ++++++++++++ 4 files changed, 29 insertions(+), 231 deletions(-) delete mode 100644 src/lib9/_p9proc-Linux.c delete mode 100644 src/lib9/_p9proc-getpid.c delete mode 100644 src/lib9/_p9proc.c create mode 100644 src/lib9/execl.c (limited to 'src') diff --git a/src/lib9/_p9proc-Linux.c b/src/lib9/_p9proc-Linux.c deleted file mode 100644 index 902a9579..00000000 --- a/src/lib9/_p9proc-Linux.c +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef __Linux26__ -#include "_p9proc-pthread.c" -#else -#include "_p9proc-getpid.c" -#endif diff --git a/src/lib9/_p9proc-getpid.c b/src/lib9/_p9proc-getpid.c deleted file mode 100644 index 9543bf24..00000000 --- a/src/lib9/_p9proc-getpid.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This needs to be callable from a signal handler, so it has been - * written to avoid locks. The only lock is the one used to acquire - * an entry in the table, and we make sure that acquiring is done - * when not in a handler. Lookup and delete do not need locks. - * It's a scan-forward hash table. To avoid breaking chains, - * T ((void*)-1) is used as a non-breaking nil. - */ - -#include -#include -#include "9proc.h" - -enum { PIDHASH = 1021 }; - -#define T ((void*)-1) -static Uproc *alluproc[PIDHASH]; -static int allupid[PIDHASH]; -static Lock uproclock; - -void -_clearuproc(void) -{ - int i; - - /* called right after fork - no locking needed */ - for(i=0; ipid = pid; - lock(&uproclock); - h = pid%PIDHASH; - for(i=0; i -#include -#include "9proc.h" - -enum { PIDHASH = 1021 }; - -#define T ((void*)-1) -static Uproc *alluproc[PIDHASH]; -static int allupid[PIDHASH]; -static Lock uproclock; - -void -_clearuproc(void) -{ - int i; - - /* called right after fork - no locking needed */ - for(i=0; ipid = pid; - lock(&uproclock); - h = pid%PIDHASH; - for(i=0; i +#include + +int +execl(char *prog, ...) +{ + int i; + va_list arg; + char **argv; + + va_start(arg, prog); + for(i=0; va_arg(arg, char*) != nil; i++) + ; + va_end(arg); + + argv = malloc((i+1)*sizeof(char*)); + if(argv == nil) + return -1; + + va_start(arg, prog); + for(i=0; (argv[i] = va_arg(arg, char*)) != nil; i++) + ; + va_end(arg); + + exec(prog, argv); + free(argv); + return -1; +} + -- cgit v1.2.3