Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Oct 2010 13:13:26 -0700
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        Doug Barton <dougb@freebsd.org>
Cc:        freebsd-current@freebsd.org
Subject:   Re: [RFC] More meaningful information about ENOEXEC for kldload(8)
Message-ID:  <AANLkTindYRwpmA=En%2BpYyHVcUkmQ0wsZrB7Y-f2E=vK=@mail.gmail.com>
In-Reply-To: <4CC5D9DB.1020409@FreeBSD.org>
References:  <4CC5D83E.8030505@delphij.net> <4CC5D9DB.1020409@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Oct 25, 2010 at 12:26 PM, Doug Barton <dougb@freebsd.org> wrote:
> On 10/25/2010 12:19, Xin LI wrote:
>>
>> Here is a simple patch that adds more meaning messages when kldload hits
>> ENOEXEC.
>
> +1 on anything that makes this (and related) error more clear. I know I've
> stumbled over it numerous times.

    Typo in the error message aside...
    Technically you can dig the source of these errors from
/var/log/messages // syslog though, so why not just keep status quo?
Making errors more intuitive is nice, but providing more misleading
errors are worse than providing less misleading errors; this kind of
error message falls in the more misleading message category, as
ENOEXEC means:

     [ENOEXEC]          The file format of file was unrecognized.

    That is open for a lot of interpretation as to what the actual
error is, as this applies to the logic paths in
/sys/kern/kern_linker.c:linker_load_file (to date) on CURRENT, which
applies to both the child and parent modules.
    If anything though, I find this reasoning for hammering everything
into ENOEXEC slightly annoying:

                /*
                 * Format not recognized or otherwise unloadable.
                 * When loading a module that is statically built into
                 * the kernel EEXIST percolates back up as the return
                 * value.  Preserve this so that apps like sysinstall
                 * can recognize this special case and not post bogus
                 * dialog boxes.
                 */
                if (error != EEXIST)
                        error = ENOEXEC;

    Why doesn't the error code properly percolate up the chain if it's
not EEXIST -_-...? It's almost like there needs to be a more
descriptive means to state what the errors are and those errors should
be properly documented in the kldload(2) manpage.
Thanks,
-Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTindYRwpmA=En%2BpYyHVcUkmQ0wsZrB7Y-f2E=vK=>