IPC
[generic]

HelenOS uspace IPC. More...


Files

file  adb.h
 ADB device interface.
file  bd.h
file  char.h
 Character device interface.
file  clipboard.h
file  common.h
file  console.h
file  fb.h
file  ipc.c
file  ipc.h
file  irc.h
file  loader.h
file  net.h
 Networking common message definitions.
file  ns.h
file  services.h
 List of all known services and their codes.
file  vfs.h

Data Structures

struct  async_call_t
 Structures of this type are used for keeping track of sent asynchronous calls and queing unsent calls. More...
struct  ipc_call_t
struct  vfs_info_t
 A structure like this is passed to VFS by each individual FS upon its registration. More...

Networking specific message arguments definitions

#define IPC_GET_COUNT(call)   ((size_t) IPC_GET_ARG2(call))
 Return the count message argument.
#define IPC_GET_DEVICE(call)   ((device_id_t) IPC_GET_ARG1(call))
 Return the device identifier message argument.
#define IPC_GET_ERROR(call)   ((services_t) IPC_GET_ARG4(call))
 Return the error service message argument.
#define IPC_GET_MTU(call)   ((size_t) IPC_GET_ARG2(call))
 Return the maximum transmission unit message argument.
#define IPC_GET_PACKET(call)   ((packet_id_t) IPC_GET_ARG2(call))
 Return the packet identifier message argument.
#define IPC_GET_PHONE(call)   ((int) IPC_GET_ARG5(call))
 Return the phone message argument.
#define IPC_GET_SENDER(call)   ((services_t) IPC_GET_ARG3(call))
 Return the sender service message argument.
#define IPC_GET_SERVICE(call)   ((services_t) IPC_GET_ARG3(call))
 Return the device driver service message argument.
#define IPC_GET_STATE(call)   ((device_state_t) IPC_GET_ARG2(call))
 Return the device state message argument.
#define IPC_GET_TARGET(call)   ((services_t) IPC_GET_ARG3(call))
 Return the target service message argument.
#define IPC_SET_ADDR(answer, value)   IPC_SET_ARG1(answer, (sysarg_t) (value))
 Set the minimum address length in the message answer.
#define IPC_SET_CONTENT(answer, value)   IPC_SET_ARG3(answer, (sysarg_t) (value))
 Set the maximum content size in the message answer.
#define IPC_SET_DEVICE(answer, value)   IPC_SET_ARG1(answer, (sysarg_t) (value))
 Set the device identifier in the message answer.
#define IPC_SET_PREFIX(answer, value)   IPC_SET_ARG2(answer, (sysarg_t) (value))
 Set the minimum prefix size in the message answer.
#define IPC_SET_SUFFIX(answer, value)   IPC_SET_ARG4(answer, (sysarg_t) (value))
 Set the minimum suffix size in the message answer.

Networking message intervals

#define IS_NET_ARP_MESSAGE(call)   IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ARP_FIRST, NET_ARP_LAST)
 Check if the IPC call is an ARP message.
#define IS_NET_ETH_MESSAGE(call)   IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ETH_FIRST, NET_ETH_LAST)
 Check if the IPC call is an Ethernet message.
#define IS_NET_ICMP_MESSAGE(call)   IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ICMP_FIRST, NET_ICMP_LAST)
 Check if the IPC call is an ICMP message.
#define IS_NET_IL_MESSAGE(call)   IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_IL_FIRST, NET_IL_LAST)
 Check if the IPC call is an inter-network layer message.
#define IS_NET_IP_MESSAGE(call)   IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_IP_FIRST, NET_IP_LAST)
 Check if the IPC call is an IP message.
#define IS_NET_MESSAGE(call)   IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_FIRST, NET_LAST)
 Check if the IPC call is a generic networking message.
#define IS_NET_NET_MESSAGE(call)   IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_NET_FIRST, NET_NET_LAST)
 Check if the IPC call is a generic networking message.
#define IS_NET_NIL_MESSAGE(call)   IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_NIL_FIRST, NET_NIL_LAST)
 Check if the IPC call is a network interface layer message.
#define IS_NET_PACKET_MESSAGE(call)   IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_PACKET_FIRST, NET_PACKET_LAST)
 Check if the IPC call is a packet manaagement system message.
#define IS_NET_SOCKET_MESSAGE(call)   IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_SOCKET_FIRST, NET_SOCKET_LAST)
 Check if the IPC call is a socket message.
#define IS_NET_TCP_MESSAGE(call)   IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_TCP_FIRST, NET_TCP_LAST)
 Check if the IPC call is a TCP message.
#define IS_NET_TL_MESSAGE(call)   IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_TL_FIRST, NET_TL_LAST)
 Check if the IPC call is a transport layer message.
#define IS_NET_UDP_MESSAGE(call)   IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_UDP_FIRST, NET_UDP_LAST)
 Check if the IPC call is a UDP message.
#define NET_ARP_FIRST   (NET_IP_LAST + 0)
 First ARP message.
#define NET_ARP_LAST   (NET_ARP_FIRST + NET_ARP_COUNT)
 Last ARP message.
#define NET_COUNT   (NET_LAST - NET_FIRST)
 Number of networking messages.
#define NET_ETH_FIRST   (NET_NIL_LAST + 0)
 First Ethernet message.
#define NET_ETH_LAST   (NET_ETH_FIRST + NET_ETH_COUNT)
 Last Ethernet message.
#define NET_FIRST   2000
 First networking message.
