Changes in / [7c7a3209:e035612] in mainline
- Location:
- uspace
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/scli.c
r7c7a3209 re035612 61 61 usr->line = (char *) NULL; 62 62 usr->name = "root"; 63 usr->home = "/"; 63 64 usr->cwd = (char *) NULL; 64 65 usr->prompt = (char *) NULL; 66 chdir(usr->home); 65 67 usr->lasterr = 0; 66 68 return (int) cli_set_prompt(usr); -
uspace/app/bdsh/scli.h
r7c7a3209 re035612 7 7 typedef struct { 8 8 char *name; 9 char *home; 9 10 char *line; 10 11 char *cwd; -
uspace/lib/libc/generic/libc.c
r7c7a3209 re035612 80 80 __stdio_init(0, NULL); 81 81 } else { 82 (void) chdir(__pcb->cwd);83 82 argc = __pcb->argc; 84 83 argv = __pcb->argv; -
uspace/lib/libc/generic/loader.c
r7c7a3209 re035612 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 138 103 /** Set pathname of the program to load. 139 104 * -
uspace/lib/libc/generic/task.c
r7c7a3209 re035612 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 96 91 /* Send program pathname. */ 97 92 rc = loader_set_pathname(ldr, path); … … 103 98 if (rc != EOK) 104 99 goto error; 100 105 101 106 102 /* Send default files */ -
uspace/lib/libc/generic/vfs/vfs.c
r7c7a3209 re035612 664 664 char *getcwd(char *buf, size_t size) 665 665 { 666 if (!cwd_size)667 return NULL;668 666 if (!size) 669 667 return NULL; -
uspace/lib/libc/include/ipc/loader.h
r7c7a3209 re035612 41 41 LOADER_HELLO = IPC_FIRST_USER_METHOD, 42 42 LOADER_GET_TASKID, 43 LOADER_SET_CWD,44 43 LOADER_SET_PATHNAME, 45 44 LOADER_SET_ARGS, -
uspace/lib/libc/include/loader/loader.h
r7c7a3209 re035612 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 *);52 51 extern int loader_set_pathname(loader_t *, const char *); 53 52 extern int loader_set_args(loader_t *, char *const[]); -
uspace/lib/libc/include/loader/pcb.h
r7c7a3209 re035612 52 52 /** Program entry point. */ 53 53 entry_point_t entry; 54 55 /** Current working directory. */56 char *cwd;57 54 58 55 /** Number of command-line arguments. */ -
uspace/srv/loader/main.c
r7c7a3209 re035612 72 72 static pcb_t pcb; 73 73 74 /** Current working directory */75 static char *cwd = NULL;76 77 74 /** Number of arguments */ 78 75 static int argc = 0; … … 118 115 } 119 116 120 /** Receive a call setting the current working directory.121 *122 * @param rid123 * @param request124 */125 static void ldr_set_cwd(ipc_callid_t rid, ipc_call_t *request)126 {127 ipc_callid_t callid;128 size_t len;129 130 if (!async_data_write_receive(&callid, &len)) {131 ipc_answer_0(callid, EINVAL);132 ipc_answer_0(rid, EINVAL);133 return;134 }135 136 cwd = malloc(len + 1);137 if (!cwd) {138 ipc_answer_0(callid, ENOMEM);139 ipc_answer_0(rid, ENOMEM);140 return;141 }142 143 async_data_write_finalize(callid, cwd, len);144 cwd[len] = '\0';145 146 ipc_answer_0(rid, EOK);147 }148 117 149 118 /** Receive a call setting pathname of the program to execute. … … 344 313 elf_create_pcb(&prog_info, &pcb); 345 314 346 pcb.cwd = cwd;347 348 315 pcb.argc = argc; 349 316 pcb.argv = argv; … … 439 406 case LOADER_GET_TASKID: 440 407 ldr_get_taskid(callid, &call); 441 continue;442 case LOADER_SET_CWD:443 ldr_set_cwd(callid, &call);444 408 continue; 445 409 case LOADER_SET_PATHNAME:
Note:
See TracChangeset
for help on using the changeset viewer.