[2/3] Various pages: Remove unused <sys/ipc.h> (and <sys/types.h>)

Message ID 20210421224418.143065-2-alx.manpages@gmail.com
State Not applicable
Headers
Series [1/3] alloc_hugepages.2, arch_prctl.2, capget.2, clone.2, delete_module.2, execveat.2, exit_group.2, get_robust_list.2, getunwind.2, init_module.2: Add note about the use of syscall(2) |

Commit Message

Alejandro Colomar April 21, 2021, 10:44 p.m. UTC
  In b0b19983d9a2001ce94b908a99f4c05a50fd47ee we removed
<sys/types.h>.  For the same reasons there, remove now <sys/ipc.h>
from many pages.

If someone wonders why <sys/ipc.h> was needed, the reason was to
get all the definitions of IPC_* constants.  However, that header
is now included by <sys/msg.h>, so it's not needed anymore to
explicitly include it.  Quoting POSIX: "In addition, the
<sys/msg.h> header shall include the <sys/ipc.h> header."

There were some remaining cases where I forgot to remove
<sys/types.h>; remove them now too.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man2/msgctl.2 | 12 ------------
 man2/msgget.2 | 12 ------------
 man2/msgop.2  | 12 ------------
 man2/semctl.2 | 12 ------------
 man2/semget.2 | 12 ------------
 man2/semop.2  | 12 ------------
 man2/shmctl.2 | 12 ------------
 man2/shmget.2 | 14 --------------
 man3/ftok.3   |  1 -
 9 files changed, 99 deletions(-)
  

Comments

Michael Kerrisk \(man-pages\) May 9, 2021, 7:54 p.m. UTC | #1
Hello ALex,

On 4/22/21 10:44 AM, Alejandro Colomar wrote:
> In b0b19983d9a2001ce94b908a99f4c05a50fd47ee we removed
> <sys/types.h>.  For the same reasons there, remove now <sys/ipc.h>
> from many pages.
> 
> If someone wonders why <sys/ipc.h> was needed, the reason was to
> get all the definitions of IPC_* constants.  However, that header
> is now included by <sys/msg.h>, so it's not needed anymore to
> explicitly include it.  Quoting POSIX: "In addition, the
> <sys/msg.h> header shall include the <sys/ipc.h> header."
> 
> There were some remaining cases where I forgot to remove
> <sys/types.h>; remove them now too.

Seems reasonable to me. Patch applied.

Thanks,

Michael

> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
> ---
>  man2/msgctl.2 | 12 ------------
>  man2/msgget.2 | 12 ------------
>  man2/msgop.2  | 12 ------------
>  man2/semctl.2 | 12 ------------
>  man2/semget.2 | 12 ------------
>  man2/semop.2  | 12 ------------
>  man2/shmctl.2 | 12 ------------
>  man2/shmget.2 | 14 --------------
>  man3/ftok.3   |  1 -
>  9 files changed, 99 deletions(-)
> 
> diff --git a/man2/msgctl.2 b/man2/msgctl.2
> index d42a47d2b..72598dd4c 100644
> --- a/man2/msgctl.2
> +++ b/man2/msgctl.2
> @@ -40,7 +40,6 @@
>  msgctl \- System V message control operations
>  .SH SYNOPSIS
>  .nf
> -.B #include <sys/ipc.h>
>  .B #include <sys/msg.h>
>  .PP
>  .BI "int msgctl(int " msqid ", int " cmd ", struct msqid_ds *" buf );
> @@ -405,17 +404,6 @@ capability).
>  POSIX.1-2001, POSIX.1-2008, SVr4.
>  .\" SVID does not document the EIDRM error condition.
>  .SH NOTES
> -The inclusion of
> -.I <sys/ipc.h>
> -isn't required on Linux or by any version of POSIX.
> -However,
> -some old implementations required the inclusion of this header file,
> -and the SVID also documented its inclusion.
> -Applications intended to be portable to such old systems may need
> -to include this header file.
> -.\" Like Linux, the FreeBSD man pages still document
> -.\" the inclusion of this header file.
> -.PP
>  The
>  .BR IPC_INFO ,
>  .BR MSG_STAT ,
> diff --git a/man2/msgget.2 b/man2/msgget.2
> index edc91467b..fd9cbe0a1 100644
> --- a/man2/msgget.2
> +++ b/man2/msgget.2
> @@ -37,7 +37,6 @@
>  msgget \- get a System V message queue identifier
>  .SH SYNOPSIS
>  .nf
> -.B #include <sys/ipc.h>
>  .B #include <sys/msg.h>
>  .PP
>  .BI "int msgget(key_t " key ", int " msgflg );
> @@ -188,17 +187,6 @@ would be exceeded.
>  .SH CONFORMING TO
>  POSIX.1-2001, POSIX.1-2008, SVr4.
>  .SH NOTES
> -The inclusion of
> -.I <sys/ipc.h>
> -isn't required on Linux or by any version of POSIX.
> -However,
> -some old implementations required the inclusion of this header file,
> -and the SVID also documented its inclusion.
> -Applications intended to be portable to such old systems may need
> -to include this header file.
> -.\" Like Linux, the FreeBSD man pages still document
> -.\" the inclusion of this header file.
> -.PP
>  .B IPC_PRIVATE
>  isn't a flag field but a
>  .I key_t
> diff --git a/man2/msgop.2 b/man2/msgop.2
> index e56176f08..d46e5b1dd 100644
> --- a/man2/msgop.2
> +++ b/man2/msgop.2
> @@ -42,7 +42,6 @@
>  msgrcv, msgsnd \- System V message queue operations
>  .SH SYNOPSIS
>  .nf
> -.B #include <sys/ipc.h>
>  .B #include <sys/msg.h>
>  .PP
>  .BI "int msgsnd(int " msqid ", const void *" msgp ", size_t " msgsz \
> @@ -480,17 +479,6 @@ their definitions can be obtained by defining the
>  .\" MSG_COPY since glibc 2.18
>  feature test macro.
>  .SH NOTES
> -The inclusion of
> -.I <sys/ipc.h>
> -isn't required on Linux or by any version of POSIX.
> -However,
> -some old implementations required the inclusion of this header file,
> -and the SVID also documented its inclusion.
> -Applications intended to be portable to such old systems may need
> -to include this header file.
> -.\" Like Linux, the FreeBSD man pages still document
> -.\" the inclusion of this header file.
> -.PP
>  The
>  .I msgp
>  argument is declared as \fIstruct msgbuf\ *\fP in
> diff --git a/man2/semctl.2 b/man2/semctl.2
> index 504cdf9da..ac8bd906d 100644
> --- a/man2/semctl.2
> +++ b/man2/semctl.2
> @@ -44,7 +44,6 @@
>  semctl \- System V semaphore control operations
>  .SH SYNOPSIS
>  .nf
> -.B #include <sys/ipc.h>
>  .B #include <sys/sem.h>
>  .PP
>  .BI "int semctl(int " semid ", int " semnum ", int " cmd ", ...);"
> @@ -536,17 +535,6 @@ It was also so defined on Linux 2.2 and earlier,
>  but, since Linux 2.4, the field has the type
>  .IR "unsigned\ long" .
>  .SH NOTES
> -The inclusion of
> -.I <sys/ipc.h>
> -isn't required on Linux or by any version of POSIX.
> -However,
> -some old implementations required the inclusion of this header file,
> -and the SVID also documented its inclusion.
> -Applications intended to be portable to such old systems may need
> -to include this header file.
> -.\" Like Linux, the FreeBSD man pages still document
> -.\" the inclusion of these header files.
> -.PP
>  The
>  .BR IPC_INFO ,
>  .BR SEM_STAT ,
> diff --git a/man2/semget.2 b/man2/semget.2
> index b0914f900..2fce9b1ce 100644
> --- a/man2/semget.2
> +++ b/man2/semget.2
> @@ -39,7 +39,6 @@
>  semget \- get a System V semaphore set identifier
>  .SH SYNOPSIS
>  .nf
> -.B #include <sys/ipc.h>
>  .B #include <sys/sem.h>
>  .fi
>  .PP
> @@ -219,17 +218,6 @@ SVr4, POSIX.1-2001.
>  .\" SVr4 documents additional error conditions EFBIG, E2BIG, EAGAIN,
>  .\" ERANGE, EFAULT.
>  .SH NOTES
> -The inclusion of
> -.I <sys/ipc.h>
> -isn't required on Linux or by any version of POSIX.
> -However,
> -some old implementations required the inclusion of this header file,
> -and the SVID also documented its inclusion.
> -Applications intended to be portable to such old systems may need
> -to include this header file.
> -.\" Like Linux, the FreeBSD man pages still document
> -.\" the inclusion of this header file.
> -.PP
>  .B IPC_PRIVATE
>  isn't a flag field but a
>  .I key_t
> diff --git a/man2/semop.2 b/man2/semop.2
> index 9479f7e4c..f0cd66302 100644
> --- a/man2/semop.2
> +++ b/man2/semop.2
> @@ -37,7 +37,6 @@
>  semop, semtimedop \- System V semaphore operations
>  .SH SYNOPSIS
>  .nf
> -.B #include <sys/ipc.h>
>  .B #include <sys/sem.h>
>  .PP
>  .BI "int semop(int " semid ", struct sembuf *" sops ", size_t " nsops );
> @@ -383,17 +382,6 @@ first appeared in version 2.3.3.
>  POSIX.1-2001, POSIX.1-2008, SVr4.
>  .\" SVr4 documents additional error conditions EINVAL, EFBIG, ENOSPC.
>  .SH NOTES
> -The inclusion of
> -.I <sys/ipc.h>
> -isn't required on Linux or by any version of POSIX.
> -However,
> -some old implementations required the inclusion of this header file,
> -and the SVID also documented its inclusion.
> -Applications intended to be portable to such old systems may need
> -to include this header file.
> -.\" Like Linux, the FreeBSD man pages still document
> -.\" the inclusion of this header file.
> -.PP
>  The
>  .I sem_undo
>  structures of a process aren't inherited by the child produced by
> diff --git a/man2/shmctl.2 b/man2/shmctl.2
> index 31c86af86..5aa74e676 100644
> --- a/man2/shmctl.2
> +++ b/man2/shmctl.2
> @@ -49,7 +49,6 @@ shmctl \- System V shared memory control
>  .SH SYNOPSIS
>  .nf
>  .ad l
> -.B #include <sys/ipc.h>
>  .B #include <sys/shm.h>
>  .PP
>  .BI "int shmctl(int " shmid ", int " cmd ", struct shmid_ds *" buf );
> @@ -466,17 +465,6 @@ POSIX.1-2001, POSIX.1-2008, SVr4.
>  .\" ENOENT, ENOSPC, ENOMEM, EEXIST.  Neither SVr4 nor SVID documents
>  .\" an EIDRM error condition.
>  .SH NOTES
> -The inclusion of
> -.I <sys/ipc.h>
> -isn't required on Linux or by any version of POSIX.
> -However,
> -some old implementations required the inclusion of this header file,
> -and the SVID also documented its inclusion.
> -Applications intended to be portable to such old systems may need
> -to include this header file.
> -.\" Like Linux, the FreeBSD man pages still document
> -.\" the inclusion of this header file.
> -.PP
>  The
>  .BR IPC_INFO ,
>  .BR SHM_STAT ,
> diff --git a/man2/shmget.2 b/man2/shmget.2
> index 1d9e6825c..757b7b7f1 100644
> --- a/man2/shmget.2
> +++ b/man2/shmget.2
> @@ -41,7 +41,6 @@ shmget \- allocates a System V shared memory segment
>  .SH SYNOPSIS
>  .nf
>  .ad l
> -.B #include <sys/ipc.h>
>  .B #include <sys/shm.h>
>  .PP
>  .BI "int shmget(key_t " key ", size_t " size ", int " shmflg );
> @@ -284,19 +283,6 @@ and
>  .B SHM_NORESERVE
>  are Linux extensions.
>  .SH NOTES
> -The inclusion of
> -.I <sys/types.h>
> -and
> -.I <sys/ipc.h>
> -isn't required on Linux or by any version of POSIX.
> -However,
> -some old implementations required the inclusion of these header files,
> -and the SVID also documented their inclusion.
> -Applications intended to be portable to such old systems may need
> -to include these header files.
> -.\" Like Linux, the FreeBSD man pages still document
> -.\" the inclusion of these header files.
> -.PP
>  .B IPC_PRIVATE
>  isn't a flag field but a
>  .I key_t
> diff --git a/man3/ftok.3 b/man3/ftok.3
> index 5d8907b56..d46481356 100644
> --- a/man3/ftok.3
> +++ b/man3/ftok.3
> @@ -31,7 +31,6 @@
>  ftok \- convert a pathname and a project identifier to a System V IPC key
>  .SH SYNOPSIS
>  .nf
> -.B #include <sys/types.h>
>  .B #include <sys/ipc.h>
>  .fi
>  .PP
>
  

Patch

diff --git a/man2/msgctl.2 b/man2/msgctl.2
index d42a47d2b..72598dd4c 100644
--- a/man2/msgctl.2
+++ b/man2/msgctl.2
@@ -40,7 +40,6 @@ 
 msgctl \- System V message control operations
 .SH SYNOPSIS
 .nf
-.B #include <sys/ipc.h>
 .B #include <sys/msg.h>
 .PP
 .BI "int msgctl(int " msqid ", int " cmd ", struct msqid_ds *" buf );
@@ -405,17 +404,6 @@  capability).
 POSIX.1-2001, POSIX.1-2008, SVr4.
 .\" SVID does not document the EIDRM error condition.
 .SH NOTES
-The inclusion of
-.I <sys/ipc.h>
-isn't required on Linux or by any version of POSIX.
-However,
-some old implementations required the inclusion of this header file,
-and the SVID also documented its inclusion.
-Applications intended to be portable to such old systems may need
-to include this header file.
-.\" Like Linux, the FreeBSD man pages still document
-.\" the inclusion of this header file.
-.PP
 The
 .BR IPC_INFO ,
 .BR MSG_STAT ,
diff --git a/man2/msgget.2 b/man2/msgget.2
index edc91467b..fd9cbe0a1 100644
--- a/man2/msgget.2
+++ b/man2/msgget.2
@@ -37,7 +37,6 @@ 
 msgget \- get a System V message queue identifier
 .SH SYNOPSIS
 .nf
