aboutsummaryrefslogtreecommitdiffstats
path: root/man3
AgeCommit message (Collapse)AuthorFilesLines
2024-05-02man/, share/mk/: Move man*/ to man/Alejandro Colomar1705-99858/+1
This is a scripted change: $ mkdir man/; $ mv man* man/; $ ln -st . man/man*; $ find share/mk/ -type f \ | xargs grep -l '^MANDIR *:=' \ | xargs sed -i '/^MANDIR *:=/s,$,/man,'; $ find share/mk/dist/ -type f \ | xargs grep -l man \ | xargs sed -i 's,man%,man/%,g'; Link: <https://lore.kernel.org/linux-man/YxcV4h+Xn7cd6+q2@pevik/T/> Cc: Petr Vorel <pvorel@suse.cz> Cc: Jakub Wilk <jwilk@jwilk.net> Cc: Stefan Puiu <stefan.puiu@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-04-26slist.3: wfixSimon Barth1-1/+1
This page is about singly linked lists, not doubly linked lists. Signed-off-by: Simon Barth <simon.barth@gmx.de> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-04-26strchr.3: HISTORY: strchrnul(3) is present in FreeBSD and NetBSDAlejandro Colomar1-1/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-04-10man3/, debian/debhelper.in/glibc-doc.links: Move link pages to their placeAlejandro Colomar16-0/+16
Scripted change: $ cat debian/debhelper.in/glibc-doc.links \ | while read l; do \ echo $l \ | awk '{print $1}' \ | sed 's,usr/share/man/,.so ,' \ | sed 's,\.gz,,' \ > "$(echo $l \ | awk '{print $2}' \ | sed 's,usr/share/man/,,' \ | sed 's,\.gz,,')"; done; $ rm debian/debhelper.in/glibc-doc.links Link: <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1068188> Link: <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1068166> Link: <https://lore.kernel.org/linux-man/703ec07e-dd2b-bbc6-f1bc-f495e53b764f@gmail.com/T/> Cc: Marcos Fouces <marcos@debian.org> Cc: Sven Joachim <svenjoac@gmx.de> Cc: Bas Couwenberg <sebastic@xs4all.nl> Cc: Andreas Beckmann <anbe@debian.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-04-09S_ISBLK.3, S_ISCHR.3, S_ISDIR.3, S_ISFIFO.3, S_ISLNK.3, S_ISREG.3, ↵Alejandro Colomar7-0/+7
S_ISSOCK.3: Add link pages to inode(7) These function-like macros are described in inode(7). Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-04-04sigwait.3: Note sigprocmask(2) requirement, explicitly link ↵наб1-1/+6
sigtimedwait(2)/NOTES This comes from a real user complaint. sigwait(3) is the most obvious of the family, and it doesn't mention any of the usage details. Most of these can be crosslinked, but not mentioning the sigprocmask(2) requirement is malice. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-03-30getgrouplist.3: EXAMPLES: Fix error handling for getpwnam(3)Fedor Lapshin1-2/+7
Signed-off-by: Fedor Lapshin <fe.lap.prog@gmail.com> Co-developed-by: Alejandro Colomar <alx@kernel.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-03-26man*/: EXAMPLES: Add include guardsAlejandro Colomar1-0/+5
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-03-26man*/: EXAMPLES: Fix includesAlejandro Colomar1-4/+12
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-03-16getgrouplist.3: Use same type in both sides of comparisonAlejandro Colomar1-5/+5
This removes a warning. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-03-16printf.3: Return the number of bytes printed, not charactersJeremy Baxter1-1/+1
From <https://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html>: Upon successful completion, the dprintf(), fprintf(), and printf() functions shall return the number of bytes transmitted. Closes: <https://bugzilla.kernel.org/show_bug.cgi?id=218600> Reported-by: <quirin.blaeser@freenet.de> Signed-off-by: Jeremy Baxter <jtbx@disroot.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-03-12logb.3: floor(log2(fabs(x))) has rounding errorsAlejandro Colomar1-2/+3
Link: <https://inbox.sourceware.org/libc-alpha/20240305150131.GD3653@qaa.vinc17.org/T/#m3ceecda630012995339bcc5448fee451cf277a8b> Reported-by: Vincent Lefevre <vincent@vinc17.net> Suggested-by: Vincent Lefevre <vincent@vinc17.net> Cc: Morten Welinder <mwelinder@gmail.com> Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-03-12TIMESPEC_TO_TIMEVAL.3, TIMEVAL_TO_TIMESPEC.3: Document these macrosAlejandro Colomar2-0/+33
Reported-by: Guillem Jover <guillem@hadrons.org> Reviewed-by: Oskari Pirhonen <xxc3ncoredxx@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-03-12log2.3, log10.3: wfixAlejandro Colomar2-4/+4
Reported-by: Morten Welinder <mwelinder@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-03-12cbrt.3: wfix: Cube roots are rarely representableAlejandro Colomar1-2/+5
On Thu, Feb 29, 2024 at 07:28:10PM -0500, Morten Welinder wrote: > The phrase "every representable real value has a representable real > cube root" is wrong. In fact, a representable cube root is quite > rare. Link: <https://lore.kernel.org/linux-man/ZeYKUOKYS7G90SaV@debian/T/#mff0ab388000c6afdb5e5162804d4a0073de481de> Reported-by: Morten Welinder <mwelinder@gmail.com> Cowritten-by: Morten Welinder <mwelinder@gmail.com> Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Cc: Vincent Lefevre <vincent@vinc17.net> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-03-12significand.3: significand() uses FLT_RADIX, not 2Alejandro Colomar1-1/+2
It's implemented using scalb(), which uses FLT_RADIX. Reported-by: Morten Welinder <mwelinder@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-03-12logb.3: logb(x) is floor(log2(fabs(x)))Alejandro Colomar1-1/+1
log2(3) doesn't accept negative input, but it seems logb(3) does accept it. Link: <https://lore.kernel.org/linux-man/ZeYKUOKYS7G90SaV@debian/T/#u> Reported-by: Morten Welinder <mwelinder@gmail.com> Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Cc: Vincent Lefevre <vincent@vinc17.net> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-03-03man*/: epoll_*(), fcntl(), flock(), ioctl(), msgctl(), *prctl(), ptrace(), ↵Alejandro Colomar1-5/+6
quotactl(), reboot(), semctl(), shmctl(), lockf(): Consistently use 'op' and 'operation' Reported-by: Bruno Haible <bruno@clisp.org> Cc: Elliott Hughes <enh@google.com> Cc: Stefan Puiu <stefan.puiu@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-02-26share/mk/, man*/: build-ex: Skip expected failuresAlejandro Colomar7-7/+7
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-02-26man3/: Say cancelation instead of cancellationAlejandro Colomar3-7/+7
It's the most common spelling in this project. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-02-26mbsrtowcs.3: ffixAlejandro Colomar1-1/+2
With groff-1.23.0, which has a base paragraph indentation of 7, this line was longer than 80 columns. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-02-25man*/: srcfixAlejandro Colomar3-7/+7
Found with: $ grep -rn '"""' man* \ | grep -v '"""""""""""' \ | sed 's/:.*//' \ | sort \ | uniq; man2/add_key.2 man2/getrlimit.2 man2/keyctl.2 man2/pivot_root.2 man2/request_key.2 man3/isalpha.3 man3/setlocale.3 man3/toupper.3 man7/capabilities.7 man7/cgroups.7 man7/keyrings.7 man7/locale.7 man7/user_namespaces.7 Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-02-18getaddrinfo.3: tfixŠtěpán Němec1-1/+1
(Incidentally, the glibc function source does name the parameter "name" rather than "node", unlike this man page. (The POSIX man page uses "nodename".)) Signed-off-by: Štěpán Němec <stepnem@smrk.net> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-02-12man*/: ffixAlejandro Colomar1-1/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-02-12pthread_create.3: Re-do the architecture/default stack size mappingнаб1-17/+2
Currently, the page lists 2 of the 3 x86 architectures, no ARM(!), old PowerPC only, and most egregiously itanium, which linux doesn't target. Per glibc 2.38: $ git grep ARCH_STACK_DEFAULT_SIZE aarch64 #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) arc #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) arm #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) csky #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) loongarch #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) m68k #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) microblaze #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) mips #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) nios2 #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) or1k #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) riscv #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) s390 #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) sh #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) sparc32 #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) x86 #define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024) alpha #define ARCH_STACK_DEFAULT_SIZE (4 * 1024 * 1024) powerpc #define ARCH_STACK_DEFAULT_SIZE (4 * 1024 * 1024) sparc64 #define ARCH_STACK_DEFAULT_SIZE (4 * 1024 * 1024) hppa #define ARCH_STACK_DEFAULT_SIZE (8 * 1024 * 1024) ia64 #define ARCH_STACK_DEFAULT_SIZE (32 * 1024 * 1024) I cut PA-RISC and the Alpha. They have 10 and 6 popcon entries, respectively, and AFAICT they haven't seen a processor released in over a decade, they aren't relevant to any modern reader. Similarly, use "POWER" instead of "PowerPC" ‒ the consensus branding is "POWER"+version (POWER8/POWER9); PowerPC is itself a POWER variant and doesn't really deserve its own special mention, especially in 2024. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-01-29frexp.3: ISO C defines frexp(3) in terms of 2, not FLT_RADIXAlejandro Colomar1-2/+1
Even in systems where FLT_RADIX != 2, frexp(3) would be 2-based. This was correctly worded in the DESCRIPTION, but the example program was incorrect. Link: <https://lore.kernel.org/linux-man/CANv4PNkqQBPn_oyfdYZfOck-7gGwzP6YPPA9hDaiaJPUj+c3xw@mail.gmail.com/T/#u> Reported-by: Morten Welinder <mwelinder@gmail.com> Cc: Matthew House <mattlloydhouse@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-01-28adjtime.3: wfixAlejandro Colomar1-1/+1
Reported-by: Helge Kreutzmann <debian@helgefjell.de> Cc: Mario Blaettermann <mario.blaettermann@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-01-28man*/: Say ISO 3166Alejandro Colomar1-1/+1
Link: <https://www.iso.org/iso-3166-country-codes.html> Reported-by: Helge Kreutzmann <debian@helgefjell.de> Cc: Mario Blaettermann <mario.blaettermann@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-01-28man*/: Say ISO 639Alejandro Colomar1-1/+1
Link: <https://www.iso.org/standard/74575.html> Reported-by: Helge Kreutzmann <debian@helgefjell.de> Cc: Mario Blaettermann <mario.blaettermann@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-01-28man3/: Say ISO 8601Alejandro Colomar3-13/+13
Link: <https://www.iso.org/standard/70907.html> Reported-by: Helge Kreutzmann <debian@helgefjell.de> Cc: Mario Blaettermann <mario.blaettermann@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-01-28nl_langinfo.3: ffixAlejandro Colomar1-1/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-01-28man*/: Say ISO/IEC 2022Alejandro Colomar1-1/+1
Link: <https://www.iso.org/standard/22747.html> Reported-by: Helge Kreutzmann <debian@helgefjell.de> Cc: Mario Blaettermann <mario.blaettermann@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-01-16fts.3, div_t.3type: ffixG. Branden Robinson1-4/+8
Break lines containing a parametric prefix to a man page name into two lines, using distinct font alternation macros and the `\c` escape sequence to "connect" the output. This prepares for adoption of the `MR` man(7) macro in groff 1.23.0. The style seen here assumes that the typeface used for man page names is bold, which is ahistorical and which the `MR` feature makes configurable. It might be better to recast this shorthand into English. Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2024-01-01sched_getcpu.3: tfixAlejandro Colomar1-1/+1
Fixes: 2b65a83f2983 ("Documents sched_getcpu(3), a wrapper for getcpu(2), provided since glibc 2.6.") Reported-by: Shahab Ouraie <shahabouraie@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-29fopencookie.3, stdio.3: wfixнаб2-2/+2
Suggested-by: Alejandro Colomar <alx@kernel.org> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-29stdio.3: Note down fmemopen(3), fopencookie(3), and open_[w]memstream(3)наб1-0/+12
I was looking for fmemopen() to remember I was actually looking for open_memstream(), and it was much more difficult than it ought to've been. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-28open_memstream.3: ffixнаб1-1/+1
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-19strtol.3, strtoul.3: If the base is not supported, endptr may be left untouchedAlejandro Colomar2-0/+6
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-09scanf.3: BUGS: It's impossible to know how many characters were consumedAlejandro Colomar1-0/+9
Suggested-by: Zack Weinberg <zack@owlfolio.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-09scanf.3, sscanf.3: These functions scan formatted inputAlejandro Colomar2-2/+2
Suggested-by: Lee Griffiths <poddster@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-09scanf.3: CAVEATS: Trailing text cannot be checkedAlejandro Colomar1-0/+3
scanf("%d foo"); It is impossible to know if scanf(3) consumed " foo" or not. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-09scanf.3: CAVEATS: These functions don't distinguish newlines easilyAlejandro Colomar1-0/+5
One could use "%*1[\n]" for specifying a newline, and "%*[ \t] for other white space. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-06strtol.3: Clarify that the base should be tested beforehand, if at allAlejandro Colomar1-3/+25
Normally, the base need not be tested, and the only interesting errno value should be ERANGE. If the base needs to be tested, it should be tested in a call that would not otherwise fail. Otherwise, it would be easy to trigger Undefined Behavior. Consider the following example: errno = 0; val = strtol("foo", &end, -42); There's no portable way to know if the call failed due to the string or the base. Cc: Matthew House <mattlloydhouse@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-06sscanf.3: Remove term 'deprecated', and expand BUGSAlejandro Colomar1-13/+2
Several programmers have been confused about this use of 'deprecated'. Also, maximum field width can be used with these fields to mitigate the problem. Still, it's only a mitigation, since it limits the number of characters read, but that means an input of LONG_MAX+1 --which takes up the same number of characters than LONG_MAX-- would still cause UB; or one can limit that to well below the limit of UB, but then it artificially invalidates valid input. No good way to avoid UB with sscanf(3), but it's not necessarily bad with trusted input (and strtol(3) isn't the panacea either: it avoids UB, but error checking is hard; strtoi(3) is good, though, but not standard). Link: <https://stackoverflow.com/questions/77601832/man-sscanf-d-is-deprecated-in-c-or-glibc/> Cc: Lee Griffiths <poddster@gmail.com> Cc: Zack Weinberg <zack@owlfolio.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-05strncat.3: Clarify that it terminates the stringAlejandro Colomar1-1/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-04strncat.3: Fix return value of possible implementationAlejandro Colomar1-1/+2
Accidentally, I changed the return while changing something else. Fix it. Fixes: 790795ec4e5e ("strncat.3: Write the null byte with stpcpy(3)") Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-04strncat.3: Write the null byte with stpcpy(3)Alejandro Colomar1-5/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-04strncat.3: Implement strncat(3) in terms of strnul()Alejandro Colomar1-1/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-12-01strtol.3, strtoul.3: ERRORS: Clarify that these don't set errno on successAlejandro Colomar2-0/+6
That's a guarantee made by POSIX. Reported-by: Jakub Wilk <jwilk@jwilk.net> Cc: Florian Weimer <fweimer@redhat.com> Cc: Iker Pedrosa <ipedrosa@redhat.com> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-24posix_memalign.3: wfixAlejandro Colomar1-2/+0
Remove superfluous words. Suggested-by: Jonny Grant <jg@jguk.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-24posix_memalign.3: ERRORS: wfixAlejandro Colomar1-1/+1
Simplify, and make it consistent with malloc(3). Suggested-by: Jonny Grant <jg@jguk.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-24pthread_key_create.3: tfixJakub Wilk1-1/+1
Signed-off-by: Jakub Wilk <jwilk@jwilk.net> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-22stpncpy.3: Rename third parameter to 'dsize'Alejandro Colomar1-9/+9
This better clarifies that the size is of dst. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-22stpncpy.3: Reword, saying 'byte' instead of 'character'Alejandro Colomar1-5/+6
These functions are also used with multi-byte characters, so character can be confusing. Suggested-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-22stpncpy.3: EXAMPLES: errx(3) instead of warnx(3) if truncation occursAlejandro Colomar1-2/+2
Truncation is not acceptable in most cases. Don't suggest that it's just fine. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-22stpncpy.3: EXAMPLES: Use fwrite(3) instead of printf(3)Alejandro Colomar1-2/+4
fwrite(3) is more appropriate for printing a character sequence with known lenght. printf(3) has a limitation of INT_MAX, and also requires more complex (less readable) code. Suggested-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-22stpncpy.3: NAME: Clarify that these functions only pad if necessaryAlejandro Colomar1-2/+2
Suggested-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21stpncpy.3: Optimize possible implementation of stpncpy()Alejandro Colomar1-2/+4
Don't zero twice, since it can be confusing. Since bzero(3) returns void, we need memset(3) here. Reported-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21stpncpy.3: SYNOPSIS: ffixAlejandro Colomar1-2/+2
Reported-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21stpncpy.3: Don't say 'width' when 'size' is meantAlejandro Colomar1-2/+2
Reported-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: CAVEATS: wfixAlejandro Colomar1-2/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: Reword descriptionAlejandro Colomar1-4/+9
While rewording, use "byte" instead of "character". This function is also used with multi-byte characters, so character can be confusing. Suggested-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: Say that if dst isn't a string, the behavior is undefinedAlejandro Colomar1-3/+5
Suggested-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: SEE ALSO: tfixAlejandro Colomar1-1/+1
Reported-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: EXAMPLES: Fix name of variableAlejandro Colomar1-4/+3
It was called maxsize, but it was really a number of elements. And it wasn't maximum; it was exact. Reported-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: Simplify possible implementation of strncat()Alejandro Colomar1-5/+2
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: Rename third parameter to ssizeAlejandro Colomar1-5/+5
This better clarifies that the size is of src. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: Fix bug in possible implementation of strncat(3)Alejandro Colomar1-2/+2
Reported-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: SYNOPSIS: ffixAlejandro Colomar1-1/+1
Reported-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: Don't say 'width' when 'size' is meantAlejandro Colomar1-2/+2
Reported-by: Paul Eggert <eggert@cs.ucla.edu> Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-21strncat.3: Say append instead of (con)catenateAlejandro Colomar1-2/+2
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-19mbsrtowcs.3: Clarify that mbsrtowcs(3) is a restartable version of mbstowcs(3)Alejandro Colomar1-1/+4
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-19mbsrtowcs.3: Clarify how to ensure a full conversionAlejandro Colomar1-0/+6
This text is based on a similar one from mbstowcs(3). Suggested-by: Andriy Utkin <andriy_utkin@fastmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-19ffs.3: All these functions live in <strings.h>.Elliott Hughes1-6/+0
In most cases you'll get them transitively through <string.h>, but it's misleading for the man page to claim that they're _in_ <string.h>, and especially weird to claim they're in _different_ headers from each other! This is also true of Apple's headers, and FreeBSD (the other BSDs only have ffs(), not its siblings). Signed-off-by: Elliott Hughes <enh@google.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-14mbstowcs.3: Reorder textAlejandro Colomar1-6/+6
So that it appears in the same order as in mbsrtowcs(3), for being able to diff(1) the two pages. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-14mbsrtowcs.3, mbstowcs.3: Remove unnecessary references to the function nameAlejandro Colomar2-12/+5
This allows diffing both pages, which are very similar: $ diff -u <(man mbstowcs) <(man mbsrtowcs) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-14mbsrtowcs.3, mbstowcs.3: Use dsize for dst size; not len, and not nAlejandro Colomar2-13/+13
This makes it clear that it's a size, not a length. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-14string.3: strncpy(): wfixPaul Eggert1-1/+1
Say "size" not "width" for byte counts; "width" is for the number of bits in a word. Say "leading" to make it clear we don’t care about what the source contains after its first null byte. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-13string.3: strncpy(): Talk about bytes, not charactersAlejandro Colomar1-1/+1
These functions are also the way to copy multibyte strings, so be generic and say that they just copy bytes. Not every byte is a valid character in (for example) UTF-8 locales. Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-13string.3: strncpy(): Reword so as to not imply the result has some null padding.Alejandro Colomar1-2/+2
Cowritten-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-13string.3: tfixAlejandro Colomar1-1/+1
Replace “‐” (U+2020 HYPHEN) with “-” (U+002D HYPHEN-MINUS). Reported-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-13stpecpyx.3: Remove link pagePaul Eggert1-1/+0
* Remove man3/stpecpyx.3; no longer present. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-13stpecpy.3, ustpcpy.3, ustr2stp.3, zustr2stp.3, zustr2ustp.3: Remove link ↵Alejandro Colomar5-5/+0
pages that don't correspond to a libc function Reported-by: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-11man*/: Improve timestamp documentationPaul Eggert1-16/+7
Improve discussion of leap seconds, year-2038 etc. Cc: Elliott Hughes <enh@google.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-09stpncpy.3, string.3, string_copying.7: Clarify that st[rp]ncpy() pad with ↵Alejandro Colomar2-13/+8
null bytes The previous wording could be interpreted as if the nulls were already in place. Clarify that it's this function which pads with null bytes. Also, it copies "characters" from the src string. That's a bit more specific than copying "bytes", and makes it clearer that the terminating null byte in src is not part of the copy. Suggested-by: Jonny Grant <jg@jguk.org> Cc: DJ Delorie <dj@redhat.com> Cc: Matthew House <mattlloydhouse@gmail.com> Cc: Oskari Pirhonen <xxc3ncoredxx@gmail.com> Cc: Thorsten Kukuk <kukuk@suse.com> Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Cc: Zack Weinberg <zack@owlfolio.org> Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com> Cc: Carlos O'Donell <carlos@redhat.com> Cc: Paul Eggert <eggert@cs.ucla.edu> Cc: Xi Ruoyao <xry111@xry111.site> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-09stpncpy.3, string_copying.7: Clarify that st[rp]ncpy() do NOT produce a stringAlejandro Colomar1-4/+13
These copy *from* a string. But the destination is a simple character sequence within an array; not a string. Suggested-by: DJ Delorie <dj@redhat.com> Acked-by: Oskari Pirhonen <xxc3ncoredxx@gmail.com> Cc: Jonny Grant <jg@jguk.org> Cc: Matthew House <mattlloydhouse@gmail.com> Cc: Thorsten Kukuk <kukuk@suse.com> Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Cc: Zack Weinberg <zack@owlfolio.org> Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com> Cc: Carlos O'Donell <carlos@redhat.com> Cc: Paul Eggert <eggert@cs.ucla.edu> Cc: Xi Ruoyao <xry111@xry111.site> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-06stpncpy.3: tfixAlejandro Colomar1-1/+1
Fixes: 4131356cdab8 ("man*/, man-pages.7: VERSIONS, STANDARDS, HISTORY: Reorganize sections") Reported-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-02bcmp.3: wfixAlejandro Colomar1-1/+1
Reported-by: Helge Kreutzmann <debian@helgefjell.de> Cc: Mario Blaettermann <mario.blaettermann@gmail.com> Suggested-by: Stefan Puiu <stefan.puiu@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-01setlogmask.3: ffixAlejandro Colomar1-1/+5
Fixes: c06eb28eb622 ("man-pages 1.41") Reported-by: Helge Kreutzmann <debian@helgefjell.de> Cc: Mario Blaettermann <mario.blaettermann@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-01catan.3: ffixAlejandro Colomar1-1/+3
Fixes: 8d332a95081b ("man-pages 1.57") Reported-by: Helge Kreutzmann <debian@helgefjell.de> Cc: Mario Blaettermann <mario.blaettermann@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-11-01malloc_get_state.3: tfixAlejandro Colomar1-1/+1
Fixes: 30ed4712c794 ("chroot.2, dup.2, nfsservctl.2, utimensat.2, malloc_get_state.3, pthread_setaffinity_np.3, ddp.7, fifo.7, ip.7: Remove some out-of-date/obsolete/irrelevant FIXMEs") Reported-by: Helge Kreutzmann <debian@helgefjell.de> Cc: Mario Blaettermann <mario.blaettermann@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-10-31man*/: srcfix (Use .P instead of .PP or .LP)Alejandro Colomar586-4798/+4798
We're trying to "standardize" on a paragraphing macro from the three equivalent ones (P, PP, LP). We (somewhat arbitrarily) agreed on P. Scripted change: $ find man* -type f | xargs sed -i '/\.PP/s/PP/P/' $ find man* -type f | xargs sed -i '/\.LP/s/LP/P/' Suggested-by: "G. Branden Robinson" <branden@debian.org> Cc: Ingo Schwarze <schwarze@openbsd.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-10-26strerror.3: Document the string produced by 'strerrorname_np(0);'Alejandro Colomar1-0/+4
Reported-by: Alexander Kozhevnikov <mentalisttraceur@gmail.com> Link: <https://stackoverflow.com/questions/19885360/how-can-i-print-the-symbolic-name-of-an-errno-in-c/> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-10-23man*/: ffix (Use '.TQ' where appropriate)Alejandro Colomar3-3/+9
When there are multiple tags for a paragraph, using a single TP and separating the tags with commas makes the man(7) source more complex. It also has a disadvantage: when searching through a manual page, heuristics such as " --option" don't work so well. By using GNU's TQ, we simplify the source of the pages, and improve the ability to search them. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-10-04pthread_key_create.3: Mention glibc instead of LinuxThreadsAlejandro Colomar1-1/+1
glibc defines PTHREAD_DESTRUCTOR_ITERATIONS in <limits.h>. This means it must not loop forever. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-10-04pthread_*.3: ffix (semantic newlines)Alejandro Colomar6-275/+395
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-10-04pthread_*.3: ffix (paragraphing)Alejandro Colomar6-152/+149
Replace blank lines by either a no-op '.', the dummy character '\&', or an appropriate paragraphing macro. I've experimented with two '.' lines before section headings, which may increase readability. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-10-04pthread_*.3: Remove AUTHOR section; add copyright; adapt THAlejandro Colomar6-25/+36
Xavier asked that his name be removed from the AUTHOR section, and since we don't use that section in this project, we can just wipe it. Add copyright notices to the pages, with Xavier as the original author, and me, who will maintain them from now on. Xavier ACKed the Linux-man-pages-copyleft license. Adapt the TH line: - Specify the date as (date). - Specify the project name in the 4th arg. - The first arg, the page name, must be the same as the file name. Suggested-by: Xavier Leroy <Xavier.Leroy@inria.fr> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-10-04pthread_cond_init.3, pthread_condattr_init.3, pthread_key_create.3, ↵Alejandro Colomar6-209/+198
pthread_mutex_init.3, pthread_mutexattr_setkind_np.3, pthread_once.3: Update the glibc pages with the debian/glibc version of them Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-10-04pthread_cond_init.3, pthread_condattr_init.3, pthread_key_create.3, ↵Alejandro Colomar6-0/+710
pthread_mutex_init.3, pthread_mutexattr_setkind_np.3, pthread_once.3: Import pages from glibc Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-09-27printf.3: Fix reference to CAVEATS (previously NOTES)Alejandro Colomar1-2/+2
Fixes: 4131356cd ("man*/, man-pages.7: VERSIONS, STANDARDS, HISTORY: Reorganize sections") Reported-by: Дилян Палаузов <dilyan.palauzov@aegee.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-09-22man*/: Update references to sigevent(7 => 3type)Alejandro Colomar7-14/+14
Acked-by: Elliott Hughes <enh@google.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-09-13popen.3: wfixTom Schwindl1-1/+1
Signed-off-by: Tom Schwindl <schwindl@posteo.de> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-09-13fmod.3: Add example sectionJan Engelhardt1-0/+12
Signed-off-by: Jan Engelhardt <jengelh@inai.de> [alx: ffix] Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-09-13fmod.3: Add note how to obtain modulus/LPRJan Engelhardt1-0/+17
Signed-off-by: Jan Engelhardt <jengelh@inai.de> [alx: ffix] Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-09-07pthread_setschedparam.3: EXAMPLES: Add missing [[noreturn]]Alejandro Colomar1-0/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-09-07getutent.3: EXAMPLES: Fix use of time(3)Alejandro Colomar1-1/+1
time(ptr) was wrong here, because struct utmp::ut_time is a int32_t, not a time_t. Also, the use of time(ptr) is obsolete, and time(NULL) is always preferred. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-09-07getaddrinfo_a.3: EXAMPLES: Use a safer wrapper around *alloc*(3) functionsAlejandro Colomar1-4/+27
These wrappers result in cleaner code, and prevent many mistakes that can happen when using malloc(3), calloc(3), realloc(3), and functions of that family. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-08-31strtol.3: EXAMPLES: Remove unused includeAlejandro Colomar1-1/+0
Fixes: 93f369892aea ("strtol.3: EXAMPLES: Simplify errno checking") Reported-by: iwyu(1) (`make lint-c-iwyu`) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-08-31_Generic.3: EXAMPLES: Silence indent warningAlejandro Colomar1-1/+1
cpplint(1) complained about the previous indentation of the comment. Oh well. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-08-31pthread_setschedparam.3: EXAMPLES: Add const to function parameterAlejandro Colomar1-1/+1
Just because we can. Reported-by: cppcheck(1) (`make lint-c-cppcheck`) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-08-31pthread_getattr_np.3: EXAMPLES: Fix bug in comparisonAlejandro Colomar1-3/+3
size_t can't ever be `< 0`. Instead, the intention was comparing to `-1`, a sentinel value that was being converted to `SIZE_MAX`. Comparing with `!= -1` we can keep the `-1` in the source code, which will be more readable. Reported-by: cppcheck(1) (`make lint-c-cppcheck`) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-08-31getaddrinfo_a.3: EXAMPLES: Handle *alloc(3) errorsAlejandro Colomar1-6/+17
- Use reallocf(3bsd) to avoid memory leaks with misuses of realloc(3). - err(3bsd) on allocation errors. Reported-by: cppcheck(1) (`make lint-c-cppcheck`) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-08-31pthread_getattr_default_np.3: EXAMPLES: Fix conversion specifier for size_tAlejandro Colomar1-2/+2
Reported-by: cppcheck(1) (`make lint-c-cppcheck`) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-08-31man3/: EXAMPLES: Don't build programs that have UB on purposeAlejandro Colomar4-4/+4
It doesn't make sense linting and building these, as we know they'll yell at us. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-08-29strcpy.3, strncat.3, string_copying.7: tfixAlejandro Colomar2-2/+2
Remove non-breaking space (0xC2A0) that accidentally landed in the source of some string pages. Replace by a normal space (0x20). Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-08-14strerror.3: Change strerror() reference from MT-Unsafe to MT-SafeShani Leviim1-16/+15
The information in this patch was obtained from a glibc upstream patch, commit 28aff047818eb1726394296d27b9c7885340bead ("string: Implement strerror in terms of strerror_l"). According to the patch above, for glibc versions >=2.32, strerror() is MT-Safe. Signed-off-by: Shani Leviim <sleviim@redhat.com> Cc: Florian Weimer <fweimer@redhat.com> Cc: Carlos O'Donell <carlos@redhat.com> Cc: Sergei Gromeniuk <sgromeni@redhat.com> Cc: Gobinda Das <godas@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-08-13man*/: Replace .sp 1 calls by PP or IPAlejandro Colomar16-16/+16
They were used after a table as a workaround for a groff-1.22.4 bug, but now, in groff-1.23.0, we can use the usual PP or IP macros. Link: <https://savannah.gnu.org/bugs/index.php?49390> Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-08-13man*/: Remove .sp 1 calls right before SH or PPAlejandro Colomar500-500/+0
Scripted patch: $ grep -rl '^\.sp ' man* | xargs sed -z -i 's/\n\.TE\n\.sp 1\n\.SH/\n.TE\n.SH/' $ grep -rl '^\.sp ' man* | xargs sed -z -i 's/\n\.TE\n\.sp 1\n\.PP/\n.TE\n.PP/' plus a few other cases where roff(7) comments made it more complex. This was a workaround for some groff-1.22.4 bug, but it has been fixed in groff-1.23.0. Link: <https://savannah.gnu.org/bugs/index.php?49390> Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-30setnetgrent.3, unlocked_stdio.3: ffixG. Branden Robinson2-4/+0
Stop attempting to manipulate adjustment outside of tbl(1) text blocks. Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-30man3/: srcfixG. Branden Robinson3-45/+39
Clean up in preparation for "MR sed". Protect (non-cross-referenced) man page names from hyphenation. Use the hyphenation control escape sequence `\%` to do this rather than bracketing a region of the page with `na` and `hy` requests, which enables automatic hyphenation even when it is not desired and uses the wrong hyphenation mode for English to boot. Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-30pthread_setcancelstate.3: ffixG. Branden Robinson1-1/+1
Clean up in preparation for "MR sed". Protect man page name from hyphenation. `MR` will take care of that for us; this change is to detect a regression when migrating to it. Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-30pthread_setcancelstate.3: srcfixG. Branden Robinson1-1/+0
Continue commit 9e54434ead, 19 July. Fix half-bracketed table that didn't turn hyphenation off prior to the `TS` call in the first place. Fizes: 9e54434ead ("man*/: ffix (un-bracket tables)") Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-30termios.3: srcfixG. Branden Robinson1-2/+0
Continue commit 9e54434ead, 19 July. Fix an anomalously bracketed table, not detected by my sed script because of the intrusion of a *roff comment. Fizes: 9e54434ead ("man*/: ffix (un-bracket tables)") Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-30man*/: ffix (un-bracket tables, continued)G. Branden Robinson1-4/+0
Continue commit 9e54434ead, 19 July. 4 pages issued requests to manipulate adjustment and automatic hyphenation around tbl(1) tables in a different order from the other 525 documents in the tree that performed this trick. I produced this change with the following GNU sed script. /^\.nh/{N;/\n\.ad l/{N;/\n\.TS/s/.*/.TS/}} /^\.TE/{N;/\n\.ad/{N;/\n\.hy/s/.*/.TE/}} Fizes: 9e54434ead ("man*/: ffix (un-bracket tables)") Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-30memcmp.3: Recast security caveatG. Branden Robinson1-3/+11
Use terminology more carefully. * Refer to the info sec property of confidentiality[1] instead of saying, vaguely, "security-critical". * Try not to confuse anyone who's studied the analysis of algorithms: don't say "constant time" when "deterministic time" is meant. The time to perform the memory comparison remains linear (O(n)), not constant (O(1)). * Tighten wording. Link: [1] <https://informationsecurity.wustl.edu/items/confidentiality-integrity-and-availability-the-cia-triad/> Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-28abort.3: Clarify consequences of calling abort()Tomáš Golembiovský1-0/+6
Clarify that atexit(3)/on_exit(3) are not called because those are called only on normal process termination (as documented on their respective manual pages). Check with the following test program: ```c #define _DEFAULT_SOURCE #include <stdio.h> #include <stdlib.h> void one(void) { puts("atexit called"); } void two(int, void*) { puts("on_exit called"); } int main(void) { atexit(one); on_exit(two, NULL); puts("terminating"); //abort(); exit(EXIT_SUCCESS); } ``` Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com> Cc: Stefan Puiu <stefan.puiu@gmail.com> Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-20man*/: ffix (un-bracket tables)G. Branden Robinson516-2068/+1406
* Stop disabling adjustment and automatic hyphenation before tables, and incorrectly "restoring" it afterward. In addition to repetitious boilerplate around tables, the `ad` and `hy` requests, when not given arguments, do not behave as many man page authors expect. If adjustment was initially disabled when rendering the page, it was being activated after `TE` calls, frustrating the desire of the reader. Furthermore, `hy` when given no argument enables automatic hyphenation in mode "1", which is not an appropriate value for the TeX-based hyphenation patterns for English that groff has used for over 30 years. And analogously to `ad`, a simple `hy` request would reactivate automatic hyphenation even if the reader had disabled it. Moreover, such fiddling is often unnecessary. tbl(1) from groff 1.23.0 describes how tbl(1) has always worked, dating back to Michael Lesk's original implementation at Bell Labs in the 1970s. "Ordinarily, a table entry is typeset rigidly. It is not filled, broken, hyphenated, adjusted, or populated with additional inter- sentence space. ... Text blocks are formatted as was the text prior to the table, modified by applicable column descriptors. ... Add na or ad requests to the beginning of a text block to alter its adjustment distinctly from other text in the document. As with other table entries, when a text block ends, any alterations to formatting parameters are discarded. They do not affect subsequent table entries, not even other text blocks." * Apropos of the foregoing, add `na` and `nh` requests to the "Interface" columns of MT-safety tables in pages' "ATTRIBUTES" sections, so that C function names are not inappropriately hyphenated. I produced this change with the following GNU sed script. :start /^\.ad l/{N;/\n\.nh/{N;/\n\.TS/s/.*/.TS/}} /^\.TE/{N;/\n\.hy/{N;/\n\.ad/s/.*/.TE/}} /^Interface.*Attribute.*Value/{N;/\nT{/s/.*/&\n.na\n.nh/ :loop n /T{/s/.*/&\n.na\n.nh/ /^\.TE/b start; b loop } Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-20man*/: ffix (use `\%`)G. Branden Robinson2-2/+2
Protect instances of some literals from hyphenation. These are only those necessary to improve analyzability of a large-scale (500+ file), sed-driven change to improve adjustment and hyphenation enablement management around tables. * man2/getrlimit.2: Protect some instances of `RLIMIT_MSGQUEUE`, `RLIMIT_SIGPENDING`, `RLIMIT_FSIZE`, and `getrlimit` from hyphenation. * man2/sigaltstack.2: Protect an instance of `setrlimit` from hyphenation. * man3/gethostbyname.3: Protect an instance of `endhostent` from hyphenation. * man3/getmntent.3: Protect an instance of `getmntinfo` from hyphenation. Signed-off-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-18grantpt.3: It's a no-op on modern glibc and other UNIXes; HISTORYiseнаб1-12/+10
FreeBSD, OpenBSD, and Linux (/dev/ptmx) do all intialisation in open(2), and grantpt(3) is a no-op (that checks whether the fd is a pty, except on musl). The illumos gate and NetBSD do a ioctl (and, indeed, illumos-gate commit facf4a8d7b59fde89a8662b4f4c73a758e6c402c ("PSARC/2003/246 Filesystem Driven Device Naming"), which kills pt_chmod, notes that it's been "6464196 bfu should remove pt_chmod, obsoleted by /dev filesystem"). glibc 2.33 completely kills BSD PTY support on Linux (Debian hasn't configured with them on any architecture since 2007: https://bugs.debian.org/338404 and even earlier on some arches; they're really just trivia under Linux ‒ this may be better served stuffed into HISTORY as an explainer for the SIGCHLD thing, since regardless of the "version", the behaviour is well-defined and consistent). There really aren't many cohesive "versions" of this ‒ indeed, so long as grantpt(3) exists it behaves precisely as described here ‒ inasmuch as different systems, historically, had different ptys, and thus different implementations. These are all but trivia. Cc: Jakub Wilk <jwilk@jwilk.net> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-16crypt.3, encrypt.3: Fix library name and descriptionXi Ruoyao2-17/+17
libcrypt is the password hashing library, and libcrypto is a completely different library (OpenSSL cryptography library). While the encrypt() function can "encrypt" things, it uses a broken algorithm so let's not call libcrypt an "encryption" library at all. In crypt.3, also replace "encrypt" with "hash" except several places where it really means "encrypt". Signed-off-by: Xi Ruoyao <xry111@xry111.site> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-15man*/: Use SPDX-License-Identifier: Linux-man-pages-1-paraAlejandro Colomar2-14/+4
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-15man*/: Prefer off_t over off64_t for splice(2), etc.Paul Eggert1-3/+14
For the few functions that come only in 64-bit off_t flavors, document their APIs as using off_t instead of off64_t, and say also that code should #define _FILE_OFFSET_BITS 64. This documents what user code is (and should be) doing anyway, if it needs to work on traditional x86 and ARM Linux. Reported-by: Rich Felker <dalias@libc.org> Fixes: 9bebb17e5b57 ("splice.2: Use 'off64_t' instead of 'loff_t'") Fixes: 76c5631fb442 ("copy_file_range.2: Document glibc wrapper instead of kernel syscall") Fixes: 5cabfa06b407 ("man-pages 1.68") Fixes: 3ca974e3988a ("New page for sync_file_range(2), new in kernel 2.6.17.") Fixes: 9bebb17e5b57 ("sync_file_range.2: Document the architecture-specific sync_file_range2() system call") Fixes: 79bf8cdcf36a ("Document fopencookie(3), a library function that allows custom implementation of a stdio stream.") Signed-off-by: Paul Eggert <eggert@cs.ucla.edu> Reviewed-by: Sam James <sam@gentoo.org> Cc: Jonathan Wakely <jwakely@redhat.com> Cc: Szabolcs Nagy <nsz@port70.net> Cc: Jakub Wilk <jwilk@jwilk.net> Cc: A. Wilcox <AWilcox@wilcox-tech.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-15statvfs.3: note f_favail = f_ffree on Linuxнаб1-0/+8
Quoting myself from #musl: 01:59:40 hm, I think this was just invented for symmetry with bfree/bavail 02:00:46 FFS has minfree for space but nothing equivalent for inodes 02:32:31 (this is mirrored in ext4; a global grep over DragonFlyBSD and the illumos gate showed just NFSv3 forwarding from the server; OpenBSD always sets it to the same thing as f_ffree; oddly, NetBSD /does/ calculate it differently for LFS and FFS but due to queued writes or w/e not because of root reservation; and as expected a lot of "/* what to put in here? */" and "// XXX same??") Link: https://lore.kernel.org/linux-man/f54kudgblgk643u32tb6at4cd3kkzha6hslahv24szs4raroaz@ogivjbfdaqtb/t/#u Cc: Tom Schwindl <schwindl@posteo.de> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-08isalpha.3: Move NOTES to CAVEATS, and clarify some Undefined BehaviorAlejandro Colomar1-2/+4
Reported-by: Yedidyah Bar David <didi@redhat.com> Acked-by: Sam James <sam@gentoo.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-08regex.3: ffix: "([^...])" is not an end of sentenceнаб1-1/+1
Caused a double space before "not". Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Tested-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Cc: Tom Schwindl <schwindl@posteo.de> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-07-08memchr.3: rawmemchr doesn't have an n parameterнаб1-1/+1
The /point/ is it's unbounded; git grep -F 'void "' | grep -F '[]' didn't return anything so I reverted it to a void*. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Fixes: c64cd13e0025 ("Various pages: SYNOPSIS: Use VLA syntax in 'void *' function parameters") Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-06-02malloc.3: write about another possible reason for ENOMEMMasatake YAMATO1-0/+4
Signed-off-by: Masatake YAMATO <yamato@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-05-26malloc.3: srcfixJakub Wilk1-1/+1
Signed-off-by: Jakub Wilk <jwilk@jwilk.net> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-05-25List a fifth condition when iconv(3) may stop.Bruno Haible1-1/+37
The wording regarding transliteration is vague, because this man page is not the right place for going into the details of the transliteration. Here are the details: GNU libc and GNU libiconv support transliteration, for example, of "½" to "1/2", or of "å" to "aa" in a Danish locale. The transliteration maps a multibyte character of the input encoding to zero or more characters in the output. There are two kinds of transliteration rules: - Those that are valid regardless of locale. Typically this means that the original and the transliterated character have similar glyphs, such as in the case "½" to "1/2". In GNU libc, these are collected in the files glibc/localedata/locales/translit_*. - Those that are valid in a single locale only. Often such a rule reflects similar pronounciation of the original and the transliterated characters. Some locales have script-based transliteration, for example from the Cyrillic script to the Latin script. In GNU libc, these are collected in the file glibc/localedata/locales/<locale>. In GNU libiconv, transliterations of this kind are not supported. Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29913#c4 Link: https://bugzilla.kernel.org/show_bug.cgi?id=217059 Reported-by: Steffen Nurpmeso <steffen@sdaoden.eu> Reported-by: Reuben Thomas <rrt@sc3d.org> Signed-off-by: Bruno Haible <bruno@clisp.org> [ fix semantic newlines ] Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-05-24putenv.3: tfixнаб1-1/+1
Fixes: commit b324e17d3208c940622ab192609b836928d5aa8d ("Many pages: wfix") Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-05-24putenv.3: Originated in SysVr2; in 4.3BSD-Reno; fixed on modern systemsнаб1-2/+3
Fixed in: NetBSD 6 src lib/libc/stdlib/putenv.c 1.13 FreeBSD 7 putenv(3) says so OpenBSD 4.6 src lib/libc/stdlib/setenv.c 1.10 and is correct under current(?) MacOS as well The current wording implies that all of 4.4BSD's descenants also carry this bug (at least it did to me): they did until like 2009 but they're fine now Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-05-20posix_memalign.3: Update aligned_alloc(3) to match C17DJ Delorie1-3/+2
Link: <https://sourceware.org/pipermail/libc-alpha/2023-May/147810.html> Link: <https://patchwork.sourceware.org/project/glibc/patch/33ec9e0c1e587813b90e8aa771c2c8e6e379dd48.camel@posteo.net/> Link: <https://lore.kernel.org/linux-man/d79b505c-5b19-331c-5b25-d40adc9cc843@wanadoo.fr/> Cc: John Scott <jscott@posteo.net> Cc: Paul Floyd <pjfloyd@wanadoo.fr> Signed-off-by: DJ Delorie <dj@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-05-18fflush.3, unlocked_stdio.3: SYNOPSIS: The streams can be nullAlejandro Colomar2-2/+2
Cc: Xi Ruoyao <xry111@xry111.site> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-05-03malloc.3: SYNOPSIS: Add the _Nullable qualifierAlejandro Colomar1-3/+3
These functions accept NULL. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-05-03malloc.3: ffixAlejandro Colomar1-5/+5
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-05-03man*/, man.ignore.grep: srcfix; warn about blank linesAlejandro Colomar121-1134/+1134
- Use the dummy character to avoid warnings in examples. - Re-enable the warning. Suggested-by: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-29man*/: srcfixAlejandro Colomar2-3/+3
Reported-by: groff(1) (`make build-catman-troff`) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-22regex.3: srcfixAlejandro Colomar1-1/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-22regex.3: We rewrote most of the pageAlejandro Colomar1-0/+2
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-21regex.3: Destandardeseify Match offsetsнаб1-28/+25
This section reads like it were (and pretty much is) lifted from POSIX. That's hard to read, because POSIX is horrendously verbose, as usual. Instead, synopsise it into something less formal but more reasonable, and describe the resulting range with a range instead of a paragraph. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-21regex.3: Desoupify regerror() descriptionнаб1-20/+16
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-21regex.3: SYNOPSIS: Remove superfluous commentsAlejandro Colomar1-6/+3
This has the benefit that we can use proportional-width fonts in the SYNOPSIS without misalignment in the structures. Cc: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Cc: Ralph Corderoy <ralph@inputplus.co.uk> Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-21regex.3: Further clarify the sole purpose of REG_NOSUBнаб1-8/+6
Link: <https://lore.kernel.org/linux-man/3459b2a0-6a07-40fc-1e66-db906c3f62ac@gmail.com/T/#mb50a957359e029c611d6e0b8f1b1a20101aae670> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-21regex.3: Finalise move of reg*.3typeнаб1-18/+32
They're inextricably linked, not cross-referenced at all, and not used anywhere else. Now that they (realistically) exist to the reader, add a note on how big nmatch can be; POSIX even says "The application developer should note that there is probably no reason for using a value of nmatch that is larger than preg−>re_nsub+1.". Also remove the now-duplicate regmatch_t declaration. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-21regex.3, regex_t.3type, regmatch_t.3type, regoff_t.3type: Move & link ↵наб1-0/+30
regex_t.3type into regex.3 Move-only commit. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-21dl_iterate_phdr.3: EXAMPLES: Alignment should match open parenthesisAlejandro Colomar1-14/+14
Reported-by: checkpatch(1) (`make lint-c-checkpatch`) Reported-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-21regex.3: Desoupify regfree() descriptionнаб1-5/+5
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-21regex.3: Improve REG_STARTENDнаб1-13/+16
Explicitly spell out the ranges involved. The original wording always confused me, but it's actually very sane. Remove "this doesn't change R_NOTBOL & R_NEWLINE" ‒ so does it change R_NOTEOL? No. That's weird and confusing. String largeness doesn't matter, known-lengthness does. Explicitly spell out the influence on returned matches (relative to string, not start of range). Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-21regex.3: Desoupify regexec() descriptionнаб1-6/+4
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-20regex.3: SYNOPSIS: Add _Nullable qualifier to regerror()'s errbufAlejandro Colomar1-2/+2
Passing NULL there means that the function returns the size needed for a copy without actually copying (possibly useful before allocating a buffer large enough). Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-20regex.3: Desoupify regcomp() descriptionнаб1-15/+7
Behold: regerror() is passed the error code, errcode, the pattern buffer, preg, a pointer to a character string buffer, errbuf, and the size of the string buffer, errbuf_size. Absolute soup. This reads to me like an ill-conceived copy from a very early standard version. It looks fine in source form but is horrific to read as running text. Instead, replace all of these with just the descriptions of what they do with their arguments. What the arguments are is very clearly noted in big bold in the prototypes. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-20regex.3: Fix subsection headingsнаб1-5/+5
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-20regex.3: SYNOPSIS: Add _Nullable qualifierAlejandro Colomar1-2/+2
Reported-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-20man*/: ffix, wfixнаб1-2/+2
Use "bitwise OR" instead of "bitwise-or" (with fonts). No other pages spell it like this. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-20regex.3: wfixнаб1-2/+2
"Not in POSIX.2", so is it in POSIX.1-2008? POSIX.1-2001? (or any other combination of standards from this millenion not mentioned on this page?) It's not: just say POSIX. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-20regex.3: ffixнаб1-2/+2
We never bold POSIX, not even anywhere else on this page. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-20regex.3: Note that pmatch is still used if REG_NOSUB if REG_STARTENDнаб1-2/+4
In the regexec() signature regmatch_t pmatch[restrict .nmatch], is a simplification. It's actually regmatch_t pmatch[restrict ((.preg->flags & REG_NOSUB) ? 0 : .nmatch) ?: !!(.eflags & REG_STARTEND)], But speccing that would be insane. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-11fts.3: SYNOPSIS: Fix nullabilityAlejandro Colomar1-2/+2
Reported-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-11fts.3: Note fts_open() behaviour with empty stringsнаб1-0/+11
This is undocumented in BSD, too, and present in the original SCCS check-in (5.1 (Berkeley) 12/30/89). This is very surprising, since in most other cases FTS is rather quite sane about error reporting, but /any/ empty string in the input vector blows out the creation entirely. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-11scanf.3: srcfixAlejandro Colomar1-1/+1
That extra whitespace cuased issues to the Debian packaging tool that autodetects the licenses from the SPDX header. Cc: Marcos Fouces <marcos@debian.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-08malloc_usable_size.3: The returned value should not be trustedAlejandro Colomar1-18/+15
It might very well return a value larger than the actual usable size, so writing to the excess bytes is Undefined Behavior. There's absolutely no promise about the value, except that it is no less than the size that was once passed to malloc(3). Link: <https://github.com/systemd/systemd/issues/22801#issuecomment-1343041481> Link: <https://inbox.sourceware.org/libc-alpha/20221124213258.305192-1-siddhesh@gotplt.org/T/> Reported-by: Mingye Wang <arthur200126@gmail.com> Reported-by: Siddhesh Poyarekar <siddhesh@gotplt.org> Cc: DJ Delorie <dj@redhat.com> Cc: Sam James <sam@gentoo.org> Cc: Florian Weimer <fweimer@redhat.com> Cc: Andreas Schwab <schwab@linux-m68k.org> Cc: Zack Weinberg <zack@owlfolio.org> Cc: Wilco Dijkstra <Wilco.Dijkstra@arm.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-05man*/: srcfixAlejandro Colomar1-1/+1
Reported-by: mandoc(1) (`make lint-man-mandoc`) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-03difftime.3: Don't suggest redefining a reserved identifierAlejandro Colomar1-1/+1
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-03getopt.3: Remove const from argvAlejandro Colomar1-10/+12
It is unnecessary to let readers believe it's const. Keep it as a detail in VERSIONS, which will only be found by those who need it. It is better to believe it's non-const, and rarely will one need to know that it isn't true. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-03man*/: ffixAlejandro Colomar2-3/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-04-01printf.3: Fix wording for the 0 flag with given precisionVincent Lefevre1-1/+1
When a precision is given, the 0 flag is ignored only for integer conversions, not for all numeric conversions. Signed-off-by: Vincent Lefevre <vincent@vinc17.net> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-03-30man*/, man-pages.7: VERSIONS, STANDARDS, HISTORY: Reorganize sectionsAlejandro Colomar558-2446/+3509
- Add a new HISTORY section that covers the history of an API, both regarding implementations and regarding old standards. This was previously covered in VERSIONS, and in some cases in STANDARDS. - Repurpose VERSIONS to cover differing implementations in _current_ systems. - STANDARDS is reduced to only cover current versions of standards. That basically means only C11 (C99 has been superseeded by C11; C17 is just a bugfix of C11, so not really a new version), and POSIX.1-2008 (*-2001 was superseeded by *-2008; *-2017 was just a bugfix for *-2008). The section also mentions for example 'Linux', 'GNU' or 'BSD' when a non-standard API is Linux- or GNU-only or if it's (de-facto) standard in the BSDs. - In some cases content that should go into one of these sections was in NOTES. Move it from there to where it corresponds. - In the SYNOPSIS, I added [[deprecated]] in some functions that I found are deprecated by the relevant standards. - A few other related changes... Cc: Oskari Pirhonen <xxc3ncoredxx@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-03-21man*/: Replace links to <sources.redhat.com>Yedidyah Bar David26-36/+36
<sources.redhat.com/bugzilla> seems broken right now. Apparently it was replaced, quite a long time ago --based on what I can find on the net-- with <www.sourceware.org/bugzilla>, which does work. This patch was created with: $ find man* -type f \ | xargs grep -l 'sources.redhat.com/bugzilla' \ | xargs sed -i 's;http://sources.redhat.com/bugzilla/;https://www.sourceware.org/bugzilla/;g' Verified with: $ git diff | sed -n 's;^+.*\(https://www.sourceware.org/bugzilla/show_bug.cgi?id=[0-9]*\).*;\1;p' > URLs $ mkdir test $ cd test $ wget -i ../URLs Signed-off-by: Yedidyah Bar David <didi@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-03-18arc4random.3: Simplify STANDARDS; add HISTORYAlejandro Colomar1-1/+8
Data copied from libbsd's page. Reported-by: Jakub Wilk <jwilk@jwilk.net> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-03-18man*/: tfixTom Schwindl1-1/+1
Signed-off-by: Tom Schwindl <schwindl@posteo.de> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-03-17man2/, man3/, man-pages.7: Move VERSIONS next to STANDARDSAlejandro Colomar160-607/+607
VERSIONS and STANDARDS are closely related (and often the distinction is not so clear). Now that we're going to add another section, HISTORY, that is related to both, it makes sense to have the three together. As a curiosity, the list in man-pages(7) that detailed what each section should contain had them by accident(?) in the order that we're moving to, instead of the order that was used elsewhere. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-03-15arc4random.3, man-pages.7: ffixAlejandro Colomar1-1/+1
Reported-by: Jakub Wilk <jwilk@jwilk.net> Cc: Tom Schwindl <schwindl@posteo.de> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-03-13Revert "Many pages: Remove references to C89"Alejandro Colomar85-86/+131
This reverts commit 72b349dd8c209d7375d4d4f76e2315943d654ee9. This removal caused inconveniences to some programmers. We've agreed to keep the information about C89, since there's an easy way to keep it correct by checking against a plain-text copy of the standard itself: $ stdc89() { grep "[[:alpha:]] \**\b$1([[:alnum:]*,. ]*);" /path/to/c89-draft.txt; } $ stdc89 printf int printf(const char *format, ...); int printf(const char *format, ...); We will also do a split of the information in STANDARDS, since now it's a mix of what a proper STANDARDS section would be plus a HISTORY section commonly-found in other manual pages. C89 will go into HISTORY. Link: <https://lore.kernel.org/linux-man/b73a9636-1a17-36f3-3718-d9ca3b9293ed@gmail.com/T/> Link: <https://port70.net/~nsz/c/c89/c89-draft.txt> Reported-by: Oskari Pirhonen <xxc3ncoredxx@gmail.com> Reported-by: Matt Jolly <Matt.Jolly@footclan.ninja> Cc: Brian Inglis <Brian.Inglis@Shaw.ca> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-03-12man*/: Fix ISO -> ISO/IEC where appropriateAlejandro Colomar1-1/+1
Link: <https://www.iso.org> Reported-by: Helge Kreutzmann <debian@helgefjell.de> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-03-10posix_memalign.3: SYNOPSIS: Mark functions as [[deprecated]]Alejandro Colomar1-3/+3
These functions are declared as obsolete in the same page. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-03-08man3/: srcfix (\" t comments)Alejandro Colomar2-1/+1
Add missing or remove redundant \" t comments (for tbl(1)). Reported-by: mandoc(1) (make lint-man-mandoc) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-03-08man*/: ffix (semantic newlines; commas)Alejandro Colomar4-8/+14
Reported-by: mandoc(1) (make lint-man-mandoc) Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-02-25malloc.3: EXAMPLES: Add example program with mallocarray() and macrosAlejandro Colomar1-0/+32
mallocarray() is safer than malloc(3), since it checks for overflow; it should be preferred almost always (with the exception of non-arrays maybe). The macros like MALLOCARRAY() --and MALLOC()-- that perform automatic casting and sizeof() are also safer than calling the functions directly: - The type of the allocated object (not the pointer) is specified as an argument, which improves readability: - It is directly obvious what is the type of the object just by reading the macro call. - It allows grepping for all allocations of a given type. This is admittedly similar to using sizeof() to get the size of the object, but we'll see why this is better. - In the case of reallocation macros, an extra check is performed to make sure that the previous pointer was compatible with the allocated type, which can avoid some mistakes. - The cast is performed automatically, with a pointer type derived from the type of the object. This is the best point of this macro, since it does an automatic cast, where there's no chance of typos. Usually, programmers have to decide whether to cast or not the result of malloc(3). Casts usually hide warnings, so are to be avoided. However, these functions already return a void *, so a cast doesn't really add much danger. Moreover, a cast can even add warnings in this exceptional case, if the type of the cast is different than the type of the assigned pointer. Performing a manual cast is still not perfect, since there are chances that a mistake will be done, and even ignoring accidents, they clutter code, hurting readability. And now we have a cast that is synced with sizeof. - Whenever the type of the object changes, since we perform an explicit cast to the old type, there will be a warning due to type mismatch in the assignment, so we'll be able to see all lines that are affected by such a change. This is especially important, since changing the type of a variable and missing to update an allocation call far away from the declaration is easy, and the consequences can be quite bad Apart from those benefits, there are other minor style benefits: - Consistency in getting the size of the object from sizeof(type), instead of a mix of sizeof(type) sometimes and sizeof(*p) other times. - More readable code: no casts, and no sizeof(), so also shorter lines that we don't need to cut. - Consistency in using array allocation calls for allocations of arrays of objects, even when the object size is 1. Link: <https://github.com/shadow-maint/shadow/pull/649> Cc: Serge Hallyn <serge@hallyn.com> Cc: Iker Pedrosa <ipedrosa@redhat.com> Cc: "Valentin V. Bartenev" <vbartenev@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-02-15sscanf.3: RETURN VALUE: These functions don't use a streamAlejandro Colomar1-7/+0
This text I forgot to remove it when the page was split from scanf(3). Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-02-15memcmp.3: wfixTom Schwindl1-1/+1
Link: <https://lore.kernel.org/linux-man/27264e6b-bc50-f772-f8d5-1abc4ebcbe62@gmail.com/T/> Signed-off-by: Tom Schwindl <schwindl@posteo.de> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-02-12_Generic.3: Remove example codeAlejandro Colomar1-89/+0
Casting sockaddr structures is just a symptom that these APIs were seriously misdesigned. In GNU C, there's already a better way to handle this (see [[gnu::transparent_union]]). ISO C should be fixed. Let's not promote this kind of code. Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-02-12register_printf_specifier.3, register_printf_modifier.3, ↵Alex Colomar3-0/+3
register_printf_type.3: Add links to printf.h(3head) Cc: Walter Harms <wharms@bfs.de> Cc: <Radisson97@gmx.de> Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com> Cc: <libc-alpha@sourceware.org> Signed-off-by: Alex Colomar <alx.manpages@gmail.com>
2023-02-10man*/: srcfix (^ -> \[ha])G. Branden Robinson4-8/+8
Use correct *roff special character for hat/caret/circumflex accent. Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-02-05Many pages: Use \[bu] instead of \(buAlejandro Colomar49-167/+167
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-02-05Various pages: Use \[rq] instead of \(rqAlejandro Colomar1-3/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-02-05Various pages: Use \[lq] instead of \(lqAlejandro Colomar1-3/+3
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-02-05Many pages: Use \[ha] instead of \(haAlejandro Colomar10-17/+17
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-02-05Many pages: Use \[ti] instead of \(tiAlejandro Colomar4-8/+8
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2023-02-05Many pages: Use \[em] instead of \(emAlejandro Colomar18-21/+21
Signed-off-by: Alejandro Colomar <alx@kernel.org>