Subversion Repositories HelenOS

Rev

Rev 3469 | Rev 3566 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3469 Rev 3470
Line 61... Line 61...
61
{
61
{
62
    loader_t *ldr;
62
    loader_t *ldr;
63
    task_id_t task_id;
63
    task_id_t task_id;
64
    int rc;
64
    int rc;
65
 
65
 
66
    /* Spawn a program loader */   
66
    /* Spawn a program loader. */  
67
    ldr = loader_spawn();
67
    ldr = loader_spawn();
68
    if (ldr == NULL)
68
    if (ldr == NULL)
69
        return 0;
69
        return 0;
70
 
70
 
71
    /* Get task ID. */
71
    /* Get task ID. */
72
    rc = loader_get_task_id(ldr, &task_id);
72
    rc = loader_get_task_id(ldr, &task_id);
73
    if (rc != EOK)
73
    if (rc != EOK)
74
        goto error;
74
        goto error;
75
 
75
 
76
    /* Send program pathname */
76
    /* Send program pathname. */
77
    rc = loader_set_pathname(ldr, path);
77
    rc = loader_set_pathname(ldr, path);
78
    if (rc != EOK)
78
    if (rc != EOK)
79
        goto error;
79
        goto error;
80
 
80
 
81
    /* Send arguments */
81
    /* Send arguments. */
82
    rc = loader_set_args(ldr, argv);
82
    rc = loader_set_args(ldr, argv);
83
    if (rc != EOK)
83
    if (rc != EOK)
84
        goto error;
84
        goto error;
85
 
85
 
86
    /* Request loader to start the program */  
86
    /* Load the program. */
87
    rc = loader_start_program(ldr);
87
    rc = loader_load_program(ldr);
-
 
88
    if (rc != EOK)
-
 
89
        goto error;
-
 
90
 
-
 
91
    /* Run it. */
-
 
92
    /* Load the program. */
-
 
93
    rc = loader_run(ldr);
88
    if (rc != EOK)
94
    if (rc != EOK)
89
        goto error;
95
        goto error;
90
 
96
 
91
    /* Success */
97
    /* Success */
-
 
98
 
-
 
99
    free(ldr);
92
    return task_id;
100
    return task_id;
93
 
101
 
94
    /* Error exit */
102
    /* Error exit */
95
error:
103
error:
96
    loader_abort(ldr);
104
    loader_abort(ldr);
-
 
105
    free(ldr);
-
 
106
 
97
    return 0;
107
    return 0;
98
}
108
}
99
 
109
 
100
/** @}
110
/** @}
101
 */
111
 */