Rev 2927 | Rev 3148 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2927 | Rev 3004 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | */ |
33 | */ |
34 | 34 | ||
35 | #include <task.h> |
35 | #include <task.h> |
- | 36 | #include <ipc/ipc.h> |
|
36 | #include <libc.h> |
37 | #include <async.h> |
- | 38 | #include <errno.h> |
|
37 | 39 | ||
38 | task_id_t task_get_id(void) |
40 | task_id_t task_get_id(void) |
39 | { |
41 | { |
40 | task_id_t task_id; |
42 | task_id_t task_id; |
41 | 43 | ||
42 | (void) __SYSCALL1(SYS_TASK_GET_ID, (sysarg_t) &task_id); |
44 | (void) __SYSCALL1(SYS_TASK_GET_ID, (sysarg_t) &task_id); |
43 | 45 | ||
44 | return task_id; |
46 | return task_id; |
45 | } |
47 | } |
46 | 48 | ||
- | 49 | static int task_spawn_loader(void) |
|
- | 50 | { |
|
- | 51 | int phone_id, rc; |
|
- | 52 | ||
- | 53 | rc = __SYSCALL1(SYS_TASK_SPAWN, (sysarg_t) &phone_id); |
|
- | 54 | if (rc != 0) |
|
- | 55 | return rc; |
|
- | 56 | ||
- | 57 | return phone_id; |
|
- | 58 | } |
|
- | 59 | #include <stdio.h> |
|
- | 60 | #include <unistd.h> |
|
- | 61 | task_id_t task_spawn(const char *path, const char *argv[]) |
|
- | 62 | { |
|
- | 63 | int phone_id; |
|
- | 64 | ipc_call_t answer; |
|
- | 65 | aid_t req; |
|
- | 66 | int rc; |
|
- | 67 | ||
- | 68 | phone_id = task_spawn_loader(); |
|
- | 69 | if (phone_id < 0) return 0; |
|
- | 70 | printf("phone_id:%d\n", phone_id); |
|
- | 71 | ||
- | 72 | // getchar(); |
|
- | 73 | ||
- | 74 | // req = async_send_0(phone_id, 1024, &answer); |
|
- | 75 | rc = ipc_data_write_start(phone_id, (void *)path, strlen(path)); |
|
- | 76 | printf("->%d\n", rc); |
|
- | 77 | if (rc != EOK) { |
|
- | 78 | // async_wait_for(req, NULL); |
|
- | 79 | return 1; |
|
- | 80 | } |
|
- | 81 | // async_wait_for(req, &rc); |
|
- | 82 | ||
- | 83 | if (rc != EOK) return 0; |
|
- | 84 | ||
- | 85 | // rc = async_req_0_0(phone_id, 1025); |
|
- | 86 | // printf("->%d\n", rc); |
|
- | 87 | // if (rc != EOK) return 0; |
|
- | 88 | ||
- | 89 | // ipc_hangup(phone_id); |
|
- | 90 | ||
- | 91 | return 1; |
|
- | 92 | } |
|
- | 93 | ||
47 | /** @} |
94 | /** @} |
48 | */ |
95 | */ |