Subversion Repositories HelenOS

Rev

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

Rev 3772 Rev 3773
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/loader.h>
53
#include <ipc/loader.h>
54
#include <loader/pcb.h>
54
#include <loader/pcb.h>
55
#include <errno.h>
55
#include <errno.h>
56
#include <async.h>
56
#include <async.h>
57
#include <as.h>
57
#include <as.h>
58
 
58
 
59
#include <elf.h>
59
#include <elf.h>
60
#include <elf_load.h>
60
#include <elf_load.h>
61
 
61
 
62
void program_run(void *entry, pcb_t *pcb);
62
void program_run(void *entry, pcb_t *pcb);
63
 
63
 
64
/** Pathname of the file that will be loaded */
64
/** Pathname of the file that will be loaded */
65
static char *pathname = NULL;
65
static char *pathname = NULL;
66
 
66
 
67
/** The Program control block */
67
/** The Program control block */
68
static pcb_t pcb;
68
static pcb_t pcb;
69
 
69
 
70
/** Number of arguments */
70
/** Number of arguments */
71
static int argc = 0;
71
static int argc = 0;
72
/** Argument vector */
72
/** Argument vector */
73
static char **argv = NULL;
73
static char **argv = NULL;
74
/** Buffer holding all arguments */
74
/** Buffer holding all arguments */
75
static char *arg_buf = NULL;
75
static char *arg_buf = NULL;
76
 
76
 
77
static elf_info_t prog_info;
77
static elf_info_t prog_info;
78
static elf_info_t interp_info;
78
static elf_info_t interp_info;
79
 
79
 
80
static bool is_dyn_linked;
80
static bool is_dyn_linked;
81
 
81
 
82
 
82
 
83
static void loader_get_taskid(ipc_callid_t rid, ipc_call_t *request)
83
static void loader_get_taskid(ipc_callid_t rid, ipc_call_t *request)
84
{
84
{
85
    ipc_callid_t callid;
85
    ipc_callid_t callid;
86
    task_id_t task_id;
86
    task_id_t task_id;
87
    size_t len;
87
    size_t len;
88
 
88
 
89
    task_id = task_get_id();
89
    task_id = task_get_id();
90
 
90
 
91
    if (!ipc_data_read_receive(&callid, &len)) {
91
    if (!ipc_data_read_receive(&callid, &len)) {
92
        ipc_answer_0(callid, EINVAL);
92
        ipc_answer_0(callid, EINVAL);
93
        ipc_answer_0(rid, EINVAL);
93
        ipc_answer_0(rid, EINVAL);
94
        return;
94
        return;
95
    }
95
    }
96
 
96
 
97
    if (len > sizeof(task_id)) len = sizeof(task_id);
97
    if (len > sizeof(task_id)) len = sizeof(task_id);
98
 
98
 
99
    ipc_data_read_finalize(callid, &task_id, len);
99
    ipc_data_read_finalize(callid, &task_id, len);
100
    ipc_answer_0(rid, EOK);
100
    ipc_answer_0(rid, EOK);
101
}
101
}
102
 
102
 
103
 
103
 
104
/** Receive a call setting pathname of the program to execute.
104
/** Receive a call setting pathname of the program to execute.
105
 *
105
 *
106
 * @param rid
106
 * @param rid
107
 * @param request
107
 * @param request
108
 */
108
 */
