Subversion Repositories HelenOS

Rev

Rev 4338 | Rev 4344 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4338 Rev 4343
1
/*
1
/*
2
 * Copyright (c) 2008 Jiri Svoboda
2
 * Copyright (c) 2008 Jiri Svoboda
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
8
 *
8
 *
9
 * - Redistributions of source code must retain the above copyright
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
15
 *   derived from this software without specific prior written permission.
16
 *
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
/** @addtogroup loader
29
/** @addtogroup loader
30
 * @brief   Loads and runs programs from VFS.
30
 * @brief   Loads and runs programs from VFS.
31
 * @{
31
 * @{
32
 */
32
 */
33
/**
33
/**
34
 * @file
34
 * @file
35
 * @brief   Loads and runs programs from VFS.
35
 * @brief   Loads and runs programs from VFS.
36
 *
36
 *
37
 * The program loader is a special init binary. Its image is used
37
 * The program loader is a special init binary. Its image is used
38
 * to create a new task upon a @c task_spawn syscall. The syscall
38
 * to create a new task upon a @c task_spawn syscall. The syscall
39
 * returns the id of a phone connected to the newly created task.
39
 * returns the id of a phone connected to the newly created task.
40
 *
40
 *
41
 * The caller uses this phone to send the pathname and various other
41
 * The caller uses this phone to send the pathname and various other
42
 * information to the loader. This is normally done by the C library
42
 * information to the loader. This is normally done by the C library
43
 * and completely hidden from applications.
43
 * and completely hidden from applications.
44
 */
44
 */
45
 
45
 
46
#include <stdio.h>
46
#include <stdio.h>
47
#include <stdlib.h>
47
#include <stdlib.h>
48
#include <unistd.h>
48
#include <unistd.h>
49
#include <bool.h>
49
#include <bool.h>
50
#include <fcntl.h>
50
#include <fcntl.h>
51
#include <sys/types.h>
51
#include <sys/types.h>
52
#include <ipc/ipc.h>
52
#include <ipc/ipc.h>
-
 
53
#include <ipc/services.h>
53
#include <ipc/loader.h>
54
#include <ipc/loader.h>
54
#include <loader/pcb.h>
55
#include <loader/pcb.h>
55
#include <errno.h>
56
#include <errno.h>
56
#include <async.h>
57
#include <async.h>
57
#include <as.h>
58
#include <as.h>
58
 
59
 
59
#include <elf.h>
60
#include <elf.h>
60
#include <elf_load.h>
61
#include <elf_load.h>
61
 
62
 
62
#define DPRINTF(...)
63
#define DPRINTF(...)
63
 
64
 
64
void program_run(void *entry, pcb_t *pcb);
65
void program_run(void *entry, pcb_t *pcb);
65
 
66
 
66
/** Pathname of the file that will be loaded */
67
/** Pathname of the file that will be loaded */
67
static char *pathname = NULL;
68
static char *pathname = NULL;
68
 
69
 
69
/** The Program control block */
70
/** The Program control block */
70
static pcb_t pcb;
71
static pcb_t pcb;
71
 
72
 
72
/** Number of arguments */
73
/** Number of arguments */
73
static int argc = 0;
74
static int argc = 0;
74
/** Argument vector */
75
/** Argument vector */
75
static char **argv = NULL;
76
static char **argv = NULL;
76
/** Buffer holding all arguments */
77
/** Buffer holding all arguments */
77
static char *arg_buf = NULL;
78
static char *arg_buf = NULL;
78
 
79
 
79
static elf_info_t prog_info;
80
static elf_info_t prog_info;
80
static elf_info_t interp_info;
81
static elf_info_t interp_info;
81
 
82
 
82
static bool is_dyn_linked;
83
static bool is_dyn_linked;
83
 
84
 
-
 
85
/** Used to limit number of connections to one. */
-
 
86
static bool connected;
84
 
87
 
