What is UNIX

What's New in the Single UNIX Specification, Version 2

The Open Group published Version 2 of the Single UNIX Specification in February 1997. The Single UNIX Specification is a collection of documents that are part of the Open Group's Common Applications Environment (CAE), and consists of:

This article gives an overview of the new features of Single UNIX Specification, Version 2. For each specification a brief description of the changes is given.


The Single UNIX Specification, Version 2 incorporates and aligns with the following:

New Interfaces in XSH

New system interfaces have been originated as follows:

POSIX Realtime Extension

The Single UNIX Specification, Version 2 incorporates IEEE Std 1003.1b-1993 and IEEE Std 1003.1i-1995. These are organized as an Optional Feature Group within the Single UNIX Specification, Version 2, denoted by the symbol _XOPEN_REALTIME.

By organizing the majority of the IEEE Std 1003.1b-1993 feature options into a single Feature Group, it is possible for applications running on an X/Open realtime system to reliably utilize a cohesive set of realtime features.

Functional Overview

The functionality introduced by the POSIX Realtime Extension includes:

Mandatory Functionality

Some parts of the POSIX Realtime Extension are mandatory in the Single UNIX Specification, Version 2, since they were previously in the Single UNIX Specification. These are as follows:

Mandatory POSIX Realtime Extension functions:

  mmap munmap mprotect   msync fsync fchmod   ftruncate

Mandatory POSIX Realtime Extension headers:


Optional Functionality

The majority of the rest of the POSIX Realtime Extension is mandatory when _XOPEN_REALTIME is set to a value other than -1. The exception to this is _POSIX_PRIORITIZED_IO which is always optional.

The functions in the Realtime Threads Feature Group are:

  aio_cancel aio_error aio_fsync aio_read aio_return aio_suspend aio_write clock_getres clock_gettime clock_settime fdatasync lio_listio mlock mlockall mq_close mq_getattr mq_notify mq_open   mq_receive mq_send mq_setattr mq_unlink munlock munlockall nanosleep sched_get_priority_max sched_get_priority_min sched_getparam sched_getscheduler sched_rr_get_interval sched_setparam sched_setscheduler sched_yield sem_close sem_destroy sem_getvalue   sem_init sem_open sem_post sem_trywait sem_unlink sem_wait shm_open shm_unlink sigqueue sigtimedwait sigwaitinfo timer_create timer_delete timer_getoverrun timer_gettime timer_settime

The headers are:

  aio.h   mqueue.h   sched.h

ISO C Amendment 1 (MSE)

The Single UNIX Specification, Version 2 is fully aligned with ISO/IEC 9899:1990/Amendment 1:1995 (E), which adds extensive multibyte support to the ISO C standard. The value of __STDC__VERSION for this version of the specification is 199409L.

The Single UNIX Specification, Version 2 includes the following new interfaces and header files from the ISO C Amendment 1 (MSE):

New interfaces:

  btowc fwide fwprintf fwscanf mbrlen mbrtowc mbsinit mbsrtowcs swprintf   swscanf towctrans vfwprintf vswprintf vwprintf wcrtomb wcsrtombs wcsstr wctob   wctrans wmemchr wmemcmp wmemcpy wmemmove wmemset wprintf wscanf

New headers:

  iso646.h   wctype.h

The iso646.h header contains alternative spellings for C-language tokens.

The wctype.h header contains the multibyte versions of the functions contained in ctype.h .

Dynamic Linking

The Single UNIX Specification, Version 2 Dynamic Linking extension that came out of the Aspen group comprises a set of four routines and a header file to provide a portable dynamic linking API.

The routines are:

  dlopen dlsym   dlclose   dlerror

POSIX Threads Extension

The Single UNIX Specification includes support for threads programming that allows multiple tasks to run concurrently within the same program.

Multi-threading capabilities give a large benefit to certain classes of applications, typically server or parallel processing applications, allowing them to:

The threads capabilities included in the Single UNIX Specification are built upon the IEEE Std 1003.1c-1995, known as Pthreads, with additional X/Open Threads Extensions.

Functional Overview

Pthreads is a general threads API, specifiying a robust set of threads facilities, including new thread-specific APIs for the following:

The majority of the Pthreads functionality is mandatory in the Single UNIX Specification, Version 2, apart from the interfaces covered by the POSIX Threads compile-time symbolic constants _POSIX_THREAD_PRIO_INHERIT, _POSIX_THREAD_PRIO_PROTECT and _POSIX_THREAD_PRIORITY_SCHEDULING as defined in unistd.h . These options collectively make up the Realtime Threads Feature Group.

Mandatory Functionality

On systems conforming to Single UNIX Specification, Version 2 the symbols _POSIX_THREADS, _POSIX_THREAD_ATTR_STACKADDR, _POSIX_THREAD_SAFE_FUNCTIONS, _POSIX_THREAD_ATTR_STACKSIZE and _POSIX_THREAD_PROCESS_SHARED are always defined. Therefore, the following threads interfaces are always supported:

  asctime_r ctime_r flockfile ftrylockfile funlockfile getc_unlocked getchar_unlocked getgrgid_r getgrnam_r getpwnam_r getpwuid_r gmtime_r localtime_r pthread_addr_setstacksize pthread_atfork pthread_attr_destroy pthread_attr_getdetachstate pthread_attr_getschedparam pthread_attr_getstackaddr pthread_attr_getstacksize pthread_attr_init pthread_attr_setdetachstate pthread_attr_setschedparam pthread_attr_setstackaddr pthread_cancel pthread_cleanup_pop pthread_cleanup_push pthread_cond_broadcast pthread_cond_destroy pthread_cond_init pthread_cond_signal pthread_cond_timedwait pthread_cond_wait pthread_condattr_destroy pthread_condattr_getpshared   pthread_condattr_init pthread_condattr_setpshared pthread_create pthread_detach pthread_equal pthread_exit pthread_getschedparam pthread_getspecific pthread_join pthread_key_create pthread_key_delete pthread_kill pthread_mutex_destroy pthread_mutex_init pthread_mutex_lock pthread_mutex_trylock pthread_mutex_unlock pthread_mutexattr_destroy pthread_mutexattr_getpshared pthread_mutexattr_init pthread_mutexattr_setpshared pthread_once pthread_self pthread_setcancelstate pthread_setcanceltype pthread_setschedparam pthread_setspecific pthread_sigmask pthread_testcancel putc_unlocked putchar_unlocked rand_r readdir_r sigwait strtok_r

Optional Functionality

The optional interfaces derived from Pthreads in the Realtime Threads Feature Group are:

  pthread_attr_getinheritsched pthread_attr_getschedpolicy pthread_attr_getscope pthread_attr_setinheritsched pthread_attr_setschedpolicy pthread_attr_setscope pthread_getschedparam   pthread_setschedparam pthread_mutexattr_setprotocol pthread_mutexattr_getprotocol pthread_mutexattr_setprioceiling pthread_mutexattr_getprioceiling pthread_mutex_getprioceiling pthread_mutex_setprioceiling

X/Open Threads Extension

Threads support in the Single UNIX Specification adds new extensions to IEEE Std 1003.1c-1995. The threads extensions over POSIX came from the Aspen group, and include extensions made by DCE as well as SUN, HP and Digital. The following extensions are made over POSIX threads:

The mandatory interfaces in the X/Open Threads Extension are:

  pthread_setconcurrency pthread_getconcurrency pthread_rwlock_destroy pthread_rwlock_init pthread_rwlock_rdlock pthread_rwlock_tryrdlock pthread_rwlock_trywrlock pthread_rwlock_unlock pthread_rwlock_wrlock pthread_rwlockattr_destroy   pthread_rwlockattr_getpshared pthread_rwlockattr_init pthread_rwlockattr_setpshared pthread_mutexattr_gettype pthread_mutexattr_settype pthread_attr_getguardsize pthread_attr_setguardsize pread pwrite

