Thread: [Wisp-cvs] wisp/src/builtin dictbase.wisp,1.243,1.244 modular.wisp,1.64,1.65 sys.wisp,1.113,1.114
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2002-09-13 16:35:36
|
Update of /cvsroot/wisp/wisp/src/builtin In directory usw-pr-cvs1:/tmp/cvs-serv10070/src/builtin Modified Files: dictbase.wisp modular.wisp sys.wisp Log Message: Dropped |sys:raw:read|, |sys:raw:write|, |sys:raw:open|, and |sys:raw:waitpid| in favour of the new corresponding low-level non-signalling procedures. Index: dictbase.wisp =================================================================== RCS file: /cvsroot/wisp/wisp/src/builtin/dictbase.wisp,v retrieving revision 1.243 retrieving revision 1.244 diff -u -d -r1.243 -r1.244 --- dictbase.wisp 11 Sep 2002 17:36:47 -0000 1.243 +++ dictbase.wisp 13 Sep 2002 16:35:32 -0000 1.244 @@ -103,7 +103,6 @@ (local e2f-set! (asm NN_e2f_set)) (local e2f-sref! (asm NN_e2f_sref)) (local encsi (asm NN_encsi)) -(local encui (asm NN_encui)) (local evmfunc? (asm NN_evmfunc_huh)) (local fit-for-symbol? (asm NN_fit_for_symbol_huh)) (local fixnum? (asm NN_fixnum_huh)) @@ -146,6 +145,7 @@ (local sys:getpid (asm NN_sys_getpid)) (local sys:getppid (asm NN_sys_getppid)) (local sys:getuid (asm NN_sys_getuid)) +(local sys:ns:waitpid (asm NN_sys_ns_waitpid)) (local sys:select (asm NN_sys_select)) (local sys:sync (asm NN_sys_sync)) (local truncate (asm NN_truncate)) Index: modular.wisp =================================================================== RCS file: /cvsroot/wisp/wisp/src/builtin/modular.wisp,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- modular.wisp 7 Sep 2002 21:51:14 -0000 1.64 +++ modular.wisp 13 Sep 2002 16:35:32 -0000 1.65 @@ -59,9 +59,9 @@ sys:getcwd sys:getegid sys:geteuid sys:getgid sys:getpgid sys:getpgrp sys:getpid sys:getppid sys:getuid sys:kill sys:link sys:listen sys:lseek sys:lstat sys:mkdir - sys:nanosleep sys:open sys:pipe sys:read sys:rename - sys:select sys:setpgid sys:setpgrp sys:setsid sys:stat - sys:symlink sys:sync sys:tcgetattr sys:tcsetattr + sys:nanosleep sys:ns:waitpid sys:open sys:pipe sys:read + sys:rename sys:select sys:setpgid sys:setpgrp sys:setsid + sys:stat sys:symlink sys:sync sys:tcgetattr sys:tcsetattr sys:truncate sys:unlink sys:waitpid sys:write)))))) (define modules ; a box containing an alist Index: sys.wisp =================================================================== RCS file: /cvsroot/wisp/wisp/src/builtin/sys.wisp,v retrieving revision 1.113 retrieving revision 1.114 diff -u -d -r1.113 -r1.114 --- sys.wisp 11 Sep 2002 17:36:47 -0000 1.113 +++ sys.wisp 13 Sep 2002 16:35:32 -0000 1.114 @@ -43,14 +43,18 @@ (lseek fd ofs whence) (lstat filename) (mkdir name mode) + (open name flags mode) (pipe) + (read fd buffer delta amount) (rename oldname newname) (setpgid pid pgid) (setsid) (stat filename) (symlink oldname newname) (truncate filename len) - (unlink name))))) + (unlink name) + (waitpid pid options) + (write fd buffer delta amount))))) (local (sys:getpgrp) (sys:getpgid 0)) @@ -84,65 +88,6 @@ (%wsv->0tv envp))) `(sys:execve ,filename ,argv ,envp))) -; options is an integer, bitwise-or'ed: -; 1=WNOHANG, 2=WUNTRACED (the way Linux defines them) -(local (sys:waitpid pid options) - (my status (cons '() '()) - (my res (encsi ((asm NN_sys_raw_waitpid) - (decsi pid) status (decui options))) - (cond - ((zero? res) ; WNOHANG and no child - '#f) - ((negative? res) - (signal-system-error res `(sys:waitpid ,pid ,options))) - (else - (set! status (encui (car status))) - (let ((exit (>> status 8)) - (term (modulo status 128)) - (core? (not (zero? (>> (modulo status 256) 7))))) - (my ret (if core? `(core) '()) - (set! ret - (cond - ((zero? term) - `(exit ,exit . ,ret)) - ((and (= term 127) (not core?)) - `(stop ,exit)) - (else - `(raise ,term . ,ret)))) - (cons res ret)))))))) - -(local (sys:read fd target delta amount) - (type string target) - (let ((d (decui delta)) - (c (decui amount)) - (l (asm target (l . 1)))) - (if (char<? l d) - (raise 'range delta)) - (if (char<? (asm (l . d) pt subat mta) c) - (raise 'range amount)) - (my res (encsi ((asm NN_sys_raw_read) - (decui fd) (asm (d . target) (l . 2) pt addat mta) c)) - (if (negative? res) - ; As a safety precaution, we don't want to let a potential - ; malicious signal handler get the buffer. - (signal-system-error res `(sys:read ,fd N/A ,delta ,amount) #t) - res)))) - -(local (sys:write fd target delta amount) - (type string target) - (let ((d (decui delta)) - (c (decui amount)) - (l (asm target (l . 1)))) - (if (char<? l d) - (raise 'range delta)) - (if (char<? (asm (l . d) pt subat mta) c) - (raise 'range amount)) - (my res (encsi ((asm NN_sys_raw_write) - (decui fd) (asm (d . target) (l . 2) pt addat mta) c)) - (if (negative? res) - (signal-system-error res `(sys:write ,fd N/A ,delta ,amount) #t) - res)))) - (local (sys:nanosleep req) (my res ((asm NN_sys_ns_nanosleep) (case req @@ -157,13 +102,6 @@ res (+ (car res) (/ (cdr res) 1000 1000 1000)))) (else (signal-system-error res `(sys:nanosleep ,req)))))) - -(define (sys:open name flags mode) - (my fd (encsi ((asm NN_sys_raw_open) (%ws->0t name) - (decui flags) (decui mode))) - (if (negative? fd) - (signal-system-error fd `(sys:open ,name ,flags ,mode)) - fd))) (local sys:for-dir-entries (asm NN_sys_for_dir_entries)) |