Changeset 9eb3623 in mainline
- Timestamp:
- 2009-04-08T18:47:17Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8be693b
- Parents:
- 6071a8f
- Location:
- uspace/lib/libc/generic
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/loader.c
r6071a8f r9eb3623 55 55 { 56 56 return __SYSCALL2(SYS_PROGRAM_SPAWN_LOADER, 57 (sysarg_t) name, str len(name));57 (sysarg_t) name, str_size(name)); 58 58 } 59 59 … … 169 169 buffer_size = 0; 170 170 while (*ap != NULL) { 171 buffer_size += str len(*ap) + 1;171 buffer_size += str_size(*ap) + 1; 172 172 ++ap; 173 173 } … … 179 179 ap = argv; 180 180 dp = arg_buf; 181 181 182 while (*ap != NULL) { 182 str cpy(dp, *ap);183 dp += str len(*ap) + 1;183 str_ncpy(dp, *ap, buffer_size - (dp - arg_buf)); 184 dp += str_size(*ap) + 1; 184 185 185 186 ++ap; -
uspace/lib/libc/generic/sysinfo.c
r6071a8f r9eb3623 39 39 sysarg_t sysinfo_value(char *name) 40 40 { 41 return __SYSCALL2(SYS_SYSINFO_VALUE, (sysarg_t ) name, (sysarg_t) strlen(name)); 41 return __SYSCALL2(SYS_SYSINFO_VALUE, (sysarg_t ) name, 42 (sysarg_t) str_size(name)); 42 43 } 43 44 -
uspace/lib/libc/generic/task.c
r6071a8f r9eb3623 58 58 int task_set_name(const char *name) 59 59 { 60 return __SYSCALL2(SYS_TASK_SET_NAME, (sysarg_t) name, str len(name));60 return __SYSCALL2(SYS_TASK_SET_NAME, (sysarg_t) name, str_size(name)); 61 61 } 62 62 -
uspace/lib/libc/generic/thread.c
r6071a8f r9eb3623 110 110 111 111 rc = __SYSCALL4(SYS_THREAD_CREATE, (sysarg_t) uarg, (sysarg_t) name, 112 (sysarg_t) str len(name), (sysarg_t) tid);112 (sysarg_t) str_size(name), (sysarg_t) tid); 113 113 114 114 if (rc) { -
uspace/lib/libc/generic/vfs/vfs.c
r6071a8f r9eb3623 58 58 DIR *cwd_dir = NULL; 59 59 char *cwd_path = NULL; 60 size_t cwd_ len= 0;60 size_t cwd_size = 0; 61 61 62 62 char *absolutize(const char *path, size_t *retlen) … … 66 66 67 67 futex_down(&cwd_futex); 68 size_t len = strlen(path);68 size_t size = str_size(path); 69 69 if (*path != '/') { 70 70 if (!cwd_path) { … … 72 72 return NULL; 73 73 } 74 ncwd_path_nc = malloc(cwd_ len + 1 + len+ 1);74 ncwd_path_nc = malloc(cwd_size + 1 + size + 1); 75 75 if (!ncwd_path_nc) { 76 76 futex_up(&cwd_futex); 77 77 return NULL; 78 78 } 79 str cpy(ncwd_path_nc, cwd_path);80 ncwd_path_nc[cwd_ len] = '/';81 ncwd_path_nc[cwd_ len+ 1] = '\0';79 str_ncpy(ncwd_path_nc, cwd_path, cwd_size + 1 + size + 1); 80 ncwd_path_nc[cwd_size] = '/'; 81 ncwd_path_nc[cwd_size + 1] = '\0'; 82 82 } else { 83 ncwd_path_nc = malloc( len+ 1);83 ncwd_path_nc = malloc(size + 1); 84 84 if (!ncwd_path_nc) { 85 85 futex_up(&cwd_futex); … … 133 133 &answer); 134 134 135 ipcarg_t retval = ipc_data_write_start(phone, name, str len(name) + 1);135 ipcarg_t retval = ipc_data_write_start(phone, name, str_size(name) + 1); 136 136 137 137 if (retval != EOK) { … … 167 167 return res; 168 168 169 size_t mpa_ len;170 char *mpa = absolutize(mp, &mpa_ len);169 size_t mpa_size; 170 char *mpa = absolutize(mp, &mpa_size); 171 171 if (!mpa) 172 172 return ENOMEM; … … 177 177 178 178 req = async_send_2(vfs_phone, VFS_MOUNT, dev_handle, flags, NULL); 179 rc = ipc_data_write_start(vfs_phone, (void *) mpa, mpa_ len);179 rc = ipc_data_write_start(vfs_phone, (void *) mpa, mpa_size); 180 180 if (rc != EOK) { 181 181 async_wait_for(req, NULL); … … 186 186 } 187 187 188 rc = ipc_data_write_start(vfs_phone, (void *) fs_name, str len(fs_name));188 rc = ipc_data_write_start(vfs_phone, (void *) fs_name, str_size(fs_name)); 189 189 if (rc != EOK) { 190 190 async_wait_for(req, NULL); … … 209 209 aid_t req; 210 210 211 size_t pa_ len;212 char *pa = absolutize(path, &pa_ len);211 size_t pa_size; 212 char *pa = absolutize(path, &pa_size); 213 213 if (!pa) 214 214 return ENOMEM; … … 219 219 220 220 req = async_send_3(vfs_phone, VFS_OPEN, lflag, oflag, 0, &answer); 221 rc = ipc_data_write_start(vfs_phone, pa, pa_ len);221 rc = ipc_data_write_start(vfs_phone, pa, pa_size); 222 222 if (rc != EOK) { 223 223 async_wait_for(req, NULL); … … 385 385 aid_t req; 386 386 387 size_t pa_ len;388 char *pa = absolutize(path, &pa_ len);387 size_t pa_size; 388 char *pa = absolutize(path, &pa_size); 389 389 if (!pa) 390 390 return ENOMEM; … … 395 395 396 396 req = async_send_1(vfs_phone, VFS_MKDIR, mode, NULL); 397 rc = ipc_data_write_start(vfs_phone, pa, pa_ len);397 rc = ipc_data_write_start(vfs_phone, pa, pa_size); 398 398 if (rc != EOK) { 399 399 async_wait_for(req, NULL); … … 415 415 aid_t req; 416 416 417 size_t pa_ len;418 char *pa = absolutize(path, &pa_ len);417 size_t pa_size; 418 char *pa = absolutize(path, &pa_size); 419 419 if (!pa) 420 420 return ENOMEM; … … 425 425 426 426 req = async_send_0(vfs_phone, VFS_UNLINK, NULL); 427 rc = ipc_data_write_start(vfs_phone, pa, pa_ len);427 rc = ipc_data_write_start(vfs_phone, pa, pa_size); 428 428 if (rc != EOK) { 429 429 async_wait_for(req, NULL); … … 455 455 aid_t req; 456 456 457 size_t olda_ len;458 char *olda = absolutize(old, &olda_ len);457 size_t olda_size; 458 char *olda = absolutize(old, &olda_size); 459 459 if (!olda) 460 460 return ENOMEM; 461 461 462 size_t newa_ len;463 char *newa = absolutize(new, &newa_ len);462 size_t newa_size; 463 char *newa = absolutize(new, &newa_size); 464 464 if (!newa) { 465 465 free(olda); … … 472 472 473 473 req = async_send_0(vfs_phone, VFS_RENAME, NULL); 474 rc = ipc_data_write_start(vfs_phone, olda, olda_ len);474 rc = ipc_data_write_start(vfs_phone, olda, olda_size); 475 475 if (rc != EOK) { 476 476 async_wait_for(req, NULL); … … 481 481 return (int) rc; 482 482 } 483 rc = ipc_data_write_start(vfs_phone, newa, newa_ len);483 rc = ipc_data_write_start(vfs_phone, newa, newa_size); 484 484 if (rc != EOK) { 485 485 async_wait_for(req, NULL); … … 500 500 int chdir(const char *path) 501 501 { 502 size_t pa_ len;503 char *pa = absolutize(path, &pa_ len);502 size_t pa_size; 503 char *pa = absolutize(path, &pa_size); 504 504 if (!pa) 505 505 return ENOMEM; … … 517 517 free(cwd_path); 518 518 cwd_path = NULL; 519 cwd_ len= 0;519 cwd_size = 0; 520 520 } 521 521 cwd_dir = d; 522 522 cwd_path = pa; 523 cwd_ len = pa_len;523 cwd_size = pa_size; 524 524 futex_up(&cwd_futex); 525 525 return EOK; … … 531 531 return NULL; 532 532 futex_down(&cwd_futex); 533 if (size < cwd_ len+ 1) {533 if (size < cwd_size + 1) { 534 534 futex_up(&cwd_futex); 535 535 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.