85
static void loader_get_taskid(ipc_callid_t rid, ipc_call_t *request)
88
static void loader_get_taskid(ipc_callid_t rid, ipc_call_t *request)
86
{
89
{
87
    ipc_callid_t callid;
90
    ipc_callid_t callid;
88
    task_id_t task_id;
91
    task_id_t task_id;
89
    size_t len;
92
    size_t len;
90
 
93
 
91
    task_id = task_get_id();
94
    task_id = task_get_id();
92
 
95
 
93
    if (!ipc_data_read_receive(&callid, &len)) {
96
    if (!ipc_data_read_receive(&callid, &len)) {
94
        ipc_answer_0(callid, EINVAL);
97
        ipc_answer_0(callid, EINVAL);
95
        ipc_answer_0(rid, EINVAL);
98
        ipc_answer_0(rid, EINVAL);
96
        return;
99
        return;
97
    }
100
    }
98
 
101
 
99
    if (len > sizeof(task_id)) len = sizeof(task_id);
102
    if (len > sizeof(task_id)) len = sizeof(task_id);
100
 
103
 
101
    ipc_data_read_finalize(callid, &task_id, len);
104
    ipc_data_read_finalize(callid, &task_id, len);
102
    ipc_answer_0(rid, EOK);
105
    ipc_answer_0(rid, EOK);
103
}
106
}
104
 
107
 
105
 
108
 
106
/** Receive a call setting pathname of the program to execute.
109
/** Receive a call setting pathname of the program to execute.
107
 *
110
 *
108
 * @param rid
111
 * @param rid
109
 * @param request
112
 * @param request
110
 */
113
 */
111
static void loader_set_pathname(ipc_callid_t rid, ipc_call_t *request)
114
static void loader_set_pathname(ipc_callid_t rid, ipc_call_t *request)
112
{
115
{
113
    ipc_callid_t callid;
116
    ipc_callid_t callid;
114
    size_t len;
117
    size_t len;
115
    char *name_buf;
118
    char *name_buf;
116
 
119
 
117
    if (!ipc_data_write_receive(&callid, &len)) {
120
    if (!ipc_data_write_receive(&callid, &len)) {
118
        ipc_answer_0(callid, EINVAL);
121
        ipc_answer_0(callid, EINVAL);
119
        ipc_answer_0(rid, EINVAL);
122
        ipc_answer_0(rid, EINVAL);
120
        return;
123
        return;
121
    }
124
    }
122
 
125
 
123
    name_buf = malloc(len + 1);
126
    name_buf = malloc(len + 1);
124
    if (!name_buf) {
127
    if (!name_buf) {
125
        ipc_answer_0(callid, ENOMEM);
128
        ipc_answer_0(callid, ENOMEM);
126
        ipc_answer_0(rid, ENOMEM);
129
        ipc_answer_0(rid, ENOMEM);
127
        return;
130
        return;
128
    }
131
    }
129
 
132
 
130
    ipc_data_write_finalize(callid, name_buf, len);
133
    ipc_data_write_finalize(callid, name_buf, len);
131
    ipc_answer_0(rid, EOK);
134
    ipc_answer_0(rid, EOK);
132
 
135
 
133
    if (pathname != NULL) {
136
    if (pathname != NULL) {
134
        free(pathname);
137
        free(pathname);
135
        pathname = NULL;
138
        pathname = NULL;
136
    }
139
    }
137
 
140
 
138
    name_buf[len] = '\0';
141
    name_buf[len] = '\0';
139
    pathname = name_buf;
142
    pathname = name_buf;
140
}
143
}
141
 
144
 
142
/** Receive a call setting arguments of the program to execute.
145
/** Receive a call setting arguments of the program to execute.
143
 *
146
 *
144
 * @param rid
147
 * @param rid
145
 * @param request
148
 * @param request
146
 */
149
 */
