www.delorie.com/gnu/docs/gawk/gawk_70.html   search  
 
Buy the book!


The GNU Awk User's Guide

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.7.2 Special Files for Process-Related Information

gawk also provides special file names that give access to information about the running gawk process. Each of these "files" provides a single record of information. To read them more than once, they must first be closed with the close function (see section Closing Input and Output Redirections). The file names are:

`/dev/pid'
Reading this file returns the process ID of the current process, in decimal form, terminated with a newline.

`/dev/ppid'
Reading this file returns the parent process ID of the current process, in decimal form, terminated with a newline.

`/dev/pgrpid'
Reading this file returns the process group ID of the current process, in decimal form, terminated with a newline.

`/dev/user'
Reading this file returns a single record terminated with a newline. The fields are separated with spaces. The fields represent the following information:

$1
The return value of the getuid system call (the real user ID number).

$2
The return value of the geteuid system call (the effective user ID number).

$3
The return value of the getgid system call (the real group ID number).

$4
The return value of the getegid system call (the effective group ID number).

If there are any additional fields, they are the group IDs returned by the getgroups system call. (Multiple groups may not be supported on all systems.)

These special file names may be used on the command line as data files, as well as for I/O redirections within an awk program. They may not be used as source files with the `-f' option.

Note: The special files that provide process-related information are now considered obsolete and will disappear entirely in the next release of gawk. gawk prints a warning message every time you use one of these files. To obtain process-related information, use the PROCINFO array. See section Built-in Variables That Convey Information.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003