#define NET_ICMP_FIRST   (NET_ARP_LAST + 0)
 First ICMP message.
#define NET_ICMP_LAST   (NET_ICMP_FIRST + NET_ICMP_COUNT)
 Last ICMP message.
#define NET_IL_FIRST   (NET_ETH_LAST + 0)
 First inter-network message.
#define NET_IL_LAST   (NET_IL_FIRST + NET_IL_COUNT)
 Last inter-network message.
#define NET_IP_FIRST   (NET_IL_LAST + 0)
 First IP message.
#define NET_IP_LAST   (NET_IP_FIRST + NET_IP_COUNT)
 Last IP message.
#define NET_LAST   NET_PACKET_LAST
 Last networking message.
#define NET_NET_FIRST   (NET_NETIF_LAST + 0)
 First general networking message.
#define NET_NET_LAST   (NET_NET_FIRST + NET_NET_COUNT)
 Last general networking message.
#define NET_NETIF_FIRST   NET_FIRST
 First network interface layer message.
#define NET_NETIF_LAST   (NET_NETIF_FIRST + NET_NETIF_COUNT)
 Last network interface layer message.
#define NET_NIL_FIRST   (NET_NET_LAST + 0)
 First network interface layer message.
#define NET_NIL_LAST   (NET_NIL_FIRST + NET_NIL_COUNT)
 Last network interface layer message.
#define NET_PACKET_FIRST   (NET_SOCKET_LAST + 0)
 First packet management system message.
#define NET_PACKET_LAST   (NET_PACKET_FIRST + NET_PACKET_COUNT)
 Last packet management system message.
#define NET_SOCKET_FIRST   (NET_TCP_LAST + 0)
 First socket message.
#define NET_SOCKET_LAST   (NET_SOCKET_FIRST + NET_SOCKET_COUNT)
 Last socket message.
#define NET_TCP_FIRST   (NET_UDP_LAST + 0)
 First TCP message.
#define NET_TCP_LAST   (NET_TCP_FIRST + NET_TCP_COUNT)
 Last TCP message.
#define NET_TL_FIRST   (NET_ICMP_LAST + 0)
 First ICMP message.
#define NET_TL_LAST   (NET_TL_FIRST + NET_TL_COUNT)
 Last ICMP message.
#define NET_UDP_FIRST   (NET_TL_LAST + 0)
 First UDP message.
#define NET_UDP_LAST   (NET_UDP_FIRST + NET_UDP_COUNT)
 Last UDP message.

Networking message counts

#define NET_ARP_COUNT   5
 Number of ARP messages.
#define NET_ETH_COUNT   0
 Number of Ethernet messages.
#define NET_ICMP_COUNT   6
 Number of ICMP messages.
#define NET_IL_COUNT   6
 Number of inter-network messages.
#define NET_IP_COUNT   4
 Number of IP messages.
#define NET_NET_COUNT   3
 Number of general networking messages.
#define NET_NETIF_COUNT   6
 Number of network interface driver messages.
#define NET_NIL_COUNT   7
 Number of network interface layer messages.
#define NET_PACKET_COUNT   5
 Number of packet management system messages.
#define NET_SOCKET_COUNT   14
 Number of socket messages.
#define NET_TCP_COUNT   0
 Number of TCP messages.
#define NET_TL_COUNT   1
 Number of transport layer messages.
#define NET_UDP_COUNT   0
 Number of UDP messages.

Defines

