From owner-freebsd-arch@FreeBSD.ORG Wed Dec 22 18:13:17 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 693F216A4CE; Wed, 22 Dec 2004 18:13:17 +0000 (GMT) Received: from mortis.over-yonder.net (adsl-222-79-99.jan.bellsouth.net [68.222.79.99]) by mx1.FreeBSD.org (Postfix) with ESMTP id 717B243D58; Wed, 22 Dec 2004 18:13:16 +0000 (GMT) (envelope-from fullermd@over-yonder.net) Received: by mortis.over-yonder.net (Postfix, from userid 100) id 7E351211B5; Wed, 22 Dec 2004 12:13:14 -0600 (CST) Date: Wed, 22 Dec 2004 12:13:14 -0600 From: "Matthew D. Fuller" To: Poul-Henning Kamp Message-ID: <20041222181313.GJ32388@over-yonder.net> References: <20041222010143.GS53357@wantadilla.lemis.com> <8412.1103737516@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8412.1103737516@critter.freebsd.dk> X-Editor: vi X-OS: FreeBSD User-Agent: Mutt/1.5.6i-fullermd.2 cc: Greg 'groggy' Lehey cc: FreeBSD Architecture Mailing List Subject: Re: Header files with enums instead of defines? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Dec 2004 18:13:17 -0000 On Wed, Dec 22, 2004 at 06:45:16PM +0100 I heard the voice of Poul-Henning Kamp, and lo! it spake thus: > > One of my pet peeves is that comples system calls have no way to > convey additional information about why the return a given return > value like EPERM. > > I would almost advocate adding a char[X] to each thread and a system > call which could retrieve it. Complex system calls like > mount/nmount, ioctl and similar could then stick an explanation into > that string which strerror(3) or err(3) and similar functions could > pull out and give the user. I do roughly this in the errno-ish facility in my sadly-dormant libpostal project. My error structure looks like struct postal_errfoo_t { unsigned int postal_errno; char postal_errstr[POSTAL_ERRSTR_LEN]; }; Of course, I get to mandate that you use postal_errno() and postal_errstr() to retrieve the data. I use (1<<15) as a flag in the errno int (at least, until I get a WHOLE lot more error conditions that I have now) for when there's an extra message to be returned. I don't think I actually USE the capability anywhere right now, but it's designed in. -- Matthew Fuller (MF4839) | fullermd@over-yonder.net Systems/Network Administrator | http://www.over-yonder.net/~fullermd/ "The only reason I'm burning my candle at both ends, is because I haven't figured out how to light the middle yet"