Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/ipc.c

    rba8f8cb rd9c8c81  
    565565}
    566566
    567 /** Interrupt one thread of this task from waiting for IPC. */
    568 void ipc_poke(void)
    569 {
    570         __SYSCALL0(SYS_IPC_POKE);
    571 }
    572 
    573567/** Ask destination to do a callback connection.
    574568 *
     
    730724        int res;
    731725        sysarg_t tmp_flags;
    732         res = ipc_call_sync_3_2(phoneid, IPC_M_SHARE_IN, (ipcarg_t) dst,
     726        res = async_req_3_2(phoneid, IPC_M_SHARE_IN, (ipcarg_t) dst,
    733727            (ipcarg_t) size, arg, NULL, &tmp_flags);
    734728        if (flags)
     
    737731}
    738732
     733/** Wrapper for receiving the IPC_M_SHARE_IN calls.
     734 *
     735 * This wrapper only makes it more comfortable to receive IPC_M_SHARE_IN calls
     736 * so that the user doesn't have to remember the meaning of each IPC argument.
     737 *
     738 * So far, this wrapper is to be used from within a connection fibril.
     739 *
     740 * @param callid        Storage where the hash of the IPC_M_SHARE_IN call will
     741 *                      be stored.
     742 * @param size          Destination address space area size.   
     743 *
     744 * @return              Non-zero on success, zero on failure.
     745 */
     746int ipc_share_in_receive(ipc_callid_t *callid, size_t *size)
     747{
     748        ipc_call_t data;
     749       
     750        assert(callid);
     751        assert(size);
     752
     753        *callid = async_get_call(&data);
     754        if (IPC_GET_METHOD(data) != IPC_M_SHARE_IN)
     755                return 0;
     756        *size = (size_t) IPC_GET_ARG2(data);
     757        return 1;
     758}
     759
    739760/** Wrapper for answering the IPC_M_SHARE_IN calls.
    740761 *
     
    763784int ipc_share_out_start(int phoneid, void *src, int flags)
    764785{
    765         return ipc_call_sync_3_0(phoneid, IPC_M_SHARE_OUT, (ipcarg_t) src, 0,
     786        return async_req_3_0(phoneid, IPC_M_SHARE_OUT, (ipcarg_t) src, 0,
    766787            (ipcarg_t) flags);
     788}
     789
     790/** Wrapper for receiving the IPC_M_SHARE_OUT calls.
     791 *
     792 * This wrapper only makes it more comfortable to receive IPC_M_SHARE_OUT calls
     793 * so that the user doesn't have to remember the meaning of each IPC argument.
     794 *
     795 * So far, this wrapper is to be used from within a connection fibril.
     796 *
     797 * @param callid        Storage where the hash of the IPC_M_SHARE_OUT call will
     798 *                      be stored.
     799 * @param size          Storage where the source address space area size will be
     800 *                      stored.
     801 * @param flags         Storage where the sharing flags will be stored.
     802 *
     803 * @return              Non-zero on success, zero on failure.
     804 */
     805int ipc_share_out_receive(ipc_callid_t *callid, size_t *size, int *flags)
     806{
     807        ipc_call_t data;
     808       
     809        assert(callid);
     810        assert(size);
     811        assert(flags);
     812
     813        *callid = async_get_call(&data);
     814        if (IPC_GET_METHOD(data) != IPC_M_SHARE_OUT)
     815                return 0;
     816        *size = (size_t) IPC_GET_ARG2(data);
     817        *flags = (int) IPC_GET_ARG3(data);
     818        return 1;
    767819}
    768820
     
    793845int ipc_data_read_start(int phoneid, void *dst, size_t size)
    794846{
    795         return ipc_call_sync_2_0(phoneid, IPC_M_DATA_READ, (ipcarg_t) dst,
     847        return async_req_2_0(phoneid, IPC_M_DATA_READ, (ipcarg_t) dst,
    796848            (ipcarg_t) size);
     849}
     850
     851/** Wrapper for receiving the IPC_M_DATA_READ calls.
     852 *
     853 * This wrapper only makes it more comfortable to receive IPC_M_DATA_READ calls
     854 * so that the user doesn't have to remember the meaning of each IPC argument.
     855 *
     856 * So far, this wrapper is to be used from within a connection fibril.
     857 *
     858 * @param callid        Storage where the hash of the IPC_M_DATA_READ call will
     859 *                      be stored.
     860 * @param size          Storage where the maximum size will be stored. Can be
     861 *                      NULL.
     862 *
     863 * @return              Non-zero on success, zero on failure.
     864 */
     865int ipc_data_read_receive(ipc_callid_t *callid, size_t *size)
     866{
     867        ipc_call_t data;
     868       
     869        assert(callid);
     870
     871        *callid = async_get_call(&data);
     872        if (IPC_GET_METHOD(data) != IPC_M_DATA_READ)
     873                return 0;
     874        if (size)
     875                *size = (size_t) IPC_GET_ARG2(data);
     876        return 1;
    797877}
    798878
     
    824904int ipc_data_write_start(int phoneid, const void *src, size_t size)
    825905{
    826         return ipc_call_sync_2_0(phoneid, IPC_M_DATA_WRITE, (ipcarg_t) src,
     906        return async_req_2_0(phoneid, IPC_M_DATA_WRITE, (ipcarg_t) src,
    827907            (ipcarg_t) size);
     908}
     909
     910/** Wrapper for receiving the IPC_M_DATA_WRITE calls.
     911 *
     912 * This wrapper only makes it more comfortable to receive IPC_M_DATA_WRITE calls
     913 * so that the user doesn't have to remember the meaning of each IPC argument.
     914 *
     915 * So far, this wrapper is to be used from within a connection fibril.
     916 *
     917 * @param callid        Storage where the hash of the IPC_M_DATA_WRITE call will
     918 *                      be stored.
     919 * @param size          Storage where the suggested size will be stored. May be
     920 *                      NULL
     921 *
     922 * @return              Non-zero on success, zero on failure.
     923 */
     924int ipc_data_write_receive(ipc_callid_t *callid, size_t *size)
     925{
     926        ipc_call_t data;
     927       
     928        assert(callid);
     929
     930        *callid = async_get_call(&data);
     931        if (IPC_GET_METHOD(data) != IPC_M_DATA_WRITE)
     932                return 0;
     933        if (size)
     934                *size = (size_t) IPC_GET_ARG2(data);
     935        return 1;
    828936}
    829937
Note: See TracChangeset for help on using the changeset viewer.