#define FS_NAME_MAXLEN   20
#define ipc_answer_0(callid, retval)   ipc_answer_fast((callid), (retval), 0, 0, 0, 0)
#define ipc_answer_1(callid, retval, arg1)   ipc_answer_fast((callid), (retval), (arg1), 0, 0, 0)
#define ipc_answer_2(callid, retval, arg1, arg2)   ipc_answer_fast((callid), (retval), (arg1), (arg2), 0, 0)
#define ipc_answer_3(callid, retval, arg1, arg2, arg3)   ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), 0)
#define ipc_answer_4(callid, retval, arg1, arg2, arg3, arg4)   ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), (arg4))
#define ipc_answer_5(callid, retval, arg1, arg2, arg3, arg4, arg5)   ipc_answer_slow((callid), (retval), (arg1), (arg2), (arg3), (arg4), (arg5))
#define ipc_call_async_0(phoneid, method, private, callback, can_preempt)
#define ipc_call_async_1(phoneid, method, arg1, private, callback, can_preempt)
#define ipc_call_async_2(phoneid, method, arg1, arg2, private, callback, can_preempt)
#define ipc_call_async_3(phoneid, method, arg1, arg2, arg3, private, callback, can_preempt)
#define ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, private, callback, can_preempt)
#define ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, private, callback, can_preempt)
#define ipc_call_sync_0_0(phoneid, method)   ipc_call_sync_fast((phoneid), (method), 0, 0, 0, 0, 0, 0, 0, 0)
#define ipc_call_sync_0_1(phoneid, method, res1)   ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), 0, 0, 0, 0)
#define ipc_call_sync_0_2(phoneid, method, res1, res2)   ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), 0, 0, 0)
#define ipc_call_sync_0_3(phoneid, method, res1, res2, res3)
#define ipc_call_sync_0_4(phoneid, method, res1, res2, res3, res4)
#define ipc_call_sync_0_5(phoneid, method, res1, res2, res3, res4, res5)
#define ipc_call_sync_1_0(phoneid, method, arg1)   ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, 0, 0, 0, 0, 0)
#define ipc_call_sync_1_1(phoneid, method, arg1, res1)   ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), 0, 0, 0, 0)
#define ipc_call_sync_1_2(phoneid, method, arg1, res1, res2)
#define ipc_call_sync_1_3(phoneid, method, arg1, res1, res2, res3)
#define ipc_call_sync_1_4(phoneid, method, arg1, res1, res2, res3, res4)
#define ipc_call_sync_1_5(phoneid, method, arg1, res1, res2, res3, res4, res5)
#define ipc_call_sync_2_0(phoneid, method, arg1, arg2)
#define ipc_call_sync_2_1(phoneid, method, arg1, arg2, res1)
#define ipc_call_sync_2_2(phoneid, method, arg1, arg2, res1, res2)
#define ipc_call_sync_2_3(phoneid, method, arg1, arg2, res1, res2, res3)
#define ipc_call_sync_2_4(phoneid, method, arg1, arg2, res1, res2, res3, res4)
#define ipc_call_sync_2_5(phoneid, method, arg1, arg2, res1, res2, res3, res4, res5)
#define ipc_call_sync_3_0(phoneid, method, arg1, arg2, arg3)
#define ipc_call_sync_3_1(phoneid, method, arg1, arg2, arg3, res1)
#define ipc_call_sync_3_2(phoneid, method, arg1, arg2, arg3, res1, res2)
#define ipc_call_sync_3_3(phoneid, method, arg1, arg2, arg3, res1, res2, res3)
#define ipc_call_sync_3_4(phoneid, method, arg1, arg2, arg3, res1, res2, res3, res4)
#define ipc_call_sync_3_5(phoneid, method, arg1, arg2, arg3, res1, res2, res3, res4, res5)
#define ipc_call_sync_4_0(phoneid, method, arg1, arg2, arg3, arg4)
#define ipc_call_sync_4_1(phoneid, method, arg1, arg2, arg3, arg4, res1)
#define ipc_call_sync_4_2(phoneid, method, arg1, arg2, arg3, arg4, res1, res2)
#define ipc_call_sync_4_3(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, res3)
#define ipc_call_sync_4_4(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, res3, res4)
#define ipc_call_sync_4_5(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, res3, res4, res5)
#define ipc_call_sync_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5)
#define ipc_call_sync_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1)
#define ipc_call_sync_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, res2)
#define ipc_call_sync_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, res2, res3)
#define ipc_call_sync_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, res2, res3, res4)
#define ipc_call_sync_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, res2, res3, res4, res5)
#define IPC_FLAG_BLOCKING   0x01
#define ipc_share_in_start_0_0(phoneid, dst, size)   ipc_share_in_start((phoneid), (dst), (size), 0, NULL)
#define ipc_share_in_start_0_1(phoneid, dst, size, flags)   ipc_share_in_start((phoneid), (dst), (size), 0, (flags))
#define ipc_share_in_start_1_0(phoneid, dst, size, arg)   ipc_share_in_start((phoneid), (dst), (size), (arg), NULL)
#define ipc_share_in_start_1_1(phoneid, dst, size, arg, flags)   ipc_share_in_start((phoneid), (dst), (size), (arg), (flags))
#define ipc_wait_for_call(data)   ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT);
#define IS_IN_INTERVAL(item, first_inclusive, last_exclusive)   (((item) >= (first_inclusive)) && ((item) < (last_exclusive)))
 Return a value indicating whether the value is in the interval.
#define L_CREATE   32
 L_CREATE is used for creating both regular files and directories.
#define L_DIRECTORY   2
 Lookup will succeed only if the object is a directory.
#define L_EXCLUSIVE   16
 When used with L_CREATE, L_EXCLUSIVE will cause the lookup to fail if the object already exists.
#define L_FILE   1
 Lookup will succeed only if the object is a regular file.
#define L_LINK   64
 L_LINK is used for linking to an already existing nodes.
#define L_MP   8
 Lookup will succeed only if the object is a mount point.
#define L_NONE   0
 No lookup flags used.
#define L_OPEN   256
 L_OPEN is used to indicate that the lookup operation is a part of VFS_IN_OPEN call from the client.
#define L_ROOT   4
 Lookup will succeed only if the object is a root directory.
#define L_UNLINK   128
 L_UNLINK is used to remove leaves from the file system namespace.
#define MAX_PATH_LEN   (64 * 1024)
#define PLB_SIZE   (2 * MAX_PATH_LEN)

Typedefs

typedef int16_t fs_handle_t
typedef uint32_t fs_index_t
typedef void(*) ipc_async_callback_t (void *, int, ipc_call_t *)
typedef sysarg_t ipc_callid_t

Enumerations

enum  
enum  adb_notif_t
enum  adb_request_t
enum  bd_request_t
enum  char_notif_t
enum  char_request_t
enum  clipboard_request_t
enum  clipboard_tag_t
enum  console_request_t
enum  fb_request_t
enum  irc_request_t
enum  loader_request_t
enum  ns_request_t
enum  services_t
enum  vfs_in_request_t
enum  vfs_out_request_t

Functions

static void dispatch_queued_calls (void)
 Try to dispatch queued calls from the async queue.
static void handle_answer (ipc_callid_t callid, ipc_call_t *data)
 Handle received answer.
