Show
Ignore:
Timestamp:
05/26/09 10:15:14 (3 years ago)
Author:
mwhitworth
Message:

Add function to call userspace module loader (currently used in filesystem code).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/trunk/kernel/module.c

    r1975 r2050  
    482482        VaList list; 
    483483        char* name; 
     484        char* args[2]; 
     485        int fds[] = {0, 0, 0}; 
     486        int pid, exitStatus, ret; 
    484487         
    485488        VaStart(list, fmt); 
     
    487490        VaEnd(list); 
    488491         
    489         /* TODO: Call userspace service that will load modules based on name, device 
    490          * ID or lack of system call 
    491          */ 
     492        args[0] = name; 
     493        args[1] = NULL; 
     494         
     495        pid = Exec("/System/Modules/modloader", fds, args); 
     496         
     497        if (pid < 0) 
     498                return -ENOENT; 
     499                                                  
     500        ret = ThrWaitForProcessFinish(pid, &exitStatus); 
     501                 
     502        if (ret < 0) 
     503                return ret; 
    492504         
    493505        MemFree(name); 
    494          
    495         return 0; 
     506 
     507        if (exitStatus) 
     508                exitStatus = -ENOENT;    
     509         
     510        return exitStatus; 
    496511} 
    497512