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

Re: Ruby status



On Mon, Jan 07, 2002 at 01:30:16PM +0100, Niels Möller wrote:
> Emacs uses the same trick, but uses a few more tag bits, giving
> fixnums a size of 28 bits on a 32-bit machine. Does emacs give access
> to to numerical errno values? Then it would have the same problem. I
> remember that access to time_t values is somewhat complicated, as
> these values are (or were, it's some years since I read those parts of
> the manual) split up as a cons cell with two fixnums, before any lisp
> code sees them.

It would be straightforward to do the same on the Hurd for error values,
because they are composed of a subsystem and an error value.  The subsystem
is in the high bits.  (This is originally a Mach thing.)

Such high errno have triggered some bugs and interface quirks (and are the
reasons we don't have sys_errlist, of course).

> What is the largest errno value that the Hurd uses? Does it fit in 31
> bits?

The Hurd uses Mach subsystem 0x10.  From include/bits/errno.h

/* This file generated by errnos.awk.  */

/* The Hurd uses Mach error system 0x10, currently only subsystem 0. */
#ifndef _HURD_ERRNO
#define _HURD_ERRNO(n)	((0x10 << 26) | ((n) & 0x3fff))
#endif

But GLibC can cope with other subsystems as well (like the Mach subsystem,
or the MiG subsystem).  So we have to look at the Mach conventions in
mach/error.h:

/*
 *	error number layout as follows:
 *
 *	hi		 		       lo
 *	| system(6) | subsystem(12) | code(14) |
 */

Ok, so maybe I lied.  Where I said subsystem, I should have said system.
But the moral of the story is that all 32 bits are potentially used.  The
upper six for the system, then 12 bits for the subsystem, and the remaining
14 for the actual code.

Those are the ones actually in use:

/*	major error systems	*/
#define	err_kern		err_system(0x0)		/* kernel */
#define	err_us			err_system(0x1)		/* user space library */
#define	err_server		err_system(0x2)		/* user space servers */
#define	err_ipc			err_system(0x3)		/* old ipc errors */
#define err_mach_ipc		err_system(0x4)		/* mach-ipc errors */
#define err_bootstrap		err_system(0x5)		/* bootstrap errors */
#define err_hurd		err_system(0x10) /* GNU Hurd server errors */
#define err_local		err_system(0x3e)	/* user defined errors */
#define	err_ipc_compat		err_system(0x3f)	/* (compatibility) mach-ipc errors */

#define	err_max_system		0x3f

Interestingly, the high bit 0x20 is indeed already in use, although I am
not sure if it can actually occur on our current system.  Dropping the
highest bit will make an error value interpreted in the wrong error system,
with bad results.

Thanks,
Marcus


-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de



Reply to: