Changeset 622cdbe in mainline for uspace/lib/libc
- Timestamp:
- 2009-10-15T17:45:16Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d8ef374
- Parents:
- 81342f7
- Location:
- uspace/lib/libc
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/libc.c
r81342f7 r622cdbe 80 80 __stdio_init(0, NULL); 81 81 } else { 82 (void) chdir(__pcb->cwd); 82 83 argc = __pcb->argc; 83 84 argv = __pcb->argv; -
uspace/lib/libc/generic/loader.c
r81342f7 r622cdbe 101 101 } 102 102 103 /** Set current working directory for the loaded task. 104 * 105 * Sets the current working directory for the loaded task. 106 * 107 * @param ldr Loader connection structure. 108 * 109 * @return Zero on success or negative error code. 110 * 111 */ 112 int loader_set_cwd(loader_t *ldr) 113 { 114 char *cwd; 115 size_t len; 116 117 cwd = (char *) malloc(MAX_PATH_LEN + 1); 118 if (!cwd) 119 return ENOMEM; 120 if (!getcwd(cwd, MAX_PATH_LEN + 1)) 121 str_cpy(cwd, MAX_PATH_LEN + 1, "/"); 122 len = str_length(cwd); 123 124 ipc_call_t answer; 125 aid_t req = async_send_0(ldr->phone_id, LOADER_SET_CWD, &answer); 126 int rc = async_data_write_start(ldr->phone_id, cwd, len); 127 free(cwd); 128 if (rc != EOK) { 129 async_wait_for(req, NULL); 130 return rc; 131 } 132 133 ipcarg_t retval; 134 async_wait_for(req, &retval); 135 return (int) retval; 136 } 137 103 138 /** Set pathname of the program to load. 104 139 * -
uspace/lib/libc/generic/task.c
r81342f7 r622cdbe 89 89 goto error; 90 90 91 /* Send spawner's current working directory. */ 92 rc = loader_set_cwd(ldr); 93 if (rc != EOK) 94 goto error; 95 91 96 /* Send program pathname. */ 92 97 rc = loader_set_pathname(ldr, path); … … 98 103 if (rc != EOK) 99 104 goto error; 100 101 105 102 106 /* Send default files */ -
uspace/lib/libc/include/ipc/loader.h
r81342f7 r622cdbe 41 41 LOADER_HELLO = IPC_FIRST_USER_METHOD, 42 42 LOADER_GET_TASKID, 43 LOADER_SET_CWD, 43 44 LOADER_SET_PATHNAME, 44 45 LOADER_SET_ARGS, -
uspace/lib/libc/include/loader/loader.h
r81342f7 r622cdbe 49 49 extern loader_t *loader_connect(void); 50 50 extern int loader_get_task_id(loader_t *, task_id_t *); 51 extern int loader_set_cwd(loader_t *); 51 52 extern int loader_set_pathname(loader_t *, const char *); 52 53 extern int loader_set_args(loader_t *, char *const[]); -
uspace/lib/libc/include/loader/pcb.h
r81342f7 r622cdbe 52 52 /** Program entry point. */ 53 53 entry_point_t entry; 54 55 /** Current working directory. */ 56 char *cwd; 54 57 55 58 /** Number of command-line arguments. */
Note:
See TracChangeset
for help on using the changeset viewer.