109
static void loader_set_pathname(ipc_callid_t rid, ipc_call_t *request)
109
static void loader_set_pathname(ipc_callid_t rid, ipc_call_t *request)
110
{
110
{
111
    ipc_callid_t callid;
111
    ipc_callid_t callid;
112
    size_t len;
112
    size_t len;
113
    char *name_buf;
113
    char *name_buf;
114
 
114
 
115
    if (!ipc_data_write_receive(&callid, &len)) {
115
    if (!ipc_data_write_receive(&callid, &len)) {
116
        ipc_answer_0(callid, EINVAL);
116
        ipc_answer_0(callid, EINVAL);
117
        ipc_answer_0(rid, EINVAL);
117
        ipc_answer_0(rid, EINVAL);
118
        return;
118
        return;
119
    }
119
    }
120
 
120
 
121
    name_buf = malloc(len + 1);
121
    name_buf = malloc(len + 1);
122
    if (!name_buf) {
122
    if (!name_buf) {
123
        ipc_answer_0(callid, ENOMEM);
123
        ipc_answer_0(callid, ENOMEM);
124
        ipc_answer_0(rid, ENOMEM);
124
        ipc_answer_0(rid, ENOMEM);
125
        return;
125
        return;
126
    }
126
    }
127
 
127
 
128
    ipc_data_write_finalize(callid, name_buf, len);
128
    ipc_data_write_finalize(callid, name_buf, len);
129
    ipc_answer_0(rid, EOK);
129
    ipc_answer_0(rid, EOK);
130
 
130
 
131
    if (pathname != NULL) {
131
    if (pathname != NULL) {
132
        free(pathname);
132
        free(pathname);
133
        pathname = NULL;
133
        pathname = NULL;
134
    }
134
    }
135
 
135
 
136
    name_buf[len] = '\0';
136
    name_buf[len] = '\0';
137
    pathname = name_buf;
137
    pathname = name_buf;
138
}
138
}
139
 
139
 
140
/** Receive a call setting arguments of the program to execute.
140
/** Receive a call setting arguments of the program to execute.
141
 *
141
 *
142
 * @param rid
142
 * @param rid
143
 * @param request
143
 * @param request
144
 */
144
 */
145
static void loader_set_args(ipc_callid_t rid, ipc_call_t *request)
145
static void loader_set_args(ipc_callid_t rid, ipc_call_t *request)
146
{
146
{
147
    ipc_callid_t callid;
147
    ipc_callid_t callid;
148
    size_t buf_len, arg_len;
148
    size_t buf_len, arg_len;
149
    char *p;
149
    char *p;
150
    int n;
150
    int n;
151
 
151
 
152
    if (!ipc_data_write_receive(&callid, &buf_len)) {
152
    if (!ipc_data_write_receive(&callid, &buf_len)) {
153
        ipc_answer_0(callid, EINVAL);
153
        ipc_answer_0(callid, EINVAL);
154
        ipc_answer_0(rid, EINVAL);
154
        ipc_answer_0(rid, EINVAL);
155
        return;
155
        return;
156
    }
156
    }
157
 
157
 
158
    if (arg_buf != NULL) {
158
    if (arg_buf != NULL) {
159
        free(arg_buf);
159
        free(arg_buf);
160
        arg_buf = NULL;
160
        arg_buf = NULL;
161
    }
161
    }
162
 
162
 
163
    if (argv != NULL) {
163
    if (argv != NULL) {
164
        free(argv);
164
        free(argv);
165
        argv = NULL;
165
        argv = NULL;
166
    }
166
    }
167
 
167
 
168
    arg_buf = malloc(buf_len + 1);
168
    arg_buf = malloc(buf_len + 1);
169
    if (!arg_buf) {
169
    if (!arg_buf) {
170
        ipc_answer_0(callid, ENOMEM);
170
        ipc_answer_0(callid, ENOMEM);
171
        ipc_answer_0(rid, ENOMEM);
171
        ipc_answer_0(rid, ENOMEM);
172
        return;
172
        return;
173
    }
173
    }
174
 
174
 
175
    ipc_data_write_finalize(callid, arg_buf, buf_len);
175
    ipc_data_write_finalize(callid, arg_buf, buf_len);
176
    ipc_answer_0(rid, EOK);
176
    ipc_answer_0(rid, EOK);
177
 
177
 
178
    arg_buf[buf_len] = '\0';
178
    arg_buf[buf_len] = '\0';
179
 
179
 
180
    /*
180
    /*
181
     * Count number of arguments
181
     * Count number of arguments
182
     */
182
     */
183
    p = arg_buf;
183
    p = arg_buf;
184
    n = 0;
184
    n = 0;
185
    while (p < arg_buf + buf_len) {
185
    while (p < arg_buf + buf_len) {
186
        arg_len = strlen(p);
186
        arg_len = strlen(p);
187
        p = p + arg_len + 1;
187
        p = p + arg_len + 1;
188
        ++n;
188
        ++n;
189
    }
189
    }
190
 
190
 
191
    /* Allocate argv */
191
    /* Allocate argv */
192
    argv = malloc((n + 1) * sizeof(char *));
192
    argv = malloc((n + 1) * sizeof(char *));
193
 
193
 
194
    if (argv == NULL) {
194
    if (argv == NULL) {
195
        free(arg_buf);
195
        free(arg_buf);
196
        ipc_answer_0(callid, ENOMEM);
196
        ipc_answer_0(callid, ENOMEM);
197
        ipc_answer_0(rid, ENOMEM);
197
        ipc_answer_0(rid, ENOMEM);
198
        return;
198
        return;
199
    }
199
    }
200
 
200
 
201
    /*
201
    /*
202
     * Fill argv with argument pointers
202
     * Fill argv with argument pointers
203
     */
203
     */
204
    p = arg_buf;
204
    p = arg_buf;
205
    n = 0;
205
    n = 0;
206
    while (p < arg_buf + buf_len) {
206
    while (p < arg_buf + buf_len) {
207
        argv[n] = p;
207
        argv[n] = p;
208
 
208
 
209
        arg_len = strlen(p);
209
        arg_len = strlen(p);
210
        p = p + arg_len + 1;
210
        p = p + arg_len + 1;
211
        ++n;
211
        ++n;
212
    }
212
    }
213
 
213
 
214
    argc = n;
214
    argc = n;
215
    argv[n] = NULL;
215
    argv[n] = NULL;
216
}
216
}
217
 
