aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2022-05-02 23:20:37 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2022-05-02 23:20:37 +0200
commit47b94bbddef40645d787e5016ffff913662be19a (patch)
tree4cb1ae2b7632b880830b01687f410ab1d9564f27
parentddffcbf1393415ed26e7889b808cf08bfa787d27 (diff)
downloadman-pages-47b94bbddef40645d787e5016ffff913662be19a.tar.gz
Various pages: EXAMPLES: Remove unused includes
Reported-by: iwyu(1) Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-rw-r--r--man2/add_key.21
-rw-r--r--man2/clock_getres.25
-rw-r--r--man2/eventfd.27
-rw-r--r--man2/getdents.23
-rw-r--r--man2/getrlimit.23
-rw-r--r--man2/ioctl_tty.21
-rw-r--r--man2/kcmp.211
-rw-r--r--man2/keyctl.28
-rw-r--r--man2/listxattr.22
-rw-r--r--man2/memfd_create.25
-rw-r--r--man2/mprotect.25
-rw-r--r--man2/msgop.28
-rw-r--r--man2/open_by_handle_at.210
-rw-r--r--man2/pipe.25
-rw-r--r--man2/poll.23
-rw-r--r--man2/readlink.23
-rw-r--r--man2/request_key.22
-rw-r--r--man2/seccomp.29
-rw-r--r--man2/semget.26
-rw-r--r--man2/stat.25
-rw-r--r--man2/syscall.25
-rw-r--r--man2/timerfd_create.27
-rw-r--r--man2/userfaultfd.215
23 files changed, 46 insertions, 83 deletions
diff --git a/man2/add_key.2 b/man2/add_key.2
index 381dcfc0e9..969af5c077 100644
--- a/man2/add_key.2
+++ b/man2/add_key.2
@@ -240,7 +240,6 @@ $ \fBgrep \(aq64a4dca\(aq /proc/keys\fP
\&
.\" SRC BEGIN (add_key.c)
.EX
-#include <sys/types.h>
#include <keyutils.h>
#include <stdint.h>
#include <stdio.h>
diff --git a/man2/clock_getres.2 b/man2/clock_getres.2
index bf138d57f3..3ad9c901fc 100644
--- a/man2/clock_getres.2
+++ b/man2/clock_getres.2
@@ -447,12 +447,11 @@ CLOCK_BOOTTIME : 72691.019 (20h 11m 31s)
Licensed under GNU General Public License v2 or later.
*/
#define _XOPEN_SOURCE 600
-#include <time.h>
+#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
-#include <stdbool.h>
-#include <unistd.h>
+#include <time.h>
#define SECS_IN_DAY (24 * 60 * 60)
diff --git a/man2/eventfd.2 b/man2/eventfd.2
index 2293e28d27..0f0e6c1022 100644
--- a/man2/eventfd.2
+++ b/man2/eventfd.2
@@ -380,12 +380,11 @@ Parent read 28 (0x1c) from efd
\&
.\" SRC BEGIN (eventfd.c)
.EX
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <sys/eventfd.h>
#include <unistd.h>
-#include <inttypes.h> /* Definition of PRIu64 & PRIx64 */
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h> /* Definition of uint64_t */
#define handle_error(msg) \e
do { perror(msg); exit(EXIT_FAILURE); } while (0)
diff --git a/man2/getdents.2 b/man2/getdents.2
index 594540dce7..f7285b32b9 100644
--- a/man2/getdents.2
+++ b/man2/getdents.2
@@ -255,10 +255,9 @@ inode# file type d_reclen d_off d_name
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
-#include <unistd.h>
#include <stdlib.h>
-#include <sys/stat.h>
#include <sys/syscall.h>
+#include <unistd.h>
#define handle_error(msg) \e
do { perror(msg); exit(EXIT_FAILURE); } while (0)
diff --git a/man2/getrlimit.2 b/man2/getrlimit.2
index 5b7e4d28f8..9e690deb5c 100644
--- a/man2/getrlimit.2
+++ b/man2/getrlimit.2
@@ -772,10 +772,9 @@ The program below demonstrates the use of
#define _FILE_OFFSET_BITS 64
#include <stdint.h>
#include <stdio.h>
-#include <time.h>
#include <stdlib.h>
-#include <unistd.h>
#include <sys/resource.h>
+#include <time.h>
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e
} while (0)
diff --git a/man2/ioctl_tty.2 b/man2/ioctl_tty.2
index e660788d22..d1af878267 100644
--- a/man2/ioctl_tty.2
+++ b/man2/ioctl_tty.2
@@ -785,7 +785,6 @@ Get or set arbitrary baudrate on the serial port.
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
-#include <sys/types.h>
#include <unistd.h>
int
diff --git a/man2/kcmp.2 b/man2/kcmp.2
index 17d07a7f17..8fad91b043 100644
--- a/man2/kcmp.2
+++ b/man2/kcmp.2
@@ -339,15 +339,14 @@ Child duplicated FD 3 to create FD 5
.\" SRC BEGIN (kcmp.c)
.EX
#define _GNU_SOURCE
-#include <sys/syscall.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
+#include <fcntl.h>
+#include <linux/kcmp.h>
#include <stdint.h>
-#include <stdlib.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <sys/syscall.h>
+#include <sys/wait.h>
#include <unistd.h>
-#include <fcntl.h>
-#include <linux/kcmp.h>
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e
} while (0)
diff --git a/man2/keyctl.2 b/man2/keyctl.2
index d3bb9d171b..c184b7839d 100644
--- a/man2/keyctl.2
+++ b/man2/keyctl.2
@@ -2082,16 +2082,14 @@ $ \fBcat /proc/keys | egrep \(aqmykey|256e6a6\(aq\fP
.EX
/* key_instantiate.c */
-#include <sys/types.h>
+#include <errno.h>
#include <keyutils.h>
-#include <time.h>
-#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <string.h>
-#include <errno.h>
+#include <sys/types.h>
+#include <time.h>
#ifndef KEY_SPEC_REQUESTOR_KEYRING
#define KEY_SPEC_REQUESTOR_KEYRING \-8
diff --git a/man2/listxattr.2 b/man2/listxattr.2
index 9978525e8e..bfcc493794 100644
--- a/man2/listxattr.2
+++ b/man2/listxattr.2
@@ -196,11 +196,9 @@ user.empty: <no value>
.SS Program source (listxattr.c)
.\" SRC BEGIN (listxattr.c)
.EX
-#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
#include <sys/xattr.h>
int
diff --git a/man2/memfd_create.2 b/man2/memfd_create.2
index 4cb8b0b4eb..0d5b7817c5 100644
--- a/man2/memfd_create.2
+++ b/man2/memfd_create.2
@@ -498,12 +498,9 @@ main(int argc, char *argv[])
.\" SRC BEGIN (t_get_seals.c)
.EX
#define _GNU_SOURCE
-#include <sys/mman.h>
#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
#include <stdio.h>
+#include <stdlib.h>
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e
} while (0)
diff --git a/man2/mprotect.2 b/man2/mprotect.2
index 6d424d448c..dc1dc122c4 100644
--- a/man2/mprotect.2
+++ b/man2/mprotect.2
@@ -288,13 +288,12 @@ Got SIGSEGV at address: 0x804e000
\&
.\" SRC BEGIN (mprotect.c)
.EX
-#include <unistd.h>
+#include <malloc.h>
#include <signal.h>
#include <stdio.h>
-#include <malloc.h>
#include <stdlib.h>
-#include <errno.h>
#include <sys/mman.h>
+#include <unistd.h>
#define handle_error(msg) \e
do { perror(msg); exit(EXIT_FAILURE); } while (0)
diff --git a/man2/msgop.2 b/man2/msgop.2
index 3f74f81d38..295e09b3a6 100644
--- a/man2/msgop.2
+++ b/man2/msgop.2
@@ -560,15 +560,13 @@ message received: a message at Wed Mar 4 16:25:45 2015
\&
.\" SRC BEGIN (msgop.c)
.EX
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
+#include <time.h>
+#include <unistd.h>
struct msgbuf {
long mtype;
diff --git a/man2/open_by_handle_at.2 b/man2/open_by_handle_at.2
index e969daf694..c3e28ec361 100644
--- a/man2/open_by_handle_at.2
+++ b/man2/open_by_handle_at.2
@@ -528,14 +528,10 @@ open_by_handle_at: Stale NFS file handle
.\" SRC BEGIN (t_name_to_handle_at.c)
.EX
#define _GNU_SOURCE
-#include <sys/types.h>
-#include <sys/stat.h>
+#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e
} while (0)
@@ -603,14 +599,12 @@ main(int argc, char *argv[])
.\" SRC BEGIN (t_open_by_handle_at.c)
.EX
#define _GNU_SOURCE
-#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <string.h>
+#include <unistd.h>
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e
} while (0)
diff --git a/man2/pipe.2 b/man2/pipe.2
index 4133a46fff..de50ee491f 100644
--- a/man2/pipe.2
+++ b/man2/pipe.2
@@ -221,12 +221,11 @@ and echoes it on standard output.
.SS Program source
.\" SRC BEGIN (pipe.c)
.EX
-#include <sys/types.h>
-#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <string.h>
+#include <sys/wait.h>
+#include <unistd.h>
int
main(int argc, char *argv[])
diff --git a/man2/poll.2 b/man2/poll.2
index ebc6995681..85d3950773 100644
--- a/man2/poll.2
+++ b/man2/poll.2
@@ -550,9 +550,8 @@ at which point the file descriptor was closed and the program terminated.
Licensed under GNU General Public License v2 or later.
*/
-#include <poll.h>
#include <fcntl.h>
-#include <sys/types.h>
+#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/man2/readlink.2 b/man2/readlink.2
index 3de7a1aa74..95938d017c 100644
--- a/man2/readlink.2
+++ b/man2/readlink.2
@@ -256,11 +256,10 @@ reports a size of zero.
.PP
.\" SRC BEGIN (readlink.c)
.EX
-#include <sys/types.h>
-#include <sys/stat.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/stat.h>
#include <unistd.h>
int
diff --git a/man2/request_key.2 b/man2/request_key.2
index 3a8d6f445f..f8a84a0347 100644
--- a/man2/request_key.2
+++ b/man2/request_key.2
@@ -502,12 +502,10 @@ For another example of the use of this program, see
.EX
/* t_request_key.c */
-#include <sys/types.h>
#include <keyutils.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
int
main(int argc, char *argv[])
diff --git a/man2/seccomp.2 b/man2/seccomp.2
index e6243e9010..9031b45356 100644
--- a/man2/seccomp.2
+++ b/man2/seccomp.2
@@ -1109,16 +1109,15 @@ cecilia
.SS Program source
.\" SRC BEGIN (seccomp.c)
.EX
-#include <errno.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
#include <linux/audit.h>
#include <linux/filter.h>
#include <linux/seccomp.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <sys/prctl.h>
#include <sys/syscall.h>
+#include <unistd.h>
#define X32_SYSCALL_BIT 0x40000000
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
diff --git a/man2/semget.2 b/man2/semget.2
index 1459501e48..7af3e18bd2 100644
--- a/man2/semget.2
+++ b/man2/semget.2
@@ -369,12 +369,10 @@ ID = 9
Licensed under GNU General Public License v2 or later.
*/
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
#include <unistd.h>
static void
diff --git a/man2/stat.2 b/man2/stat.2
index de6ad6fb8d..0fd90b1064 100644
--- a/man2/stat.2
+++ b/man2/stat.2
@@ -459,13 +459,12 @@ structure.
.PP
.\" SRC BEGIN (stat.c)
.EX
-#include <sys/types.h>
-#include <sys/stat.h>
#include <stdint.h>
-#include <time.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/stat.h>
#include <sys/sysmacros.h>
+#include <time.h>
int
main(int argc, char *argv[])
diff --git a/man2/syscall.2 b/man2/syscall.2
index ba28624870..3a6ad7c1ef 100644
--- a/man2/syscall.2
+++ b/man2/syscall.2
@@ -336,10 +336,9 @@ architectures may indiscriminately clobber other registers not listed here.
.\" SRC BEGIN (syscall.c)
.EX
#define _GNU_SOURCE
-#include <unistd.h>
-#include <sys/syscall.h>
-#include <sys/types.h>
#include <signal.h>
+#include <sys/syscall.h>
+#include <unistd.h>
int
main(void)
diff --git a/man2/timerfd_create.2 b/man2/timerfd_create.2
index a1b0ec4df6..ff12bec38d 100644
--- a/man2/timerfd_create.2
+++ b/man2/timerfd_create.2
@@ -606,13 +606,12 @@ a.out 3 1 100
.\"#define TFD_TIMER_ABSTIME (1 << 0)
.\"
.\"////////////////////////////////////////////////////////////
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <sys/timerfd.h>
#include <time.h>
#include <unistd.h>
-#include <inttypes.h> /* Definition of PRIu64 */
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h> /* Definition of uint64_t */
#define handle_error(msg) \e
do { perror(msg); exit(EXIT_FAILURE); } while (0)
diff --git a/man2/userfaultfd.2 b/man2/userfaultfd.2
index d2456a61a2..bb3b64a07d 100644
--- a/man2/userfaultfd.2
+++ b/man2/userfaultfd.2
@@ -734,22 +734,19 @@ Read address 0x7fd30106ec0f in main(): C
Licensed under the GNU General Public License version 2 or later.
*/
#define _GNU_SOURCE
+#include <errno.h>
+#include <fcntl.h>
#include <inttypes.h>
-#include <sys/types.h>
-#include <stdio.h>
#include <linux/userfaultfd.h>
+#include <poll.h>
#include <pthread.h>
-#include <errno.h>
-#include <unistd.h>
+#include <stdio.h>
#include <stdlib.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <poll.h>
#include <string.h>
+#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/syscall.h>
-#include <sys/ioctl.h>
-#include <poll.h>
+#include <unistd.h>
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e
} while (0)