how to get a module load error code back to userspace?

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

 



  poking around with the details of what happens when you try to load
a module that returns a negative error value, and it's not obvious how
(or if) you can examine the actual error code back in user space.

  for example, in my module init() routine, if i realize an error has
occurred, i can return the appropriate error code, such as, say,

  return -EIO;

if that's the error that occurs, then what i get back in user space
when i try to insmod is:

# insmod hi.ko
insmod: error inserting 'hi.ko': -1 Input/output error
#

  now, that's moderately useful since insmod at least tells me it's an
"Input/output error" to match the error code.  but i don't see a way
to examine the actual numeric code, if that's what i wanted.

  if i check the shell return code variable $?, no matter what error
is returned from the module init() routine, $? will always contain 1.
i don't see an easy way to, from user space, get the actual number,
although i'm sure the argument is that that value is more meant for
kernel space and you shouldn't be asking for it back in user space
anyway.

  thoughts?

rday
--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Linked In:                             http://www.linkedin.com/in/rpjday
Twitter:                                       http://twitter.com/rpjday
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux