On 20/04/2021 11:58, Konstantin Belousov wrote:
On Sat, Apr 17, 2021 at 09:13:06PM +0000, Mateusz Piotrowski wrote:
URL:
https://cgit.FreeBSD.org/src/commit/?id=c4207d867c201a726aa3157e09262f72166c89c4
commit c4207d867c201a726aa3157e09262f72166c89c4
Author: Mateusz Piotrowski <[email protected]>
AuthorDate: 2021-04-17 21:10:48 +0000
Commit: Mateusz Piotrowski <[email protected]>
CommitDate: 2021-04-17 21:12:06 +0000
fork.2: Add a simple use pattern
It seems to be a nice idea to show how fork() is usually used in
practice. This may act as a guide to developers who want to quickly
recall how to use the fork() function.
Reviewed by: bcr, yuripv
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27626
Using printf around fork is not the best idea, and definitely should not
be provided as a guiding example in the man page. Using stdio safely around
fork() requires at least flushing buffers and ensuring that opened FILEs are
in some consistent state right at fork.
It would work by chance in your example, mostly because you did not used
anything in stdio before fork, but any further changes would result in
very puzzling bugs (for beginners, who are the target of this example).
OK, I've opened a revision on Phabricator to address those issues:
https://reviews.freebsd.org/D29880
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "[email protected]"