Muli Ben-Yehuda wrote:

>On Sun, Nov 06, 2005 at 02:35:19AM +0200, David Harel wrote:
>  
>
>>Hi,
>>
>>Without doing system("insmod usb-storage"); how do I implement this 
>>operation on system calls level?
>>    
>>
>
>Read the source of the utilities that do implement it, concentrating
>on init_module; realize that it's kernel version dependant and you're
>not expected to be doing it; ask yourself why do you need to do it,
>and are there existing mechanisms that do what you need? the answer is
>almost certainly yes.
>  
>
I'll just mention that the Unix philosophy says "(almost) everything you
need to do, you do by running another process that does it". The Windows
philosophy is "My process does everything".

When a Windows programmer goes Unix, they are usually (I know I was)
hesitant about running an external program "only to" shut down the
machine/install a module/eject the CD/whatever.

If that is the case, David, just do "system" (I prefer fork+exec - saves
on the intermediate shell, but maybe that's just renmants of my Windows
days talking) for that and be done.

If, on the other hand, you want to hack the process, then by all means,
read the sources for insmod (and also the relevant sources from the
kernel, to ballance things out).

As usual, more info would give you more of an answer.

             Shachar

-- 
Shachar Shemesh
Lingnu Open Source Consulting ltd.
Have you backed up today's work? http://www.lingnu.com/backup.html


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to