Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/stdlib Clarify the behavior of exit(x) for out-of-r...



details:   https://anonhg.NetBSD.org/src/rev/e1efdf16aaaf
branches:  trunk
changeset: 772403:e1efdf16aaaf
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Jan 02 15:55:29 2012 +0000

description:
Clarify the behavior of exit(x) for out-of-range x. PR 45769

diffstat:

 lib/libc/stdlib/exit.3 |  20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r 14211d5b2066 -r e1efdf16aaaf lib/libc/stdlib/exit.3
--- a/lib/libc/stdlib/exit.3    Mon Jan 02 15:41:51 2012 +0000
+++ b/lib/libc/stdlib/exit.3    Mon Jan 02 15:55:29 2012 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: exit.3,v 1.14 2003/08/07 16:43:39 agc Exp $
+.\" $NetBSD: exit.3,v 1.15 2012/01/02 15:55:29 dholland Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\"     from: @(#)exit.3       8.1 (Berkeley) 6/4/93
 .\"
-.Dd August 11, 2002
+.Dd January 2, 2012
 .Dt EXIT 3
 .Os
 .Sh NAME
@@ -78,11 +78,19 @@
 .Fn exit
 calls
 .Xr _exit 2 .
-Note that typically
-.Xr _exit 2
-only passes the lower 8 bits of
+.Sh RESTRICTIONS
+Standard C guarantees only that the values zero,
+.Dv EXIT_SUCCESS ,
+and
+.Dv EXIT_FAILURE
+produce meaningful results.
+POSIX extends this to guarantee that the
+least significant 8 bits of
 .Fa status
-on to the parent, thus negative values have less meaning.
+are preserved and returned to the parent via
+.Xr wait 2 .
+Values outside the supported range 0-255 are bitwise-truncated; therefore,
+negative values should not be used.
 .Sh RETURN VALUES
 The
 .Fn exit



Home | Main Index | Thread Index | Old Index