sysarg_t ipc_answer_fast (ipc_callid_t callid, sysarg_t retval, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
 Answer received call (fast version).
sysarg_t ipc_answer_slow (ipc_callid_t callid, sysarg_t retval, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
 Answer received call (entire payload).
void ipc_call_async_fast (int phoneid, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, void *private, ipc_async_callback_t callback, bool can_preempt)
 Fast asynchronous call.
static ipc_callid_t ipc_call_async_internal (int phoneid, ipc_call_t *data)
 Send asynchronous message via syscall.
void ipc_call_async_slow (int phoneid, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, void *private, ipc_async_callback_t callback, bool can_preempt)
 Asynchronous call transmitting the entire payload.
int ipc_call_sync_fast (int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t *result1, sysarg_t *result2, sysarg_t *result3, sysarg_t *result4, sysarg_t *result5)
 Fast synchronous call.
int ipc_call_sync_slow (int phoneid, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *result1, sysarg_t *result2, sysarg_t *result3, sysarg_t *result4, sysarg_t *result5)
 Synchronous call transmitting 5 arguments of payload.
int ipc_connect_kbox (task_id_t id)
 Connect to a task specified by id.
int ipc_connect_me_to (int phoneid, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)
 Request new connection.
int ipc_connect_me_to_blocking (int phoneid, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)
 Request new connection (blocking).
int ipc_connect_to_me (int phoneid, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t *taskhash, sysarg_t *phonehash)
 Request callback connection.
int ipc_data_read_finalize (ipc_callid_t callid, const void *src, size_t size)
 Wrapper for answering the IPC_M_DATA_READ calls.
int ipc_data_read_start (int phoneid, void *dst, size_t size)
 Wrapper for IPC_M_DATA_READ calls.
int ipc_data_write_finalize (ipc_callid_t callid, void *dst, size_t size)
 Wrapper for answering the IPC_M_DATA_WRITE calls.
int ipc_data_write_start (int phoneid, const void *src, size_t size)
 Wrapper for IPC_M_DATA_WRITE calls.
static void ipc_finish_async (ipc_callid_t callid, int phoneid, async_call_t *call, bool can_preempt)
 Epilog for ipc_call_async_*() functions.
int ipc_forward_fast (ipc_callid_t callid, int phoneid, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
 Forward a received call to another destination.
int ipc_forward_slow (ipc_callid_t callid, int phoneid, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, unsigned int mode)
int ipc_hangup (int phoneid)
 Hang up a phone.
void ipc_poke (void)
 Interrupt one thread of this task from waiting for IPC.
static async_call_tipc_prepare_async (void *private, ipc_async_callback_t callback)
 Prolog for ipc_call_async_*() functions.
int ipc_share_in_finalize (ipc_callid_t callid, void *src, unsigned int flags)
 Wrapper for answering the IPC_M_SHARE_IN calls.
int ipc_share_in_start (int phoneid, void *dst, size_t size, sysarg_t arg, unsigned int *flags)
 Wrapper for IPC_M_SHARE_IN calls.
int ipc_share_out_finalize (ipc_callid_t callid, void *dst)
 Wrapper for answering the IPC_M_SHARE_OUT calls.
int ipc_share_out_start (int phoneid, void *src, unsigned int flags)
 Wrapper for IPC_M_SHARE_OUT calls.
ipc_callid_t ipc_trywait_for_call (ipc_call_t *call)
 Check if there is an IPC call waiting to be picked up.
ipc_callid_t ipc_wait_cycle (ipc_call_t *call, sysarg_t usec, unsigned int flags)
 Wait for first IPC call to come.
ipc_callid_t ipc_wait_for_call_timeout (ipc_call_t *call, sysarg_t usec)
 Wait for first IPC call to come.
 LIST_INITIALIZE (queued_calls)
 List of asynchronous calls that were not accepted by kernel.
int service_connect (sysarg_t, sysarg_t, sysarg_t)
int service_connect_blocking (sysarg_t, sysarg_t, sysarg_t)
int service_register (sysarg_t)

Variables

atomic_t async_futex
static atomic_t ipc_futex = FUTEX_INITIALIZER

Detailed Description

HelenOS uspace IPC.


Define Documentation

#define IPC_GET_COUNT ( call   )     ((size_t) IPC_GET_ARG2(call))

Return the count message argument.

Parameters:
[in] call Message call structure.

Definition at line 293 of file net.h.

#define IPC_GET_DEVICE ( call   )     ((device_id_t) IPC_GET_ARG1(call))

Return the device identifier message argument.

Parameters:
[in] call Message call structure.

Definition at line 279 of file net.h.

#define IPC_GET_ERROR ( call   )     ((services_t) IPC_GET_ARG4(call))

Return the error service message argument.

&

Parameters:
[in] call Message call structure.

Definition at line 335 of file net.h.

#define IPC_GET_MTU ( call   )     ((size_t) IPC_GET_ARG2(call))

Return the maximum transmission unit message argument.

Parameters:
[in] call Message call structure.

Definition at line 307 of file net.h.

#define IPC_GET_PACKET ( call   )     ((packet_id_t) IPC_GET_ARG2(call))

Return the packet identifier message argument.

Parameters:
[in] call Message call structure.

Definition at line 286 of file net.h.

#define IPC_GET_PHONE ( call   )     ((int) IPC_GET_ARG5(call))

Return the phone message argument.

Parameters:
[in] call Message call structure.

Definition at line 342 of file net.h.

#define IPC_GET_SENDER ( call   )     ((services_t) IPC_GET_ARG3(call))

Return the sender service message argument.

Parameters:
[in] call Message call structure.

Definition at line 328 of file net.h.

#define IPC_GET_SERVICE ( call   )     ((services_t) IPC_GET_ARG3(call))

Return the device driver service message argument.

Parameters:
[in] call Message call structure.

Definition at line 314 of file net.h.

#define IPC_GET_STATE ( call   )     ((device_state_t) IPC_GET_ARG2(call))

Return the device state message argument.

Parameters:
[in] call Message call structure.

Definition at line 300 of file net.h.

#define IPC_GET_TARGET ( call   )     ((services_t) IPC_GET_ARG3(call))

Return the target service message argument.

Parameters:
[in] call Message call structure.

Definition at line 321 of file net.h.

#define IPC_SET_ADDR ( answer,
value   )     IPC_SET_ARG1(answer, (sysarg_t) (value))

Set the minimum address length in the message answer.

Parameters:
[out] answer Message answer structure.
[in] value Value to set.

Definition at line 358 of file net.h.

#define IPC_SET_CONTENT ( answer,
value   )     IPC_SET_ARG3(answer, (sysarg_t) (value))

Set the maximum content size in the message answer.

Parameters:
[out] answer Message answer structure.
[in] value Value to set.

Definition at line 374 of file net.h.

#define IPC_SET_DEVICE ( answer,
value   )     IPC_SET_ARG1(answer, (sysarg_t) (value))