Large File Support

The Single UNIX Specification, Version 2 includes changes submitted by the Large File Summit. These include the following new functions:

  fseeko   ftello

Data Size Neutrality

The following header file has been added to support new opaque types:



The following were added to address some generic problems of the form sprintf(s, f, data) or vsprintf(s, f, args) where the data written to the string s is too long for the string. This can cause crashes or other security holes in vulnerable applications.

  snprintf   vsnprintf

New Utilities in XCU

The major changes in XCU, Issue 5 have been the introduction of the LEGACY class of utility, and Large File Support.


The utilities in the table below are marked LEGACY. Support for these utilities is optional, and thus these may not be supported on all implementations. Application writers should not use functionality marked LEGACY. Many of these utilities were previously marked TO BE WITHDRAWN in XCU, Issue 4, Version 2.

To determine if the LEGACY utilities are collectively supported use the getconf utility with the _XOPEN_LEGACY system_var .

  calendar cancel cc col cpio cu dircmp   dis* du egrep fgrep line lint lpstat   mail pack pcat pg spell sum tar   unpack uulog uuname uupick uuto

Large File Support

The following utilities support files of any size up to the maximum that can be created by the implementation. This support includes correct writing of file size-related values (such as file sizes and offsets, line numbers and block counts) and correct interpretation of command line arguments that contain such values.

Return non-directory portion of pathname.

Concatenate and print files.

Change working directory.

Change file group ownership.

Change file modes.

Change file ownership.

Write file checksums and sizes.

Compare two files.

Copy files.

Convert and copy a file.

Report free disk space.

Return directory portion of pathname.

Estimate file space usage.

Find files.

Link files.

List directory contents.

Make directories.

Move files.

Check pathnames.

Return working directory name.

Remove directory entries.

Remove directories.

Shell, the standard command language interpreter.

Print checksum and block or byte count of a file.

Evaluate expression.

Change file access and modification times.

Set or report file size limit.

Exceptions to the requirement that utilities support files of any size up to the maximum are:

  1. Utilities such as tar and cpio cannot support arbitrary file sizes due to limitations imposed by fixed file formats.

  2. Uses of files as command scripts, or for configuration or control, are exempt. For example, it is not required that sh be able to read an arbitrarily large ".profile".

  3. Shell input and output redirection are exempt. For example, it is not required that the redirections sum < file or echo foo > file succeed for an arbitrarily large existing file.

New Utilities

The following utilities are new in XCU:

  fuser ipcrm   ipcs link   unlink

New Interfaces in Networking Services, Issue 5

Networking Services, Issue 5 contains a number of new features.

The most important is the removal of implicit data length assumptions (for example, that an item of type int is 32 bits long). This enables the APIs to be used effectively on new computer architectures with 64-bit (or bigger) word lengths. There are other improvements too, including:

The following functions are new in Networking Services, Issue 5:

  t_rcvv t_rcvvudata   t_sndv t_sndvudata

New Curses Interfaces

X/Open Curses, Issue 4, Version 2 contains corrections and clarifications which have been suggested by industry feedback based on Version 1 of the specification. In particular the following changes were made:

The following functions are new in X/Open Curses, Issue 4, Version 2:

  attr_get attr_off attr_on attr_set color_set slk_attroff slk_attr_off slk_attron slk_attr_on slk_attrset   slk_attr_set slk_clear slk_color slk_init slk_label slk_nooutrefresh slk_refresh slk_restore slk_set slk_touch   slk_wset term_attrs vid_attr vid_puts wattr_get wattr_off wattr_on wattr_set wcolor_set

More Information

More information on the Single UNIX Specification, Version 2 can be obtained from the following sources:

Read other technical papers.

Read or download the complete Single UNIX Specification from http://www.UNIX-systems.org/go/unix.

Copyright © 1997-1998 The Open Group

UNIX is a registered trademark of The Open Group.