217
 
218
/** Load the previously selected program.
218
/** Load the previously selected program.
219
 *
219
 *
220
 * @param rid
220
 * @param rid
221
 * @param request
221
 * @param request
222
 * @return 0 on success, !0 on error.
222
 * @return 0 on success, !0 on error.
223
 */
223
 */
224
static int loader_load(ipc_callid_t rid, ipc_call_t *request)
224
static int loader_load(ipc_callid_t rid, ipc_call_t *request)
225
{
225
{
226
    int rc;
226
    int rc;
227
 
227
 
228
    printf("Load program '%s'\n", pathname);
-
 
229
 
-
 
230
    rc = elf_load_file(pathname, 0, 0, &prog_info);
228
    rc = elf_load_file(pathname, 0, 0, &prog_info);
231
    if (rc < 0) {
229
    if (rc < 0) {
232
        printf("Failed to load executable '%s'.\n", pathname);
230
        printf("Failed to load executable '%s'.\n", pathname);
233
        ipc_answer_0(rid, EINVAL);
231
        ipc_answer_0(rid, EINVAL);
234
        return 1;
232
        return 1;
235
    }
233
    }
236
 
234
 
237
    printf("Create PCB\n");
-
 
238
 
-
 
239
    elf_create_pcb(&prog_info, &pcb);
235
    elf_create_pcb(&prog_info, &pcb);
240
 
236
 
241
    printf("Fill args\n");
-
 
242
 
-
 
243
    pcb.argc = argc;
237
    pcb.argc = argc;
244
    pcb.argv = argv;
238
    pcb.argv = argv;
245
 
239
 
246
    printf("Check interp\n");
-
 
247
 
-
 
248
    if (prog_info.interp == NULL) {
240
    if (prog_info.interp == NULL) {
249
        /* Statically linked program */
241
        /* Statically linked program */
250
        is_dyn_linked = false;
242
        is_dyn_linked = false;
251
        ipc_answer_0(rid, EOK);
243
        ipc_answer_0(rid, EOK);
252
        return 0;
244
        return 0;
253
    }
245
    }
254
 
246
 
255
    printf("Load ELF interpreter '%s'\n", prog_info.interp);
247
    printf("Load ELF interpreter '%s'\n", prog_info.interp);
256
    rc = elf_load_file(prog_info.interp, 0, 0, &interp_info);
248
    rc = elf_load_file(prog_info.interp, 0, 0, &interp_info);
257
    if (rc < 0) {
249
    if (rc < 0) {
258
        printf("Failed to load interpreter '%s.'\n", prog_info.interp);
250
        printf("Failed to load interpreter '%s.'\n", prog_info.interp);
259
        ipc_answer_0(rid, EINVAL);
251
        ipc_answer_0(rid, EINVAL);
260
        return 1;
252
        return 1;
261
    }
253
    }
262
 
254
 
263
    printf("Run interpreter.\n");
255
    printf("Run interpreter.\n");
264
    printf("entry point: 0x%lx\n", interp_info.entry);
256
    printf("entry point: 0x%lx\n", interp_info.entry);
265
    printf("pcb address: 0x%lx\n", &pcb);
257
    printf("pcb address: 0x%lx\n", &pcb);
266
    printf("prog dynamic: 0x%lx\n", prog_info.dynamic);
258
    printf("prog dynamic: 0x%lx\n", prog_info.dynamic);
267
 
259
 
268
    is_dyn_linked = true;
260
    is_dyn_linked = true;
269
    ipc_answer_0(rid, EOK);
261
    ipc_answer_0(rid, EOK);
270
 
262
 
271
    return 0;
263
    return 0;
272
}
264
}
273
 
