Changeset bfd1546 in mainline for uspace/lib/libc


Ignore:
Timestamp:
2009-02-15T00:01:06Z (16 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
08b777e
Parents:
4cac212c
Message:

More elegant way of invoking the loader - as a 'cloneable' service. Task names functionality lost for the time being.

Location:
uspace/lib/libc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/loader.c

    r4cac212c rbfd1546  
    3535#include <ipc/ipc.h>
    3636#include <ipc/loader.h>
     37#include <ipc/services.h>
    3738#include <libc.h>
    3839#include <task.h>
     
    5152 *              de-allocated using free() after use).
    5253 */
    53 loader_t *loader_spawn(const char *name)
    54 {
    55         int phone_id, rc;
     54int loader_spawn(const char *name)
     55{
     56        return __SYSCALL2(SYS_PROGRAM_SPAWN_LOADER,
     57            (sysarg_t) name, strlen(name));
     58}
     59
     60loader_t *loader_connect(void)
     61{
    5662        loader_t *ldr;
    57 
    58         /*
    59          * Ask kernel to spawn a new loader task.
    60          */
    61         rc = __SYSCALL3(SYS_PROGRAM_SPAWN_LOADER, (sysarg_t) &phone_id,
    62                 (sysarg_t) name, strlen(name));
    63         if (rc != 0)
    64                 return NULL;
    65 
    66         /*
    67          * Say hello so that the loader knows the incoming connection's
    68          * phone hash.
    69          */
    70         rc = async_req_0_0(phone_id, LOADER_HELLO);
    71         if (rc != EOK)
     63        int phone_id;
     64
     65        phone_id = ipc_connect_me_to(PHONE_NS, SERVICE_LOAD, 0, 0);
     66        if (phone_id < 0)
    7267                return NULL;
    7368
     
    7772
    7873        ldr->phone_id = phone_id;
    79         return ldr;
     74        return ldr;     
    8075}
    8176
  • uspace/lib/libc/generic/task.c

    r4cac212c rbfd1546  
    6464        int rc;
    6565
    66         /* Spawn a program loader. */   
    67         ldr = loader_spawn(path);
     66        /* Connect to a program loader. */
     67        ldr = loader_connect();
    6868        if (ldr == NULL)
    6969                return 0;
     
    9090
    9191        /* Run it. */
    92         /* Load the program. */
    9392        rc = loader_run(ldr);
    9493        if (rc != EOK)
  • uspace/lib/libc/include/ipc/services.h

    r4cac212c rbfd1546  
    3939
    4040typedef enum {
    41         SERVICE_PCI = 1,
     41        SERVICE_LOAD = 1,
     42        SERVICE_PCI,
    4243        SERVICE_KEYBOARD,
    4344        SERVICE_VIDEO,
  • uspace/lib/libc/include/loader/loader.h

    r4cac212c rbfd1546  
    4545} loader_t;
    4646
    47 extern loader_t *loader_spawn(const char *name);
     47extern int loader_spawn(const char *);
     48extern loader_t *loader_connect(void);
    4849extern int loader_get_task_id(loader_t *, task_id_t *);
    4950extern int loader_set_pathname(loader_t *, const char *);
Note: See TracChangeset for help on using the changeset viewer.