Next: , Previous: , Up: posix   [Index]


4.16 Users and groups

Function: getuid

Interface to the C function getuid(), (libc)getuid. Return a fixnum representing the real user ID of the process.

Function: getgid

Interface to the C function getgid(), (libc)getgid. Return a fixnum representing the real group ID of the process.

Function: geteuid

Interface to the C function geteuid(), (libc)geteuid. Return a fixnum representing the effective user ID of the process.

Function: getegid

Interface to the C function getegid(), (libc)getegid. Return a fixnum representing the effective group ID of the process.

Function: getgroups

Interface to the C function getgroups(), (libc)getgroups. Return a list of fixnums representing the supplementary group IDs of the process; if an error occurs an exception is raised.

Function: seteuid new-uid

Interface to the C function seteuid(), (libc)seteuid. Set the effective user ID to new-uid, which must be a fixnum. If successful return unspecified values, else raise an exception.

Function: setuid new-uid

Interface to the C function setuid(), (libc)setuid. Set both the real and effective user IDs to new-uid, which must be a fixnum. If successful return unspecified values, else raise an exception.

Function: setreuid real-uid effective-uid

Interface to the C function setreuid(), (libc)setreuid. Set the real user ID to real_uid and the effective user ID to effective_uid, both the arguments must be fixnums. If successful return unspecified values, else raise an exception.

Function: setegid new-gid

Interface to the C function setegid(), (libc)setegid. Set the effective group ID to new-gid, which must be a fixnum. If successful return unspecified values, else raise an exception.

Function: setgid new-gid

Interface to the C function setgid(), (libc)setgid. Set both the real and effective group IDs to new-gid, which must be a fixnum. If successful return unspecified values, else raise an exception.

Function: setregid real-gid effective-gid

Interface to the C function setregid(), (libc)setregid. Set the real group ID to real_gid and the effective group ID to effective_gid, both the arguments must be fixnums. If successful return unspecified values, else raise an exception.

Function: getlogin
Function: getlogin/string

Interface to the C function getlogin(), (libc)getlogin. getlogin returns a bytevector holding the ASCII coding of the name of the user logged in on the controlling terminal of the process; getlogin/string returns a string; if the name cannot be determined: return false.

Structure Type: struct-passwd

Scheme level representation of struct passwd. It has the following fields:

pw_name

Bytevector, user login name.

pw_passwd

Bytevector, encrypted password.

pw_uid

Fixnum, user ID.

pw_gid

Fixnum, group ID.

pw_gecos

Bytevector, user data.

pw_dir

Bytevector, user’s home directory.

pw_shell

Bytevector, user’s default shell.

Function: make-struct-passwd name passwd uid gid gecos dir shell

Build and return a new instance of struct-passwd.

Function: struct-passwd? obj

Return #t if obj is an instance of struct-passwd.

Function: struct-passwd-pw_name passwd
Function: struct-passwd-pw_passwd passwd
Function: struct-passwd-pw_uid passwd
Function: struct-passwd-pw_gid passwd
Function: struct-passwd-pw_gecos passwd
Function: struct-passwd-pw_dir passwd
Function: struct-passwd-pw_shell passwd

Accessors for the fields of struct-passwd.

Function: getpwuid uid

Interface to the C function getpwuid(), (libc)getpwuid. Retrieve informations on the user with identifier uid, which must be a fixnum. If successful return an instance of struct-passwd; if a user with such an ID does not exists: return false.

Function: getpwnam name

Interface to the C function getpwnam(), (libc)getpwnam. Retrieve informations on the user with name represented in ASCII coding in the string or bytevector name. If successful return an instance of struct-passwd; if a user with such an ID does not exists: return false.

Function: user-entries

Interface to the C functions setpwent(), getpwent() and endpwent(), (libc)setpwent. Iterate the database of users and return a list of struct-passwd representing the entries.

Structure Type: struct-group

Scheme level representation of struct group. It has the following fields:

gr_name

Bytevector, group name.

gr_gid

Fixnum, group ID.

gr_mem

List of bytevectors, user names.

Function: make-struct-group name gid mem

Build and return a new instance of struct-group.

Function: struct-group-gr_name group
Function: struct-group-gr_gid group
Function: struct-group-gr_mem group

Accessors for the fields of struct-group.

Function: getgrgid gid

Interface to the C function getgrgid(), (libc)getgrgid. Retrieve informations on the group with identifier gid, which must be a fixnum. If successful return an instance of struct-group; if a group with such an ID does not exists: return false.

Function: getgrnam name

Interface to the C function getgrnam(), (libc)getgrnam. Retrieve informations on the group with name represented in ASCII coding in the string or bytevector name. If successful return an instance of struct-group; if a group with such an ID does not exists: return false.

Function: group-entries

Interface to the C functions setgrent(), getgrent() and endgrent(), (libc)setgrent. Iterate the database of groups and return a list of struct-group representing the entries.


Next: , Previous: , Up: posix   [Index]