Set the device identifier in the message answer.

Parameters:
[out] answer Message answer structure.
[in] value Value to set.

Definition at line 350 of file net.h.

#define IPC_SET_PREFIX ( answer,
value   )     IPC_SET_ARG2(answer, (sysarg_t) (value))

Set the minimum prefix size in the message answer.

Parameters:
[out] answer Message answer structure.
[in] value Value to set.

Definition at line 366 of file net.h.

#define IPC_SET_SUFFIX ( answer,
value   )     IPC_SET_ARG4(answer, (sysarg_t) (value))

Set the minimum suffix size in the message answer.

Parameters:
[out] answer Message answer structure.
[in] value Value to set.

Definition at line 382 of file net.h.

#define IS_IN_INTERVAL ( item,
first_inclusive,
last_exclusive   )     (((item) >= (first_inclusive)) && ((item) < (last_exclusive)))

Return a value indicating whether the value is in the interval.

Parameters:
[in] item Value to be checked.
[in] first_inclusive First value in the interval inclusive.
[in] last_exclusive First value after the interval.

Definition at line 51 of file net.h.

#define IS_NET_ARP_MESSAGE ( call   )     IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ARP_FIRST, NET_ARP_LAST)

Check if the IPC call is an ARP message.

Parameters:
[in] call IPC call to be checked.

Definition at line 178 of file net.h.

#define IS_NET_ETH_MESSAGE ( call   )     IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ETH_FIRST, NET_ETH_LAST)

Check if the IPC call is an Ethernet message.

Parameters:
[in] call IPC call to be checked.

Definition at line 186 of file net.h.

#define IS_NET_ICMP_MESSAGE ( call   )     IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ICMP_FIRST, NET_ICMP_LAST)

Check if the IPC call is an ICMP message.

Parameters:
[in] call IPC call to be checked.

Definition at line 194 of file net.h.

#define IS_NET_IL_MESSAGE ( call   )     IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_IL_FIRST, NET_IL_LAST)

Check if the IPC call is an inter-network layer message.

Parameters:
[in] call IPC call to be checked.

Definition at line 202 of file net.h.

#define IS_NET_IP_MESSAGE ( call   )     IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_IP_FIRST, NET_IP_LAST)

Check if the IPC call is an IP message.

Parameters:
[in] call IPC call to be checked.

Definition at line 210 of file net.h.

#define IS_NET_MESSAGE ( call   )     IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_FIRST, NET_LAST)

Check if the IPC call is a generic networking message.

Parameters:
[in] call IPC call to be checked.

Definition at line 170 of file net.h.

#define IS_NET_NET_MESSAGE ( call   )     IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_NET_FIRST, NET_NET_LAST)

Check if the IPC call is a generic networking message.

Parameters:
[in] call IPC call to be checked.

Definition at line 218 of file net.h.

#define IS_NET_NIL_MESSAGE ( call   )     IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_NIL_FIRST, NET_NIL_LAST)

Check if the IPC call is a network interface layer message.

Parameters:
[in] call IPC call to be checked.

Definition at line 226 of file net.h.

#define IS_NET_PACKET_MESSAGE ( call   )     IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_PACKET_FIRST, NET_PACKET_LAST)

Check if the IPC call is a packet manaagement system message.

Parameters:
[in] call IPC call to be checked.

Definition at line 234 of file net.h.

#define IS_NET_SOCKET_MESSAGE ( call   )     IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_SOCKET_FIRST, NET_SOCKET_LAST)

Check if the IPC call is a socket message.

Parameters:
[in] call IPC call to be checked.

Definition at line 242 of file net.h.

#define IS_NET_TCP_MESSAGE ( call   )     IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_TCP_FIRST, NET_TCP_LAST)

Check if the IPC call is a TCP message.

Parameters:
[in] call IPC call to be checked.

Definition at line 250 of file net.h.

#define IS_NET_TL_MESSAGE ( call   )     IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_TL_FIRST, NET_TL_LAST)

Check if the IPC call is a transport layer message.

Parameters:
[in] call IPC call to be checked.

Definition at line 258 of file net.h.

