TOC »
Module (chicken process-context posix)
This module provides access to POSIX-specific procedures which deal with the current process context.
- New in CHICKEN 5.4.0: Errors caused by underlying C calls that change errno will produce a condition object with an errno property, which can be accessed with (get-condition-property <the-condition-object> 'exn 'errno).
Process filesystem context
change-directory*
- change-directory* FDprocedure
- (set! (current-directory) FD)procedure
Changes the current working directory to the one represented by the file-descriptor FD, which should be an exact integer.
NOTE: Windows does not allow {open} on directories, so while technically it is supported, in practice you cannot use this procedure on native Windows builds (on cygwin it works because cygwin emulates this).
set-root-directory!
- set-root-directory! STRINGprocedure
Sets the root directory for the current process to the path given in STRING (using the chroot function). If the current process has no root permissions, the operation will fail.
NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.
Retrieving user & group information
current-user-id
- current-user-idprocedure
- (set! (current-user-id) UID)setter
Get or set the real user-id of the current process. The procedure corresponds to the getuid and setuid C functions.
NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.
current-user-name
- current-user-nameprocedure
Get the login name corresponding to the real user-id of the current process from the system password database.
On Windows, there's no user-id and no distinction between real and effective user, but this procedure will return the username associated with the current process, so it is safe to use.
current-effective-user-id
- current-effective-user-idprocedure
- (set! (current-effective-user-id) UID)setter
Get or set the effective user-id of the current process.
NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.
current-effective-user-name
- current-effective-user-nameprocedure
Get the login name corresponding to the effective user-id of the current process from the system password database.
NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.
current-group-id
- current-group-idprocedure
- (set! (current-group-id) GID)setter
Get or set the real group-id of the current process.
NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.
current-effective-group-id
- current-effective-group-idprocedure
- (set! (current-effective-group-id) GID)setter
Get or set the effective group-id of the current process. ID can be found, then #f is returned.
NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.
Process identity
current-process-id
- current-process-idprocedure
Returns the process ID of the current process.
parent-process-id
- parent-process-idprocedure
Returns the process ID of the parent of the current process.
NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.
process-group-id
- process-group-id PIDprocedure
- set! (process-group-id PID) PGIDsetter
Get or set the process group ID of the process specified by PID.
NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.
create-session
- create-sessionprocedure
Creates a new session with the current process as group leader. Returns current process id on success. Equivalent to setsid(2).
user-information
- user-information USER #!optional AS-VECTORprocedure
If USER specifes a valid username (as a string) or user ID, then the user database is consulted and a list of 7 values are returned: the user-name, the encrypted password, the user ID, the group ID, a user-specific string, the home directory and the default shell. When AS-VECTOR is #t a vector of 7 elements is returned instead of a list. If no user with this name or id then #f is returned.
Note: on Android systems, the user-specific string is always "", since pw_gecos is not available in the C passwd struct on that platform.
NOTE: On native Windows builds (all except cygwin), this procedure is unimplemented and will raise an error.
Previous: Module (chicken process-context)
Next: Module (chicken random)