147
static void loader_set_args(ipc_callid_t rid, ipc_call_t *request)
150
static void loader_set_args(ipc_callid_t rid, ipc_call_t *request)
148
{
151
{
149
    ipc_callid_t callid;
152
    ipc_callid_t callid;
150
    size_t buf_len, arg_len;
153
    size_t buf_len, arg_len;
151
    char *p;
154
    char *p;
152
    int n;
155
    int n;
153
 
156
 
154
    if (!ipc_data_write_receive(&callid, &buf_len)) {
157
    if (!ipc_data_write_receive(&callid, &buf_len)) {
155
        ipc_answer_0(callid, EINVAL);
158
        ipc_answer_0(callid, EINVAL);
156
        ipc_answer_0(rid, EINVAL);
159
        ipc_answer_0(rid, EINVAL);
157
        return;
160
        return;
158
    }
161
    }
159
 
162
 
160
    if (arg_buf != NULL) {
163
    if (arg_buf != NULL) {
161
        free(arg_buf);
164
        free(arg_buf);
162
        arg_buf = NULL;
165
        arg_buf = NULL;
163
    }
166
    }
164
 
167
 
165
    if (argv != NULL) {
168
    if (argv != NULL) {
166
        free(argv);
169
        free(argv);
167
        argv = NULL;
170
        argv = NULL;
168
    }
171
    }
169
 
172
 
170
    arg_buf = malloc(buf_len + 1);
173
    arg_buf = malloc(buf_len + 1);
171
    if (!arg_buf) {
174
    if (!arg_buf) {
172
        ipc_answer_0(callid, ENOMEM);
175
        ipc_answer_0(callid, ENOMEM);
173
        ipc_answer_0(rid, ENOMEM);
176
        ipc_answer_0(rid, ENOMEM);
174
        return;
177
        return;
175
    }
178
    }
176
 
179
 
177
    ipc_data_write_finalize(callid, arg_buf, buf_len);
180
    ipc_data_write_finalize(callid, arg_buf, buf_len);
178
    ipc_answer_0(rid, EOK);
181
    ipc_answer_0(rid, EOK);
179
 
182
 
180
    arg_buf[buf_len] = '\0';
183
    arg_buf[buf_len] = '\0';
181
 
184
 
182
    /*
185
    /*
183
     * Count number of arguments
186
     * Count number of arguments
184
     */
187
     */
185
    p = arg_buf;
188
    p = arg_buf;
186
    n = 0;
189
    n = 0;
187
    while (p < arg_buf + buf_len) {
190
    while (p < arg_buf + buf_len) {
188
        arg_len = strlen(p);
191
        arg_len = strlen(p);
189
        p = p + arg_len + 1;
192
        p = p + arg_len + 1;
190
        ++n;
193
        ++n;
191
    }
194
    }
192
 
195
 
193
    /* Allocate argv */
196
    /* Allocate argv */
194
    argv = malloc((n + 1) * sizeof(char *));
197
    argv = malloc((n + 1) * sizeof(char *));
195
 
198
 
196
    if (argv == NULL) {
199
    if (argv == NULL) {
197
        free(arg_buf);
200
        free(arg_buf);
198
        ipc_answer_0(callid, ENOMEM);
201
        ipc_answer_0(callid, ENOMEM);
199
        ipc_answer_0(rid, ENOMEM);
202
        ipc_answer_0(rid, ENOMEM);
200
        return;
203
        return;
201
    }
204
    }
202
 
205
 
203
    /*
206
    /*
204
     * Fill argv with argument pointers
207
     * Fill argv with argument pointers
205
     */
208
     */
206
    p = arg_buf;
209
    p = arg_buf;
207
    n = 0;
210
    n = 0;
208
    while (p < arg_buf + buf_len) {
211
    while (p < arg_buf + buf_len) {
209
        argv[n] = p;
212
        argv[n] = p;
210
 
213
 
211
        arg_len = strlen(p);
214
        arg_len = strlen(p);
212
        p = p + arg_len + 1;
215
        p = p + arg_len + 1;
213
        ++n;
216
        ++n;
214
    }
217
    }
215
 
218
 
216
    argc = n;
219
    argc = n;
217
    argv[n] = NULL;
220
    argv[n] = NULL;
218
}
221
}
219
 
222
 
220
/** Load the previously selected program.
223
/** Load the previously selected program.
221
 *
224
 *
222
 * @param rid
225
 * @param rid
223
 * @param request
226
 * @param request
224
 * @return 0 on success, !0 on error.
227
 * @return 0 on success, !0 on error.
225
 */
228
 */
