diff --git a/basis/unix/groups/groups.factor b/basis/unix/groups/groups.factor index c3af9cc83d..b8edf7fa36 100644 --- a/basis/unix/groups/groups.factor +++ b/basis/unix/groups/groups.factor @@ -4,7 +4,7 @@ USING: alien alien.c-types alien.strings io.encodings.utf8 io.unix.backend kernel math sequences splitting unix strings combinators.short-circuit byte-arrays combinators qualified accessors math.parser fry assocs namespaces continuations -unix.users ; +unix.users unix.utilities ; IN: unix.groups QUALIFIED: grouping @@ -18,12 +18,7 @@ GENERIC: group-struct ( obj -- group ) string - [ alien-address "char**" heap-size + ] dip - ] [ ] produce nip ; + group-gr_mem utf8 alien>strings ; : (group-struct) ( id -- group-struct id group-struct byte-array length void* ) "group" tuck 4096 diff --git a/basis/unix/process/process.factor b/basis/unix/process/process.factor index 7d3d757705..030f0977e2 100644 --- a/basis/unix/process/process.factor +++ b/basis/unix/process/process.factor @@ -1,6 +1,6 @@ USING: kernel alien.c-types alien.strings sequences math alien.syntax unix - vectors kernel namespaces continuations threads assocs vectors - io.unix.backend io.encodings.utf8 ; +vectors kernel namespaces continuations threads assocs vectors +io.unix.backend io.encodings.utf8 unix.utilities ; IN: unix.process ! Low-level Unix process launching utilities. These are used @@ -15,17 +15,16 @@ FUNCTION: int execv ( char* path, char** argv ) ; FUNCTION: int execvp ( char* path, char** argv ) ; FUNCTION: int execve ( char* path, char** argv, char** envp ) ; -: >argv ( seq -- alien ) - [ utf8 malloc-string ] map f suffix >c-void*-array ; - : exec ( pathname argv -- int ) - [ utf8 malloc-string ] [ >argv ] bi* execv ; + [ utf8 malloc-string ] [ utf8 strings>alien ] bi* execv ; : exec-with-path ( filename argv -- int ) - [ utf8 malloc-string ] [ >argv ] bi* execvp ; + [ utf8 malloc-string ] [ utf8 strings>alien ] bi* execvp ; : exec-with-env ( filename argv envp -- int ) - [ utf8 malloc-string ] [ >argv ] [ >argv ] tri* execve ; + [ utf8 malloc-string ] + [ utf8 strings>alien ] + [ utf8 strings>alien ] tri* execve ; : exec-args ( seq -- int ) [ first ] [ ] bi exec ; @@ -99,4 +98,4 @@ FUNCTION: pid_t wait ( int* status ) ; FUNCTION: pid_t waitpid ( pid_t wpid, int* status, int options ) ; : wait-for-pid ( pid -- status ) - 0 [ 0 waitpid drop ] keep *int WEXITSTATUS ; \ No newline at end of file + 0 [ 0 waitpid drop ] keep *int WEXITSTATUS ; diff --git a/basis/unix/unix.factor b/basis/unix/unix.factor index 960115d1a6..0963856ea6 100644 --- a/basis/unix/unix.factor +++ b/basis/unix/unix.factor @@ -105,6 +105,8 @@ FUNCTION: int getdtablesize ; FUNCTION: gid_t getegid ; FUNCTION: uid_t geteuid ; FUNCTION: gid_t getgid ; +FUNCTION: char* getenv ( char* name ) ; + FUNCTION: int getgrgid_r ( gid_t gid, group* grp, char* buffer, size_t bufsize, group** result ) ; FUNCTION: int getgrnam_r ( char* name, group* grp, char* buffer, size_t bufsize, group** result ) ; FUNCTION: passwd* getpwent ( ) ; @@ -171,6 +173,8 @@ FUNCTION: int rename ( char* from, char* to ) ; FUNCTION: int rmdir ( char* path ) ; FUNCTION: int select ( int nfds, void* readfds, void* writefds, void* exceptfds, timeval* timeout ) ; FUNCTION: ssize_t sendto ( int s, void* buf, size_t len, int flags, sockaddr-in* to, socklen_t tolen ) ; +FUNCTION: int setenv ( char* name, char* value, int overwrite ) ; +FUNCTION: int unsetenv ( char* name ) ; FUNCTION: int setegid ( gid_t egid ) ; FUNCTION: int seteuid ( uid_t euid ) ; FUNCTION: int setgid ( gid_t gid ) ;