[an error occurred while processing this directive]
HP OpenVMS Systems Documentation |
HP C
|
Previous | Contents | Index |
Gets the process group ID of the calling process.
#include <unistd.h>pid_t getpgrp (void);
The getpgrp function returns the process group ID of the calling process.The getpgrp function is always successful, and no return value is reserved to indicate an error.
x The process group ID of the calling process.
Returns the process ID of the current process.
#include <unistd.h>pid_t getpid (void);
x The process ID of the current process.
Returns the parent process ID of the calling process.
#include <unistd.h>pid_t getppid (void);
x The parent process ID. 0 Indicates that the calling process does not have a parent process.
Accesses user entry information in the user database, returning a pointer to a passwd structure.
#include <pwd.h>Function Variants The getpwent function has variants named __32_getpwent and __64_getpwent for use with 32-bit and 64-bit pointer sizes, respectively. See Section 1.10 for more information on using pointer-size-specific functions.struct passwd *getpwent (void);
The getpwent function returns a pointer to a structure containing fields whose values are derived from an entry in the user database. Entries in the database are accessed sequentially by getpwent . When first called, getpwent returns a pointer to a passwd structure containing the first entry in the user database. Thereafter, it returns a pointer to a passwd structure containing the next entry in the user database. Successive calls can be used to search the entire user database.The passwd structure is defined in the <pwd.h> header file as follows:
pw_name The name of the user. pw_uid The ID of the user. pw_gid The group ID of the principle group of the user. pw_dir The home directory of the user. pw_shell The initial program for the user. If an end-of-file or an error is encountered on reading, getpwent returns a NULL pointer.
Because getpwent accesses the user authorization file (SYSUAF) directly, the process must have appropriate privileges enabled or the function will fail.
Notes
All information generated by the getpwent function is stored in a per-thread static area and is overwritten on subsequent calls to the function.
Password file entries that are too long are ignored.
x Pointer to a passwd structure, if successful. NULL Indicates an end-of-file or error occurred. The function sets errno to one of the following values:
- EIO -- Indicates that an I/O error occurred or the user does not have appropriate privileges enabled to access the user authorization file (SYSUAF).
- EMFILE -- OPEN_MAX file descriptors are currently open in the calling process.
- ENFILE -- The maximum allowable number of files is currently open in the system.
The getpwnam function returns information about a user database entry for the specified name.The getpwnam_r function is a reentrant version of getpwnam .
#include <pwd.h>Function Variants The getpwnam and getpwnam_r functions have variants named __32_getpwnam , _getpwnam_r32 and __64_getpwnam , _getpwnam_r64 for use with 32-bit and 64-bit pointer sizes, respectively. See Section 1.10 for more information on using pointer-size-specific functions.struct passwd *getpwnam (const char *name); (ISO POSIX-1)
struct passwd *getpwnam (const char *name, ...); (HP C EXTENSION)
int getpwnam_r (const char *name, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result); (ISO POSIX-1), (ALPHA ONLY)
int getpwnam_r (const char *name, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result, ...); (HP C EXTENSION), (ALPHA ONLY)
name
The name of the user for which the attributes are to be read.pwd
The address of a passwd structure into which the function writes its results.buffer
A working buffer for the result argument that is able to hold the largest entry in the passwd structure. Storage referenced by the passwd structure is allocated from the memory provided with the buffer argument, which is bufsize characters in length.bufsize
The length of the character array that buffer points to.result
Upon successful return, is set to pwd. Upon unsuccessful return, the result is set to NULL....
An optional argument that can be either 1 or 0. If you specify 1, the directory specification is returned in OpenVMS format. If you specify 0, the directory specification (pathname) is returned in UNIX style format. If you omit this argument, the function returns the directory specification according to your current command-language interpreter. For more information about UNIX style directory specifications, see Section 1.4.3.
The getpwnam function searches the user database for an entry with the specified name. The function returns the first user entry in the database with the pw_name member of the passwd structure that matches the name argument.The passwd structure is defined in the <pwd.h> header file as follows:
pw_name The user's login name. pw_uid The numerical user ID. pw_gid The numerical group ID. pw_dir The home directory of the user. pw_shell The initial program for the user.
Note
All information generated by the getpwnam function is stored in a per-thread static area and is overwritten on subsequent calls to the function.The getpwnam_r function is the reentrant version of getpwnam . The getpwnam_r function updates the passwd structure pointed to by pwd and stores a pointer to that structure at the location pointed to by result. The structure will contain an entry from the user database that matches the specified name. Storage referenced by the structure is allocated from the memory provided with the buffer argument, which is bufsize characters in length. The maximum size needed for this buffer can be determined with the _SC_GETPW_R_SIZE_MAX parameter of the sysconf function. On error or if the requested entry is not found, a NULL pointer is returned at the location pointed to by result.
Applications wishing to check for error situations should set errno to 0 before calling getpwnam . If getpwnam returns a NULL pointer and errno is nonzero, an error occurred.
x getpwnam returns a pointer to a valid passwd structure, if a matching entry is found. NULL getpwnam returns NULL if an error occurred or a the specified entry was not found. errno is set to indicate the error. The getpwnam function may fail if:
- EIO -- An I/O error has occurred.
- EINTR -- A signal was caught during getpwnam .
- EMFILE -- OPEN_MAX file descriptors are currently open in the calling process.
- ENFILE -- The maximum allowable number of files is currently open in the system.
0 When successful, getpwnam_r returns 0 and stores a pointer to the updated passwd structure at the location pointed to by result. 0 When unsuccessful (on error or if the requested entry is not found), getpwnam_r returns 0 and stores a NULL pointer at the location pointed to by result. The getpwnam_r function may fail if:
- ERANGE -- Insufficient storage was supplied through buffer and bufsize to contain the data to be referenced by the resulting passwd structure.
The getpwuid function returns information about a user database entry for the specified uid.The getpwuid_r function is a reentrant version of getpwuid .
#include <pwd.h>Function Variants The getpwuid and getpwuid_r functions have variants named __32_getpwuid , _getpwuid_r32 and __64_getpwuid , _getpwuid_r64 for use with 32-bit and 64-bit pointer sizes, respectively. See Section 1.10 for more information on using pointer-size-specific functions.struct passwd *getpwuid (uid_t uid); (ISO POSIX-1)
struct passwd *getpwuid (uid_t uid, ...); (HP C EXTENSION)
int getpwuid_r (uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result); (ISO POSIX-1)
int getpwuid_r (uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result, ...); (HP C EXTENSION)
uid
The user ID (UID) for which the attributes are to be read.pwd
The location where the retrieved passwd structure is to be placed.buffer
A working buffer for the result argument that is able to hold the entry in the passwd structure. Storage referenced by the passwd structure is allocated from the memory provided with the buffer argument, which is bufsize characters in size.bufsize
The length of the character array that buffer points to.result
Upon successful return, result is set to pwd. Upon unsuccessful return, result is set to NULL....
An optional argument that can be either 1 or 0. If you specify 1, the directory specification is returned in OpenVMS format. If you specify 0, the directory specification (pathname) is returned in UNIX style format. If you omit this argument, the function returns the directory specification according to your current command-language interpreter. For more information about UNIX style directory specifications, see Section 1.4.3.
The getpwuid function searches the user database for an entry with the specified uid. The function returns the first user entry in the database with a pw_uid member of the passwd structure that matches the uid argument.The passwd structure is defined in the <pwd.h> header file as follows:
pw_name The user's login name. pw_uid The numerical user ID. pw_gid The numerical group ID. pw_dir The home directory of the user. pw_shell The initial program for the user.
Note
All information generated by the getpwuid function is stored in a per-thread static area and is overwritten on subsequent calls to the function.The getpwuid_r function is the reentrant version of getpwuid . The getpwuid_r function updates the passwd structure pointed to by pwd and stores a pointer to that structure at the location pointed to by result. The structure will contain an entry from the user database with a matching uid. Storage referenced by the structure is allocated from the memory provided with the buffer argument, which is bufsize characters in size. The maximum size needed for this buffer can be determined with the _SC_GETPW_R_SIZE_MAX parameter of the sysconf function. On error or if the requested entry is not found, a NULL pointer is returned at the location pointed to by result.
Applications wishing to check for error situations should set errno to 0 before calling getpwuid . If getpwuid returns a NULL pointer and errno is nonzero, an error occurred.
x getpwuid returns a pointer to a valid passwd structure, if a matching entry is found. NULL getpwuid returns NULL if an error occurred or a matching entry was not found. errno is set to indicate the error. The getpwuid function may fail if:
- EIO -- An I/O error has occurred.
- EINTR -- A signal was caught during getpwnam .
- EMFILE -- OPEN_MAX file descriptors are currently open in the calling process.
- ENFILE -- The maximum allowable number of files is currently open in the system.
0 When successful, getpwuid_r returns 0 and stores a pointer to the updated passwd structure at the location pointed to by result. 0 When unsuccessful (on error or if the requested entry is not found), getpwuid_r returns 0 and stores a NULL pointer at the location pointed to by result. The getpwuid_r function may fail if:
- ERANGE -- Insufficient storage was supplied through buffer and bufsize to contain the data to be referenced by the resulting passwd structure.
Reads a line from the standard input ( stdin ).
#include <stdio.h>Function Variants The gets function has variants named _gets32 and _gets64 for use with 32-bit and 64-bit pointer sizes, respectively. See Section 1.10 for more information on using pointer-size-specific functions.char *gets (char *str);
str
A pointer to a character string that is large enough to hold the information fetched from stdin .
The new-line character (\n) that ends the line is replaced by the function with an ASCII null character (\0).When stdin is opened in record mode, gets treats the end of a record the same as a new-line character and, therefore, reads up to and including a new-line character or to the end of the record.
x A pointer to the str argument. NULL Indicates that an error has occurred or that the end-of-file was encountered before a new-line character was encountered. The contents of str are undefined if a read error occurs.
Gets the process group ID of the session leader.
#include <unistd.h>pid_t getsid (pid_t pid);
pid
The process ID of the process whose session leader process group ID is being requested.
The getsid function obtains the process group ID of the process that is the session leader of the process specified by pid. If pid is (pid_t)0, it specifies the calling process.
x The process group ID of the session leader of the specified process. (pid_t) - 1 Indicates an error. The function sets errno to one of the following values:
- EPERM -- The process specified by pid is not in the same session as the calling process, and the implementation does not allow access to the process group ID of the session leader of that process from the calling process.
- ESRCH -- There is no process with a process ID of pid.
Get a string from the terminal screen, store it in the variable str, and echo it on the specified window. The getstr function works on the stdscr window.
#include <curses.h>int getstr (char *str);
int wgetstr (WINDOW *win, char *str);
win
A pointer to the window.str
Must be large enough to hold the character string fetched from the window.
The getstr and wgetstr functions refresh the specified window before fetching a string. The new-line terminator is stripped from the fetched string. For more information, see the scrollok function.
OK Indicates success. ERR Indicates that the function makes the screen scroll illegally.
Gets the date and time.
#include <time.h>int gettimeofday (struct timeval *tp, void *tzp);
tp
Pointer to a timeval structure, defined in the <time.h> header file.tzp
A NULL pointer. If this argument is not a NULL pointer, it is ignored.
The gettimeofday function gets the current time (expressed as seconds and microseconds) since 00::00 Coordinated Universal Time, January 1, 1970. The current time is stored in the timeval structure pointed to by the tp argument.The tzp argument is intended to hold time-zone information set by the kernel. However, because the OpenVMS kernel does not set time-zone information, the tzp argument should be NULL. If it is not NULL, it is ignored. This function is supported for compatibility with BSD programs.
If the value of the SYS$TIMEZONE_DIFFERENTIAL logical is wrong, the function fails with errno set to EINVAL.
0 Indicates success. - 1 An error occurred. errno is set to indicate the error.
Previous | Next | Contents | Index |