Subversion Repositories HelenOS

Rev

Rev 3732 | Rev 4037 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3732 Rev 3896
Line 32... Line 32...
32
/** @file
32
/** @file
33
 */
33
 */
34
 
34
 
35
#include <ipc/ipc.h>
35
#include <ipc/ipc.h>
36
#include <ipc/loader.h>
36
#include <ipc/loader.h>
-
 
37
#include <ipc/services.h>
37
#include <libc.h>
38
#include <libc.h>
38
#include <task.h>
39
#include <task.h>
39
#include <string.h>
40
#include <string.h>
40
#include <stdlib.h>
41
#include <stdlib.h>
41
#include <async.h>
42
#include <async.h>
Line 48... Line 49...
48
 * Spawns a new program loader task and returns the connection structure.
49
 * Spawns a new program loader task and returns the connection structure.
49
 * @param name  Symbolic name to set on the newly created task.
50
 * @param name  Symbolic name to set on the newly created task.
50
 * @return  Pointer to the loader connection structure (should be
51
 * @return  Pointer to the loader connection structure (should be
51
 *      de-allocated using free() after use).
52
 *      de-allocated using free() after use).
52
 */
53
 */
53
loader_t *loader_spawn(const char *name)
54
int loader_spawn(const char *name)
54
{
55
{
55
    int phone_id, rc;
-
 
56
    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,
56
    return __SYSCALL2(SYS_PROGRAM_SPAWN_LOADER,
62
        (sysarg_t) name, strlen(name));
57
        (sysarg_t) name, strlen(name));
63
    if (rc != 0)
58
}
64
        return NULL;
-
 
65
 
59
 
-
 
60
loader_t *loader_connect(void)
66
    /*
61
{
67
     * Say hello so that the loader knows the incoming connection's
62
    loader_t *ldr;
68
     * phone hash.
63
    int phone_id;
69
     */
64
 
70
    rc = async_req_0_0(phone_id, LOADER_HELLO);
65
    phone_id = ipc_connect_me_to(PHONE_NS, SERVICE_LOAD, 0, 0);
71
    if (rc != EOK)
66
    if (phone_id < 0)
72
        return NULL;
67
        return NULL;
73
 
68
 
74
    ldr = malloc(sizeof(loader_t));
69
    ldr = malloc(sizeof(loader_t));
75
    if (ldr == NULL)
70
    if (ldr == NULL)
76
        return NULL;
71
        return NULL;