[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

accept4 and SOCK_NONBLOCK

From: Richard W.M. Jones
Subject: accept4 and SOCK_NONBLOCK
Date: Tue, 20 Aug 2019 16:27:05 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

First of all I'm using Linux 5.0.17 & glibc-2.29-15 so as far as I'm
aware accept4 exists and fully works and gnulib shouldn't be replacing
it at all.  I don't understand why it's being replaced.

But given that, in libguestfs we call:

  r = accept4 (console_sock, NULL, NULL, SOCK_NONBLOCK|SOCK_CLOEXEC);


This is a valid set of flags according to the Linux man page for
accept4(2).  But it fails with EINVAL because of the following test in

  if ((flags & ~(SOCK_CLOEXEC | O_TEXT | O_BINARY)) != 0)
      errno = EINVAL;
      return -1;


So I think the set of flags should be broadened to include
SOCK_NONBLOCK + add a call to set_nonblocking_flag.

As for why accept4 is being replaced at all, the only reference to it
in config.log is:

  configure:25630: checking whether accept4 is declared
  configure:25630: gcc -c -O2 -g -pipe -Wall -Werror=format-security 
-fstack-protector-strong -grecord-gcc-switches 
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic 
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  
conftest.c >&5
  configure:25630: $? = 0
  configure:25630: result: yes


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch

reply via email to

[Prev in Thread] Current Thread [Next in Thread]