[PATCH 00/22] Simplify inclusion conditionals

Alejandro Colomar alx.manpages at gmail.com
Sun Jun 19 13:50:10 UTC 2022


Hi Andrew,

This patch set simplifies the rules for including files, so that
widely-available headers, especially those required by
POSIX.1-2001, are included unconditionally.

Then, headers that may not exist in some systems are included
conditionally to their existence.  For that we need to add a new
set of NXT_HAVE_..._H macros created by the new <auto/headers>
script.

This patch set fixes some obscure dependencies between headers,
which when reordering some include files, triggers MacOS to
include <mntent.h>, which doesn't exist in that system.  After
this patch set, since the header doesn't exist, it's not included.

This is a prerequisite for even attempting to use iwyu(1).

Cheers,

Alex

Alejandro Colomar (22):
  Including <mntent.h> iff it exists.
  Including <sys/prctl.h> iff it exists.
  Including <linux/openat2.h> iff it exists.
  Including <sys/mount.h> unconditionally.
  Including <sys/random.h> iff it exists.
  Including <sys/sendfile.h> iff it exists.
  Including <sys/pollset.h> iff it exists.
  Including <sys/devpoll.h> iff it exists.
  Including <port.h> iff it exists.
  Including <sys/event.h> iff it exists.
  Including <sys/eventfd.h> iff it exists.
  Including <sys/signalfd.h> iff it exists.
  Including <sys/epoll.h> iff it exists.
  Including <sys/un.h> iff it exists.
  Removed code used when NXT_HAVE_POSIX_SPAWN is false.
  Including <sys/mercury.h> iff it exists.
  Including <malloc_np.h> iff it exists.
  Including <sys/param.h> unconditionally.
  Including <sys/uio.h> unconditionally.
  Including <sys/syscall.h> and <unistd.h> unconditionally.
  Including <linux/memfd.h> iff it exists.
  Including <linux/capability.h> iff it exists.

 auto/headers          | 224 ++++++++++++++++++++++++++++++++++++++++++
 auto/unix             |  15 ---
 configure             |   1 +
 src/nxt_application.c |   2 +-
 src/nxt_capability.c  |   8 +-
 src/nxt_fs.c          |   2 -
 src/nxt_isolation.c   |   2 +-
 src/nxt_port_memory.c |   7 +-
 src/nxt_process.c     |  50 +---------
 src/nxt_process.h     |   4 +-
 src/nxt_socket_msg.h  |   2 +-
 src/nxt_unit.c        |   2 +-
 src/nxt_unix.h        |  47 ++++-----
 13 files changed, 261 insertions(+), 105 deletions(-)
 create mode 100644 auto/headers

-- 
2.36.1



More information about the unit mailing list