Re: Header files with enums instead of defines?
From: Matthew D. Fuller (fullermd_at_over-yonder.net)
Date: 12/22/04
- Previous message: Poul-Henning Kamp: "no more <sys/vnode.h> in device drivers."
- In reply to: Poul-Henning Kamp: "Re: Header files with enums instead of defines?"
- Next in thread: Greg 'groggy' Lehey: "Re: Header files with enums instead of defines?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 22 Dec 2004 12:13:14 -0600 To: Poul-Henning Kamp <phk@phk.freebsd.dk>
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" _______________________________________________ freebsd-arch@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-arch To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
- Previous message: Poul-Henning Kamp: "no more <sys/vnode.h> in device drivers."
- In reply to: Poul-Henning Kamp: "Re: Header files with enums instead of defines?"
- Next in thread: Greg 'groggy' Lehey: "Re: Header files with enums instead of defines?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]