Created attachment 238386 [details] The patch. Most of the affected man pages are of standard functions which are defined by POSIX not to need a sys/types.h include. Only setproctitle.3 and tcsetsid.3 are not standard functions. In both cases, I've verified that the other headers these functions require include all the necessary type declarations. This unnecessary include seems to be a minor but recurring issue in FreeBSD man pages as evidenced by these past commits: https://cgit.freebsd.org/src/log/lib/libc?id=310d2ce0f6835de3754d8f7f1da304c66440ffd3&qt=grep&q=sys%2Ftypes.h
Did you wrote (small) test programs for each of the function, to check that it still compiles without sys/types.h? If yes, could you please share the tests?
Created attachment 238411 [details] Test if unistd.h functions need sys/types.h
Created attachment 238412 [details] Test if termios.h functions need sys/types.h
Created attachment 238413 [details] Test if pwd.h functions need sys/types.h
Created attachment 238414 [details] Test if sys/ipc.h functions need sys/types.h
(In reply to Konstantin Belousov from comment #1) Sorry, I'm not a FreeBSD user, I've only read the source code. I just wrote a test for each header and attached them to this bug report, I haven't tried the tests on a FreeBSD system.
General note: we already test to make sure that many headers can be included on their own. We don't test, though, if the proper functions are defined by them. We may need to augment those tests, but they don't replace the ones that Guilherme has uploaded. I also think this is the right thing to do to the man pages, but will let kib@ drive
(In reply to Guilherme Janczak from comment #3) s/tcsetid/tcsetsid/ Otherwise all tests look good, thank you.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=a6d40b0ad2c51e16a8c99750d5ed6f9aea2be7d4 commit a6d40b0ad2c51e16a8c99750d5ed6f9aea2be7d4 Author: Guilherme Janczak <guilherme.janczak@yandex.com> AuthorDate: 2022-11-28 22:57:37 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-11-29 22:45:07 +0000 libc: remove unneeded sys/types.h include from several synopses PR: 268028 Reviewed by: kib Discussed with: imp MFC after: 1 week lib/libc/gen/ftok.3 | 3 +-- lib/libc/gen/getpeereid.3 | 3 +-- lib/libc/gen/getpwent.3 | 3 +-- lib/libc/gen/setproctitle.3 | 3 +-- lib/libc/gen/tcgetpgrp.3 | 3 +-- lib/libc/gen/tcgetsid.3 | 3 +-- lib/libc/gen/tcsetpgrp.3 | 3 +-- lib/libc/gen/tcsetsid.3 | 3 +-- 8 files changed, 8 insertions(+), 16 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=5b6f0a5012e9bc37dcb32b57b41e2443a46da620 commit 5b6f0a5012e9bc37dcb32b57b41e2443a46da620 Author: Guilherme Janczak <guilherme.janczak@yandex.com> AuthorDate: 2022-11-28 22:57:37 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-12-06 04:06:23 +0000 libc: remove unneeded sys/types.h include from several synopses PR: 268028 (cherry picked from commit a6d40b0ad2c51e16a8c99750d5ed6f9aea2be7d4) lib/libc/gen/ftok.3 | 3 +-- lib/libc/gen/getpeereid.3 | 3 +-- lib/libc/gen/getpwent.3 | 3 +-- lib/libc/gen/setproctitle.3 | 3 +-- lib/libc/gen/tcgetpgrp.3 | 3 +-- lib/libc/gen/tcgetsid.3 | 3 +-- lib/libc/gen/tcsetpgrp.3 | 3 +-- lib/libc/gen/tcsetsid.3 | 3 +-- 8 files changed, 8 insertions(+), 16 deletions(-)
Since manual pages were updated last year, (In reply to Warner Losh from comment #7) (In reply to Konstantin Belousov from comment #8) – please, what remains to do in this report? ---- ^Triage: * summary, keywords * CC freebsd-doc@ * in progress but not assigned to a person (noted, not changed).
^Triage: assign to committer that resolved. Apparently this was MFCed to 13. MFCs to 12 are now OBE.