Skip to content
  • Pekka Paalanen's avatar
    os: wrap socket(SOCK_CLOEXEC) calls · 7134a439
    Pekka Paalanen authored
    
    
    Some system C libraries do not offer SOCK_CLOEXEC flag.
    
    Add a new header for OS compatibility wrappers. Wrap socket() calls into
    wl_os_socket_cloexec() which makes sure the O_CLOEXEC flag gets set on
    the file descriptor.
    
    On systems having SOCK_CLOEXEC this uses the old socket() call, and
    falls back if it fails due to the flag (kernel not supporting it).
    
    wayland-os.h is private and not exported.
    
    Add close-on-exec tests for both normal and forced fallback paths.
    
    Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <ppaalanen@gmail.com>
    7134a439