This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++23 status.

3869. Deprecate std::errc constants related to UNIX STREAMS

Section: 19.5.2 [system.error.syn] Status: C++23 Submitter: Jonathan Wakely Opened: 2023-01-30 Last modified: 2023-11-22

Priority: Not Prioritized

View all other issues in [system.error.syn].

View all issues with C++23 status.

Discussion:

This is the resolution for NB comment GB-084

The error numbers ENODATA, ENOSR, ENOSTR and ETIME are all marked "obsolecent" in POSIX 2017 (the current normative reference for C++) and they are absent in the current POSIX 202x draft. They related to the obsolete STREAMS API, which was optional and not required for conformance to the previous POSIX standard (because popular unix-like systems refused to implement it). C++11 added those error numbers to <errno.h> and also defined corresponding errc enumerators: errc::no_message_available, errc::no_stream_resources, errc::not_a_stream and errc::stream_timeout.

Given the obsolescent status of those constants in the current normative reference and their absence from the next POSIX standard, WG21 should consider deprecating them now. A deprecation period will allow removing them when C++ is eventually rebased to a new POSIX standard. Otherwise C++ will be left with dangling references to ENODATA, ENOSR, ENOSTR and ETIME that are not defined in the POSIX reference.

After a period of deprecation they can be removed from Annex D, and the names added to 16.4.5.3.2 [zombie.names] so that implementations can continue to define them if they need to.

[Issaquah 2023-02-06; LWG]

Unanimous consent (9/0/0) to move to Immediate for C++23.

[2023-02-13 Approved at February 2023 meeting in Issaquah. Status changed: Immediate → WP.]

Proposed resolution:

This wording is relative to N4928.

  1. Modify 19.4.2 [cerrno.syn], header <cerrno> synopsis, as indicated:

    
      #define ENETUNREACH see below
      #define ENFILE see below
      #define ENOBUFS see below
      #define ENODATA see below
      #define ENODEV see below
      #define ENOENT see below
      #define ENOEXEC see below
      #define ENOLCK see below
      #define ENOLINK see below
      #define ENOMEM see below
      #define ENOMSG see below
      #define ENOPROTOOPT see below
      #define ENOSPC see below
      #define ENOSR see below
      #define ENOSTR see below
      #define ENOSYS see below
      #define ENOTCONN see below
      #define ENOTDIR see below
      #define ENOTEMPTY see below
      ...
      #define EROFS see below
      #define ESPIPE see below
      #define ESRCH see below
      #define ETIME see below
      #define ETIMEDOUT see below
      #define ETXTBSY see below
      #define EWOULDBLOCK see below
      #define EXDEV see below
    

    -1- The meaning of the macros in this header is defined by the POSIX standard.

  2. Modify 19.5.2 [system.error.syn], header <system_error> synopsis, as indicated:

    
        no_child_process,                   // ECHILD
        no_link,                            // ENOLINK
        no_lock_available,                  // ENOLCK
        no_message_available,               // ENODATA
        no_message,                         // ENOMSG
        no_protocol_option,                 // ENOPROTOOPT
        no_space_on_device,                 // ENOSPC
        no_stream_resources,                // ENOSR
        no_such_device_or_address,          // ENXIO
        no_such_device,                     // ENODEV
        no_such_file_or_directory,          // ENOENT
        no_such_process,                    // ESRCH
        not_a_directory,                    // ENOTDIR
        not_a_socket,                       // ENOTSOCK
        not_a_stream,                       // ENOSTR
        not_connected,                      // ENOTCONN
        not_enough_memory,                  // ENOMEM
        ...
        result_out_of_range,                // ERANGE
        state_not_recoverable,              // ENOTRECOVERABLE
        stream_timeout,                     // ETIME
        text_file_busy,                     // ETXTBSY
        timed_out,                          // ETIMEDOUT
    
  3. Modify 99 [depr], Annex D, Compatibility Features, by adding a new subclause before [depr.default.allocator]: :

    D.?? Deprecated error numbers [depr.cerrno]

    -1- The following macros are defined in addition to those specified in 19.4.2 [cerrno.syn]:

    
      #define ENODATA see below
      #define ENOSR see below
      #define ENOSTR see below
      #define ETIME see below
    

    -2- The meaning of these macros is defined by the POSIX standard.

    -4- The following enum errc enumerators are defined in addition to those specified in 19.5.2 [system.error.syn]:

    
      no_message_available,               // ENODATA
      no_stream_resources,                // ENOSR
      not_a_stream,                       // ENOSTR
      stream_timeout,                     // ETIME
    

    -4- The value of each enum errc enumerator above is the same as the value of the <cerrno> macro shown in the above synopsis.