-.B #include <sys/ipc.h>
 .B #include <sys/msg.h>
 .PP
 .BI "int msgget(key_t " key ", int " msgflg );
@@ -188,17 +187,6 @@  would be exceeded.
 .SH CONFORMING TO
 POSIX.1-2001, POSIX.1-2008, SVr4.
 .SH NOTES
-The inclusion of
-.I <sys/ipc.h>
-isn't required on Linux or by any version of POSIX.
-However,
-some old implementations required the inclusion of this header file,
-and the SVID also documented its inclusion.
-Applications intended to be portable to such old systems may need
-to include this header file.
-.\" Like Linux, the FreeBSD man pages still document
-.\" the inclusion of this header file.
-.PP
 .B IPC_PRIVATE
 isn't a flag field but a
 .I key_t
diff --git a/man2/msgop.2 b/man2/msgop.2
index e56176f08..d46e5b1dd 100644
--- a/man2/msgop.2
+++ b/man2/msgop.2
@@ -42,7 +42,6 @@ 
 msgrcv, msgsnd \- System V message queue operations
 .SH SYNOPSIS
 .nf
-.B #include <sys/ipc.h>
 .B #include <sys/msg.h>
 .PP
 .BI "int msgsnd(int " msqid ", const void *" msgp ", size_t " msgsz \
@@ -480,17 +479,6 @@  their definitions can be obtained by defining the
 .\" MSG_COPY since glibc 2.18
 feature test macro.
 .SH NOTES
-The inclusion of
-.I <sys/ipc.h>
-isn't required on Linux or by any version of POSIX.
-However,
-some old implementations required the inclusion of this header file,
-and the SVID also documented its inclusion.
-Applications intended to be portable to such old systems may need
-to include this header file.
-.\" Like Linux, the FreeBSD man pages still document
-.\" the inclusion of this header file.
-.PP
 The
 .I msgp
 argument is declared as \fIstruct msgbuf\ *\fP in
diff --git a/man2/semctl.2 b/man2/semctl.2
index 504cdf9da..ac8bd906d 100644
--- a/man2/semctl.2
+++ b/man2/semctl.2
@@ -44,7 +44,6 @@ 
 semctl \- System V semaphore control operations
 .SH SYNOPSIS
 .nf
-.B #include <sys/ipc.h>
 .B #include <sys/sem.h>
 .PP
 .BI "int semctl(int " semid ", int " semnum ", int " cmd ", ...);"
@@ -536,17 +535,6 @@  It was also so defined on Linux 2.2 and earlier,
 but, since Linux 2.4, the field has the type
 .IR "unsigned\ long" .
 .SH NOTES
-The inclusion of
-.I <sys/ipc.h>
-isn't required on Linux or by any version of POSIX.
-However,
-some old implementations required the inclusion of this header file,
-and the SVID also documented its inclusion.
-Applications intended to be portable to such old systems may need
-to include this header file.
-.\" Like Linux, the FreeBSD man pages still document
-.\" the inclusion of these header files.
-.PP
 The
 .BR IPC_INFO ,
 .BR SEM_STAT ,
diff --git a/man2/semget.2 b/man2/semget.2
index b0914f900..2fce9b1ce 100644
--- a/man2/semget.2
+++ b/man2/semget.2
@@ -39,7 +39,6 @@ 
 semget \- get a System V semaphore set identifier
 .SH SYNOPSIS
 .nf
-.B #include <sys/ipc.h>
 .B #include <sys/sem.h>
 .fi
 .PP
@@ -219,17 +218,6 @@  SVr4, POSIX.1-2001.
 .\" SVr4 documents additional error conditions EFBIG, E2BIG, EAGAIN,
 .\" ERANGE, EFAULT.
 .SH NOTES
