Page MenuHomeFreeBSD

_exit.2: Cross-reference atexit(3)
Needs ReviewPublic

Authored by tembun_bk.ru on Sat, Jan 3, 10:48 AM.
Referenced Files
F141889029: D54467.diff
Mon, Jan 12, 1:22 AM
F141867823: D54467.diff
Sun, Jan 11, 5:12 PM
Unknown Object (File)
Sat, Jan 10, 4:11 AM
Unknown Object (File)
Mon, Jan 5, 2:36 PM
Unknown Object (File)
Mon, Jan 5, 4:07 AM
Unknown Object (File)
Mon, Jan 5, 3:41 AM
Unknown Object (File)
Mon, Jan 5, 3:23 AM
Unknown Object (File)
Mon, Jan 5, 3:04 AM
Subscribers

Details

Reviewers
ziaee
brooks
Group Reviewers
docs
manpages
Summary

atexit(3) is one of the cases when _exit(2) must be used instead of exit(3).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

We're a bit outside my expertise here, but initial thoughts:

atexit(3) is one of the cases when _exit(2) must be used instead of exit(3).

Shouldnt the cross-reference go the other way for discoverability then? atexit should link to _exit(2)?

We're a bit outside my expertise here, but initial thoughts:

atexit(3) is one of the cases when _exit(2) must be used instead of exit(3).

Shouldnt the cross-reference go the other way for discoverability then? atexit should link to _exit(2)?

Yes, I guess that would be a good idea. atexit(3) does describe the _exit(2) thing, but it doesn't have a cross-reference to it in SEE ALSO section.

Cross-reference _exit(2) from atexit(3).

Also, please update diffs with -U9999 so we can see all the context. Alternatively, try using src/tools/tools/git/git-arc.sh, which also has a manual in that dir too.

lib/libsys/_exit.2
111

Based on my comment above, again from not really understanding the implications of using the function, I don't think this is useful flow of information, to reference a function that requires a call from that calls manual.

lib/libsys/_exit.2
111

In most cases, programmers should use exit(3), which is a wrapper for _exit(2). From _exit(2):

Most C programs call the library routine exit(3), which flushes buffers, closes streams, unlinks temporary files, etc., before calling _exit().

However, when function is registered to be called at program exit with atexit(3), then this function should not use exit(3) inside. Instead, it should use _exit(2) or abort(3).
I just thought, since atexit(3) is one of the rare cases when _exit(2) should be used instead of exit(3), it would be useful to have it referenced in the man page (as one of the ways to apply this function).

But of course, if this would be, as you said, not very useful, then I guess we could leave only _exit(2) reference from in atexit(3).