#define IS_NET_UDP_MESSAGE ( call   )     IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_UDP_FIRST, NET_UDP_LAST)

Check if the IPC call is a UDP message.

Parameters:
[in] call IPC call to be checked.

Definition at line 266 of file net.h.

#define L_DIRECTORY   2

Lookup will succeed only if the object is a directory.

If L_CREATE is specified, an empty directory will be created. This flag is mutually exclusive with L_FILE.

Definition at line 120 of file vfs.h.

#define L_EXCLUSIVE   16

When used with L_CREATE, L_EXCLUSIVE will cause the lookup to fail if the object already exists.

L_EXCLUSIVE is implied when L_DIRECTORY is used.

Definition at line 139 of file vfs.h.

#define L_FILE   1

Lookup will succeed only if the object is a regular file.

If L_CREATE is specified, an empty file will be created. This flag is mutually exclusive with L_DIRECTORY.

Definition at line 113 of file vfs.h.

#define L_MP   8

Lookup will succeed only if the object is a mount point.

The flag is mutually exclusive with L_FILE and L_ROOT.

Definition at line 132 of file vfs.h.

#define L_OPEN   256

L_OPEN is used to indicate that the lookup operation is a part of VFS_IN_OPEN call from the client.

This means that the server might allocate some resources for the opened file. This flag cannot be passed directly by the client.

Definition at line 164 of file vfs.h.

#define L_ROOT   4

Lookup will succeed only if the object is a root directory.

The flag is mutually exclusive with L_FILE and L_MP.

Definition at line 126 of file vfs.h.

#define L_UNLINK   128

L_UNLINK is used to remove leaves from the file system namespace.

This flag cannot be passed directly by the client, but will be set by VFS during VFS_UNLINK.

Definition at line 156 of file vfs.h.


Function Documentation

static void dispatch_queued_calls ( void   )  [static]

Try to dispatch queued calls from the async queue.

Definition at line 449 of file ipc.c.

static void handle_answer ( ipc_callid_t  callid,
ipc_call_t data 
) [static]

Handle received answer.

Find the hash of the answer and call the answer callback.

The answer has the same hash as the request OR'ed with the IPC_CALLID_ANSWERED bit.

Parameters:
callid Hash of the received answer.
data Call data of the answer.

Definition at line 506 of file ipc.c.

sysarg_t ipc_answer_fast ( ipc_callid_t  callid,
sysarg_t  retval,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3,
sysarg_t  arg4 
)

Answer received call (fast version).

The fast answer makes use of passing retval and first four arguments in registers. If you need to return more, use the ipc_answer_slow() instead.

Parameters:
callid Hash of the call being answered.
retval Return value.
arg1 First return argument.
arg2 Second return argument.
arg3 Third return argument.
arg4 Fourth return argument.
Returns:
Zero on success.

Value from errno.h on failure.

Definition at line 410 of file ipc.c.

sysarg_t ipc_answer_slow ( ipc_callid_t  callid,
sysarg_t  retval,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3,
sysarg_t  arg4,
sysarg_t  arg5 
)

Answer received call (entire payload).

Parameters:
callid Hash of the call being answered.
retval Return value.
arg1 First return argument.
arg2 Second return argument.
arg3 Third return argument.
arg4 Fourth return argument.
arg5 Fifth return argument.
Returns:
Zero on success.

Value from errno.h on failure.

Definition at line 431 of file ipc.c.

void ipc_call_async_fast ( int  phoneid,
sysarg_t  imethod,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3,
sysarg_t  arg4,
void *  private,
ipc_async_callback_t  callback,
bool  can_preempt 
)

Fast asynchronous call.

This function can only handle four arguments of payload. It is, however, faster than the more generic ipc_call_async_slow().

Note that this function is a void function.

During normal operation, answering this call will trigger the callback. In case of fatal error, the callback handler is called with the proper error code. If the call cannot be temporarily made, it is queued.

Parameters:
phoneid Phone handle for the call.
imethod Requested interface and method.
arg1 Service-defined payload argument.
arg2 Service-defined payload argument.
arg3 Service-defined payload argument.
arg4 Service-defined payload argument.
private Argument to be passed to the answer/error callback.
callback Answer or error callback.
can_preempt If true, the current fibril will be preempted in case the kernel temporarily refuses to accept more asynchronous calls.

Definition at line 300 of file ipc.c.

static ipc_callid_t ipc_call_async_internal ( int  phoneid,
ipc_call_t data 
) [static]

Send asynchronous message via syscall.

Parameters:
phoneid Phone handle for the call.
data Call data with the request.
Returns:
Hash of the call or an error code.

Definition at line 189 of file ipc.c.

void ipc_call_async_slow ( int  phoneid,
sysarg_t  imethod,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3,
sysarg_t  arg4,
sysarg_t  arg5,
void *  private,
ipc_async_callback_t  callback,
bool  can_preempt 
)

Asynchronous call transmitting the entire payload.

Note that this function is a void function.

During normal operation, answering this call will trigger the callback. In case of fatal error, the callback handler is called with the proper error code. If the call cannot be temporarily made, it is queued.

Parameters:
phoneid Phone handle for the call.
imethod Requested interface and method.
arg1 Service-defined payload argument.
arg2 Service-defined payload argument.
arg3 Service-defined payload argument.
arg4 Service-defined payload argument.
arg5 Service-defined payload argument.
private Argument to be passed to the answer/error callback.
callback Answer or error callback.
can_preempt If true, the current fibril will be preempted in case the kernel temporarily refuses to accept more asynchronous calls.

