Re: Header files with enums instead of defines?

From: Poul-Henning Kamp (phk_at_phk.freebsd.dk)
Date: 12/22/04

  • Next message: Poul-Henning Kamp: "no more <sys/vnode.h> in device drivers."
    To: "Greg 'groggy' Lehey" <grog@freebsd.org>
    Date: Wed, 22 Dec 2004 18:45:16 +0100
    
    

    In message <20041222010143.GS53357@wantadilla.lemis.com>, "Greg 'groggy' Lehey"
     writes:

    >Has anybody thought about replacing #defines with enums in header
    >files? It would make debugging a whole lot easier. Foe example, I'm
    >currently looking at a debug printout which contains:

    I agree with others who have shot this down: compatibility would
    not allow us to do something like that.

    But that is not to say that the error reporting mechanism could not
    be improved in other ways.

    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.

    There is a heck of a difference between getting:

            fdisk: permission denied

    And

            fdisk: permission denied (partitions overlap)

    -- 
    Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
    phk@FreeBSD.ORG         | TCP/IP since RFC 956
    FreeBSD committer       | BSD since 4.3-tahoe    
    Never attribute to malice what can adequately be explained by incompetence.
    _______________________________________________
    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"
    

  • Next message: Poul-Henning Kamp: "no more <sys/vnode.h> in device drivers."