From owner-freebsd-doc@FreeBSD.ORG Mon Feb 11 05:04:48 2013 Return-Path: Delivered-To: freebsd-doc@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E839DDF6 for ; Mon, 11 Feb 2013 05:04:48 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) Received: from alogt.com (alogt.com [69.36.191.58]) by mx1.freebsd.org (Postfix) with ESMTP id 9B40174F for ; Mon, 11 Feb 2013 05:04:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alogt.com; s=default; h=Content-Transfer-Encoding:Content-Type:Mime-Version:Message-ID:Subject:To:From:Date; bh=5q/0Mnne4/Udh+EcRX+Ed1BKAqv0zMAoUp5dzx/3Bf4=; b=akfgwbRwXLLZAdJfkILAiHRn1mMOT8lbhJyH3vzK5xG6GU0J/9WJFPrhmMvQFEGAjvIgII1WxuZr3d9xDY+KblH+AMOCc7bV+cbG3pb0D0w+TKlg++SDv63BWLH9NGQL; Received: from [122.129.203.50] (port=60147 helo=X220.ovitrap.com) by sl-508-2.slc.westdc.net with esmtpsa (SSLv3:DHE-RSA-AES128-SHA:128) (Exim 4.80) (envelope-from ) id 1U4lZJ-003FkD-Rs for freebsd-doc@freebsd.org; Sun, 10 Feb 2013 22:04:42 -0700 Date: Mon, 11 Feb 2013 12:04:38 +0700 From: Erich Dollansky To: freebsd-doc@freebsd.org Subject: missing information in man 3 system Message-ID: <20130211120438.730ce5d3@X220.ovitrap.com> X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.6; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sl-508-2.slc.westdc.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - alogt.com X-Get-Message-Sender-Via: sl-508-2.slc.westdc.net: authenticated_id: erichsfreebsdlist@alogt.com X-Source: X-Source-Args: X-Source-Dir: X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Feb 2013 05:04:49 -0000 Hi, man 3 system says: RETURN VALUES The system() function returns the exit status of the shell as returned by waitpid(2), or -1 if an error occurred when invoking fork(2) or waitpid(2). A return value of 127 means the execution of the shell failed. It seems to me that one part is missing here. I made two small test programs: Program 1 in error.c int main (void) { return 0x1; } Program 2 in show result: int main (void) { printf ("Return code: %i\n", system ("error")); return 0 } This results in Return code: 256 being displayed. system () returns the result from 'error.c' in the result but shifted by 8 bits to the left. I could not find this behaviour in the FreeBSD documentation. So, is this the intended behaviour of system ()? Should the documentation be uptdated? Or did I simply miss something? Erich