0-13-933821-7 Unix System V Rel4 Migration Guide 1990
0-13-933821-7 Unix System V Rel4 Migration Guide 1990
UN/~ SYSTEM V
RELEASE 4
Migration Guide
No part of this publication may be reproduced or transmitted in any form or by any means-graphic,
electronic, electrical, mechanical, or chemical, including photocopying, recording in any medium, tap-
ing, by any computer or information storage and retrieval systems, etc., without prior permissions in
writing from AT&T.
AT&T reserves the right to make changes without further notice to any products herein to improve
reliability, function, or design.
TRADEMARKS
NeWS and SunOS are registered trademarks of Sun Microsystems, Inc.
OPEN LOOK is a trademark of AT&T.
PostScript is a registered trademark of Adobe Systems, Inc.
UNIX is a registered trademark of AT&T.
VAX is a trademark of Digital Equipment Corporation.
XEN IX is a registered trademark of Microsoft Corporation.
10 9 8 7 6 5 4 3 2 1
ISBN 0-13-933821-7
UNIX
PRESS
A Prentice Hall Title
PRE N T C E HAL L
ORDERING INFORMATION
Table of Contents
Table of Contents _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __
InpuVOutput 5-21
Memory Management 5-23
System Access 5-25
Process Management 5-27
System Administration and Maintenance 5-30
Networking 5-32
Character-Based User Interfaces 5-38
Graphical User Interface 5-39
Internationalization 5-41
C Language 5-44
II Migration Guide
Introduction
Introduction 3-1
Table of Contents
Introduction
UNIX System V Release 2 comprised two major releases, which introduced new
features, and several maintenance releases. The major releases were Release 2.0
and Release 2.1.
The features introduced in the major Release 2 releases are described in this sec-
tion. Users upgrading from Release 2 should read this section to learn what has
happened to each feature as the system has evolved through the major Release 2
and Release 3 releases; the descriptions explain the extent to which a Release 2
feature has been changed or enhanced in Release 4.0, or whether or not it has
been replaced or deleted altogether.
Self-Configu ration
Release 2.0 introduced self-configuration, a feature that enables peripheral
drivers to be kept on the hard disk instead of permanently in the UNIX System
V kernel. When the system is booted, the feature can automatically detect new
hardware and retrieve the corresponding drivers.
Demand Paging
REGIONS demand paging, introduced in Release 2.1, is a virtual memory
management architecture that replaced the original UNIX system swapping
architecture. Demand paging allows the UNIX system to execute processes that
exceed the address space of main memory.
In Release 4.0, a third-generation memory management architecture replaces
both the original swapping architecture and the REGIONS virtual-memory
architecture. The new Virtual Memory (VM) architecture memory-management
provides the benefits of demand paging, plus a number of new, distinctive
advantages, such as greater portability of kernel code. System programs that
reference REGIONS data structures will not work in Release 4.0. For more
information about the VM architecture, see Chapter 5 of this guide.
For an explanation of the differences in the two modes of record locking, see the
description of File and Record Locking in ''Release 2.0 Features."
Introduction 4-1
Table of Contents
Table of Contents
Ii Migration Guide
Introduction
This section is directed to Release 2 and Release 3 users who are upgrading to
Release 4.0. The section describes the features that were introduced to System V
in the Release 3 releases and alerts users to Release 3 features that have been
replaced or significantly enhanced in Release 4.0.
UNIX System V Release 3 consisted of three releases-Release 3.0, Release 3.1,
and Release 3.2. Although each release introduced a range of new features,
Release 3.0 enhancements were mainly in the area of networking, Release 3.1
focused on internationalizing the UNIX system, and Release 3.2 added security
enhancements.
Release 3.0 introduced features that are important to extending the UNIX
system's capabilities as a networked operating system. These features, packaged
together in the Network Support Utilities package, consisted of
• STREAMS
• the Transport Level Interface (TLI)
• the Listener.
Release 3.1 also introduced RFS client caching. This feature enables a client sys-
tem (one that is accessing data from another system) in a Remote File Sharing
arrangement to maintain a local copy of the data it needs. When a block of data
is read from or written to a remote system, it is placed in a local buffer where it
can be accessed by subsequent requests for data by local processes. This can
reduce significantly the amount of data that needs to be sent across the network,
resulting in significant performance improvements for many patterns of remote
file use.
In Release 4.0, Remote File Sharing has been implemented as a file system type
(rfs) and is one of two distributed file system types supported by a new Virtual
File System architecture. The second distributed file system type is an imple-
mentation of Network File System, a SunOS file-sharing package that allows a
computer to share one or more of its file systems with other computers in a
heterogeneous operating system environment. Both RFS and NFS can run
simultaneously on the same machine, and both packages are administered
through a common command interface.
For more information about RFS, see the Network User's and Administrator's
Guide. For more information about the Virtual File System and the Network
File System, see Chapter 5 of this guide.
STREAMS
STREAMS was introduced in Release 3.0 as a mechanism and a set of tools for
the development of communication and networking services within the UNIX
system kernel.
STREAMS defines standard interfaces for character input/output within the ker-
nel, and between the kernel and the rest of the UNIX system. The STREAMS
mechanism enables modular, portable program development and seamless
integration of network services.
The interfaces defined in STREAMS allow networking architectures and higher-
level protocols to be independent of underlying protocols, drivers, and media.
Higher-level services are created by selecting and connecting lower-level ser-
vices and protocols.
Listener
For each transport provider on a system, UNIX System V Release 3.0 provides
an active user-level program called a Listener. The purpose of the Listener is to
receive requests for network services from another system, interpret which net-
work service is needed, and initiate a process that has been designated to pro-
vide the requested network service. The Listener then drops out of the com-
munications path and continues to listen for new service requests.
Although the Listener remains virtually unchanged in Release 4.0, it has been
implemented under the Service Access Facility (SAF}-a new facility that
manages all external access to the system and provides consistent handling of
connection requests from different access points.
For more information about the SAF, see Chapter 5 of this guide and the System
Administrator's Guide.
Shared Libraries
Shared libraries were introduced in Release 3.0.
A shared library is a set of routines that is attached to a program at run-time,
rather than having routines combined with an application program when it is
compiled. The end user of an application that was built in this way benefits in
several ways:
• The application program may occupy less storage space.
• When it is running, the application program occupies less space in
memory.
• When routines in a shared library are changed, the new, improved ver-
sions are accessible without recompilation of the programs that access
them. For example, by improving the performance of one routine, the
performance of every application that uses that routine will
be improved
immediately.
For information about shared libraries, see the Programmer's Guide: System Ser-
vices and Application Packaging Tools.
getopts
A new shell function, getopts, was offered in Release 3.0 as a replacement for
the getopt command. To ease migration, both Commands were supported in
Release 3.0, and, to assist in the conversion of affected shell scripts, both a
conversion command (qetoptcvt) and hand conversion procedures were pro-
vided with Release 3.0.
Beginning with Release 3.1, only getopts is supported.
The focus of Release 3.1 was on making UNIX System V more adaptable to dif-
ferent languages and national conventions. To promote the use of the UNIX
system internationally, Release 3.1 offered support for 8-bit characters, alternate
date and time formats, and alternate character classifications and conversion
rules. (For a full discussion of the features in Release 4.0 that support interna-
tional applications, see "Internationalization" in Chapter 5 of this guide.)
In addition, Release 3.1 provided a new version of awk (called nawk) that sup-
ports 8-bit characters.
Performance improvements in Release 3.1 consisted of improved recovery of
files from cpio archives, incremental backup of nested files, the ability to page
the user area, and a smaller and faster curses library.
Release 3.1 also introduced enhancements to RFS. For a description of the
enhancements, see the description of RFS in ''Release 3.0 Features" earlier in
this guide.
In Release 4.0, awk is provided as oawk (old awk) and nawk. By default, awk is
linked to oawk.
For more information about nawk, see the nawk(1) manual page.
One of the great benefits of the UNIX system when it was first developed was
the ease with which the researchers working on a project could share data. This
benefit was achieved, to some extent, by minimizing security barriers in the sys-
tem. The UNIX system's multi-user capability is no less valuable today, but the
system has now proliferated to environments in which protecting data is as
important as sharing it. In response to this realization, features were added to
UNIX System V in Release 3.2 to improve system security.
In addition to security features, Release 3.2 added enhancements to UNIX Sys-
tem V in the form of new utilities packages: the 2K File System Utilities, FACE,
and FMLI.
To enhance security, the time that a user last logged in is displayed each
time that user logs in.
• Sticky Bit
well as to the overall security of the system. Beginning with Release 3.2,
the sticky bit on a directory is used to restrict the removal of files within
that directory so that only the owner can remove the files. Without the
sticky bit, the standard UNIX system semantics for object removal are fol-
lowed. The Release 3.2 and Release 4.0 installation media set the sticky
bit for the public directories /tmp and /var/tmp.
• Enhanced Shell
In UNIX System V there are programs that change a user's effective access
privileges. For security purposes, an enhanced shell was provided in
Release 3.2 that resets the effective user or group ID (and possibly both) to
the real ID. This occurs when the effective user ID is less than 100 (and
the effective group ID is not equal to 1). Any application whose effective
user and group IDs are greater than 99 is not affected by this enhance-
ment.
In Release 3.2, two versions of the shell were provided, with the older ver-
sion provided for compatibility with applications that might not work
correctly with the enhanced version. The default version for Release 3.2
was the enhanced /usr/bin/sh.
Release 4.0 supports four shells. The default is still the enhanced
/usr/bin/sh. Alternative shells are the C shell, the Korn shell, and the
job control shell, none of which supports the security features described
above; however, all support some security features. (The older version of
/usr/bin/sh, supported in Release 3.2 for compatibility with earlier
releases, is not supported in Release 4.0.)
For information about the shells supported in Release 4.0, see ''UNIX Sys-
tem V Release 4.0 Features" later in this guide.
Enhanced curses
The UNIX System curses screen management library was improved in Release
3.2 to support color text on tenninals capable of displaying it. A default table of
eight colors can be modified or expanded.
In Release 4.0, curses is packaged with the C Software Development System,
Issue 5.
Introduction 5-1
Table of Contents
Table of Contents _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __
Input/Output 5-21
STREAMS 5-21
Device-Kernel Interface/Device Driver Interface 5-22
ii Migration Guide
Table of Contents
Networking 5-32
Sockets 5-33
TCP/IP Protocols and Commands 5-34
inetd 5-34
Network File System 5-35
Remote Procedure Call 5-35
External Data Representation 5-36
Network Selection 5-36
Name-to-Address Mapping 5-37
Service Access Facility 5-37
Internationalization 5-41
International Character Manipulation 5-42
Message Management 5-42
National Conventions 5-43
C Language 5-44
ANSIC 5-44
Dynamic Linking of C Programs 5-45
COFF to ELF 5-45
The goal of UNIX System V Release 4.0 is to unify important UNIX system vari-
ants into one, full-featured product that conforms to industry-defined standards
for the UNIX system.
Where standards have been defined by industry-wide standards bodies, such as
the IEEE PlOO3 POSIX Committee, UNIX System V conforms. Where standards
have yet to be defined, UNIX System V incorporates de facto standards intro-
duced by a number of different UNIX systems. These de facto standards
represent the most popular features of 4.2 and 4.3 BSD, SunOS, and XENIX, as
well as UNIX System V. In addition, the System V Interface Definition (SVID),
AT&T's published standard for UNIX System V, has been revised and extended,
submitted for industry-review, and reissued in concert with Release 4.0.
To meet the goal of unification and standardization, an extensive redesign of
some aspects of the UNIX system was necessary; for example, the traditional
UNIX file system becomes one of many supported file system types. Despite
the scope of its changes, however, Release 4.0 provides a high degree of compa-
tibility with previous UNIX System V releases and applications.
Incorporating features introduced in other UNIX systems extends the capabili-
ties of UNIX System V in many areas, especially in the area of networking. For
the first time in Release 4.0, UNIX System V offers full support for networking
via a STREAMS-based implementation of the DARPA Internet protocol suite
(TCP /IP}-a family of network protocols that has been included in BSD releases
in the past.
Unifying UNIX system variants and conforming to standards does not preclude
introducing new technologies and enhanced capabilities. For example, Release
4.0 introduces features that allow the UNIX system to be more useful in real-
time processing environments.
The discussion of Release 4.0 that follows is not simply a list of new features.
Instead, it describes various functional areas of UNIX System V as they existed
prior to Release 4.0 and as they exist in Release 4.0. The discussion covers the
following topics:
• The Command Set
• The Command Interface (the Shell)
• File Operations
• The File System
• The Directory Tree
• Input/Output
• Memory Management
• System Access
• Process Management
• System Administration and Maintenance
• Networking
• Character-Based User Interfaces
• Graphical User Interface
• Internationalization
Descriptions of new features are integrated into the discussion of each func-
tional area. For a description of Release 4.0 organized by feature, see the "Pro-
duct Overview" in the Product Overview and Master Index.
One of the goals of Release 4.0 is to incorporate the most popular BSD and
XENIX commands into the UNIX System V command set. By merging the com-
mands of the major UNIX operating system variants, Release 4.0 takes a
significant step toward providing the UNIX system user with a single, consistent
command set.
Merging the command sets of different systems posed a number of problems,
however. In some cases, two different commands had the same name. In other
cases, option or argument usage conflicted with existing standards, such as the
SVID. In general, the decision was made in Release 4.0 to change command
names and options when necessary, rather than sacrifice functionality or risk
introducing confusion. Commands that offered the same or similar functionality
have been merged into a single command.
Some commands from the UNIX system variants were not merged into the
Release 4.0 command set. Many of these commands have been placed in a com-
patibility package. Users can access them if they wish by including the compati-
bility "bin" in their paths; however, users who do not need the commands are
not required to install them.
The following tables list the commands from BSD, SunOS, and XENIX that have
been added to or merged with the UNIX System V command set. For informa-
tion about specific commands, see the manual pages in the Release 4.0 reference
manuals.
For the first time in Release 4.0, UNIX System V supports four command line
interfaces, or shells. These are
• The UNIX System V shell (sh)
• The C shell (csh)
• The Korn shell (ksh)
• The job control shell (jsh)
The UNIX System V shell (also known as the Bourne shell) is the default shell in
Release 4.0. The UNIX System V shell is documented in the svm and provides
the greatest portability for shell programmers.
The C shell (developed at the University of California at Berkeley) is a popular
command interface and programming language. Its popularity stems from its
command re-execution and editing facilities.
The Korn shell is supported in Release 4.0 because it provides the basic func-
tionality of the Bourne shell, but with expanded capabilities as an interactive
interface. It maintains a command history file and supports editor interfaces for
searching, modifying, and re-executing commands.
The job control shell (jsh) provides an implementation of job control that con-
forms to the POSIX standard as defined in POSIX PlOO3.1. It allows users to
stop and restart jobs in the background and foreground, and to move jobs back
and forth between the foreground and the background.
For more information, see the User's Guide and the sh(1), csh(1), and ksh(1)
manual pages.
File operations have been improved in Release 4.0 for robustness and ease of
use and to unify BSD, XENIX, and UNIX System V file manipulation interfaces.
Release 4.0 incorporates POSIX PlOO3.1 as well as popular BSD and XENIX file
manipulation system calls.
For detailed information about the features described in this section, see the
Programmer's Guide: System Services and Application Packaging Tools.
Memory-Mapped Files
The traditional method of manipulating files and devices makes resources acces-
sible to user processes only by means of explicit system calls. Accessing a
memory location in a process and accessing a file or device are completely dif-
ferent operations.
This complicates the operation of some programs and makes others impossible
to write without writing kernel code. To address the problem, a file mapping
mechanism has been introduced that allows programs to access files and devices
In earlier UNIX systems, the file system was a static entity of fixed size and for-
mat. As the UNIX system was extended to solve new problems, the traditional
file system was no longer adequate. Release 2 introduced a "convertible" file
system switch that allowed a system to support both O.5K and lK file systems.
Beginning in Release 3.2, a 2K file system was supported. In Release 4.0, Virtual
File System (VFS) has been implemented as a means of generalizing further the
concept of a file system, so that file systems of different types can be supported
simultaneously on the system.
For more information about file system types, see the System Administrator's
Guide.
File Linking
Early UNIX systems allowed a single file to be assigned more than one name
through a "linking" mechanism; however, this mechanism was limited. Direc-
tory files could not have more than one name, and all names associated with a
file had to reside within a single physical file system.
Symbolic links overcome these limitations. A symbolic link is a file that con-
tains the pathname of another file. References to the symbolic link are con-
verted by the UNIX system kernel into references to the target file.
Because symbolic links allow directory files to be linked, the logical structure of
a system's file tree can be rearranged without changing the physical locations of
files. Because symbolic links allow links to a physical file to reside in a different
physical file system, names can be linked across file systems that reside on dif-
ferent computers on a network-allowing a computer to create a logical direc-
tory tree that includes directories and files that physically reside on many dif-
ferent computers.
Release 4.0 supports both traditional and symbolic links. The In command
interprets the -s option as a request to make a symbolic link. In addition,
Release 4.0 supports the system calls symlink, readlink, lstat, and lchown for
manipulating symbolic links.
For more information about symbolic links, see the Programmer's Guide: System
Services and Application Packaging Tools.
In Release 4.0, the layout of the directory tree has been rearranged to make it
easier to share resources across a network. Within the directory layout, the
/dev directory has been restructured so that its size is more manageable.
In addition to these standard file systems, Release 4.0 creates a/stand partition,
where it stores all the files needed for file-system-independent booting.
The file types defined in Release 4.0 are
• Machine-private files
• Architecture-dependent files
• Architecture-independent files
Machine-private files are those files that cannot or should not be shared with
other machines, regardless of CPU type. Examples of machine-private files
include /sbin/init.d scripts for machine-specific boot procedures, or account-
ing logs. The root file system in Release 4.0 contains the machine-private files
for the system.
/usr
I
/ees/bin /ucb/inelude
/\ /ucb/lib
/var
/adrn /oren /mail /news /opt /preserve /saf /spool /trrp /uucp
/SPOOl/{i:SPOOl/UUcppubliC
/spool/uucp
/dev Restructuring
The /dev directory, the directory that holds device-specific files, has been res-
tructured in Release 4.0. As computers are able to support larger numbers of
terminals and pseudo-terminals, the number of terminal-related devices in the
/dev directory quickly becomes unmanageable. To alleviate this problem, sub-
directories have been created under /dev, and the ttyname library routine has
been enhanced to search subdirectories. Terminal-related devices are now
located in /dev/te:rm. Pseudo-terminals reside in a subdirectory called
/dev/pts. xt device files used by layers now reside in the /dev/xt directory,
and shell layers device files used by shl reside in the /dev/sxt directory.
With the enhanced ttyname, new subdirectories may be created under /dev,
and other peripheral ports devices need not be located in /dev/te:rm.
ttyname has been enhanced to read a configuration file called /etc/ttysrch.
/etc/ttysrch is a file that the system administrator creates if he or she wishes.
It specifies the names of the directories that should be searched and the order in
which they should be searched. Each line of the file is a directory name, includ-
ing the full path. ttyname searches the directories in the order in which they
are listed in the file. If ttysrch is not created, ttyname uses a default search
list that consists of /dev/term, /dev/pts, and /dev/xt. If a match is not
found, it then searches through the rest of the /dev directory and its other sub-
directories.
Pre-4.0 add-on packages that are dependent on the pre-4.0 /dev structure con-
tinue to work in 4.0, provided an administrator runs a script to create links from
the new structure to the pre-4.0 structure. The script /usr/sbin/lnttys is pro-
vided to create the necessary links. When an administrator invokes the script,
links are created from /dev/term/X to /dev/ttyX.
To preserve compatibility with add-on packages, it may also be necessary to
create or edit the ttysrch file so that it searches the /dev directory first before
looking in the subdirectories. This will ensure that ttyname returns the old-
style name rather than the new style.
For more information, see the System Administrator's Guide and the ttyname(3C)
and ttysrch(4) manual pages.
In the UNIX system I/O subsystem, new kernel software is required to interface
with each new device that is added to the system. In many cases, there may be
a great deal of overlap between existing device drivers and new drivers, but
there is no convenient way for driver writers to share common code.
In Release 3.0, UNIX System V introduced STREAMS, an I/O mechanism that
overcomes some limitations of traditional UNIX system I/O by providing
greater modularity and flexibility of device drivers and protocols. Release 4.0
extends the use of the STREAMS mechanism in UNIX System V and introduces
the Device Driver Interface (001) and the Driver-Kernel Interface (DKI), inter-
faces between a device driver and the kernel that make it easier to port driver
source code.
STREAMS
Release 3.0 introduced the STREAMS mechanism as a framework for UNIX sys-
tem character I/O. The STREAMS mechanism allows the structuring of kernel
software in a modular manner.
STREAMS was introduced initially as a framework for implementing network
protocols. By defining a high-level set of network interfaces, the actual device
driver (and therefore the network protocol and media) are not directly visible to
applications programmers. This allows the creation of networking applications
that do not depend on a particular network or protocol to operate.
In Release 4.0, the entire terminal (tty) subsystem in the kernel has been rewrit-
ten to use the STREAMS mechanism. The move to a STREAMS implementation
increases the modularity of the tty subsystem and provides a more flexible
framework for future enchancements. Pseudo-ttys (ptys) have been imple-
mented under STREAMS as well.
To unify the interfaces that programs use to communicate with character devices
and processes, Release 4.0 re-implements pipes using the STREAMS mechan-
isms. Release 4.0 provides compatibility with programs written prior to the
introduction of STREAMS-based pipes; existing programs that use pipes con-
tinue to operate as they did previously.
For more information about the STREAMS mEfhanisms in Release 4.0, see the
Programmer's Guide: STREAMS.
For more information about VM, see the Programmer's Guide: System Services and
Application Packaging Tools.
Port Monitors
In Release 4.0, a port monitor is a process under the control of the Service
Access Facility that detects activity on a port, or on more than one port of the
same type (tty lines or network addresses). Release 4.0 provides three port
monitors under the SAF umbrella-two network port monitors, listen and
inetd, and a serial port monitor called ttymon. listen, introduced as the
Listener in Release 3.2, is a general purpose network listener that provides
connection-oriented service in a protocol-independent manner. inetd is the
DARPA port monitor. It provides connection and connectionless service on a
TCP lIP network.
In Release 4.0, the ttymon port monitor replaces the getty program. A single
ttymon process can monitor many serial ports and eliminate the need for a
getty process for each port. ttymon makes use of two important Release 4.0
features: the ability to poll STREAMS-based ttys, and the virtually unlimited
number of file descriptors that a privileged process may have open.
lii:"""1
ijQl~
The getty P"'9,"m no longer exists in Release 4.0. A symbolic link from
getty to ttym:>n is provided to maintain compatibility with applications that
) ~~P~~~~i~J~~eu~~ ~~f~:~~nfs~:~~~'inT:;:~e:P:~~if!~~S~~~;~~:r's~h~~I~
Access Facility.
In addition to the standard port monitors provided by Release 4.0, the SAP
architecture allows new port monitors to be installed by users and applications.
For more information about port monitors, see the System Administrator's Guide
and the ttymon(lM) and listen(1M) manual pages.
Job Control
Job control is a popular feature of the BSO operating system and an optional
part of the IEEE P1OO3.l POSIX standard. Job control allows a user to stop and
later resume a job, whether it is executing in the foreground or the background.
Job control also allows a user to move jobs back and forth between the back-
ground and the foreground.
With job control a user can
• stop a foreground job in order to perform a more pressing task
• put a foreground job in the background
• stop a job to satisfy a need of the job, such as looking up data for input or
changing the name of an input file to match what was misspelled on the
command line.
Job control capabilities are available through an optional shell called the job con-
trol shell (jsh). For more information about job control, see the User's Guide.
Processes in the UNIX system receive asynchronous notification via the signal
mechanism. The notification is asynchronous because a signal can arrive at any
time during the execution of a process.
For information about the job control shell, see the sh(l) manual page.
Enhanced Signals
Over the years, many variations of the original UNIX system signal mechanism
have been created to extend the usefulness of signals and to increase their
robustness. Recently, POSIX PlOO3.1 has consolidated these signal interfaces
into a single standard.
The POSIX signal interface features:
• the ability to manipulate a set of signals
• the ability to block and unblock signals
• the ability to examine pending signals
• job control support
In addition to the POSIX signal interface, Release 4.0 supports the the complete
pre-3.0 interface (signal) and the Release 3.0 interface (sigset). All three sig-
nal interfaces may be mixed in a single program.
For more information about the POSIX signal interface, see the signal(S)
manual page.
Real-Time Support
"
Historically, the UNIX system has been a general purpose timesharing system.
Today, however, there is growing demand for real-time applications support.
To address that demand, Release 4.0 introduces a new process-scheduler archi-
tecture and high-resolution timing services.
For more information about real-time support, see the Programmer's Guide: Sys-
tem Services and Application Packaging Tools.
High-Resolution Timers
For applications that deal with very short intervals, Release 4.0 provides BSD
timing services that give microsecond resolution. These services include alarms,
interval timers, and a time-of-day clock.
Software Installation
In Release 4.0, installation routines have been made consistent across software
packages, releases, and machines. Also provided in Release 4.0 are tools and
guidelines for developing add-on packages that take advantage of the standard
software installation script, as well as the menu interface.
Early networking capabilities in the UNIX system consisted of the uucp net-
working package, included in the Basic Networking Utilities (BNU) package in
UNIX System V. uucp networks provide queued point-to-point communication
between computers over standard telephone lines. A uucp client process
queries a database for address and routing information, in this case, a telephone
number, and calls a remote system.
In the 1970s, the Advanced Research Project Agency (now the Defense
Advanced Research Project Agency, DARPA) developed TCP lIP, sometimes
called the DARPA Internet protocol suite. TCP lIP was designed to be a set of
mid-level communications protocols for use with the ARPANET wide-area
packet-switching data communications network (a network that grew to include
hundreds of nodes throughout the United States). In the late 1970s, the Univer-
sity of California at Berkeley included an implementation of TCP lIP in its UNIX
Software Distribution.
Building on the BSD innovations in UNIX system networking, SunOS intro-
duced an implementation of a Remote Procedure Call (RPC) facility, along with
a file distribution service called Network File System (NFS). RPC is a mechan-
ism that allows a local process to invoke a procedure residing on a remote sys-
tem. NFS is an application that provides transparent file sharing among com-
puters of different architectures.
The thrust in recent years has been to develop interfaces that allow network
applications to be independent of network media and protocols. In 1982, BSD
introduced a networking interface called Sockets. In Release 3, UNIX System V
introduced STREAMS-another solution to the same problems Sockets sought to
address. STREAMS is a mechanism that supports modular development of net-
work protocols and device drivers.
Release 3 also introduced the Transport Level Interface (TLI), a protocol-
independent programming interface to networking protocols, and the listener, a
program that listens for requests for service from remote machines. Also
appearing for the first time in Release 3 was Remote File Sharing (RFS), a net-
work application that allows systems to share files transparently across a net-
work connection.
Release 4.0 extends AT&T's commitment to networking, as well as to the
unification of the various commercial implementations of the UNIX system, by
incorporating many of the networking features of BSD and SunOS into UNIX
System V. These features are:
In addition to supporting BSD and SunOS features, Release 4.0 introduces the
following new features:
• Network Selection
• Name-to-Address Mapping
• Service Access Facility
All of the Release 4.0 networking features are described in the remainder of this
section.
Sockets
Sockets is a network interface used widely in BSD systems and in derivative
operating systems such as SunOS. It is functionally similar to the Transport
Level Interface (TLI) provided in UNIX System V. .
Sockets is provided as a compatibility library in Release 4.0 so that existing
Sockets applications can migrate easily to UNIX System V. To run on UNIX Sys-
tem V, Sockets applications must be recompiled and relinked to the sockets
library in Release 4.0.
TLI remains the SVID-defined networking interface. Programmers are
encouraged to write new applications using the TLI rather than Sockets.
For more information about the Sockets procedure calls supported in Release
4.0, see the Programmer's Guide: Networking Interfaces.
inetd
inetd is a BSD network port monitor that originated in BSD UNIX systems. A
port monitor is a program that performs server-side connection management.
When a connection request arrives over the network, the port monitor spawns
the server and passes the network connection to it.
inetd handles both connection and connectionless requests from remote sys-
tems on a network using TCP or UDP protocols.
For more information about inetd, see the Network User's and Administrator's
Guide and the inetd(1M) manual page.
RPC service is implemented over the Transport Level Interface (TLI), which
gives it transport protocol independence and allows it to run unchanged over
different networks conforming to the Transport Provider Interface.
For more information about RPC, see the Programmer's Guide: Networking Inter-
faces.
Network Selection
Network Selection is a feature that helps applications select a network to use for
communication. Users can specify their preference in an environment variable,
NETPATH. The system administrator can set a default NETPATH for login,
which users can override or append to as necessary. Applications have the
option of using the network specified by the user in NETP ATH, or selecting a
network based on other application-specific criteria.
The benefit of Network Selection is that a network selection no longer needs to
be embedded in the application code. This allows the application to run without
change on different systems connected to different networks.
Network Selection allows a system to have a different list of networks for dif-
ferent applications. It also allows applications to connect to a number of dif-
ferent networks until it finds one that meets its service requirements and per-
mits the connection.
For more information about Network Selection, see the System Administrator's
Guide and the Programmer's Guide: Networking Interfaces.
Name-to-Address Mapping
UNIX System V Release 4.0 networking includes a name-to-address mapping
mechanism that network clients can use to determine the addresses of servers in
a network-independent manner. It allows clients to reach servers, even if the
address on which the server is listening changes. It makes it possible for clients
to be independent of networking protocols, as long as the network provides a
transport-level interface. It also allows a client to reach a server through the
most convenient network.
A client can identify a server by
• a service name
• the name of the host computer on which the service resides
• the name of the network to be used to reach the host.
XWIN
The XWIN Graphical Windowing system is a portable window system that
creates a multi-layered server system on top of the UNIX system. XWIN gives
the user the ability to create multiple windows on a single display and to run
different applications in each window.
XWIN software uses the X protocol for exchanging information between client
applications and the graphics server, and Xlib (the C language interface) to built
system functions. The X protocol gives application programs running on dif-
ferent systems the ability to communicate with and use or display results from
other application windows.
For information about XWIN, see the Programmer's Guide: XWIN Graphical Win-
dowing System.
X11/NeWS
XlI/NeWS is a second windowing system that runs applications written to the
XII and NeWS protocols. Although the protocols are different, XlI/NeWS pro-
vides an integrated environment in which both are supported, with both work-
ing off a single window manager.
For information about Xll/NeWS, see the Programmer's Guide: Xll/NeWS Graph-
ical Windowing System.
OPEN LOOK
OPEN LooKTM defines a standard for the appearance and function of the
graphical user interface and provides developers with application programmer
interface (API) toolkits. API toolkits allow developers to manipulate windows
and window-supported graphics to achieve the standard '1ook and feel" of
OPEN LOOK GUI applications. Two toolkits are provided as part of OPEN
LooK-one for writing applications that operate on the XWIN server, and one
for writing XlI/NeWS applications.
For information about OPEN LOOK, see the Programmer's Guide: OPEN LOO[(TM
Graphical User Interface.
Migration Guide
Internationalization
Both ANSI X3.159-1989 and IEEE Std 1003.1 (POSIX) have defined standards for
international programs. The ANSI C committee has adopted the term '1ocale"
to refer to a grouping of information that provides behavior dependent on con-
ventions of nationality, culture, and language.
Release 4.0 implements the ANSI and POSIX standards. It provides the hooks
necessary for localizing applications, supports multiple locales simultaneously
on the same system, and allows multiple instances of the same program to
operate each with different locales.
The ANSI C draft standard defines the setlocale function, which allows a pro-
gram to specify the locale to be used for all subsequent locale-specific opera-
tions. The set locale function accepts two parameters, an integer indicating
the locale-dependent operation that is to be affected (category), and the name
of the locale (locale). Once setlocale returns, any of the operations specified
in category operate according to the designated locale. The variables that can
be specified with the category parameter are LC_ALL, LC_COLLATE, LC_CTYPE,
LC_MONETARy,LC_NUMERIC,LC_TIME,andLC_MESSAGES.
(For detailed information about the features described in this section, see the
Programmer's Guide: System Services and Application Packaging Tools.)
Message Management
A difficult problem to address when building international applications is the
problem of conversing with the user in his or her native language. To allow the
user to input a file name in his or her native language requires the programmer
to create new routines that prompt the user with the proper native language
phrase and accept the native language as input. Adding support for a language
requires finding every locale-dependent area in the code and modifying it to
invoke native language statements where appropriate. The time required to
build and maintain such programs is enormous, since each supported language
requires extensive modifications to the program.
In order to address the problem of locale-dependent messages, programs need
to replace references to embedded ASCII strings in program with a call to a
general purpose text string look-up service. Release 4.0 provides such a look-up
service in two forms: as a C language function and as an executable command,
both named gettxt.
Given a message identifier, gettxt retrieves the text string associated with that
identifier. The message database searched by gettxt is determined by the
current program locale; that is, if the current locale is French, gettxt will
retrieve the appropriate entry in the French version of the message database.
Once a program has been converted to use gettxt, providing support for a new
locale is simply a matter of translating the message database for the program
into the new language/character set and building the message database with the
mkmsgs command.
In Release 4.0, the directory /usr/lib/locale contains directories for each
locale that is supported on a particular system. Each directory for a particular
locale contains a subdirectory for messages, named LC_MESSAGES.
Release 4.0 provides two tools, mkmsgs and srchtxt, to create and search mes-
sage databases. In addition, Release 4.0 provides the exstr tool for converting
existing programs to use the message management facilities.
National Conventions
National conventions are the rules and formats we observe when we communi-
cate. Different countries and cultures observe different rules; for example, dif-
ferent countries use different calendars and different formats for communicating
the month, day, year, and time of day. For a program to be "international," it
must support different calendars and time-of-day calculations, via date/time cal-
culation routines.
In Release 4.0, existing utilities and interfaces have been modified to support
both implicit and explicit invocation of different national conventions.
Specifically, release 4.0 provides
• a new utility that supports the definition and creation of new collating
tables, and two new library routines that use the collating table
• a facility to provide user-definable character classification tables
• generalized date/time editing functions and separate format specifications
• an external variable that can be used by various number conversion rou-
tines to edit data in different number formats.
Most enhancements to the C programming language for this release fall into
three categories: confonnance with the American National Standards Institute
(ANSI) X3.159-1989 C language standard; transition to dynamic shared libraries
from static shared libraries; and transition to ELF (Executable and Linking For-
mat) from COFF (Common Object File Format).
Other C language enhancements, resulting from internationalization require-
ments, are described under the heading "Internationalization" in this chapter.
ANSle
Three options have been added to the C compiler [see cc(1)] to help make the
transition to ANSI C confonnance [-Xt (transition), -Xa, (ANSI), and -Xc (con-
fonnance)]. These options specify the degree of confonnance ranging from
older compilation systems to the ANSI C standard.
The following topics for migrating from non-ANSI to ANSI C code are covered
in the ANSI C Transition Guide
• mixing old and new style functions
• functions with varying arguments
• promotions: unsigned vs. value
• tokenization and preprocessing
• using const and volatile
• multibyte characters and wide characters
• standard headers and reserved names
• internationalization
• grouping and evaluation in expressions
• incomplete types
• compatible and composite types
COFF to ELF
A new transparent object file format called ELF (Executable and Linking For-
mat), replaces the old format COFF (Common Object File Format).
COFF files should be converted to ELF files with the cof2elf command or by
recompiling the source. Recompilation is preferable because it guarantees that
executable programs will be compatible with new features in this release.
(Note, too, that cof2elf discards debugging information.) ELF is described in
detail in chapter 13, "Object Files," of the Programmer's Guide: ANSI C and Pro-
gramming Support Tools.