-The inclusion of
-.I <sys/ipc.h>
-isn't required on Linux or by any version of POSIX.
-However,
-some old implementations required the inclusion of this header file,
-and the SVID also documented its inclusion.
-Applications intended to be portable to such old systems may need
-to include this header file.
-.\" Like Linux, the FreeBSD man pages still document
-.\" the inclusion of this header file.
-.PP
 .B IPC_PRIVATE
 isn't a flag field but a
 .I key_t
diff --git a/man2/semop.2 b/man2/semop.2
index 9479f7e4c..f0cd66302 100644
--- a/man2/semop.2
+++ b/man2/semop.2
@@ -37,7 +37,6 @@ 
 semop, semtimedop \- System V semaphore operations
 .SH SYNOPSIS
 .nf
-.B #include <sys/ipc.h>
 .B #include <sys/sem.h>
 .PP
 .BI "int semop(int " semid ", struct sembuf *" sops ", size_t " nsops );
@@ -383,17 +382,6 @@  first appeared in version 2.3.3.
 POSIX.1-2001, POSIX.1-2008, SVr4.
 .\" SVr4 documents additional error conditions EINVAL, EFBIG, ENOSPC.
 .SH NOTES
-The inclusion of
-.I <sys/ipc.h>
-isn't required on Linux or by any version of POSIX.
-However,
-some old implementations required the inclusion of this header file,
-and the SVID also documented its inclusion.
-Applications intended to be portable to such old systems may need
-to include this header file.
-.\" Like Linux, the FreeBSD man pages still document
-.\" the inclusion of this header file.
-.PP
 The
 .I sem_undo
 structures of a process aren't inherited by the child produced by
diff --git a/man2/shmctl.2 b/man2/shmctl.2
index 31c86af86..5aa74e676 100644
--- a/man2/shmctl.2
+++ b/man2/shmctl.2
@@ -49,7 +49,6 @@  shmctl \- System V shared memory control
 .SH SYNOPSIS
 .nf
 .ad l
-.B #include <sys/ipc.h>
 .B #include <sys/shm.h>
 .PP
 .BI "int shmctl(int " shmid ", int " cmd ", struct shmid_ds *" buf );
@@ -466,17 +465,6 @@  POSIX.1-2001, POSIX.1-2008, SVr4.
 .\" ENOENT, ENOSPC, ENOMEM, EEXIST.  Neither SVr4 nor SVID documents
 .\" an EIDRM error condition.
 .SH NOTES
-The inclusion of
-.I <sys/ipc.h>
-isn't required on Linux or by any version of POSIX.
-However,
-some old implementations required the inclusion of this header file,
-and the SVID also documented its inclusion.
-Applications intended to be portable to such old systems may need
-to include this header file.
-.\" Like Linux, the FreeBSD man pages still document
-.\" the inclusion of this header file.
-.PP
 The
 .BR IPC_INFO ,
 .BR SHM_STAT ,
diff --git a/man2/shmget.2 b/man2/shmget.2
index 1d9e6825c..757b7b7f1 100644
--- a/man2/shmget.2
+++ b/man2/shmget.2
@@ -41,7 +41,6 @@  shmget \- allocates a System V shared memory segment
 .SH SYNOPSIS
 .nf
 .ad l
-.B #include <sys/ipc.h>
 .B #include <sys/shm.h>
 .PP
 .BI "int shmget(key_t " key ", size_t " size ", int " shmflg );
@@ -284,19 +283,6 @@  and
 .B SHM_NORESERVE
 are Linux extensions.
 .SH NOTES
-The inclusion of
-.I <sys/types.h>
-and
-.I <sys/ipc.h>
-isn't required on Linux or by any version of POSIX.
-However,
-some old implementations required the inclusion of these header files,
-and the SVID also documented their inclusion.
-Applications intended to be portable to such old systems may need
-to include these header files.
-.\" Like Linux, the FreeBSD man pages still document
-.\" the inclusion of these header files.
-.PP
 .B IPC_PRIVATE
 isn't a flag field but a
 .I key_t
diff --git a/man3/ftok.3 b/man3/ftok.3
index 5d8907b56..d46481356 100644
--- a/man3/ftok.3
+++ b/man3/ftok.3
@@ -31,7 +31,6 @@ 
 ftok \- convert a pathname and a project identifier to a System V IPC key
 .SH SYNOPSIS
 .nf
-.B #include <sys/types.h>
 .B #include <sys/ipc.h>
 .fi
 .PP