The Standard ML Basis Library


The Posix.SysDB structure


Synopsis

signature POSIX_SYS_DB
structure SysDB : POSIX_SYS_DB

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 1003.1,1996[CITE].


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
User identifier; identical to Posix.ProcEnv.uid.

eqtype gid
Group identifier; identical to Posix.ProcEnv.gid.

structure Passwd

type passwd
Information related to a user.

val name : passwd -> string
val uid : passwd -> uid
val gid : passwd -> gid
val home : passwd -> string
val shell : passwd -> string
These extract the name, the user ID, the group ID, the path of the initial working, or home, directory, and the initial command shell, respectively, of the user corresponding to the passwd value. The names of the corresponding fields in C are the same, but prefixed with "pw_". The one exception is that C uses pw_dir for the home directory.

structure Group

type group
Information related to a group.

val name : group -> string
val gid : group -> gid
val members : group -> string list
These extract the name, the group ID, and the names of users belonging to the group, respectively, of the group corresponding to the group value. In C, these fields are named gr_name, gr_gid, and gr_mem, respectively.

val getgrgid : gid -> Group.group
val getgrnam : string -> Group.group
val getpwuid : uid -> Passwd.passwd
val getpwnam : string -> Passwd.passwd
These return the group or user database entry associated with the given group ID or name, or user ID or name. It raises OS.SysErr if there is no group or user with the given ID or name.

See Also

Posix

[ Top | Parent | Contents | Index | Root ]

Generated October 02, 2003
Last Modified July 1, 2002
Comments to John Reppy.


This document may be distributed freely over the internet as long as the copyright notice and license terms below are prominently displayed within every machine-readable copy.

Copyright © 2003 AT&T and Lucent Technologies. All rights reserved.

Permission is granted for internet users to make one paper copy for their own personal use. Further hardcopy reproduction is strictly prohibited. Permission to distribute the HTML document electronically on any medium other than the internet must be requested from the copyright holders by contacting the editors. Printed versions of the SML Basis Manual are available from Cambridge University Press. To order, please visit www.cup.org (North America) or www.cup.cam.ac.uk (outside North America).