--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+/* sys/param.h from glibc unconditionally overrides the MIN() and MAX() macros which interferes with our own
+ * MAX() macro. It also includes a bunch of other headers transitively so we don't want to include
+ * sys/param.h in macro-fundamental.h unconditionally. We'd like to make including this file an error but
+ * unfortunately <resolv.h> includes it. However, <resolv.h> doesn't actually make use of anything from
+ * sys/param.h, so we override it with an empty file so it can't mess with our macros. */
#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
-#include <sys/param.h>
#include <sys/sysmacros.h>
#include <sys/types.h>
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include <signal.h>
+
#include "macro.h"
#include "memory-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <unistd.h>
+
#include "alloc-util.h"
#include "conf-files.h"
#include "copy.h"
#include <stddef.h>
#include <stdint.h>
-/* This header unconditionally defines MAX() so include it here already so
- * it won't override our own definition of MAX() that we define later in this
- * file. */
-#if !SD_BOOT
-#include <sys/param.h>
-#endif
-
/* Temporarily disable some warnings */
#define DISABLE_WARNING_DEPRECATED_DECLARATIONS \
_Pragma("GCC diagnostic push"); \
*/
/* #define SELF_TEST 1 */
+#include <endian.h> /* attempt to define endianness */
#include <stdint.h> /* defines uint32_t etc */
#include <stdio.h> /* defines printf for tests */
-#include <sys/param.h> /* attempt to define endianness */
#include <time.h> /* defines time_t for timings in the test */
-#ifdef linux
-# include <endian.h> /* attempt to define endianness */
-#endif
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <arpa/inet.h>
-#include <sys/param.h>
#include "sd-device.h"
#pragma once
-#include <sys/param.h>
+#include <limits.h>
#if defined(__FreeBSD_kernel__)
# define INIT_FIFO "/etc/.initctl"
#define INIT_CMD_UNSETENV 7
#define INIT_CMD_CHANGECONS 12345
-
-#ifdef MAXHOSTNAMELEN
-# define INITRQ_HLEN MAXHOSTNAMELEN
-#else
-# define INITRQ_HLEN 64
-#endif
-
/*
* This is what BSD 4.4 uses when talking to init.
* Linux doesn't use this right now.
struct init_request_bsd {
char gen_id[8]; /* Beats me.. telnetd uses "fe" */
char tty_id[16]; /* Tty name minus /dev/tty */
- char host[INITRQ_HLEN]; /* Hostname */
+ char host[HOST_NAME_MAX]; /* Hostname */
char term_type[16]; /* Terminal type */
int signal; /* Signal to send */
int pid; /* Process to send to */