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

Re: [rtl] Modules



On Tue, Mar 06, 2001 at 07:20:57PM +0000, Frederic Cazenave wrote:
> Hi,
> 
> is there a way to check from a user space program if a module is
> installed or not ?
> And if my module is mot installed how to do it inside the program ?
> 
> Fred
> 

Hi,

I use the system call and it seems to work ok (mdpsim is the name
of my module). I don't know about inserting the module - need root
privileges.


int ret;

ret = system("/sbin/lsmod | grep ^mdpsim");

if (ret == 127) {
  fl_addto_browser(fd_control_form->connect_form_browser,"/bin/sh failed");
  return;
}
if (ret != 0) {
  fl_addto_browser(fd_control_form->connect_form_browser,"mdpsim.o not installed");
  return;
}
fprintf(stderr,"System return = %d\n",ret);

Cheers,
Matt W
-- 
 						   Matthew Whillock
mcrw@mssl.ucl.ac.uk			  Dept. of Space and Climate Physics,
Tel: +44 1483 204181			   Mullard Space Science Laboratory,
Fax: +44 1483 278312			      University College London.