265
 
274
 
266
 
275
/** Run the previously loaded program.
267
/** Run the previously loaded program.
276
 *
268
 *
277
 * @param rid
269
 * @param rid
278
 * @param request
270
 * @param request
279
 * @return 0 on success, !0 on error.
271
 * @return 0 on success, !0 on error.
280
 */
272
 */
281
static void loader_run(ipc_callid_t rid, ipc_call_t *request)
273
static void loader_run(ipc_callid_t rid, ipc_call_t *request)
282
{
274
{
283
    if (is_dyn_linked == true) {
275
    if (is_dyn_linked == true) {
284
        /* Dynamically linked program */
276
        /* Dynamically linked program */
285
        printf("run dynamic linker\n");
277
        printf("run dynamic linker\n");
286
        printf("entry point: 0x%lx\n", interp_info.entry);
278
        printf("entry point: 0x%lx\n", interp_info.entry);
287
        close_console();
279
        close_console();
288
 
280
 
289
        ipc_answer_0(rid, EOK);
281
        ipc_answer_0(rid, EOK);
290
        program_run(interp_info.entry, &pcb);
282
        program_run(interp_info.entry, &pcb);
291
 
283
 
292
    } else {
284
    } else {
293
        printf("Run static program\n");
-
 
294
        /* Statically linked program */
285
        /* Statically linked program */
295
        close_console();
286
        close_console();
296
        ipc_answer_0(rid, EOK);
287
        ipc_answer_0(rid, EOK);
297
        program_run(prog_info.entry, &pcb);
288
        program_run(prog_info.entry, &pcb);
298
    }
289
    }
299
 
290
 
300
    /* Not reached */
291
    /* Not reached */
301
}
292
}
302
 
293
 
303
/** Handle loader connection.
294
/** Handle loader connection.
304
 *
295
 *
305
 * Receive and carry out commands (of which the last one should be
296
 * Receive and carry out commands (of which the last one should be
306
 * to execute the loaded program).
297
 * to execute the loaded program).
307
 */
298
 */
