tree-wide: include unistd.h where necessary
We use symbols provided by unistd.h without including it. E.g. open(), close(), read(), write(), access(), symlink(), unlink(), rmdir(), fsync(), syncfs(), lseek(), ftruncate(), fchown(), dup2(), pipe2(), getuid(), getgid(), gettid(), getppid(), pipe2(), execv(), _exit(), environ, STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO, F_OK, and their friends and variants, so on. Currently, unistd.h is indirectly included mainly in the following two paths: - through missing_syscall.h, which is planned to covert to .c file. - through signal.h -> bits/sigstksz.h, which is new since glibc-2.34. Note, signal.h is included by sd-eevent.h. So, many source files indirectly include unistd.h if newer glibc is used. Currently, our baseline on glibc is 2.31. We need to support glibc older than 2.34, but unfortunately, we do not have any CI environments with such old glibc. CIFuzz uses glibc-2.31, but it builds only fuzzers, and many files are even not compiled.
This commit is contained in:
committed by
Daan De Meyer
parent
b9c344b5c0
commit
4f18ff2e29
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <fnmatch.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#if HAVE_VALGRIND_VALGRIND_H
|
||||
# include <valgrind/valgrind.h>
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/file.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "errno-util.h"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mount.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <sys/auxv.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <threads.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "fd-util.h"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <threads.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "errno-util.h"
|
||||
#include "missing_syscall.h"
|
||||
|
||||
Reference in New Issue
Block a user