Definition at line 367 of file ipc.c.

int ipc_call_sync_fast ( int  phoneid,
sysarg_t  method,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3,
sysarg_t result1,
sysarg_t result2,
sysarg_t result3,
sysarg_t result4,
sysarg_t result5 
)

Fast synchronous call.

Only three payload arguments can be passed using this function. However, this function is faster than the generic ipc_call_sync_slow() because the payload is passed directly in registers.

Parameters:
phoneid Phone handle for the call.
method Requested method.
arg1 Service-defined payload argument.
arg2 Service-defined payload argument.
arg3 Service-defined payload argument.
result1 If non-NULL, the return ARG1 will be stored there.
result2 If non-NULL, the return ARG2 will be stored there.
result3 If non-NULL, the return ARG3 will be stored there.
result4 If non-NULL, the return ARG4 will be stored there.
result5 If non-NULL, the return ARG5 will be stored there.
Returns:
Negative values representing IPC errors.

Otherwise the RETVAL of the answer.

Definition at line 105 of file ipc.c.

int ipc_call_sync_slow ( int  phoneid,
sysarg_t  imethod,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3,
sysarg_t  arg4,
sysarg_t  arg5,
sysarg_t result1,
sysarg_t result2,
sysarg_t result3,
sysarg_t result4,
sysarg_t result5 
)

Synchronous call transmitting 5 arguments of payload.

Parameters:
phoneid Phone handle for the call.
imethod Requested interface and method.
arg1 Service-defined payload argument.
arg2 Service-defined payload argument.
arg3 Service-defined payload argument.
arg4 Service-defined payload argument.
arg5 Service-defined payload argument.
result1 If non-NULL, storage for the first return argument.
result2 If non-NULL, storage for the second return argument.
result3 If non-NULL, storage for the third return argument.
result4 If non-NULL, storage for the fourth return argument.
result5 If non-NULL, storage for the fifth return argument.
Returns:
Negative values representing IPC errors.

Otherwise the RETVAL of the answer.

Definition at line 148 of file ipc.c.

int ipc_connect_me_to ( int  phoneid,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3 
)

Request new connection.

Parameters:
phoneid Phone handle used for contacting the other side.
arg1 User defined argument.
arg2 User defined argument.
arg3 User defined argument.
Returns:
New phone handle on success or a negative error code.

Definition at line 644 of file ipc.c.

int ipc_connect_me_to_blocking ( int  phoneid,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3 
)

Request new connection (blocking).

If the connection is not available at the moment, the call should block. This has to be, however, implemented on the server side.

Parameters:
phoneid Phone handle used for contacting the other side.
arg1 User defined argument.
arg2 User defined argument.
arg3 User defined argument.
Returns:
New phone handle on success or a negative error code.

Definition at line 669 of file ipc.c.

int ipc_connect_to_me ( int  phoneid,
sysarg_t  arg1,
sysarg_t  arg2,
sysarg_t  arg3,
sysarg_t taskhash,
sysarg_t phonehash 
)

Request callback connection.

The taskhash and phonehash identifiers returned by the kernel can be used for connection tracking.

Parameters:
phoneid Phone handle used for contacting the other side.
arg1 User defined argument.
arg2 User defined argument.
arg3 User defined argument.
taskhash Opaque identifier of the client task.
phonehash Opaque identifier of the phone that will be used for incoming calls.
Returns:
Zero on success or a negative error code.

Definition at line 627 of file ipc.c.

int ipc_data_read_finalize ( ipc_callid_t  callid,
const void *  src,
size_t  size 
)

Wrapper for answering the IPC_M_DATA_READ calls.

This wrapper only makes it more comfortable to answer IPC_M_DATA_READ calls so that the user doesn't have to remember the meaning of each IPC argument.

Parameters:
callid Hash of the IPC_M_DATA_READ call to answer.
src Source address for the IPC_M_DATA_READ call.
size Size for the IPC_M_DATA_READ call. Can be smaller than the maximum size announced by the sender.
Returns:
Zero on success or a value from errno.h on failure.

Definition at line 837 of file ipc.c.

int ipc_data_read_start ( int  phoneid,
void *  dst,
size_t  size 
)

Wrapper for IPC_M_DATA_READ calls.

Parameters:
phoneid Phone that will be used to contact the receiving side.
dst Address of the beginning of the destination buffer.
size Size of the destination buffer.
Returns:
Zero on success or a negative error code from errno.h.

Definition at line 817 of file ipc.c.

int ipc_data_write_finalize ( ipc_callid_t  callid,
void *  dst,
size_t  size 
)

Wrapper for answering the IPC_M_DATA_WRITE calls.

This wrapper only makes it more comfortable to answer IPC_M_DATA_WRITE calls so that the user doesn't have to remember the meaning of each IPC argument.

Parameters:
callid Hash of the IPC_M_DATA_WRITE call to answer.
dst Final destination address for the IPC_M_DATA_WRITE call.
size Final size for the IPC_M_DATA_WRITE call.
Returns:
Zero on success or a value from errno.h on failure.

Definition at line 870 of file ipc.c.

int ipc_data_write_start ( int  phoneid,
const void *  src,
size_t  size 
)

Wrapper for IPC_M_DATA_WRITE calls.

Parameters:
phoneid Phone that will be used to contact the receiving side.
src Address of the beginning of the source buffer.
size Size of the source buffer.
Returns:
Zero on success or a negative error code from errno.h.

