Common functions


A couple of common functions are used in all routines. They are defined in the ipc.h header file.

  • ipcaccess () ” Checks access permissions for all types of ipc requests . (The SunOS 4.x version uses the current user structure to identify the user and group information).

  • ipcget() ” Looks for a matching key and passes back a pointer to the appropriate entry. A structure will be allocated if requested (by the flags) and the key does not exist. The function returns an error status. In Solaris 2, the error code is returned or a zero for success. In SunOS 4.x, a pointer to an ipc_perm structure is returned on success, and a zero (null pointer) is returned on error, with the appropriate error code set in the user struct.

For each of these facilities, a header structure is maintained for each item allocated. This identifies the allowed operations with a permissions structure and provides parameters indicating the size, number of semaphores, or pending messages. These structures are all allocated from a pool, an array of structures whose size is determined by the tunable parameters. The identifier value returned to the user is used to produce an index into this array by taking this ID modulo the number of structures. This allows you to identify the appropriate header structure, given the ID number. This is distinct from the key , which contains a unique identifying code to be used by a process or group of processes to keep their data straight. This value is passed in when creating or locating some IPC facility; the ID value is like a file descriptor, which the user program uses to find the appropriate structures quickly.



PANIC. UNIX System Crash Dump Analysis Handbook
PANIC! UNIX System Crash Dump Analysis Handbook (Bk/CD-ROM)
ISBN: 0131493868
EAN: 2147483647
Year: 1994
Pages: 289
Authors: Chris Drake

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net