Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ intro(2) — OSF/1 SILVER Baselevel 4 rev36

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cc(1)

csh(1)

tty(7)

intro(3)

perror(3)

intro(2)  —  System Calls

Digital

NAME

intro − introduction to system calls

SYNOPSIS

#include <errno.h>

DESCRIPTION

Section 2 describes the DEC OSF/1 system calls, which are the entries into the operating system kernel. 

The Section 2 DEC OSF/1 reference pages are made up of an OSF-supplied component and a Digital-supplied component.  The title line of an OSF-supplied reference page carries an "OSF" label while the Digital-supplied reference pages are labeled "Digital". 

If OSF-supplied code operates differently on Digital platforms or has Digital extensions, an Environment Notes section is added to the OSF-supplied reference page. All reference pages that have an Environment Notes section have an "Environment_Note_Added" label added to the title line. 

When needed, technical corrections have been made to the OSF-supplied reference pages. 

The suffixes used on some Digital-supplied reference pages are used only to allow reference pages with the same base name to exist on DEC OSF/1 systems. When used, suffixes are made up of one to four letters. See the man(1) reference page for more information on suffixes. 

DEFINITIONS

The following terms are used in Section 2:

Descriptor
An integer assigned by the system when a file is referenced by open , dup , pipe , or a socket is referenced by socket or socketpair The descriptor uniquely identifies an access path to that file or socket from a given process or any of its children. 

Directory
A directory is a special type of file that contains references to other files, called links. By convention, a directory contains at least two links called dot (.) and dot-dot (..). Dot refers to the directory itself and dot-dot refers to its parent directory.

Effective User Id, Effective Group Id, and Access Groups
Access to system resources is governed by the the effective user ID, the effective group ID, and the group access list.

The effective user ID and effective group ID are initially the process’s real user ID and real group ID respectively. Either can be modified through execution of a set-user-ID or set-group-ID file, or possibly by one of its ancestors. For more information, see execve(2). 

The group access list is an additional set of group IDs used only in determining resource accessibility. Access checks are performed as defined under the term File Access Permissions. 

File Access Permissions
Every file in the file system has a set of access permissions. These permissions are used in determining whether a process may perform a requested operation on the file, such as opening a file for writing. Access permissions are established at the time a file is created. They can be changed with the chmod call. 

File access is separated into three types: read, write, and execute. Directory files use the execute permission to control whether or not the directory can be searched. 

File access permissions are interpreted by the system as they apply to three different classes of users: the owner of the file, those users in the file’s group, and anyone else.  Every file has an independent set of access permissions for each of these classes. When an access check is made, the system decides if permission should be granted by checking the access information applicable to the caller. 

Read, write, and execute/search permissions on a file are granted to a process in the following instances:

•The process’s effective user ID is that of the superuser. 

•The process’s effective user ID matches the user ID of the owner of the file and the owner permissions allow the access. 

•The process’s effective user ID does not match the user ID of the owner of the file, but either the process’s effective group ID matches the group ID of the file or the group ID of the file is in the process’s group access list and the group permissions allow the access. 

•Neither the effective user ID nor the effective group ID and group access list of the process match the corresponding user ID and group ID of the file, but the permissions for other users allow access. 

Read, write, and execute/search permissions on a file are not granted, as follows:

•If the process is trying to execute an image and the file system is mounted no execute, execute permission is denied. 

•If the process’s effective UID is not root, the process is attempting to access a character or block special device, and the file system is mounted with nodev, access is denied. 

•If the process’s effective UID is not root, the process is trying to execute an image with the setuid or setgid bit set in the file’s permissions, and the file system is mounted nosuid, execute permission is denied. 

File Name
Names consisting of up to {FILENAME_MAX} characters can be used to name an ordinary file, special file, or directory.

These characters can be selected from the set of all ASCII characters excluding null (0) and the ASCII code for backslash (\).  The parity bit (bit 8) must be 0. 

Avoid using asterisks (∗), question marks (?), or brackets ([ ]) as part of filenames because of the special meaning attached to these characters by the shell. 

Parent Process ID
A new process is created by a currently active process. For further information, see fork(2).  The parent process ID of a process is the process ID of its creator. 

Pathname
A pathname is a null-terminated character string containing an optional slash (/), followed by zero or more directory names separated by slashes. This sequence can optionally be followed by another slash and a filename. The total length of a pathname must be less than {PATHNAME_MAX} characters.

If a pathname begins with a slash, the path search begins at the root directory.  Otherwise, the search begins from the current working directory.  A slash by itself names the root directory. A null pathname refers to the current directory. 

Process ID
Each active process in the system is uniquely identified by a positive integer called a process ID. The range of this ID is from 0 to {PROC_MAX}.

Process Group ID
Each active process is a member of a process group that is identified by a positive integer called the process group ID. This is the process ID of the group leader. This grouping permits the signaling of related processes. For more information see the job control mechanisms described in csh(1). 

Real User ID and Real Group ID
Each user on the system is identified by a positive integer called the real user ID.

Each user is also a member of one or more groups.  One of these groups is distinguished from others and used in implementing accounting facilities. The positive integer corresponding to this group is called the real group ID. 

All processes have a real user ID and real group ID.  These are initialized from the equivalent attributes of the parent process. 

Root Directory and Current Working Directory
Each process has associated with it a concept of a root directory and a current working directory for the purpose of resolving path name searches. A process’s root directory does not need to be the root directory of the root file system.

Session

Each process group is a member of a session. A process is considered to be a member of the session of which its process group is a member.  Typically there is one session per login. 

Sockets and Address Families

A socket is an endpoint for communication between processes.  Each socket has queues for sending and receiving data. 

Sockets are typed according to their communications properties.  These properties determine whether messages sent and received at a socket require the name of the partner, if communication is reliable, and if the format is used in naming message recipients. 

Each instance of the system supports some collection of socket types. See socket(2) for more information about the types available and their properties. 

Each instance of the system supports some number of sets of communications protocols. Each protocol set supports addresses of a certain format. An Address Family is the set of addresses for a specific group of protocols. Each socket has an address chosen from the address family in which the socket was created. 

Special Processes
Those processes that have a process ID of 0, 1, and 2 are considered special processes. Process 0 is the scheduler. Process 1 is the initialization process init, and is the ancestor of every other process in the system. It controls the process structure. Process 2 is the paging daemon.

Superuser
A process is recognized as a superuser process and is granted special privileges if its effective user ID is 0.

tty Group ID
Each active process can be a member of a terminal group that is identified by a positive integer called the tty group ID. This grouping is used to arbitrate between multiple jobs contending for the same terminal. For more information, see csh(1) and tty(7). 

RETURN VALUES

Most system calls have one or more return values.  An error condition is indicated by an otherwise impossible return value. This value is usually −1.  When a function returns an error condition, it also stores an error number in the external variable errno.  This variable is not cleared on successful calls. Thus, you should test errno only after an error has occurred. 

All return codes and values from functions are of type int unless otherwise noted. 

For a list of the errors and their names as given in <errno.h>, see the errno(2) reference page. 

RELATED INFORMATION

cc(1), csh(1), tty(7), intro(3), perror(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026