Definition at line 851 of file ipc.c.

static void ipc_finish_async ( ipc_callid_t  callid,
int  phoneid,
async_call_t call,
bool  can_preempt 
) [inline, static]

Epilog for ipc_call_async_*() functions.

Parameters:
callid Value returned by the SYS_IPC_CALL_ASYNC_* syscall.
phoneid Phone handle through which the call was made.
call Structure returned by ipc_prepare_async().
can_preempt If true, the current fibril can be preempted in this call.

Definition at line 229 of file ipc.c.

int ipc_forward_fast ( ipc_callid_t  callid,
int  phoneid,
sysarg_t  imethod,
sysarg_t  arg1,
sysarg_t  arg2,
unsigned int  mode 
)

Forward a received call to another destination.

For non-system methods, the old method, arg1 and arg2 are rewritten by the new values. For system methods, the new method, arg1 and arg2 are written to the old arg1, arg2 and arg3, respectivelly. Calls with immutable methods are forwarded verbatim.

Parameters:
callid Hash of the call to forward.
phoneid Phone handle to use for forwarding.
imethod New interface and method for the forwarded call.
arg1 New value of the first argument for the forwarded call.
arg2 New value of the second argument for the forwarded call.
mode Flags specifying mode of the forward operation.
Returns:
Zero on success or an error code.

Definition at line 710 of file ipc.c.

int ipc_hangup ( int  phoneid  ) 

Hang up a phone.

Parameters:
phoneid Handle of the phone to be hung up.
Returns:
Zero on success or a negative error code.

Definition at line 688 of file ipc.c.

static async_call_t* ipc_prepare_async ( void *  private,
ipc_async_callback_t  callback 
) [inline, static]

Prolog for ipc_call_async_*() functions.

Parameters:
private Argument for the answer/error callback.
callback Answer/error callback.
Returns:
New, partially initialized async_call structure or NULL.

Definition at line 202 of file ipc.c.

int ipc_share_in_finalize ( ipc_callid_t  callid,
void *  src,
unsigned int  flags 
)

Wrapper for answering the IPC_M_SHARE_IN calls.

This wrapper only makes it more comfortable to answer IPC_M_DATA_READ calls so that the user doesn't have to remember the meaning of each IPC argument.

Parameters:
callid Hash of the IPC_M_DATA_READ call to answer.
src Source address space base.
flags Flags to be used for sharing. Bits can be only cleared.
Returns:
Zero on success or a value from errno.h on failure.

Definition at line 771 of file ipc.c.

int ipc_share_in_start ( int  phoneid,
void *  dst,
size_t  size,
sysarg_t  arg,
unsigned int *  flags 
)

Wrapper for IPC_M_SHARE_IN calls.

Parameters:
phoneid Phone that will be used to contact the receiving side.
dst Destination address space area base.
size Size of the destination address space area.
arg User defined argument.
flags Storage for received flags. Can be NULL.
Returns:
Zero on success or a negative error code from errno.h.

Definition at line 745 of file ipc.c.

int ipc_share_out_finalize ( ipc_callid_t  callid,
void *  dst 
)

Wrapper for answering the IPC_M_SHARE_OUT calls.

This wrapper only makes it more comfortable to answer IPC_M_SHARE_OUT calls so that the user doesn't have to remember the meaning of each IPC argument.

Parameters:
callid Hash of the IPC_M_DATA_WRITE call to answer.
dst Destination address space area base address.
Returns:
Zero on success or a value from errno.h on failure.

Definition at line 803 of file ipc.c.

int ipc_share_out_start ( int  phoneid,
void *  src,
unsigned int  flags 
)

Wrapper for IPC_M_SHARE_OUT calls.

Parameters:
phoneid Phone that will be used to contact the receiving side.
src Source address space area base address.
flags Flags to be used for sharing. Bits can be only cleared.
Returns:
Zero on success or a negative error code from errno.h.

Definition at line 785 of file ipc.c.

ipc_callid_t ipc_trywait_for_call ( ipc_call_t call  ) 

Check if there is an IPC call waiting to be picked up.

Only requests are returned, answers are processed internally.

Parameters:
call Incoming call storage.
Returns:
Hash of the call.

Definition at line 599 of file ipc.c.

ipc_callid_t ipc_wait_cycle ( ipc_call_t call,
sysarg_t  usec,
unsigned int  flags 
)

Wait for first IPC call to come.

Parameters:
call Incoming call storage.
usec Timeout in microseconds
flags Flags passed to SYS_IPC_WAIT (blocking, nonblocking).
Returns:
Hash of the call. Note that certain bits have special meaning: IPC_CALLID_ANSWERED is set in an answer and IPC_CALLID_NOTIFICATION is used for notifications.

Definition at line 546 of file ipc.c.

ipc_callid_t ipc_wait_for_call_timeout ( ipc_call_t call,
sysarg_t  usec 
)

Wait for first IPC call to come.

Only requests are returned, answers are processed internally.

Parameters:
call Incoming call storage.
usec Timeout in microseconds
Returns:
Hash of the call.

Definition at line 579 of file ipc.c.

LIST_INITIALIZE ( queued_calls   ) 

List of asynchronous calls that were not accepted by kernel.

Protected by async_futex, because if the call is not accepted by the kernel, the async framework is used automatically.


Generated on Thu Jun 2 07:45:57 2011 for HelenOS/USB by  doxygen 1.4.7