From owner-cvs-src@FreeBSD.ORG Wed Nov 9 16:35:29 2005 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5886A16A421; Wed, 9 Nov 2005 16:35:29 +0000 (GMT) (envelope-from frank@exit.com) Received: from tinker.exit.com (tinker.exit.com [206.223.0.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7F76443D46; Wed, 9 Nov 2005 16:35:28 +0000 (GMT) (envelope-from frank@exit.com) Received: from realtime.exit.com (realtime [206.223.0.5]) by tinker.exit.com (8.13.4/8.13.4) with ESMTP id jA9GZRiY065885; Wed, 9 Nov 2005 08:35:27 -0800 (PST) (envelope-from frank@exit.com) Received: from realtime.exit.com (localhost [127.0.0.1]) by realtime.exit.com (8.13.4/8.13.4) with ESMTP id jA9GZQEN005308; Wed, 9 Nov 2005 08:35:26 -0800 (PST) (envelope-from frank@exit.com) Received: (from frank@localhost) by realtime.exit.com (8.13.4/8.13.4/Submit) id jA9GZHiO005267; Wed, 9 Nov 2005 08:35:17 -0800 (PST) (envelope-from frank@exit.com) X-Authentication-Warning: realtime.exit.com: frank set sender to frank@exit.com using -f From: Frank Mayhar To: Poul-Henning Kamp In-Reply-To: <26185.1131519693@critter.freebsd.dk> References: <26185.1131519693@critter.freebsd.dk> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Exit Consulting Date: Wed, 09 Nov 2005 08:35:16 -0800 Message-Id: <1131554116.98960.16.camel@realtime.exit.com> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 FreeBSD GNOME Team Port X-Virus-Scanned: ClamAV 0.86.2/1166/Mon Nov 7 11:01:45 2005 on tinker.exit.com X-Virus-Status: Clean Cc: Craig Rodrigues , cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org, Nate Lawson Subject: Re: cvs commit: src/sys/kern vfs_mount.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: frank@exit.com List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2005 16:35:30 -0000 On Wed, 2005-11-09 at 08:01 +0100, Poul-Henning Kamp wrote: > Modify perror(3), err(3) and similar to pull out the "extended" > error, if there is one. As a data point, the way this problem was solved in one particular mainframe OS many years ago was with a more complex error code. Errors looked something like this: FMN-M0007-3 You shot yourself in the foot. The "FMN" part indicate the part of the "kernel" (called the "monitor" in those days) that issued the error, in this case the file management naming subsystem, IIRC. The "M" indicated that it was indeed a monitor error. The "0007" indicate the particular error itself, and the "3" indicated the severity of the error. Each module had its own set of error messages and each error message could have up to seven "severities," each corresponding to a more terse or more detailed message. The codes and messages themselves where defined in the source itself using special comment types and were stuffed into a database by a munger run at build time. The error print routine looked up the code in the database and printed the corresponding error message. Now, I am by no means suggesting this as a solution. I think it's overkill for FreeBSD (hell, it was probably overkill for CP-6, but it had its uses) but there is probably something to be learned from it regardless. Like, using a simple integer error code just doesn't quite meet every need, and that there's no reason to have to "pull out" a message from the kernel when 99% of the work can be done at build time, with the runtime only needing to use a special, more complex error code to get the job done. In other words, I agree that the perror(3)/err(3) route in general indicates the way to go, but a more general solution would obviously be better. -- Frank Mayhar frank@exit.com http://www.exit.com/ Exit Consulting http://www.gpsclock.com/ http://www.exit.com/blog/frank/