Changeset a8e9ab8d in mainline for uspace/lib/libc/generic/vfs/vfs.c
- Timestamp:
- 2008-03-09T17:18:30Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4072980
- Parents:
- 2664838b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/vfs/vfs.c
r2664838b ra8e9ab8d 469 469 } 470 470 471 int rename(const char *old, const char *new) 472 { 473 int res; 474 ipcarg_t rc; 475 aid_t req; 476 477 char *olda = absolutize(old); 478 if (!olda) 479 return ENOMEM; 480 size_t oldc_len; 481 char *oldc = canonify(olda, &oldc_len); 482 if (!oldc) { 483 free(olda); 484 return EINVAL; 485 } 486 char *newa = absolutize(new); 487 if (!newa) { 488 free(olda); 489 return ENOMEM; 490 } 491 size_t newc_len; 492 char *newc = canonify(newa, &newc_len); 493 if (!newc) { 494 free(olda); 495 free(newa); 496 return EINVAL; 497 } 498 499 futex_down(&vfs_phone_futex); 500 async_serialize_start(); 501 if (vfs_phone < 0) { 502 res = vfs_connect(); 503 if (res < 0) { 504 async_serialize_end(); 505 futex_up(&vfs_phone_futex); 506 free(olda); 507 free(newa); 508 return res; 509 } 510 } 511 req = async_send_0(vfs_phone, VFS_RENAME, NULL); 512 rc = ipc_data_write_start(vfs_phone, oldc, oldc_len); 513 if (rc != EOK) { 514 async_wait_for(req, NULL); 515 async_serialize_end(); 516 futex_up(&vfs_phone_futex); 517 free(olda); 518 free(newa); 519 return (int) rc; 520 } 521 rc = ipc_data_write_start(vfs_phone, newc, newc_len); 522 if (rc != EOK) { 523 async_wait_for(req, NULL); 524 async_serialize_end(); 525 futex_up(&vfs_phone_futex); 526 free(olda); 527 free(newa); 528 return (int) rc; 529 } 530 async_wait_for(req, &rc); 531 async_serialize_end(); 532 futex_up(&vfs_phone_futex); 533 free(olda); 534 free(newa); 535 return rc; 536 } 537 471 538 int chdir(const char *path) 472 539 {
Note:
See TracChangeset
for help on using the changeset viewer.