Changeset 27d293a in mainline for uspace/lib/libc/generic/ipc.c
- Timestamp:
- 2007-12-31T16:46:43Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 215e375
- Parents:
- 3115355
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/ipc.c
r3115355 r27d293a 667 667 } 668 668 669 /** Wrapper for making IPC_M_SHARE_IN calls. 670 * 671 * @param phoneid Phone that will be used to contact the receiving side. 672 * @param dst Destination address space area base. 673 * @param size Size of the destination address space area. 674 * @param arg User defined argument. 675 * @param flags Storage where the received flags will be stored. Can be 676 * NULL. 677 * 678 * @return Zero on success or a negative error code from errno.h. 679 */ 680 int ipc_share_in_send(int phoneid, void *dst, size_t size, ipcarg_t arg, 681 int *flags) 682 { 683 int res; 684 sysarg_t tmp_flags; 685 res = ipc_call_sync_3_2(phoneid, IPC_M_SHARE_IN, (ipcarg_t) dst, 686 (ipcarg_t) size, arg, NULL, &tmp_flags); 687 if (flags) 688 *flags = tmp_flags; 689 return res; 690 } 691 692 /** Wrapper for receiving the IPC_M_SHARE_IN calls. 693 * 694 * This wrapper only makes it more comfortable to receive IPC_M_SHARE_IN calls 695 * so that the user doesn't have to remember the meaning of each IPC argument. 696 * 697 * So far, this wrapper is to be used from within a connection fibril. 698 * 699 * @param callid Storage where the hash of the IPC_M_SHARE_IN call will 700 * be stored. 701 * @param size Destination address space area size. 702 * 703 * @return Non-zero on success, zero on failure. 704 */ 705 int ipc_share_in_receive(ipc_callid_t *callid, size_t *size) 706 { 707 ipc_call_t data; 708 709 assert(callid); 710 assert(size); 711 712 *callid = async_get_call(&data); 713 if (IPC_GET_METHOD(data) != IPC_M_SHARE_IN) 714 return 0; 715 *size = (size_t) IPC_GET_ARG2(data); 716 return 1; 717 } 718 719 /** Wrapper for answering the IPC_M_SHARE_IN calls. 720 * 721 * This wrapper only makes it more comfortable to answer IPC_M_DATA_READ calls 722 * so that the user doesn't have to remember the meaning of each IPC argument. 723 * 724 * @param callid Hash of the IPC_M_DATA_READ call to answer. 725 * @param src Source address space base. 726 * @param flags Flags to be used for sharing. Bits can be only cleared. 727 * 728 * @return Zero on success or a value from @ref errno.h on failure. 729 */ 730 int ipc_share_in_deliver(ipc_callid_t callid, void *src, int flags) 731 { 732 return ipc_answer_2(callid, EOK, (ipcarg_t) src, (ipcarg_t) flags); 733 } 734 735 /** Wrapper for making IPC_M_SHARE_OUT calls. 736 * 737 * @param phoneid Phone that will be used to contact the receiving side. 738 * @param src Source address space area base address. 739 * @param flags Flags to be used for sharing. Bits can be only cleared. 740 * 741 * @return Zero on success or a negative error code from errno.h. 742 */ 743 int ipc_share_out_send(int phoneid, void *src, int flags) 744 { 745 return ipc_call_sync_3_0(phoneid, IPC_M_SHARE_OUT, (ipcarg_t) src, 0, 746 (ipcarg_t) flags); 747 } 748 749 /** Wrapper for receiving the IPC_M_SHARE_OUT calls. 750 * 751 * This wrapper only makes it more comfortable to receive IPC_M_SHARE_OUT calls 752 * so that the user doesn't have to remember the meaning of each IPC argument. 753 * 754 * So far, this wrapper is to be used from within a connection fibril. 755 * 756 * @param callid Storage where the hash of the IPC_M_SHARE_OUT call will 757 * be stored. 758 * @param size Storage where the source address space area size will be 759 * stored. 760 * @param flags Storage where the sharing flags will be stored. 761 * 762 * @return Non-zero on success, zero on failure. 763 */ 764 int ipc_share_out_receive(ipc_callid_t *callid, size_t *size, int *flags) 765 { 766 ipc_call_t data; 767 768 assert(callid); 769 assert(size); 770 assert(flags); 771 772 *callid = async_get_call(&data); 773 if (IPC_GET_METHOD(data) != IPC_M_DATA_WRITE) 774 return 0; 775 *size = (size_t) IPC_GET_ARG2(data); 776 *flags = (int) IPC_GET_ARG3(data); 777 return 1; 778 } 779 780 /** Wrapper for answering the IPC_M_SHARE_OUT calls. 781 * 782 * This wrapper only makes it more comfortable to answer IPC_M_SHARE_OUT calls 783 * so that the user doesn't have to remember the meaning of each IPC argument. 784 * 785 * @param callid Hash of the IPC_M_DATA_WRITE call to answer. 786 * @param dst Destination address space area base address. 787 * 788 * @return Zero on success or a value from @ref errno.h on failure. 789 */ 790 int ipc_share_out_deliver(ipc_callid_t callid, void *dst) 791 { 792 return ipc_answer_1(callid, EOK, (ipcarg_t) dst); 793 } 794 795 669 796 /** Wrapper for making IPC_M_DATA_READ calls. 670 797 *
Note:
See TracChangeset
for help on using the changeset viewer.