tsuccess on the sun - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 005a85f3a2ef85ec1a64ce05a486c84e25cf6f94
 (DIR) parent c345061e8d81a737b2926da7ecad4b4389677fe8
 (HTM) Author: rsc <devnull@localhost>
       Date:   Fri,  7 Jan 2005 08:02:54 +0000
       
       success on the sun
       
       Diffstat:
         M src/cmd/rc/unixcrap.c               |      16 ++++++++++++++++
         M src/lib9/await.c                    |       6 +++++-
         M src/lib9/post9p.c                   |       3 +++
       
       3 files changed, 24 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/src/cmd/rc/unixcrap.c b/src/cmd/rc/unixcrap.c
       t@@ -17,13 +17,29 @@ static int rlx[] = {
                RLIMIT_CORE,
                RLIMIT_DATA,
                RLIMIT_FSIZE,
       +#ifdef RLIMIT_MEMLOCK
                RLIMIT_MEMLOCK,
       +#else
       +        0,
       +#endif
       +#ifdef RLIMIT_RSS
                RLIMIT_RSS,
       +#else
       +        0,
       +#endif
                RLIMIT_NOFILE,
                RLIMIT_STACK,
                RLIMIT_CPU,
       +#ifdef RLIMIT_NPROC
                RLIMIT_NPROC,
       +#else
       +        0,
       +#endif
       +#ifdef RLIMIT_RSS
                RLIMIT_RSS,
       +#else
       +        0,
       +#endif
        };
        
        static void
 (DIR) diff --git a/src/lib9/await.c b/src/lib9/await.c
       t@@ -82,7 +82,11 @@ _await(int pid4, char *str, int n, int opt)
                ulong u, s;
        
                for(;;){
       -                pid = wait4(pid4, &status, opt, &ru);
       +                /* On Linux, pid==-1 means anyone; on SunOS, it's pid==0. */
       +                if(pid4 == -1)
       +                        pid = wait3(&status, opt, &ru);
       +                else
       +                        pid = wait4(pid4, &status, opt, &ru);
                        if(pid <= 0)
                                return -1;
                        u = ru.ru_utime.tv_sec*1000+((ru.ru_utime.tv_usec+500)/1000);
 (DIR) diff --git a/src/lib9/post9p.c b/src/lib9/post9p.c
       t@@ -10,6 +10,7 @@ post9pservice(int fd, char *name)
        
                if((ns = getns()) == nil)
                        return -1;
       +
                s = smprint("unix!%s/%s", ns, name);
                free(ns);
                if(s == nil)
       t@@ -27,6 +28,8 @@ post9pservice(int fd, char *name)
                        _exits("exec");
                default:
                        w = wait();
       +                if(w == nil)
       +                        return -1;
                        close(fd);
                        free(s);
                        if(w->msg && w->msg[0]){