226
static int loader_load(ipc_callid_t rid, ipc_call_t *request)
229
static int loader_load(ipc_callid_t rid, ipc_call_t *request)
227
{
230
{
228
    int rc;
231
    int rc;
229
 
232
 
230
    rc = elf_load_file(pathname, 0, 0, &prog_info);
233
    rc = elf_load_file(pathname, 0, 0, &prog_info);
231
    if (rc < 0) {
234
    if (rc < 0) {
232
        DPRINTF("Failed to load executable '%s'.\n", pathname);
235
        DPRINTF("Failed to load executable '%s'.\n", pathname);
233
        ipc_answer_0(rid, EINVAL);
236
        ipc_answer_0(rid, EINVAL);
234
        return 1;
237
        return 1;
235
    }
238
    }
236
 
239
 
237
    elf_create_pcb(&prog_info, &pcb);
240
    elf_create_pcb(&prog_info, &pcb);
238
 
241
 
239
    pcb.argc = argc;
242
    pcb.argc = argc;
240
    pcb.argv = argv;
243
    pcb.argv = argv;
241
 
244
 
242
    if (prog_info.interp == NULL) {
245
    if (prog_info.interp == NULL) {
243
        /* Statically linked program */
246
        /* Statically linked program */
244
        is_dyn_linked = false;
247
        is_dyn_linked = false;
245
        ipc_answer_0(rid, EOK);
248
        ipc_answer_0(rid, EOK);
246
        return 0;
249
        return 0;
247
    }
250
    }
248
 
251
 
249
    printf("Load ELF interpreter '%s'\n", prog_info.interp);
252
    printf("Load ELF interpreter '%s'\n", prog_info.interp);
250
    rc = elf_load_file(prog_info.interp, 0, 0, &interp_info);
253
    rc = elf_load_file(prog_info.interp, 0, 0, &interp_info);
251
    if (rc < 0) {
254
    if (rc < 0) {
252
        DPRINTF("Failed to load interpreter '%s.'\n",
255
        DPRINTF("Failed to load interpreter '%s.'\n",
253
            prog_info.interp);
256
            prog_info.interp);
254
        ipc_answer_0(rid, EINVAL);
257
        ipc_answer_0(rid, EINVAL);
255
        return 1;
258
        return 1;
256
    }
259
    }
257
 
260
 
258
    printf("Run interpreter.\n");
261
    printf("Run interpreter.\n");
259
    printf("entry point: 0x%lx\n", interp_info.entry);
262
    printf("entry point: 0x%lx\n", interp_info.entry);
260
    printf("pcb address: 0x%lx\n", &pcb);
263
    printf("pcb address: 0x%lx\n", &pcb);
261
    printf("prog dynamic: 0x%lx\n", prog_info.dynamic);
264
    printf("prog dynamic: 0x%lx\n", prog_info.dynamic);
262
 
265
 
263
    is_dyn_linked = true;
266
    is_dyn_linked = true;
264
    ipc_answer_0(rid, EOK);
267
    ipc_answer_0(rid, EOK);
265
 
268
 
266
    return 0;
269
    return 0;
267
}
270
}
268
 
271
 
269
 
272
 
270
/** Run the previously loaded program.
273
/** Run the previously loaded program.
271
 *
274
 *
272
 * @param rid
275
 * @param rid
273
 * @param request
276
 * @param request
274
 * @return 0 on success, !0 on error.
277
 * @return 0 on success, !0 on error.
275
 */
278
 */
276
static void loader_run(ipc_callid_t rid, ipc_call_t *request)
279
static void loader_run(ipc_callid_t rid, ipc_call_t *request)
277
{
280
{
278
    if (is_dyn_linked == true) {
281
    if (is_dyn_linked == true) {
279
        /* Dynamically linked program */
282
        /* Dynamically linked program */
280
        DPRINTF("Run ELF interpreter.\n");
283
        DPRINTF("Run ELF interpreter.\n");
281
        DPRINTF("Entry point: 0x%lx\n", interp_info.entry);
284
        DPRINTF("Entry point: 0x%lx\n", interp_info.entry);
282
        close_console();
285
        close_console();
283
 
286
 
284
        ipc_answer_0(rid, EOK);
287
        ipc_answer_0(rid, EOK);
285
        program_run(interp_info.entry, &pcb);
288
        program_run(interp_info.entry, &pcb);
286
 
289
 
287
    } else {
290
    } else {
288
        /* Statically linked program */
291
        /* Statically linked program */
289
        close_console();
292
        close_console();
290
        ipc_answer_0(rid, EOK);
293
        ipc_answer_0(rid, EOK);
291
        program_run(prog_info.entry, &pcb);
294
        program_run(prog_info.entry, &pcb);
292
    }
295
    }
293
 
296
 
294
    /* Not reached */
297
    /* Not reached */
295
}
298
}
296
 
299
 
297
/** Handle loader connection.
300
/** Handle loader connection.
298
 *
301
 *
299
 * Receive and carry out commands (of which the last one should be
302
 * Receive and carry out commands (of which the last one should be
300
 * to execute the loaded program).
303
 * to execute the loaded program).
301
 */
304
 */
302
static void loader_connection(ipc_callid_t iid, ipc_call_t *icall)
305
static void loader_connection(ipc_callid_t iid, ipc_call_t *icall)
303
{
306
{
304
    ipc_callid_t callid;
307
    ipc_callid_t callid;
305
    ipc_call_t call;
308
    ipc_call_t call;
306
    int retval;
309
    int retval;
307
 
310
 
-
 
311
    /* Already have a connection? */
-
 
312
    if (connected) {
-
 
313
        ipc_answer_0(iid, ELIMIT);
-
 
314
        return;
-
 
315
    }
-
 
316
 
-
 
317
    connected = true;
-
 
318
   
-
 
319
    /* Accept the connection */
-
 
320
    ipc_answer_0(iid, EOK);
-
 
321
 
308
    /* Ignore parameters, the connection is already open */
322
    /* Ignore parameters, the connection is already open */
309
    (void)iid; (void)icall;
323
    (void)iid; (void)icall;
310
 
324
 
311
    while (1) {
325
    while (1) {
312
        callid = async_get_call(&call);
326
        callid = async_get_call(&call);
313
 
327
 
314
        switch (IPC_GET_METHOD(call)) {
328
        switch (IPC_GET_METHOD(call)) {
315
        case IPC_M_PHONE_HUNGUP:
329
        case IPC_M_PHONE_HUNGUP:
316
            exit(0);
330
            exit(0);
317
        case LOADER_GET_TASKID:
331
        case LOADER_GET_TASKID:
318
            loader_get_taskid(callid, &call);
332
            loader_get_taskid(callid, &call);
319
            continue;
333
            continue;
320
        case LOADER_SET_PATHNAME:
334
        case LOADER_SET_PATHNAME:
321
            loader_set_pathname(callid, &call);
335
            loader_set_pathname(callid, &call);
322
            continue;
336
            continue;
323
        case LOADER_SET_ARGS:
337
        case LOADER_SET_ARGS:
324
            loader_set_args(callid, &call);
338
            loader_set_args(callid, &call);
325
            continue;
339
            continue;
326
        case LOADER_LOAD:
340
        case LOADER_LOAD:
327
            loader_load(callid, &call);
341
            loader_load(callid, &call);
328
            continue;
342
            continue;
329
        case LOADER_RUN:
343
        case LOADER_RUN:
330
            loader_run(callid, &call);
344
            loader_run(callid, &call);
331
            /* Not reached */
345
            /* Not reached */
332
        default:
346
        default:
333
            retval = ENOENT;
347
            retval = ENOENT;
334
            break;
348
            break;
335
        }
349
        }
336
        if ((callid & IPC_CALLID_NOTIFICATION) == 0 &&
350
        if ((callid & IPC_CALLID_NOTIFICATION) == 0 &&
337
            IPC_GET_METHOD(call) != IPC_M_PHONE_HUNGUP) {
351
            IPC_GET_METHOD(call) != IPC_M_PHONE_HUNGUP) {
338
            DPRINTF("Responding EINVAL to method %d.\n",
352
            DPRINTF("Responding EINVAL to method %d.\n",
339
                IPC_GET_METHOD(call));
353
                IPC_GET_METHOD(call));
340
            ipc_answer_0(callid, EINVAL);
354
            ipc_answer_0(callid, EINVAL);
341
        }
355
        }
342
    }
356
    }
343
}
357
}
344
 
358
 
345
/** Program loader main function.
359
/** Program loader main function.
346
 */
360
 */
347
int main(int argc, char *argv[])
361
int main(int argc, char *argv[])
348
{
362
{
349
    ipc_callid_t callid;
-
 
350
    ipc_call_t call;
-
 
351
    ipcarg_t phone_hash;
363
    ipcarg_t phonead;
352
 
-
 
353
    /* The first call only communicates the incoming phone hash */
-
 
354
    callid = ipc_wait_for_call(&call);
-
 
355
 
364
 
356
    if (IPC_GET_METHOD(call) != LOADER_HELLO) {
-
 
357
        if (IPC_GET_METHOD(call) != IPC_M_PHONE_HUNGUP)
-
 
358
            ipc_answer_0(callid, EINVAL);
-
 
359
        return 1;
365
    connected = false;
360
    }
366
   
361
 
-
 
362
    ipc_answer_0(callid, EOK);
367
    /* Set a handler of incomming connections. */
363
    phone_hash = call.in_phone_hash;
368
    async_set_client_connection(loader_connection);
364
 
369
 
365
    /*
-
 
366
     * Up until now async must not be used as it couldn't
370
    /* Register at naming service. */
367
     * handle incoming requests. (Which means e.g. printf()
371
    if (ipc_connect_to_me(PHONE_NS, SERVICE_LOAD, 0, 0, &phonead) != 0)
368
     * cannot be used)
372
        return -1;
369
     */
373
   
370
    async_new_connection(phone_hash, 0, NULL, loader_connection);
-
 
371
    async_manager();
374
    async_manager();
372
 
375
 
373
    /* not reached */
376
    /* Never reached */
374
    return 0;
377
    return 0;
375
}
378
}
376
 
379
 
377
/** @}
380
/** @}
378
 */
381
 */
379
 
382