Subversion Repositories HelenOS

Rev

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

Rev 4055 Rev 4296
Line 52... Line 52...
52
 *      de-allocated using free() after use).
52
 *      de-allocated using free() after use).
53
 */
53
 */
54
int loader_spawn(const char *name)
54
int loader_spawn(const char *name)
55
{
55
{
56
    return __SYSCALL2(SYS_PROGRAM_SPAWN_LOADER,
56
    return __SYSCALL2(SYS_PROGRAM_SPAWN_LOADER,
57
        (sysarg_t) name, strlen(name));
57
        (sysarg_t) name, str_size(name));
58
}
58
}
59
 
59
 
60
loader_t *loader_connect(void)
60
loader_t *loader_connect(void)
61
{
61
{
62
    loader_t *ldr;
62
    loader_t *ldr;
Line 166... Line 166...
166
     * compute size of the buffer needed.
166
     * compute size of the buffer needed.
167
     */
167
     */
168
    ap = argv;
168
    ap = argv;
169
    buffer_size = 0;
169
    buffer_size = 0;
170
    while (*ap != NULL) {
170
    while (*ap != NULL) {
171
        buffer_size += strlen(*ap) + 1;
171
        buffer_size += str_size(*ap) + 1;
172
        ++ap;
172
        ++ap;
173
    }
173
    }
174
 
174
 
175
    arg_buf = malloc(buffer_size);
175
    arg_buf = malloc(buffer_size);
176
    if (arg_buf == NULL) return ENOMEM;
176
    if (arg_buf == NULL) return ENOMEM;
177
 
177
 
178
    /* Now fill the buffer with null-terminated argument strings */
178
    /* Now fill the buffer with null-terminated argument strings */
179
    ap = argv;
179
    ap = argv;
180
    dp = arg_buf;
180
    dp = arg_buf;
-
 
181
 
181
    while (*ap != NULL) {
182
    while (*ap != NULL) {
182
        strcpy(dp, *ap);
183
        str_cpy(dp, buffer_size - (dp - arg_buf), *ap);
183
        dp += strlen(*ap) + 1;
184
        dp += str_size(*ap) + 1;
184
 
185
 
185
        ++ap;
186
        ++ap;
186
    }
187
    }
187
 
188
 
188
    /* Send serialized arguments to the loader */
189
    /* Send serialized arguments to the loader */
Line 240... Line 241...
240
 
241
 
241
    rc = async_req_0_0(ldr->phone_id, LOADER_RUN);
242
    rc = async_req_0_0(ldr->phone_id, LOADER_RUN);
242
    if (rc != EOK)
243
    if (rc != EOK)
243
        return rc;
244
        return rc;
244
 
245
 
-
 
246
    ipc_hangup(ldr->phone_id);
-
 
247
    ldr->phone_id = 0;
245
    return EOK;
248
    return EOK;
246
}
249
}
247
 
250
 
248
/** Cancel the loader session.
251
/** Cancel the loader session.
249
 *
252
 *