Changeset 07b39338 in mainline for uspace/lib/c
- Timestamp:
- 2011-08-20T18:21:49Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6ab014d
- Parents:
- 0cf27ee (diff), f00af83 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/lib/c
- Files:
-
- 35 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/abs32le/include/types.h
r0cf27ee r07b39338 53 53 typedef int32_t intptr_t; 54 54 typedef uint32_t uintptr_t; 55 typedef int32_t intptr_t; 55 56 typedef uint32_t atomic_count_t; 56 57 typedef int32_t atomic_signed_t; -
uspace/lib/c/arch/amd64/include/types.h
r0cf27ee r07b39338 53 53 typedef int64_t intptr_t; 54 54 typedef uint64_t uintptr_t; 55 typedef int64_t intptr_t; 55 56 typedef uint64_t atomic_count_t; 56 57 typedef int64_t atomic_signed_t; -
uspace/lib/c/arch/arm32/include/types.h
r0cf27ee r07b39338 54 54 typedef int32_t intptr_t; 55 55 typedef uint32_t uintptr_t; 56 typedef int32_t intptr_t; 56 57 typedef uint32_t atomic_count_t; 57 58 typedef int32_t atomic_signed_t; -
uspace/lib/c/arch/ia32/Makefile.common
r0cf27ee r07b39338 28 28 29 29 CLANG_ARCH = i386 30 ifeq ($(PROCESSOR),i486) 31 GCC_CFLAGS += -march=i486 -fno-omit-frame-pointer 32 else 30 33 GCC_CFLAGS += -march=pentium -fno-omit-frame-pointer 34 endif 31 35 32 36 ENDIANESS = LE -
uspace/lib/c/arch/ia32/Makefile.inc
r0cf27ee r07b39338 28 28 29 29 ARCH_SOURCES = \ 30 arch/$(UARCH)/src/entry. s\30 arch/$(UARCH)/src/entry.S \ 31 31 arch/$(UARCH)/src/entryjmp.s \ 32 32 arch/$(UARCH)/src/thread_entry.s \ -
uspace/lib/c/arch/ia32/include/types.h
r0cf27ee r07b39338 53 53 typedef int32_t intptr_t; 54 54 typedef uint32_t uintptr_t; 55 typedef int32_t intptr_t; 55 56 typedef uint32_t atomic_count_t; 56 57 typedef int32_t atomic_signed_t; -
uspace/lib/c/arch/ia32/src/entry.S
r0cf27ee r07b39338 46 46 mov %ax, %fs 47 47 # Do not set %gs, it contains descriptor that can see TLS 48 48 49 #ifndef PROCESSOR_i486 49 50 # Detect the mechanism used for making syscalls 50 51 movl $(INTEL_CPUID_STANDARD), %eax … … 55 56 movl $__syscall_fast, (%eax) 56 57 0: 58 #endif 57 59 # 58 60 # Create the first stack frame. -
uspace/lib/c/arch/ia64/include/types.h
r0cf27ee r07b39338 63 63 typedef int64_t intptr_t; 64 64 typedef uint64_t uintptr_t; 65 typedef int64_t intptr_t; 65 66 typedef uint64_t atomic_count_t; 66 67 typedef int64_t atomic_signed_t; -
uspace/lib/c/arch/mips32/include/types.h
r0cf27ee r07b39338 54 54 typedef int32_t intptr_t; 55 55 typedef uint32_t uintptr_t; 56 typedef int32_t intptr_t; 56 57 typedef uint32_t atomic_count_t; 57 58 typedef int32_t atomic_signed_t; -
uspace/lib/c/arch/mips64/include/types.h
r0cf27ee r07b39338 53 53 54 54 typedef uint64_t uintptr_t; 55 typedef int64_t intptr_t; 55 56 typedef uint64_t atomic_count_t; 56 57 typedef int64_t atomic_signed_t; -
uspace/lib/c/arch/ppc32/include/types.h
r0cf27ee r07b39338 53 53 typedef int32_t intptr_t; 54 54 typedef uint32_t uintptr_t; 55 typedef int32_t intptr_t; 55 56 typedef uint32_t atomic_count_t; 56 57 typedef int32_t atomic_signed_t; -
uspace/lib/c/arch/sparc64/include/types.h
r0cf27ee r07b39338 53 53 typedef int64_t intptr_t; 54 54 typedef uint64_t uintptr_t; 55 typedef int64_t intptr_t; 55 56 typedef uint64_t atomic_count_t; 56 57 typedef int64_t atomic_signed_t; -
uspace/lib/c/generic/async.c
r0cf27ee r07b39338 112 112 #include <mem.h> 113 113 #include <stdlib.h> 114 #include <macros.h> 114 115 #include "private/async.h" 115 116 … … 138 139 link_t link; 139 140 140 sysarg_t in_task_hash;141 task_id_t in_task_id; 141 142 atomic_t refcnt; 142 143 void *data; … … 150 151 link_t link; 151 152 152 /** Incoming client task hash. */153 sysarg_t in_task_hash;153 /** Incoming client task ID. */ 154 task_id_t in_task_id; 154 155 155 156 /** Incoming phone hash. */ … … 203 204 } 204 205 205 void *async_get_client_data(void)206 {207 assert(fibril_connection);208 return fibril_connection->client->data;209 }210 211 206 /** Default fibril function that gets called to handle new connection. 212 207 * … … 289 284 { 290 285 assert(key); 286 assert(keys == 2); 291 287 assert(item); 292 288 293 289 client_t *client = hash_table_get_instance(item, client_t, link); 294 return (key[0] == client->in_task_hash); 290 return (key[0] == LOWER32(client->in_task_id) && 291 (key[1] == UPPER32(client->in_task_id))); 295 292 } 296 293 … … 580 577 } 581 578 579 static client_t *async_client_get(task_id_t client_id, bool create) 580 { 581 unsigned long key[2] = { 582 LOWER32(client_id), 583 UPPER32(client_id), 584 }; 585 client_t *client = NULL; 586 587 futex_down(&async_futex); 588 link_t *lnk = hash_table_find(&client_hash_table, key); 589 if (lnk) { 590 client = hash_table_get_instance(lnk, client_t, link); 591 atomic_inc(&client->refcnt); 592 } else if (create) { 593 client = malloc(sizeof(client_t)); 594 if (client) { 595 client->in_task_id = client_id; 596 client->data = async_client_data_create(); 597 598 atomic_set(&client->refcnt, 1); 599 hash_table_insert(&client_hash_table, key, &client->link); 600 } 601 } 602 603 futex_up(&async_futex); 604 return client; 605 } 606 607 static void async_client_put(client_t *client) 608 { 609 bool destroy; 610 unsigned long key[2] = { 611 LOWER32(client->in_task_id), 612 UPPER32(client->in_task_id) 613 }; 614 615 futex_down(&async_futex); 616 617 if (atomic_predec(&client->refcnt) == 0) { 618 hash_table_remove(&client_hash_table, key, 2); 619 destroy = true; 620 } else 621 destroy = false; 622 623 futex_up(&async_futex); 624 625 if (destroy) { 626 if (client->data) 627 async_client_data_destroy(client->data); 628 629 free(client); 630 } 631 } 632 633 void *async_get_client_data(void) 634 { 635 assert(fibril_connection); 636 return fibril_connection->client->data; 637 } 638 639 void *async_get_client_data_by_id(task_id_t client_id) 640 { 641 client_t *client = async_client_get(client_id, false); 642 if (!client) 643 return NULL; 644 if (!client->data) { 645 async_client_put(client); 646 return NULL; 647 } 648 649 return client->data; 650 } 651 652 void async_put_client_data_by_id(task_id_t client_id) 653 { 654 client_t *client = async_client_get(client_id, false); 655 656 assert(client); 657 assert(client->data); 658 659 /* Drop the reference we got in async_get_client_data_by_hash(). */ 660 async_client_put(client); 661 662 /* Drop our own reference we got at the beginning of this function. */ 663 async_client_put(client); 664 } 665 582 666 /** Wrapper for client connection fibril. 583 667 * … … 598 682 */ 599 683 fibril_connection = (connection_t *) arg; 600 601 futex_down(&async_futex);602 684 603 685 /* … … 606 688 * hash in a new tracking structure. 607 689 */ 608 609 unsigned long key = fibril_connection->in_task_hash; 610 link_t *lnk = hash_table_find(&client_hash_table, &key); 611 612 client_t *client; 613 614 if (lnk) { 615 client = hash_table_get_instance(lnk, client_t, link); 616 atomic_inc(&client->refcnt); 617 } else { 618 client = malloc(sizeof(client_t)); 619 if (!client) { 620 ipc_answer_0(fibril_connection->callid, ENOMEM); 621 futex_up(&async_futex); 622 return 0; 623 } 624 625 client->in_task_hash = fibril_connection->in_task_hash; 626 client->data = async_client_data_create(); 627 628 atomic_set(&client->refcnt, 1); 629 hash_table_insert(&client_hash_table, &key, &client->link); 630 } 631 632 futex_up(&async_futex); 633 690 691 client_t *client = async_client_get(fibril_connection->in_task_id, true); 692 if (!client) { 693 ipc_answer_0(fibril_connection->callid, ENOMEM); 694 return 0; 695 } 696 634 697 fibril_connection->client = client; 635 698 … … 643 706 * Remove the reference for this client task connection. 644 707 */ 645 bool destroy; 646 647 futex_down(&async_futex); 648 649 if (atomic_predec(&client->refcnt) == 0) { 650 hash_table_remove(&client_hash_table, &key, 1); 651 destroy = true; 652 } else 653 destroy = false; 654 655 futex_up(&async_futex); 656 657 if (destroy) { 658 if (client->data) 659 async_client_data_destroy(client->data); 660 661 free(client); 662 } 708 async_client_put(client); 663 709 664 710 /* … … 666 712 */ 667 713 futex_down(&async_futex); 668 key = fibril_connection->in_phone_hash;714 unsigned long key = fibril_connection->in_phone_hash; 669 715 hash_table_remove(&conn_hash_table, &key, 1); 670 716 futex_up(&async_futex); … … 700 746 * particular fibrils. 701 747 * 702 * @param in_task_ hashIdentification of the incoming connection.748 * @param in_task_id Identification of the incoming connection. 703 749 * @param in_phone_hash Identification of the incoming connection. 704 750 * @param callid Hash of the opening IPC_M_CONNECT_ME_TO call. … … 714 760 * 715 761 */ 716 fid_t async_new_connection( sysarg_t in_task_hash, sysarg_t in_phone_hash,762 fid_t async_new_connection(task_id_t in_task_id, sysarg_t in_phone_hash, 717 763 ipc_callid_t callid, ipc_call_t *call, 718 764 async_client_conn_t cfibril, void *carg) … … 726 772 } 727 773 728 conn->in_task_ hash = in_task_hash;774 conn->in_task_id = in_task_id; 729 775 conn->in_phone_hash = in_phone_hash; 730 776 list_initialize(&conn->msg_queue); … … 785 831 case IPC_M_CONNECT_ME_TO: 786 832 /* Open new connection with fibril, etc. */ 787 async_new_connection(call->in_task_ hash, IPC_GET_ARG5(*call),833 async_new_connection(call->in_task_id, IPC_GET_ARG5(*call), 788 834 callid, call, client_connection, NULL); 789 835 return; … … 933 979 { 934 980 if (!hash_table_create(&client_hash_table, CLIENT_HASH_TABLE_BUCKETS, 935 1, &client_hash_table_ops))981 2, &client_hash_table_ops)) 936 982 abort(); 937 983 … … 1426 1472 return ENOENT; 1427 1473 1428 sysarg_t task_hash; 1474 task_id_t task_id; 1475 sysarg_t task_id_lo; 1476 sysarg_t task_id_hi; 1429 1477 sysarg_t phone_hash; 1430 1478 int rc = async_req_3_5(exch, IPC_M_CONNECT_TO_ME, arg1, arg2, arg3, 1431 NULL, NULL, NULL, &task_hash, &phone_hash);1479 NULL, NULL, &task_id_lo, &task_id_hi, &phone_hash); 1432 1480 if (rc != EOK) 1433 1481 return rc; 1482 1483 task_id = (task_id_t) MERGE_LOUP32(task_id_lo, task_id_hi); 1434 1484 1435 1485 if (client_receiver != NULL) 1436 async_new_connection(task_ hash, phone_hash, 0, NULL,1486 async_new_connection(task_id, phone_hash, 0, NULL, 1437 1487 client_receiver, carg); 1438 1488 … … 2429 2479 } 2430 2480 2481 int async_state_change_start(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2, 2482 sysarg_t arg3, async_exch_t *other_exch) 2483 { 2484 return async_req_5_0(exch, IPC_M_STATE_CHANGE_AUTHORIZE, 2485 arg1, arg2, arg3, 0, other_exch->phone); 2486 } 2487 2488 bool async_state_change_receive(ipc_callid_t *callid, sysarg_t *arg1, 2489 sysarg_t *arg2, sysarg_t *arg3) 2490 { 2491 assert(callid); 2492 2493 ipc_call_t call; 2494 *callid = async_get_call(&call); 2495 2496 if (IPC_GET_IMETHOD(call) != IPC_M_STATE_CHANGE_AUTHORIZE) 2497 return false; 2498 2499 if (arg1) 2500 *arg1 = IPC_GET_ARG1(call); 2501 if (arg2) 2502 *arg2 = IPC_GET_ARG2(call); 2503 if (arg3) 2504 *arg3 = IPC_GET_ARG3(call); 2505 2506 return true; 2507 } 2508 2509 int async_state_change_finalize(ipc_callid_t callid, async_exch_t *other_exch) 2510 { 2511 return ipc_answer_1(callid, EOK, other_exch->phone); 2512 } 2513 2431 2514 /** @} 2432 2515 */ -
uspace/lib/c/generic/devman.c
r0cf27ee r07b39338 1 1 /* 2 2 * Copyright (c) 2007 Josef Cejka 3 * Copyright (c) 20 09Jiri Svoboda3 * Copyright (c) 2011 Jiri Svoboda 4 4 * Copyright (c) 2010 Lenka Trochtova 5 5 * All rights reserved. … … 195 195 196 196 exch = devman_exchange_begin(DEVMAN_DRIVER); 197 async_connect_to_me(exch, 0, 0, 0, NULL, NULL);197 async_connect_to_me(exch, 0, 0, 0, conn, NULL); 198 198 devman_exchange_end(exch); 199 199 … … 271 271 } 272 272 273 int devman_add_device_to_c lass(devman_handle_t devman_handle,274 const char *c lass_name)273 int devman_add_device_to_category(devman_handle_t devman_handle, 274 const char *cat_name) 275 275 { 276 276 async_exch_t *exch = devman_exchange_begin_blocking(DEVMAN_DRIVER); 277 277 278 278 ipc_call_t answer; 279 aid_t req = async_send_1(exch, DEVMAN_ADD_DEVICE_TO_C LASS,279 aid_t req = async_send_1(exch, DEVMAN_ADD_DEVICE_TO_CATEGORY, 280 280 devman_handle, &answer); 281 sysarg_t retval = async_data_write_start(exch, c lass_name,282 str_size(c lass_name));281 sysarg_t retval = async_data_write_start(exch, cat_name, 282 str_size(cat_name)); 283 283 284 284 devman_exchange_end(exch); … … 308 308 } 309 309 310 /** Remove function from device. 311 * 312 * Request devman to remove function owned by this driver task. 313 * @param funh Devman handle of the function 314 * 315 * @return EOK on success or negative error code. 316 */ 317 int devman_remove_function(devman_handle_t funh) 318 { 319 async_exch_t *exch; 320 sysarg_t retval; 321 322 exch = devman_exchange_begin_blocking(DEVMAN_DRIVER); 323 retval = async_req_1_0(exch, DEVMAN_REMOVE_FUNCTION, (sysarg_t) funh); 324 devman_exchange_end(exch); 325 326 return (int) retval; 327 } 328 310 329 async_sess_t *devman_parent_device_connect(exch_mgmt_t mgmt, 311 330 devman_handle_t handle, unsigned int flags) … … 323 342 } 324 343 325 int devman_ device_get_handle(const char *pathname, devman_handle_t *handle,344 int devman_fun_get_handle(const char *pathname, devman_handle_t *handle, 326 345 unsigned int flags) 327 346 { … … 333 352 exch = devman_exchange_begin(DEVMAN_CLIENT); 334 353 if (exch == NULL) 335 return errno;354 return ENOMEM; 336 355 } 337 356 … … 364 383 } 365 384 366 int devman_device_get_handle_by_class(const char *classname,367 const char *devname, devman_handle_t *handle, unsigned int flags)385 static int devman_get_str_internal(sysarg_t method, sysarg_t arg1, char *buf, 386 size_t buf_size) 368 387 { 369 388 async_exch_t *exch; 370 371 if (flags & IPC_FLAG_BLOCKING) 372 exch = devman_exchange_begin_blocking(DEVMAN_CLIENT); 373 else { 374 exch = devman_exchange_begin(DEVMAN_CLIENT); 375 if (exch == NULL) 376 return errno; 377 } 389 ipc_call_t dreply; 390 size_t act_size; 391 sysarg_t dretval; 392 393 exch = devman_exchange_begin_blocking(LOC_PORT_CONSUMER); 378 394 379 395 ipc_call_t answer; 380 aid_t req = async_send_1(exch, DEVMAN_DEVICE_GET_HANDLE_BY_CLASS, 381 flags, &answer); 382 sysarg_t retval = async_data_write_start(exch, classname, 383 str_size(classname)); 396 aid_t req = async_send_1(exch, method, arg1, &answer); 397 aid_t dreq = async_data_read(exch, buf, buf_size - 1, &dreply); 398 async_wait_for(dreq, &dretval); 399 400 devman_exchange_end(exch); 401 402 if (dretval != EOK) { 403 async_wait_for(req, NULL); 404 return dretval; 405 } 406 407 sysarg_t retval; 408 async_wait_for(req, &retval); 409 410 if (retval != EOK) 411 return retval; 412 413 act_size = IPC_GET_ARG2(dreply); 414 assert(act_size <= buf_size - 1); 415 buf[act_size] = '\0'; 416 417 return EOK; 418 } 419 420 int devman_fun_get_path(devman_handle_t handle, char *buf, size_t buf_size) 421 { 422 return devman_get_str_internal(DEVMAN_FUN_GET_PATH, handle, buf, 423 buf_size); 424 } 425 426 int devman_fun_get_name(devman_handle_t handle, char *buf, size_t buf_size) 427 { 428 return devman_get_str_internal(DEVMAN_FUN_GET_NAME, handle, buf, 429 buf_size); 430 } 431 432 static int devman_get_handles_once(sysarg_t method, sysarg_t arg1, 433 devman_handle_t *handle_buf, size_t buf_size, size_t *act_size) 434 { 435 async_exch_t *exch = devman_exchange_begin_blocking(DEVMAN_CLIENT); 436 437 ipc_call_t answer; 438 aid_t req = async_send_1(exch, method, arg1, &answer); 439 int rc = async_data_read_start(exch, handle_buf, buf_size); 440 441 devman_exchange_end(exch); 442 443 if (rc != EOK) { 444 async_wait_for(req, NULL); 445 return rc; 446 } 447 448 sysarg_t retval; 449 async_wait_for(req, &retval); 384 450 385 451 if (retval != EOK) { 386 devman_exchange_end(exch); 387 async_wait_for(req, NULL); 388 return retval; 389 } 390 391 retval = async_data_write_start(exch, devname, 392 str_size(devname)); 393 394 devman_exchange_end(exch); 395 396 if (retval != EOK) { 397 async_wait_for(req, NULL); 398 return retval; 399 } 400 401 async_wait_for(req, &retval); 402 403 if (retval != EOK) { 404 if (handle != NULL) 405 *handle = (devman_handle_t) -1; 406 407 return retval; 408 } 409 410 if (handle != NULL) 411 *handle = (devman_handle_t) IPC_GET_ARG1(answer); 412 413 return retval; 414 } 415 416 int devman_get_device_path(devman_handle_t handle, char *path, size_t path_size) 452 return retval; 453 } 454 455 *act_size = IPC_GET_ARG1(answer); 456 return EOK; 457 } 458 459 /** Get list of handles. 460 * 461 * Returns an allocated array of handles. 462 * 463 * @param method IPC method 464 * @param arg1 IPC argument 1 465 * @param data Place to store pointer to array of handles 466 * @param count Place to store number of handles 467 * @return EOK on success or negative error code 468 */ 469 static int devman_get_handles_internal(sysarg_t method, sysarg_t arg1, 470 devman_handle_t **data, size_t *count) 471 { 472 devman_handle_t *handles; 473 size_t act_size; 474 size_t alloc_size; 475 int rc; 476 477 *data = NULL; 478 act_size = 0; /* silence warning */ 479 480 rc = devman_get_handles_once(method, arg1, NULL, 0, 481 &act_size); 482 if (rc != EOK) 483 return rc; 484 485 alloc_size = act_size; 486 handles = malloc(alloc_size); 487 if (handles == NULL) 488 return ENOMEM; 489 490 while (true) { 491 rc = devman_get_handles_once(method, arg1, handles, alloc_size, 492 &act_size); 493 if (rc != EOK) 494 return rc; 495 496 if (act_size <= alloc_size) 497 break; 498 499 alloc_size *= 2; 500 free(handles); 501 502 handles = malloc(alloc_size); 503 if (handles == NULL) 504 return ENOMEM; 505 } 506 507 *count = act_size / sizeof(devman_handle_t); 508 *data = handles; 509 return EOK; 510 } 511 512 int devman_fun_get_child(devman_handle_t funh, devman_handle_t *devh) 417 513 { 418 514 async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT); 419 515 if (exch == NULL) 420 return errno;421 422 ipc_call_t answer;423 aid_t req = async_send_1(exch, DEVMAN_DEVICE_GET_DEVICE_PATH,424 handle, &answer);425 426 ipc_call_t data_request_call;427 aid_t data_request = async_data_read(exch, path, path_size,428 &data_request_call);429 430 devman_exchange_end(exch);431 432 if (data_request == 0) {433 async_wait_for(req, NULL);434 516 return ENOMEM; 435 } 436 437 sysarg_t data_request_rc; 438 async_wait_for(data_request, &data_request_rc); 439 440 sysarg_t opening_request_rc; 441 async_wait_for(req, &opening_request_rc); 442 443 if (data_request_rc != EOK) { 444 /* Prefer the return code of the opening request. */ 445 if (opening_request_rc != EOK) 446 return (int) opening_request_rc; 447 else 448 return (int) data_request_rc; 449 } 450 451 if (opening_request_rc != EOK) 452 return (int) opening_request_rc; 453 454 /* To be on the safe-side. */ 455 path[path_size - 1] = 0; 456 size_t transferred_size = IPC_GET_ARG2(data_request_call); 457 if (transferred_size >= path_size) 458 return ELIMIT; 459 460 /* Terminate the string (trailing 0 not send over IPC). */ 461 path[transferred_size] = 0; 462 return EOK; 517 518 sysarg_t retval = async_req_1_1(exch, DEVMAN_FUN_GET_CHILD, 519 funh, devh); 520 521 devman_exchange_end(exch); 522 return (int) retval; 523 } 524 525 int devman_dev_get_functions(devman_handle_t devh, devman_handle_t **funcs, 526 size_t *count) 527 { 528 return devman_get_handles_internal(DEVMAN_DEV_GET_FUNCTIONS, 529 devh, funcs, count); 530 } 531 532 int devman_fun_sid_to_handle(service_id_t sid, devman_handle_t *handle) 533 { 534 async_exch_t *exch = devman_exchange_begin(DEVMAN_CLIENT); 535 if (exch == NULL) 536 return ENOMEM; 537 538 sysarg_t retval = async_req_1_1(exch, DEVMAN_FUN_SID_TO_HANDLE, 539 sid, handle); 540 541 devman_exchange_end(exch); 542 return (int) retval; 463 543 } 464 544 -
uspace/lib/c/generic/event.c
r0cf27ee r07b39338 54 54 } 55 55 56 int event_task_subscribe(event_task_type_t evno, sysarg_t imethod) 57 { 58 return __SYSCALL2(SYS_EVENT_SUBSCRIBE, (sysarg_t) evno, 59 (sysarg_t) imethod); 60 } 61 56 62 /** Unmask event notifications. 57 63 * … … 66 72 } 67 73 74 int event_task_unmask(event_task_type_t evno) 75 { 76 return __SYSCALL1(SYS_EVENT_UNMASK, (sysarg_t) evno); 77 } 78 68 79 /** @} 69 80 */ -
uspace/lib/c/generic/io/io.c
r0cf27ee r07b39338 101 101 static LIST_INITIALIZE(files); 102 102 103 void __stdio_init(int filc , fdi_node_t *filv[])103 void __stdio_init(int filc) 104 104 { 105 105 if (filc > 0) { 106 stdin = f open_node(filv[0], "r");106 stdin = fdopen(0, "r"); 107 107 } else { 108 108 stdin = &stdin_null; … … 111 111 112 112 if (filc > 1) { 113 stdout = f open_node(filv[1], "w");113 stdout = fdopen(1, "w"); 114 114 } else { 115 115 stdout = &stdout_klog; … … 118 118 119 119 if (filc > 2) { 120 stderr = f open_node(filv[2], "w");120 stderr = fdopen(2, "w"); 121 121 } else { 122 122 stderr = &stderr_klog; … … 285 285 } 286 286 287 FILE *fopen_node(fdi_node_t *node, const char *mode)288 {289 int flags;290 if (!parse_mode(mode, &flags))291 return NULL;292 293 /* Open file. */294 FILE *stream = malloc(sizeof(FILE));295 if (stream == NULL) {296 errno = ENOMEM;297 return NULL;298 }299 300 stream->fd = open_node(node, flags);301 if (stream->fd < 0) {302 /* errno was set by open_node() */303 free(stream);304 return NULL;305 }306 307 stream->error = false;308 stream->eof = false;309 stream->klog = false;310 stream->sess = NULL;311 stream->need_sync = false;312 _setvbuf(stream);313 314 list_append(&stream->link, &files);315 316 return stream;317 }318 319 287 int fclose(FILE *stream) 320 288 { … … 780 748 } 781 749 782 int fnode(FILE *stream, fdi_node_t *node) 783 { 784 if (stream->fd >= 0) 785 return fd_node(stream->fd, node); 750 int fhandle(FILE *stream, int *handle) 751 { 752 if (stream->fd >= 0) { 753 *handle = stream->fd; 754 return EOK; 755 } 786 756 787 757 return ENOENT; -
uspace/lib/c/generic/io/printf_core.c
r0cf27ee r07b39338 206 206 } 207 207 208 return (int) (counter + 1);208 return (int) (counter); 209 209 } 210 210 … … 244 244 } 245 245 246 return (int) (counter + 1);246 return (int) (counter); 247 247 } 248 248 -
uspace/lib/c/generic/libc.c
r0cf27ee r07b39338 91 91 argc = 0; 92 92 argv = NULL; 93 __stdio_init(0 , NULL);93 __stdio_init(0); 94 94 } else { 95 95 argc = __pcb->argc; 96 96 argv = __pcb->argv; 97 __stdio_init(__pcb->filc , __pcb->filv);97 __stdio_init(__pcb->filc); 98 98 (void) chdir(__pcb->cwd); 99 99 } -
uspace/lib/c/generic/loader.c
r0cf27ee r07b39338 256 256 * 257 257 */ 258 int loader_set_files(loader_t *ldr, fdi_node_t *const files[]) 259 { 260 /* 261 * Serialize the arguments into a single array. First 262 * compute size of the buffer needed. 263 */ 264 fdi_node_t *const *ap = files; 265 size_t count = 0; 266 while (*ap != NULL) { 267 count++; 268 ap++; 269 } 270 271 fdi_node_t *files_buf; 272 files_buf = (fdi_node_t *) malloc(count * sizeof(fdi_node_t)); 273 if (files_buf == NULL) 274 return ENOMEM; 275 276 /* Fill the buffer */ 277 size_t i; 278 for (i = 0; i < count; i++) 279 files_buf[i] = *files[i]; 280 258 int loader_set_files(loader_t *ldr, int * const files[]) 259 { 281 260 /* Send serialized files to the loader */ 282 261 async_exch_t *exch = async_exchange_begin(ldr->sess); 283 284 ipc_call_t answer; 285 aid_t req = async_send_0(exch, LOADER_SET_FILES, &answer); 286 sysarg_t rc = async_data_write_start(exch, (void *) files_buf, 287 count * sizeof(fdi_node_t)); 288 289 async_exchange_end(exch); 290 free(files_buf); 291 262 async_exch_t *vfs_exch = vfs_exchange_begin(); 263 264 int i; 265 for (i = 0; files[i]; i++); 266 267 ipc_call_t answer; 268 aid_t req = async_send_1(exch, LOADER_SET_FILES, i, &answer); 269 270 sysarg_t rc = EOK; 271 272 for (i = 0; files[i]; i++) { 273 rc = async_state_change_start(exch, VFS_PASS_HANDLE, *files[i], 274 0, vfs_exch); 275 if (rc != EOK) 276 break; 277 } 278 279 vfs_exchange_end(vfs_exch); 280 async_exchange_end(exch); 281 292 282 if (rc != EOK) { 293 283 async_wait_for(req, NULL); -
uspace/lib/c/generic/loc.c
r0cf27ee r07b39338 45 45 static FIBRIL_MUTEX_INITIALIZE(loc_consumer_mutex); 46 46 47 static FIBRIL_MUTEX_INITIALIZE(loc_callback_mutex); 48 static bool loc_callback_created = false; 49 47 50 static async_sess_t *loc_supp_block_sess = NULL; 48 51 static async_sess_t *loc_cons_block_sess = NULL; … … 51 54 static async_sess_t *loc_consumer_sess = NULL; 52 55 56 static loc_cat_change_cb_t cat_change_cb = NULL; 57 58 static void loc_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg) 59 { 60 loc_cat_change_cb_t cb_fun; 61 62 while (true) { 63 ipc_call_t call; 64 ipc_callid_t callid = async_get_call(&call); 65 66 if (!IPC_GET_IMETHOD(call)) { 67 /* TODO: Handle hangup */ 68 return; 69 } 70 71 int retval; 72 73 switch (IPC_GET_IMETHOD(call)) { 74 case LOC_EVENT_CAT_CHANGE: 75 fibril_mutex_lock(&loc_callback_mutex); 76 cb_fun = cat_change_cb; 77 if (cb_fun != NULL) { 78 (*cb_fun)(); 79 } 80 fibril_mutex_unlock(&loc_callback_mutex); 81 retval = 0; 82 break; 83 default: 84 retval = ENOTSUP; 85 } 86 87 async_answer_0(callid, retval); 88 } 89 } 90 91 53 92 static void clone_session(fibril_mutex_t *mtx, async_sess_t *src, 54 93 async_sess_t **dst) … … 60 99 61 100 fibril_mutex_unlock(mtx); 101 } 102 103 static int loc_callback_create(void) 104 { 105 async_exch_t *exch; 106 sysarg_t retval; 107 int rc = EOK; 108 109 fibril_mutex_lock(&loc_callback_mutex); 110 111 if (!loc_callback_created) { 112 exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); 113 114 ipc_call_t answer; 115 aid_t req = async_send_0(exch, LOC_CALLBACK_CREATE, &answer); 116 async_connect_to_me(exch, 0, 0, 0, loc_cb_conn, NULL); 117 loc_exchange_end(exch); 118 119 async_wait_for(req, &retval); 120 if (rc != EOK) 121 goto done; 122 123 if (retval != EOK) { 124 rc = retval; 125 goto done; 126 } 127 128 loc_callback_created = true; 129 } 130 131 rc = EOK; 132 done: 133 fibril_mutex_unlock(&loc_callback_mutex); 134 return rc; 62 135 } 63 136 … … 194 267 } 195 268 196 /** Register new device.197 * 198 * The @p interface is used when forwarding connection to the driver.269 /** Register new service. 270 * 271 * The @p interface is used when forwarding connection to the server. 199 272 * If not 0, the first argument is the interface and the second argument 200 273 * is the service ID. … … 203 276 * the handle (to ensure backward compatibility). 204 277 * 205 * @param fq dn Fully qualified device name.206 * @param[out] handle Handle to the created instance of device.207 * @param interface Interface when forwarding .208 * 209 */ 210 int loc_service_register_with_iface(const char *fq dn,211 service_id_t * handle, sysarg_t interface)278 * @param fqsn Fully qualified service name 279 * @param[out] sid Service ID of new service 280 * @param interface Interface when forwarding 281 * 282 */ 283 int loc_service_register_with_iface(const char *fqsn, 284 service_id_t *sid, sysarg_t interface) 212 285 { 213 286 async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER); … … 216 289 aid_t req = async_send_2(exch, LOC_SERVICE_REGISTER, interface, 0, 217 290 &answer); 218 sysarg_t retval = async_data_write_start(exch, fq dn, str_size(fqdn));291 sysarg_t retval = async_data_write_start(exch, fqsn, str_size(fqsn)); 219 292 220 293 loc_exchange_end(exch); … … 228 301 229 302 if (retval != EOK) { 230 if ( handle!= NULL)231 * handle= -1;232 233 return retval; 234 } 235 236 if ( handle!= NULL)237 * handle= (service_id_t) IPC_GET_ARG1(answer);303 if (sid != NULL) 304 *sid = -1; 305 306 return retval; 307 } 308 309 if (sid != NULL) 310 *sid = (service_id_t) IPC_GET_ARG1(answer); 238 311 239 312 return retval; 240 313 } 241 314 242 /** Register new device. 243 * 244 * @param fqdn Fully qualified device name. 245 * @param handle Output: Handle to the created instance of device. 246 * 247 */ 248 int loc_service_register(const char *fqdn, service_id_t *handle) 249 { 250 return loc_service_register_with_iface(fqdn, handle, 0); 315 /** Register new service. 316 * 317 * @param fqsn Fully qualified service name 318 * @param sid Output: ID of new service 319 * 320 */ 321 int loc_service_register(const char *fqdn, service_id_t *sid) 322 { 323 return loc_service_register_with_iface(fqdn, sid, 0); 324 } 325 326 /** Unregister service. 327 * 328 * @param sid Service ID 329 */ 330 int loc_service_unregister(service_id_t sid) 331 { 332 async_exch_t *exch; 333 sysarg_t retval; 334 335 exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER); 336 retval = async_req_1_0(exch, LOC_SERVICE_UNREGISTER, sid); 337 loc_exchange_end(exch); 338 339 return (int)retval; 251 340 } 252 341 … … 291 380 } 292 381 293 /** Get service name. 294 * 295 * Provided ID of a service, return its name. 296 * 297 * @param svc_id Service ID 382 /** Get object name. 383 * 384 * Provided ID of an object, return its name. 385 * 386 * @param method IPC method 387 * @param id Object ID 298 388 * @param name Place to store pointer to new string. Caller should 299 389 * free it using free(). 300 390 * @return EOK on success or negative error code 301 391 */ 302 int loc_service_get_name(service_id_t svc_id, char **name)392 static int loc_get_name_internal(sysarg_t method, sysarg_t id, char **name) 303 393 { 304 394 async_exch_t *exch; … … 312 402 313 403 ipc_call_t answer; 314 aid_t req = async_send_1(exch, LOC_SERVICE_GET_NAME, svc_id, &answer);404 aid_t req = async_send_1(exch, method, id, &answer); 315 405 aid_t dreq = async_data_read(exch, name_buf, LOC_NAME_MAXLEN, 316 406 &dreply); … … 341 431 } 342 432 433 /** Get category name. 434 * 435 * Provided ID of a service, return its name. 436 * 437 * @param cat_id Category ID 438 * @param name Place to store pointer to new string. Caller should 439 * free it using free(). 440 * @return EOK on success or negative error code 441 */ 442 int loc_category_get_name(category_id_t cat_id, char **name) 443 { 444 return loc_get_name_internal(LOC_CATEGORY_GET_NAME, cat_id, name); 445 } 446 447 /** Get service name. 448 * 449 * Provided ID of a service, return its name. 450 * 451 * @param svc_id Service ID 452 * @param name Place to store pointer to new string. Caller should 453 * free it using free(). 454 * @return EOK on success or negative error code 455 */ 456 int loc_service_get_name(service_id_t svc_id, char **name) 457 { 458 return loc_get_name_internal(LOC_SERVICE_GET_NAME, svc_id, name); 459 } 343 460 344 461 int loc_namespace_get_id(const char *name, service_id_t *handle, … … 749 866 data, count); 750 867 } 868 869 int loc_register_cat_change_cb(loc_cat_change_cb_t cb_fun) 870 { 871 if (loc_callback_create() != EOK) 872 return EIO; 873 874 cat_change_cb = cb_fun; 875 return EOK; 876 } -
uspace/lib/c/generic/private/async.h
r0cf27ee r07b39338 36 36 #define LIBC_PRIVATE_ASYNC_H_ 37 37 38 #include <ipc/common.h> 38 39 #include <adt/list.h> 39 40 #include <fibril.h> -
uspace/lib/c/generic/private/io.h
r0cf27ee r07b39338 36 36 #define LIBC_PRIVATE_IO_H_ 37 37 38 #include <vfs/vfs.h> 39 40 extern void __stdio_init(int filc, fdi_node_t *filv[]); 38 extern void __stdio_init(int); 41 39 extern void __stdio_done(void); 42 40 -
uspace/lib/c/generic/task.c
r0cf27ee r07b39338 46 46 #include <libc.h> 47 47 #include "private/ns.h" 48 #include <vfs/vfs.h> 48 49 49 50 task_id_t task_get_id(void) … … 102 103 { 103 104 /* Send default files */ 104 fdi_node_t *files[4];105 fdi_node_t stdin_node;106 fdi_node_t stdout_node;107 fdi_node_t stderr_node;108 109 if ((stdin != NULL) && (f node(stdin, &stdin_node) == EOK))110 files[0] = & stdin_node;105 int *files[4]; 106 int fd_stdin; 107 int fd_stdout; 108 int fd_stderr; 109 110 if ((stdin != NULL) && (fhandle(stdin, &fd_stdin) == EOK)) 111 files[0] = &fd_stdin; 111 112 else 112 113 files[0] = NULL; 113 114 114 if ((stdout != NULL) && (f node(stdout, &stdout_node) == EOK))115 files[1] = & stdout_node;115 if ((stdout != NULL) && (fhandle(stdout, &fd_stdout) == EOK)) 116 files[1] = &fd_stdout; 116 117 else 117 118 files[1] = NULL; 118 119 119 if ((stderr != NULL) && (f node(stderr, &stderr_node) == EOK))120 files[2] = & stderr_node;120 if ((stderr != NULL) && (fhandle(stderr, &fd_stderr) == EOK)) 121 files[2] = &fd_stderr; 121 122 else 122 123 files[2] = NULL; … … 142 143 */ 143 144 int task_spawnvf(task_id_t *id, const char *path, const char *const args[], 144 fdi_node_t *const files[])145 int *const files[]) 145 146 { 146 147 /* Connect to a program loader. */ -
uspace/lib/c/generic/vfs/vfs.c
r0cf27ee r07b39338 69 69 * 70 70 */ 71 staticasync_exch_t *vfs_exchange_begin(void)71 async_exch_t *vfs_exchange_begin(void) 72 72 { 73 73 fibril_mutex_lock(&vfs_mutex); … … 87 87 * 88 88 */ 89 staticvoid vfs_exchange_end(async_exch_t *exch)89 void vfs_exchange_end(async_exch_t *exch) 90 90 { 91 91 async_exchange_end(exch); … … 329 329 } 330 330 331 int open_node(fdi_node_t *node, int oflag)332 {333 async_exch_t *exch = vfs_exchange_begin();334 335 ipc_call_t answer;336 aid_t req = async_send_4(exch, VFS_IN_OPEN_NODE, node->fs_handle,337 node->service_id, node->index, oflag, &answer);338 339 vfs_exchange_end(exch);340 341 sysarg_t rc;342 async_wait_for(req, &rc);343 344 if (rc != EOK)345 return (int) rc;346 347 return (int) IPC_GET_ARG1(answer);348 }349 350 331 int close(int fildes) 351 332 { … … 819 800 } 820 801 821 int fd_node(int fildes, fdi_node_t *node)822 {823 struct stat stat;824 int rc = fstat(fildes, &stat);825 826 if (rc == EOK) {827 node->fs_handle = stat.fs_handle;828 node->service_id = stat.service_id;829 node->index = stat.index;830 }831 832 return rc;833 }834 835 802 int dup2(int oldfd, int newfd) 836 803 { … … 848 815 } 849 816 817 int fd_wait(void) 818 { 819 async_exch_t *exch = vfs_exchange_begin(); 820 821 sysarg_t ret; 822 sysarg_t rc = async_req_0_1(exch, VFS_IN_WAIT_HANDLE, &ret); 823 824 vfs_exchange_end(exch); 825 826 if (rc == EOK) 827 return (int) ret; 828 829 return (int) rc; 830 } 831 850 832 /** @} 851 833 */ -
uspace/lib/c/include/async.h
r0cf27ee r07b39338 176 176 extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t); 177 177 178 extern fid_t async_new_connection( sysarg_t, sysarg_t, ipc_callid_t,178 extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t, 179 179 ipc_call_t *, async_client_conn_t, void *); 180 180 … … 186 186 extern void async_set_client_data_destructor(async_client_data_dtor_t); 187 187 extern void *async_get_client_data(void); 188 extern void *async_get_client_data_by_id(task_id_t); 189 extern void async_put_client_data_by_id(task_id_t); 188 190 189 191 extern void async_set_client_connection(async_client_conn_t); … … 477 479 extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *); 478 480 481 extern int async_state_change_start(async_exch_t *, sysarg_t, sysarg_t, 482 sysarg_t, async_exch_t *); 483 extern bool async_state_change_receive(ipc_callid_t *, sysarg_t *, sysarg_t *, 484 sysarg_t *); 485 extern int async_state_change_finalize(ipc_callid_t, async_exch_t *); 486 479 487 #endif 480 488 -
uspace/lib/c/include/devman.h
r0cf27ee r07b39338 38 38 39 39 #include <ipc/devman.h> 40 #include <ipc/loc.h> 40 41 #include <async.h> 41 42 #include <bool.h> … … 48 49 extern int devman_add_function(const char *, fun_type_t, match_id_list_t *, 49 50 devman_handle_t, devman_handle_t *); 51 extern int devman_remove_function(devman_handle_t); 50 52 51 53 extern async_sess_t *devman_device_connect(exch_mgmt_t, devman_handle_t, … … 54 56 unsigned int); 55 57 56 extern int devman_ device_get_handle(const char *, devman_handle_t *,58 extern int devman_fun_get_handle(const char *, devman_handle_t *, 57 59 unsigned int); 58 extern int devman_device_get_handle_by_class(const char *, const char *, 59 devman_handle_t *, unsigned int); 60 extern int devman_get_device_path(devman_handle_t, char *, size_t); 60 extern int devman_fun_get_child(devman_handle_t, devman_handle_t *); 61 extern int devman_dev_get_functions(devman_handle_t, devman_handle_t **, 62 size_t *); 63 extern int devman_fun_get_name(devman_handle_t, char *, size_t); 64 extern int devman_fun_get_path(devman_handle_t, char *, size_t); 61 65 62 extern int devman_add_device_to_class(devman_handle_t, const char *); 66 extern int devman_add_device_to_category(devman_handle_t, const char *); 67 extern int devman_fun_sid_to_handle(service_id_t, devman_handle_t *); 63 68 64 69 #endif -
uspace/lib/c/include/event.h
r0cf27ee r07b39338 37 37 38 38 #include <abi/ipc/event.h> 39 #include <libarch/types.h> 39 40 40 41 extern int event_subscribe(event_type_t, sysarg_t); 42 extern int event_task_subscribe(event_task_type_t, sysarg_t); 41 43 extern int event_unmask(event_type_t); 44 extern int event_task_unmask(event_task_type_t); 42 45 43 46 #endif -
uspace/lib/c/include/ipc/common.h
r0cf27ee r07b39338 39 39 #include <abi/ipc/ipc.h> 40 40 #include <atomic.h> 41 #include <task.h> 41 42 42 43 #define IPC_FLAG_BLOCKING 0x01 … … 44 45 typedef struct { 45 46 sysarg_t args[IPC_CALL_LEN]; 46 sysarg_t in_task_hash;47 task_id_t in_task_id; 47 48 sysarg_t in_phone_hash; 48 49 } ipc_call_t; -
uspace/lib/c/include/ipc/devman.h
r0cf27ee r07b39338 138 138 DEVMAN_ADD_FUNCTION, 139 139 DEVMAN_ADD_MATCH_ID, 140 DEVMAN_ADD_DEVICE_TO_C LASS141 140 DEVMAN_ADD_DEVICE_TO_CATEGORY, 141 DEVMAN_REMOVE_FUNCTION 142 142 } driver_to_devman_t; 143 143 … … 149 149 typedef enum { 150 150 DEVMAN_DEVICE_GET_HANDLE = IPC_FIRST_USER_METHOD, 151 DEVMAN_DEVICE_GET_HANDLE_BY_CLASS, 152 DEVMAN_DEVICE_GET_DEVICE_PATH 151 DEVMAN_DEV_GET_FUNCTIONS, 152 DEVMAN_FUN_GET_CHILD, 153 DEVMAN_FUN_GET_NAME, 154 DEVMAN_FUN_GET_PATH, 155 DEVMAN_FUN_SID_TO_HANDLE 153 156 } client_to_devman_t; 154 157 -
uspace/lib/c/include/ipc/loc.h
r0cf27ee r07b39338 57 57 LOC_SERVICE_GET_NAME, 58 58 LOC_NAMESPACE_GET_ID, 59 LOC_CALLBACK_CREATE, 59 60 LOC_CATEGORY_GET_ID, 61 LOC_CATEGORY_GET_NAME, 60 62 LOC_CATEGORY_GET_SVCS, 61 63 LOC_ID_PROBE, … … 68 70 LOC_GET_SERVICES 69 71 } loc_request_t; 72 73 typedef enum { 74 LOC_EVENT_CAT_CHANGE = IPC_FIRST_USER_METHOD 75 } loc_event_t; 70 76 71 77 /** Ports provided by location service. -
uspace/lib/c/include/ipc/vfs.h
r0cf27ee r07b39338 62 62 typedef enum { 63 63 VFS_IN_OPEN = IPC_FIRST_USER_METHOD, 64 VFS_IN_OPEN_NODE,65 64 VFS_IN_READ, 66 65 VFS_IN_WRITE, … … 78 77 VFS_IN_RENAME, 79 78 VFS_IN_STAT, 80 VFS_IN_DUP 79 VFS_IN_DUP, 80 VFS_IN_WAIT_HANDLE, 81 81 } vfs_in_request_t; 82 82 -
uspace/lib/c/include/loader/loader.h
r0cf27ee r07b39338 38 38 39 39 #include <task.h> 40 #include <vfs/vfs.h>41 40 42 41 /** Forward declararion */ … … 50 49 extern int loader_set_pathname(loader_t *, const char *); 51 50 extern int loader_set_args(loader_t *, const char *const[]); 52 extern int loader_set_files(loader_t *, fdi_node_t *const[]);51 extern int loader_set_files(loader_t *, int *const[]); 53 52 extern int loader_load_program(loader_t *); 54 53 extern int loader_run(loader_t *); -
uspace/lib/c/include/loader/pcb.h
r0cf27ee r07b39338 38 38 39 39 #include <sys/types.h> 40 #include <vfs/vfs.h>41 40 42 41 typedef void (*entry_point_t)(void); … … 62 61 63 62 /** Number of preset files. */ 64 int filc; 65 /** Preset files. */ 66 fdi_node_t **filv; 63 unsigned int filc; 67 64 68 65 /* -
uspace/lib/c/include/loc.h
r0cf27ee r07b39338 40 40 #include <bool.h> 41 41 42 typedef void (*loc_cat_change_cb_t)(void); 43 42 44 extern async_exch_t *loc_exchange_begin_blocking(loc_interface_t); 43 45 extern async_exch_t *loc_exchange_begin(loc_interface_t); … … 48 50 extern int loc_service_register_with_iface(const char *, service_id_t *, 49 51 sysarg_t); 52 extern int loc_service_unregister(service_id_t); 50 53 extern int loc_service_add_to_cat(service_id_t, category_id_t); 51 54 … … 73 76 extern size_t loc_get_services(service_id_t, loc_sdesc_t **); 74 77 extern int loc_get_categories(category_id_t **, size_t *); 78 extern int loc_register_cat_change_cb(loc_cat_change_cb_t); 75 79 76 80 -
uspace/lib/c/include/task.h
r0cf27ee r07b39338 37 37 38 38 #include <sys/types.h> 39 #include <vfs/vfs.h>40 39 41 40 typedef uint64_t task_id_t; … … 53 52 extern int task_spawnv(task_id_t *, const char *path, const char *const []); 54 53 extern int task_spawnvf(task_id_t *, const char *path, const char *const [], 55 fdi_node_t *const []);54 int *const []); 56 55 extern int task_spawnl(task_id_t *, const char *path, ...); 57 56 -
uspace/lib/c/include/vfs/vfs.h
r0cf27ee r07b39338 40 40 #include <ipc/loc.h> 41 41 #include <stdio.h> 42 #include <async.h> 42 43 43 /** Libc version of the VFS triplet. 44 * 45 * Unique identification of a file system node 46 * within a file system instance. 47 * 48 */ 49 typedef struct { 50 fs_handle_t fs_handle; 51 service_id_t service_id; 52 fs_index_t index; 53 } fdi_node_t; 44 enum vfs_change_state_type { 45 VFS_PASS_HANDLE 46 }; 54 47 55 48 extern char *absolutize(const char *, size_t *); … … 59 52 extern int unmount(const char *); 60 53 61 extern int open_node(fdi_node_t *, int); 62 extern int fd_node(int, fdi_node_t *); 54 extern int fhandle(FILE *, int *); 63 55 64 extern FILE *fopen_node(fdi_node_t *, const char *); 65 extern int fnode(FILE *, fdi_node_t *); 56 extern int fd_wait(void); 57 58 extern async_exch_t *vfs_exchange_begin(void); 59 extern void vfs_exchange_end(async_exch_t *); 66 60 67 61 #endif
Note:
See TracChangeset
for help on using the changeset viewer.