The Standard ML Basis Library


The Posix.SysDB structure

The Posix.SysDB structure implements operations on the user database and the group database (in POSIX parlance, the password file and the group file). These are the data and operations described in Section 9 of the POSIX standard [CITE]1003.1,1996/.


Synopsis

signature POSIX_SYS_DB
structure SysDB : POSIX_SYS_DB

Interface

eqtype uid
eqtype gid
structure Passwd : sig
    type passwd
    val name : passwd -> string
    val uid : passwd -> uid
    val gid : passwd -> gid
    val home : passwd -> string
    val shell : passwd -> string
  end
structure Group : sig
    type group
    val name : group -> string
    val gid : group -> gid
    val members : group -> string list
  end
val getgrgid : gid -> Group.group
val getgrnam : string -> Group.group
val getpwuid : uid -> Passwd.passwd
val getpwnam : string -> Passwd.passwd

Description

eqtype uid

eqtype gid

structure Passwd

type passwd

name pa
extracts the user name from the user database entry pa (in POSIX terminology, the pw_name field).

uid pa
extracts the user id from the user database entry pa (in POSIX terminology, the pw_uid field).

gid pa
extracts the group id from the user database entry pa (in POSIX terminology, the pw_gid field).

home pa
extracts the path of the initial working directory from the user database entry pa (in POSIX terminology, the pw_dir field).

shell pa
extracts the path of the initial shell from the user database entry pa (in POSIX terminology, the pw_shell field).

structure Group

type group

name gr
extracts the group name from the group database entry gr (in POSIX terminology, the gr_name field).

gid gr
extracts the group id from the group database entry gr (in POSIX terminology, the gr_gid field).

members gr
extracts the list of group members (user names) from the group database entry gr (in POSIX terminology, the gr_mem field).

getgrgid gid
getgrnam s
getpwuid uid
getpwnam s
return the group or user database entry associated with the given group or user id, or group or user name. Raises OS.SysErr if there is no group or user with the given id or name.


See Also

Posix

[ INDEX | TOP | Parent | Root ]

Last Modified April 11, 1996
Comments to John Reppy.
Copyright © 1997 Bell Labs, Lucent Technologies