jsq@ut-sally.UUCP (08/14/83)
- 12 - 2.2.8 _T_i_m_i_n_g In 4.1C, all times are returned in a machine independent format, viz., seconds and microseconds. There is also improved timezone flexibility. (Systems in Australia and Europe should no longer experience difficulties with timezones.) 4.1C uses a simulated 100 Hertz line clock to report times more accurately than before. The new system call to replace _f_t_i_m_e and _t_i_m_e is called _g_e_t_t_i_m_e_o_f_d_a_y. Profiling using _p_r_o_f is also affected. The _g_e_t_i_t_i_m_e_r and _s_e_t_i_t_i_m_e_r system calls allow the use of three interval timers, one for real time, one for virtual time (i.e., the time the process is actually running), and one for user and system virtual time. The latter allows interpreters to be profiled, that is, keeping track of when the interpreted program, rather than the interpreter, is running. These timers had a bug in 4.1C, but work properly in 4.2. 2.2.9 _I_P_C The old MPX and FIFO IPC mechanisms have been largely superseded by the new mechanisms discussed below in the section on _I_P_C. 2.3 Libraries and Subroutines There are many changes in this section. 2.3.1 _C_o_m_m_o_n__O_b_j_e_c_t__F_i_l_e__F_o_r_m_a_t__r_o_u_t_i_n_e_s System V adds a number of routines to provide specialized open, close, seek, and read operations for files written in the Common Object File Format (see below). 2.3.2 _U_t_m_p__r_o_u_t_i_n_e_s In accordance with substantial changes to the format of the _u_t_m_p structure (see below) in System V, a collection of routines similar to those provided for manipulating the password file have been added to deal with the /etc/utmp and /etc/wtmp files. 2.3.3 _F_7_7__l_i_b_r_a_r_y See above under _P_r_o_g_r_a_m_m_i_n_g _s_u_p_p_o_r_t _e_n_v_i_r_o_n_m_e_n_t_s for f77. 2.3.4 _K_n_u_t_h__a_l_g_o_r_i_t_h_m_s In addition to the binary search (_b_s_e_a_r_c_h) and linear search (_l_s_e_a_r_c_h) algorithms available in System III, System V provides routines for searching hash tables (_h_s_e_a_r_c_h) and binary trees (_t_s_e_a_r_c_h). A related UNIX-specific utility, _f_t_w, provides the ability to recursively descend a directory tree, applying a user-supplied function at each node. (In other words, it is the subroutine equivalent of the _f_i_n_d command.) - 13 - 2.3.5 _S_o_f_t_w_a_r_e__s_i_g_n_a_l_s__a_n_d__m_a_t_h_e_r_r System V preserves the _s_s_i_g_n_a_l (and the associated _g_s_i_g_n_a_l) facility from System III, allowing the user to raise and dispose of software signals. A related topic is the inclusion in System V of _m_a_t_h_e_r_r, an error-handler invoked by functions in the math library. The user may supply his own version of _m_a_t_h_e_r_r to control the disposition of such errors. 4.1C preserves the software signals added in 4.1 to support the job control features of the Cshell; these are related to the ``new tty'' line discipline. (4.2 provides a new signal interface.) 2.3.6 _S_t_d_i_o__b_u_f_f_e_r_i_n_g 4.1C buffers output even if the output file is a terminal, but flushes all terminal or pipe output when the process attempts to read from a terminal or a pipe. 4.1C adapts its buffer size according to the block size of the file system containing the relevant files, to produce a marked speed improvement. The System V stdio buffers have been increased and the string-oriented output functions have been changed to provide pseudo-line buffered output to terminals if buffering has not been specified explicitly. As in 4.1C, output is flushed on terminal reads. Both systems keep stderr unbuffered. (The calling program may, of course, determine the buffering via _s_e_t_b_u_f.) In 4.2 _p_e_r_r_o_r does a single write (using _w_r_i_t_e_v to gather the arguments) to alleviate the problem of single- character network transfers, but _s_t_d_e_r_r is still unbuffered. 2.3.7 _P_r_i_n_t_f System V has dropped the System III (undocumented) _v_p_r_i_n_t_f and _v_f_p_r_i_n_t_f, retaining the V7 (undocumented) _d_o_p_r_n_t routine, such as is still used in 4.1C. The old (undocumented) %r format has apparently not been restored, however. In a similar vein, certain Berkeley programs assume that _s_p_r_i_n_t_f returns the address of the buffer, an undocumented feature that has been changed and properly documented in System V (the number of characters written is returned). System V _p_r_i_n_t_f follows the System III standard, which abolished the old capital letter formats ("%X", "%F") for long variables in favor of the prepended-`l' ("%lx", "%lf") format so that capital letters can be used in the - 14 - hexadecimal and floating point formats to mean capital letters in the output stream. 4.1C has basically the V7 _p_r_i_n_t_f and _s_c_a_n_f. The _p_r_i_n_t_f and _s_c_a_n_f formats are still not fully compatible in either system. 2.3.8 _S_t_r_i_n_g__r_o_u_t_i_n_e_s As in System III, System V changes the V7 (and 4BSD) _i_n_d_e_x and _r_i_n_d_e_x functions to _s_t_r_c_h_r and _s_t_r_r_c_h_r, respectively, as well as adding a few additional string routines reminiscent of certain SNOBOL pattern primitives. System V also provides new routines to perform basic memory-to-memory operations (copy, compare, etc.) based on byte count rather than a terminating null character. 4.1C provides the same functions via the _b_c_o_p_y _b_c_m_p, and _b_z_e_r_o routines, which are now in the C library as well as the kernel. 2.3.9 _N_e_t_w_o_r_k__l_i_b_r_a_r_y The 4.1C C library contains a collection of routines used for translating network-related names and numbers, such as _g_e_t_h_o_s_t_b_y_n_a_m_e, which takes the name of a host and returns its address. There are also a few routines for manipulating the byte order of network addresses, such as _h_t_o_n_l, which converts a network host address from network to host byte order, and some routines brought up from the kernel that are used for manipulating byte arrays, such as _b_z_e_r_o, which clears a byte array. 2.4 Devices Details of device drivers are beyond the scope of this paper. We only mention a few corresponding to the most important devices. 2.4.1 _T_t_y See above under _i_o_c_t_l for a discussion of the terminal driver changes. 2.4.2 _D_H_-_1_1 System V provides no support for the DH-11 terminal controller. Although DEC no longer supports this device, many installations either still own DEC DHs or emulations from other vendors. Also, DEC now supports the Emulex DH-11 emulation (CS21/H). The replacement is a combination of DZ-11s controlled by KMC-11Bs. The System III dh driver is probably portable to System V, but of course you must acquire a System III distribution. - 15 - 2.4.3 _K_M_C_-_1_1_B System V no longer supports the KMC-11A microprocessor. The KMC-11B may be used in conjunction with DZ-11s for offloading terminal I/O processing; it now performs batched character transfers, an improvement over the character-at- a-time behavior (a bug) exhibited by System III. The KMC-11B, as well as the KMS11 (KMC11 plus DMS11- DA), is also used as the ``Programmable Communications Device'' (PCD) on which link-level protocols are implemented under VPM. 2.4.4 _V_P_M The Virtual Protocol Machine (VPM) is a package which supports a high-level definition language for level 2 protocols to be handled by an interpreter running in a PCD. In this manner, IBM RJE, a synchronous pseudo-terminal interface, and several network protocols, including X.25 but not TCP/IP, may be supported. 2.4.5 _S_y_n_c_h_r_o_n_o_u_s__t_e_r_m_i_n_a_l System V documents support for a synchronous terminal interface utilizing the _V_i_r_t_u_a_l _P_r_o_t_o_c_o_l _M_a_c_h_i_n_e, but it was not included in the distribution. 2.4.6 _B_L_I_T At the time of this writing, the driver for the Teletype 5620 bit-mapped terminal was available only as a System V-compatible binary object. 2.4.7 _P_t_y_s 4.1C has a pseudo-terminal driver to support network connections. This is actually a driver for two devices, a slave (/dev/ttyp?) and a master (/dev/ptyp?) end, where the slave end looks exactly like an ordinary terminal and the master end (used by network daemons such as _r_l_o_g_i_n_d and _t_e_l_n_e_t_d) has a few extra _i_o_c_t_ls to aid in simulating a terminal. This device is quite important in the common situation in which there are few directly-connected terminals and most users log in over a local network. Pseudo-terminals are also important for such programs as _E_m_a_c_s and _s_c_r_i_p_t. 2.4.8 _G_e_n_e_r_a_l_i_z_e_d__d_i_s_k__d_r_i_v_e_r System V provides a generalized driver _g_d for several moving-head disks (RM05, RM80, RP04/5/6/7). The System V driver may be derived from the Berkeley _h_p driver, which supports all MASSBUS drives. - 16 - The drive type is determined in both systems by examining the device type register and then using different parameter tables per drive. 2.4.9 _G_e_n_e_r_a_l_i_z_e_d__t_a_p_e__d_r_i_v_e_r A generalized tape driver _g_t similar to the generalized disk driver is provided by System V. This driver offers a general interface to the TE16 and TU78 style tape drives. The Berkeley _h_t drivers support all MASSBUS tape drives except the TU78, which is supported by the _m_t driver. Again, device information is determined by examining the device hardware type register. 2.5 File Formats A few file formats are worth mention. In particular, System V has reorganized several standard file formats, with important consequences. 2.5.1 _A_._o_u_t The details of the binary object file format for commands are sufficiently different between the two systems that it is not possible to run an object file from one system on the other. The Common Object File Format (_C_O_F_F) has been adopted in System V as the standard output format for programs such as _a_s and _l_d in an effort to provide uniformity across several processors and compatibility with certain other operating systems. The traditional UNIX _a._o_u_t header is included as a part of the _C_O_F_F header information. Other _C_O_F_F information includes such things as the architecture of the host on which the file was created, line numbers if a symbolic debugging option was in effect at compile time, and so forth. The _c_o_n_v_e_r_t utility may be used to convert pre-System V objects to _C_O_F_F. 2.5.2 _A_r The System V format for file archives has changed somewhat from previous releases of UNIX. In particular, an archive now includes a symbol directory created from the symbol tables of all archive members which are in _C_O_F_F to allow _l_d to perform random access on the archive. In addition, numeric data in headers (archive, symbol directory, member) is stored as 4-byte quantities and should be portably accessed using the _s_p_u_t_l and _s_g_e_t_l library calls from libld.a.