Man page for "system" says " The value returned is 127 if the execve() call
for /bin/sh fails, -1 if there was another error and the return code of the
command otherwise."
So, where are the definitions of the return codes for the commands "insmod"
and "mknod"
Thanks in advance for your help.
... Jamie
Norm
>> So, where are the definitions of the return codes for the commands "insmod"
>> and "mknod"
>My first impulse was to tell you that they were on the man-pages for insmod
>and mknod but I decided to try that first -- and neither of those pages says
>anything about return codes. A quick experiment:
> insmod frt.o ; echo $status # tc/c-shell
>shows that insmod returns 0 for success and 1 for (at least most) failures.
One could read the source and see too.
>You should be able to check mknod yourself.
Better yet, use the mknod system call. (man 2 mknod)
--
http://www.spinics.net/linux/
> I'm developing a driver for a PCI device that can "come and go".
> I want to write an app that does the system calls like insmod and mknod
> to install the driver/device. Of course my MODULE_INIT function will
> fail if the call to pci_module_init(&driverinfo) fails, which will
> happen if the PCI device is not there.
>
:-/ That is the wrong approach. Linux has a mechanism to do that:
The device nodes should always be there, they will only use a single
directory entry on disk. You can make them disappear using "devfs" though,
but that's nothing for the first try. Then, you have to setup the
"/etc/modules.conf" file properly and your driver will be "insmod"ed
automatically by "modprobe" at the time a users application uses the device
inode.
If your device(and your driver) is capable of hot-plug, things get a little
more complicated for your driver, but not for the userspace side. The
driver remains in memory unless it is "rmmod"ed and will be loaded on
demand by "modprobe".
Jan