[Contents] [Prev. Chapter] [Next Section] [Next Chapter] [Index] [Help]

B    Differences in ULTRIX and DIGITAL UNIX Header Files and Library Routines

A number of system header files are different between the DIGITAL UNIX and ULTRIX systems. In some cases, an ULTRIX header file is unavailable on DIGITAL UNIX systems. Some differences between DIGITAL UNIX and ULTRIX header files are in the definitions of constants. Some constants that are defined on ULTRIX systems are undefined on DIGITAL UNIX systems; other constants have different values on DIGITAL UNIX and ULTRIX systems. Other differences are in the definitions of functions. Some ULTRIX functions are not defined on DIGITAL UNIX systems; others have different parameters or return values. These differences might affect the binary or source portability of your application.

The header files for the system are so numerous that it is difficult to compile a complete list. The following sections describe known differences in /usr/include that may cause problems when porting binary or source code and describes the effects the differences have on program portability.


[Contents] [Prev. Chapter] [Next Section] [Next Chapter] [Index] [Help]

B.1    Changes in the acct.h File

The /usr/include/sys/acct.h header file defines data types and structures for use by programs that perform accounting. The following definitions are different between ULTRIX and DIGITAL UNIX systems:

Definition Type on ULTRIX Type on DIGITAL UNIX
ac_uid short uid_t (4 bytes)
ac_gid short gid_t (4 bytes)
ac_tty short dev_t (4 bytes)


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.2    Changes in the disktab.h File

The disktab.h header file defines structures, symbols, and routines that work with disk geometries and disk partition characteristics. On DIGITAL UNIX systems, the file omits the following definition:

struct disktab  *creatediskbyname();

The DIGITAL UNIX system does not provide the creatediskbyname routine. You must remove references to that routine from your application.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.3    Changes in the dli_var.h File

The dli_var.h header file defines constants and structures used by Data Link Interface (DLI) applications. The file is named /usr/include/dli/dli_var.h on DIGITAL UNIX systems. In addition, the sockaddr_dl structure contains the following new field, beginning in the first byte:

u_char dli_len;


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.4    Changes in the errno.h File

The errno.h header file defines constants that system calls store in the global errno variable when an error occurs.

The following definitions are not available and will have an impact on your ability to port source code:

Most of these definitions are used with DIGITAL Storage Architecture (DSA) mass storage controllers, such as the CI bus and HSC controller, which are not supported by the DIGITAL UNIX system.

See intro(2) for a list of DIGITAL UNIX errno definitions.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.5    Changes in the fcntl.h File

The /usr/include/fcntl.h file on ULTRIX systems includes the /usr/include/sys/file.h file. On DIGITAL UNIX systems, the included file is named /usr/include/sys/fcntl.h, and it contains a different set of definitions. If your application needs the definitions in /usr/include/sys/file.h, you must include that file explicitly.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.6    Changes in the fstab.h File

The fstab.h header file defines information about the known file system. On DIGITAL UNIX systems, the file omits the following definition:

struct fstab  *getfstype();

In addition, the last two members of the fstab structure have been renamed from fsname to fs_vfstype and from fs_opts to fs_mntops.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.7    Changes in the in.h File

The /usr/include/netinet/in.h file defines constants and structures defined by the internet system. On DIGITAL UNIX systems, the file has changed the definition of the in_addr structure.

On ULTRIX systems:

    struct in_addr {
            union {
                    struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
                    struct { u_short s_w1,s_w2; } S_un_w;
                    u_long S_addr;
            } S_un;
    };

On DIGITAL UNIX systems:

    struct in_addr {
            u_int s_addr;
    };


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.8    Changes in the ioctl.h and ioctl_compat.h Files

The ioctl.h and the ioctl_compat.h header files define requests and structures that you use with the ioctl system call.

The following definitions are not available and will have an impact on your ability to port source code:

DIGITAL UNIX systems use POSIX library routines to provide greater application portability. See Appendix D for examples of ULTRIX and DIGITAL UNIX modem control applications.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.9    Changes in the langinfo.h File

The langinfo.h header file defines constants that you use to get internationalization information with the nl_langinfo routine. Two of the constants that you could use as arguments to the ULTRIX nl_langinfo routine are not defined in the DIGITAL UNIX langinfo.h file. The EXPL_STR constant, which on the ULTRIX system returns a lowercase letter that you can use for an exponent character, is not defined on DIGITAL UNIX systems. The EXPU_STR constant, which on ULTRIX returns an uppercase character that you can use for an exponent character, is also not defined on DIGITAL UNIX systems.

The ic compiler ignores these constants if you use them.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.10    Changes in the limits.h File

On DIGITAL UNIX systems, the limits.h file defines certain system limits, such as the maximum number of bytes that you can use to specify a pathname or the maximum message set number that you can use in an internationalization message catalog. Some limits have changed between ULTRIX and DIGITAL UNIX systems. Table B--1 describes the differences.

Table B--1:  Differences in System Limits

Macro Name Description ULTRIX Limit DIGITAL UNIX Limit
LONG_BIT Maximum number of bits in a type 32 64
LONG_MAX Maximum value of a long type 2,147,483,647 9,223,372,036,854,775,807
LONG_MIN Minimum value of a long type -2,147,483,648 -9,223,372,036,854,775,808
MB_LEN_MAX Maximum number of bytes in a multibyte character 1 2
NL_LANGMAX Maximum length, in bytes, of a string that can be stored in the LANG environment variable 32 14
NL_LBLMAX Maximum number of labels that can be specified in an internationalization message catalog 32,767 Undefined
NL_MSGMAX Maximum number that can be assigned to a message in an internationalization message catalog 32,767 65,535
NL_NMAX Maximum n-to-1 bytes in mapping character 2 10
NL_SETMAX Maximum message set number that can be used in an internationalization message catalog 255 65,535
NL_TEXTMAX Maximum number of bytes that can be in a single program message specified in an internationalization message catalog 2048 4096
ULONG_MAX Maximum value of an unsigned long type 4,294,967,295 18,446,744,073,709,551,615


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.11    Changes in the math.h File

The math.h header file declares the functions in the math library, as well as various functions in the C library that return floating-point values. The DIGITAL UNIX math.h file omits the declaration of the atof routine. This routine is declared in the stdlib.h file on the DIGITAL UNIX system.

If you use the atof routine on a DIGITAL UNIX system, be sure your source file includes the stdlib.h file.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.12    Changes in the resource.h File

The resource.h file defines a structure named rusage. This structure has fewer fields on a DIGITAL UNIX system than it does on an ULTRIX system. The definition on the ULTRIX system contains a field for the integral shared text size. The DIGITAL UNIX definition omits this field.

You must modify your application if it depends upon the ULTRIX definition of the rusage structure.

On DIGITAL UNIX systems, the two members of the rlimit structure, rlim_cur and rlim_max are defined as unsigned long instead of as int on ULTRIX systems. You must modify your application if it depends on this structure. Otherwise, the getrlimit and setrlimit calls will fail because of a register sign extension.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.13    Changes in the stddef.h File

On ULTRIX systems, the wchar_t variable that is defined in stddef.h is declared to be an unsigned integer (32 bits). On DIGITAL UNIX systems, the variable is declared to be an unsigned short integer (16 bits).

On ULTRIX systems, the size_t variable that is defined in stddef.h is declared to be an unsigned integer (32 bits). On DIGITAL UNIX systems, the variable is declared to be an unsigned long integer (64 bits).


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.14    Changes in the stdio.h File

The stdlib.h header file defines constants and functions I/O services. The following constant values have been changed in the DIGITAL UNIX stdio.h file:

Constant ULTRIX Value DIGITAL UNIX Value
BUFSIZ 1024 8192
FILENAME_MAX 1024 255
TMP_MAX 17,576 16,384


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.15    Changes in the stdlib.h File

The stdlib.h header file defines constants and functions for ANSI compatibility. Two constants are defined to a different value on DIGITAL UNIX and ULTRIX systems. On DIGITAL UNIX systems, the RAND_MAX value is defined as 2,147483,647. On ULTRIX systems, this constant is defined to be 32,767. On DIGITAL UNIX systems, MB_CUR_MAX is defined as the function _ _getmbcurmax(). This function returns the maximum number of bytes allowed in a multibyte character in the current locale. That number is 1 for all the DIGITAL UNIX locales. On ULTRIX systems, MB_CUR_MAX is defined as 4.


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.16    Changes in the syslog.h File

The syslog.h header file defines constants that are used in the system log. This header file also defines the routines that control the system log. The definition for the openlog routine is different on DIGITAL UNIX systems. On a DIGITAL UNIX system, the definition is as follows:

int openlog (const char *, int, int);

This definition adds an extra parameter to the openlog call. For information about using the DIGITAL UNIX openlog call, see openlog(3).


[Contents] [Prev. Chapter] [Prev. Section] [Next Section] [Next Chapter] [Index] [Help]

B.17    Changes in the termio.h and termios.h Files

The termio.h and termios.h header files define structures and flags used to control terminals. The definition of the structures termio and termios differs between DIGITAL UNIX and ULTRIX systems. For termios, the DIGITAL UNIX system defines additional members to control input and output speeds and does not contain the ULTRIX c_line member for defining the line discipline. ULTRIX systems define line speed in the low-order 4 bits of the c_cflag member.

A number of flags that have been defined for both termios.h and termio.h are common between ULTRIX and DIGITAL UNIX systems; however, their actual definitions can be different across systems. Additionally, several of the definitions in /usr/include/termio.h on the ULTRIX system are located in the DIGITAL UNIX /usr/include/termios.h file. This change should be transparent because the ULTRIX termios.h file includes termio.h for these definitions.

ULTRIX and DIGITAL UNIX systems have different implementations of some of the processing options that are extensions to the POSIX and X/Open standards, as shown in the following table:

termios Member ULTRIX Name DIGITAL UNIX Name
Special control characters defined by the array c_cc None VSTATUS
Bit fields defined by c_iflag for basic terminal input control NonePPENDINTCBREAK IMAXBELNoneNone
Bit fields defined by c_oflag for system treatment of output NoneNonePTILDEPFLUSHOPLITOUTPNL2 OXTABSONOEOTNoneNoneNoneNone
Bit fields defined by c_lflag for control of various terminal functions NoneNoneNoneNoneNoneNoneNoneNonePRAWPPRTERAPCRTBSPCRTERAPCRTKIL ECHOKEECHOPRTALTWERASEMDMBUFFLUSHONOHANGPENDINNOKERNINFONoneNoneNoneNoneNone


[Contents] [Prev. Chapter] [Prev. Section] [Next Chapter] [Index] [Help]

B.18    Nonexistent Header Files

Several header files that are part of the ULTRIX system are not included in the DIGITAL UNIX system. Table B--3 lists these files and describes the effects of removing references to them from your source code.

Table B--3:  ULTRIX Header Files Not Present on DIGITAL UNIX Systems

Header File Description
ansi_compat.h Defines ANSI-style predefined macros. On DIGITAL UNIX systems, these definitions are provided either by the C preprocessor or the standards.h file. Removing references to this file has no effect.
auth.h Defines symbols for the authorization library routines, which are unavailable on DIGITAL UNIX systems. You must also remove references to the getauthuid, endauthent, storeauthent, and setauthfile routines.
cat.h Contains no definitions on an ULTRIX system. Removing the #include directive for this file has no effect.
cursesX.h Defines symbols used by the curses terminal-handling routines. Replaced by the curses.h file; change references accordingly.
des.hkrb.h These files define symbols used by the Kerberos library routines, which are unavailable on DIGITAL UNIX systems. You must remove references to these files and to any Kerberos routines.
dial.h Contains definitions used by the dial() and undial() routines.
elcsd.helwindow.h These files define symbols used by the ULTRIX error logger routines. They are not used by user applications.
execargs.h Contains no definitions on an ULTRIX system. Removing the #include directive for this file has no effect.
fpi.h Contains definitions used by the floating-point mathematical routines.
hesiod.h Defines symbols for the Hesiod name service, which is unavailable on DIGITAL UNIX systems. You must remove references to this file and to the hes_init, hes_to_bind, hes_error, and hes_resolve routines.
ieeefp.h Contains definitions for handling Not_a_Numbers (NaN). For standards conformance, these definitions are now in the /usr/include/math.h and /usr/include/nan.hm files.
i_errno.h Defines internationalization error numbers. Not typically used by user applications. If your application uses these definitions, create your own file of definitions and include that file.
nlm_prot.h Contains definitions used by the ONC lock manager daemon. This header file is not needed by user applications.
prof.h Contains no definitions on an ULTRIX system. Removing the #include directive for this file has no effect.
resscan.h Defines symbols used by the ULTRIX Hesiod routines. This file is not used by user applications.
stand.h Contains definitions for the ULTRIX standalone system. This header file is not needed on DIGITAL UNIX systems.
sysmips.h Defines MIPS specific system calls. All system calls are defined in the /usr/include/syscall.h file.
ttyio.h Contains terminal (tty) common structures and definitions. Use the /usr/include/ioctl.h file.


[Contents] [Prev. Chapter] [Prev. Section] [Next Chapter] [Index] [Help]