308
static void loader_connection(ipc_callid_t iid, ipc_call_t *icall)
299
static void loader_connection(ipc_callid_t iid, ipc_call_t *icall)
309
{
300
{
310
    ipc_callid_t callid;
301
    ipc_callid_t callid;
311
    ipc_call_t call;
302
    ipc_call_t call;
312
    int retval;
303
    int retval;
313
 
304
 
314
    /* Ignore parameters, the connection is already open */
305
    /* Ignore parameters, the connection is already open */
315
    (void)iid; (void)icall;
306
    (void)iid; (void)icall;
316
 
307
 
317
    while (1) {
308
    while (1) {
318
        callid = async_get_call(&call);
309
        callid = async_get_call(&call);
319
 
310
 
320
        switch (IPC_GET_METHOD(call)) {
311
        switch (IPC_GET_METHOD(call)) {
321
        case IPC_M_PHONE_HUNGUP:
312
        case IPC_M_PHONE_HUNGUP:
322
            exit(0);
313
            exit(0);
323
        case LOADER_GET_TASKID:
314
        case LOADER_GET_TASKID:
324
            loader_get_taskid(callid, &call);
315
            loader_get_taskid(callid, &call);
325
            continue;
316
            continue;
326
        case LOADER_SET_PATHNAME:
317
        case LOADER_SET_PATHNAME:
327
            loader_set_pathname(callid, &call);
318
            loader_set_pathname(callid, &call);
328
            continue;
319
            continue;
329
        case LOADER_SET_ARGS:
320
        case LOADER_SET_ARGS:
330
            loader_set_args(callid, &call);
321
            loader_set_args(callid, &call);
331
            continue;
322
            continue;
332
        case LOADER_LOAD:
323
        case LOADER_LOAD:
333
            loader_load(callid, &call);
324
            loader_load(callid, &call);
334
            continue;
325
            continue;
335
        case LOADER_RUN:
326
        case LOADER_RUN:
336
            loader_run(callid, &call);
327
            loader_run(callid, &call);
337
            /* Not reached */
328
            /* Not reached */
338
        default:
329
        default:
339
            retval = ENOENT;
330
            retval = ENOENT;
340
            break;
331
            break;
341
        }
332
        }
342
        if ((callid & IPC_CALLID_NOTIFICATION) == 0 &&
333
        if ((callid & IPC_CALLID_NOTIFICATION) == 0 &&
343
            IPC_GET_METHOD(call) != IPC_M_PHONE_HUNGUP) {
334
            IPC_GET_METHOD(call) != IPC_M_PHONE_HUNGUP) {
344
            printf("responding EINVAL to method %d\n",
335
            printf("responding EINVAL to method %d\n",
345
                IPC_GET_METHOD(call));
336
                IPC_GET_METHOD(call));
346
            ipc_answer_0(callid, EINVAL);
337
            ipc_answer_0(callid, EINVAL);
347
        }
338
        }
348
    }
339
    }
349
}
340
}
350
 
341
 
351
/** Program loader main function.
342
/** Program loader main function.
352
 */
343
 */
353
int main(int argc, char *argv[])
344
int main(int argc, char *argv[])
354
{
345
{
355
    ipc_callid_t callid;
346
    ipc_callid_t callid;
356
    ipc_call_t call;
347
    ipc_call_t call;
357
    ipcarg_t phone_hash;
348
    ipcarg_t phone_hash;
358
 
349
 
359
    /* The first call only communicates the incoming phone hash */
350
    /* The first call only communicates the incoming phone hash */
360
    callid = ipc_wait_for_call(&call);
351
    callid = ipc_wait_for_call(&call);
361
 
352
 
362
    if (IPC_GET_METHOD(call) != LOADER_HELLO) {
353
    if (IPC_GET_METHOD(call) != LOADER_HELLO) {
363
        if (IPC_GET_METHOD(call) != IPC_M_PHONE_HUNGUP)
354
        if (IPC_GET_METHOD(call) != IPC_M_PHONE_HUNGUP)
364
            ipc_answer_0(callid, EINVAL);
355
            ipc_answer_0(callid, EINVAL);
365
        return 1;
356
        return 1;
366
    }
357
    }
367
 
358
 
368
    ipc_answer_0(callid, EOK);
359
    ipc_answer_0(callid, EOK);
369
    phone_hash = call.in_phone_hash;
360
    phone_hash = call.in_phone_hash;
370
 
361
 
371
    /*
362
    /*
372
     * Up until now async must not be used as it couldn't
363
     * Up until now async must not be used as it couldn't
373
     * handle incoming requests. (Which means e.g. printf()
364
     * handle incoming requests. (Which means e.g. printf()
374
     * cannot be used)
365
     * cannot be used)
375
     */
366
     */
376
    async_new_connection(phone_hash, 0, NULL, loader_connection);
367
    async_new_connection(phone_hash, 0, NULL, loader_connection);
377
    async_manager();
368
    async_manager();
378
 
369
 
379
    /* not reached */
370
    /* not reached */
380
    return 0;
371
    return 0;
381
}
372
}
382
 
373
 
383
/** @}
374
/** @}
384
 */
375
 */
385
 
376