Changeset a55d5f9f in mainline for uspace


Ignore:
Timestamp:
2007-12-23T21:21:41Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a92da0a
Parents:
654b7db
Message:

Add support for IPC_M_DATA_READ calls.

Location:
uspace/lib/libc
Files:
2 edited

Legend:

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

    r654b7db ra55d5f9f  
    667667}
    668668
     669/** Wrapper for making IPC_M_DATA_READ calls.
     670 *
     671 * @param phoneid       Phone that will be used to contact the receiving side.
     672 * @param dst           Address of the beginning of the destination buffer.
     673 * @param size          Size of the destination buffer.
     674 *
     675 * @return              Zero on success or a negative error code from errno.h.
     676 */
     677int ipc_data_read_send(int phoneid, void *dst, size_t size)
     678{
     679        return ipc_call_sync_2_0(phoneid, IPC_M_DATA_READ, (ipcarg_t) dst,
     680            (ipcarg_t) size);
     681}
     682
     683/** Wrapper for receiving the IPC_M_DATA_READ calls.
     684 *
     685 * This wrapper only makes it more comfortable to receive IPC_M_DATA_READ calls
     686 * so that the user doesn't have to remember the meaning of each IPC argument.
     687 *
     688 * So far, this wrapper is to be used from within a connection fibril.
     689 *
     690 * @param callid        Storage where the hash of the IPC_M_DATA_READ call will
     691 *                      be stored.
     692 * @param size          Storage where the maximum size will be stored.
     693 *
     694 * @return              Non-zero on success, zero on failure.
     695 */
     696int ipc_data_read_receive(ipc_callid_t *callid, size_t *size)
     697{
     698        ipc_call_t data;
     699       
     700        assert(callid);
     701
     702        *callid = async_get_call(&data);
     703        if (IPC_GET_METHOD(data) != IPC_M_DATA_READ)
     704                return 0;
     705        assert(size);
     706        *size = (size_t) IPC_GET_ARG2(data);
     707        return 1;
     708}
     709
     710/** Wrapper for answering the IPC_M_DATA_READ calls.
     711 *
     712 * This wrapper only makes it more comfortable to answer IPC_M_DATA_READ calls
     713 * so that the user doesn't have to remember the meaning of each IPC argument.
     714 *
     715 * @param callid        Hash of the IPC_M_DATA_READ call to answer.
     716 * @param src           Source address for the IPC_M_DATA_READ call.
     717 * @param size          Size for the IPC_M_DATA_READ call. Can be smaller than
     718 *                      the maximum size announced by the sender.
     719 *
     720 * @return              Zero on success or a value from @ref errno.h on failure.
     721 */
     722int ipc_data_read_deliver(ipc_callid_t callid, void *src, size_t size)
     723{
     724        return ipc_answer_2(callid, EOK, (ipcarg_t) src, (ipcarg_t) size);
     725}
     726
    669727/** Wrapper for making IPC_M_DATA_WRITE calls.
    670728 *
     
    724782 * @return              Zero on success or a value from @ref errno.h on failure.
    725783 */
    726 ipcarg_t ipc_data_write_deliver(ipc_callid_t callid, void *dst, size_t size)
     784int ipc_data_write_deliver(ipc_callid_t callid, void *dst, size_t size)
    727785{
    728786        return ipc_answer_3(callid, EOK, (ipcarg_t) dst, 0, (ipcarg_t) size);
  • uspace/lib/libc/include/ipc/ipc.h

    r654b7db ra55d5f9f  
    261261extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method,
    262262    ipcarg_t arg1, ipcarg_t arg2, int mode);
     263
     264
     265extern int ipc_data_read_send(int phoneid, void *dst, size_t size);
     266extern int ipc_data_read_receive(ipc_callid_t *callid, size_t *size);
     267extern int ipc_data_read_deliver(ipc_callid_t callid, void *src, size_t size);
    263268extern int ipc_data_write_send(int phoneid, void *src, size_t size);
    264269extern int ipc_data_write_receive(ipc_callid_t *callid, void **dst,
    265270    size_t *size);
    266 extern ipcarg_t ipc_data_write_deliver(ipc_callid_t callid, void *dst,
    267     size_t size);
     271extern int ipc_data_write_deliver(ipc_callid_t callid, void *dst, size_t size);
    268272
    269273#endif
Note: See TracChangeset for help on using the changeset viewer.