From chris@claimlynx.com  Tue Jan 27 22:49:31 2004
Return-Path: <chris@claimlynx.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E74E716A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 Jan 2004 22:49:31 -0800 (PST)
Received: from ocelot.claimlynx.com (ocelot.claimlynx.com [208.210.147.66])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 81CF343D69
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 27 Jan 2004 22:49:27 -0800 (PST)
	(envelope-from chris@claimlynx.com)
Received: by ocelot.claimlynx.com (Postfix, from userid 105)
	id 5E5ADEBF5D; Wed, 28 Jan 2004 00:49:26 -0600 (CST)
Message-Id: <20040128064926.5E5ADEBF5D@ocelot.claimlynx.com>
Date: Wed, 28 Jan 2004 00:49:26 -0600 (CST)
From: Chris Johnson <chris@claimlynx.com>
Reply-To: Chris Johnson <chris@claimlynx.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: man _exit(2), exit(3) and wait(2) all tell lies.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         62021
>Category:       docs
>Synopsis:       man _exit(2), exit(3) and wait(2) all tell lies.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 27 22:50:11 PST 2004
>Closed-Date:    Mon Mar 01 18:15:44 PST 2004
>Last-Modified:  Mon Mar 01 18:15:44 PST 2004
>Originator:     Chris Johnson
>Release:        FreeBSD 4.9-RELEASE
>Organization:
self
>Environment:
System: FreeBSD ocelot.claimlynx.com 4.6.2-RELEASE FreeBSD 4.6.2-RELEASE #0: Tue Oct 15 18:00:26 CDT 2002 chris@ocelot.claimlynx.com:/usr/obj/usr/src/sys/GENERIC i386


>Description:

    man exit(3) says the status argument is an integer.

    /usr/include/sys/wait.h calls it a union or an integer, and treats
    it like an integer, even doing a right-shift of 8 bits to return what
    ought to be the upper 24 bits, since on most any i386 machine, an integer
    IS 32 BITS!

    However, actual execution demonstrates that exit(3) code is somewhere
    chopping it to 8 bits.

>How-To-Repeat:
fubar.c:
	main() {
        exit(902);
    }
% make fubar
% fubar
% echo $status
    returns 134.

>Fix:

	Correct documentation pages in _exit(2), exit(3), wait(2) and comments
    in /usr/include/sys/wait.h.

    Or actually fix the damn code to accept integers!


    Yes, I feel like going postal after wasting hours on tracking this down
    because one of my programs was returning "odd" values.  After 18 years
    of programming C / Unix code, the last place I expected to get screwed
    was by the basic OS functions and documentation.


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: cperciva 
State-Changed-When: Mon Mar 1 18:13:24 PST 2004 
State-Changed-Why:  
Documented in exit.3 version 1.12 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62021 
>Unformatted:
             The status argument is not an integer, even though they claim it is.
