#include <ipc/ipc.h>
#include <async.h>
#include <futex.h>
#include <fibril.h>
#include <stdio.h>
#include <adt/hash_table.h>
#include <adt/list.h>
#include <assert.h>
#include <errno.h>
#include <sys/time.h>
#include <arch/barrier.h>
#include <bool.h>
#include <stdlib.h>
#include <malloc.h>
#include "private/async.h"
Go to the source code of this file.
Data Structures | |
struct | amsg_t |
struct | client_t |
struct | connection_t |
struct | msg_t |
Structures of this type are used to group information about a call and about a message queue link. More... | |
Defines | |
#define | CLIENT_HASH_TABLE_BUCKETS 32 |
#define | CONN_HASH_TABLE_BUCKETS 32 |
#define | LIBC_ASYNC_C_ |
Asynchronous library. | |
Functions | |
void | __async_init (void) |
Initialize the async framework. | |
sysarg_t | async_answer_0 (ipc_callid_t callid, sysarg_t retval) |
sysarg_t | async_answer_1 (ipc_callid_t callid, sysarg_t retval, sysarg_t arg1) |
sysarg_t | async_answer_2 (ipc_callid_t callid, sysarg_t retval, sysarg_t arg1, sysarg_t arg2) |
sysarg_t | async_answer_3 (ipc_callid_t callid, sysarg_t retval, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3) |
sysarg_t | async_answer_4 (ipc_callid_t callid, sysarg_t retval, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4) |
sysarg_t | async_answer_5 (ipc_callid_t callid, sysarg_t retval, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5) |
void * | async_client_data_get (void) |
int | async_connect_kbox (task_id_t id) |
Connect to a task specified by id. | |
int | async_connect_me_to (int phone, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3) |
Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework. | |
int | async_connect_me_to_blocking (int phoneid, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3) |
Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework. | |
int | async_connect_to_me (int phone, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, async_client_conn_t client_receiver) |
Wrapper for making IPC_M_CONNECT_TO_ME calls using the async framework. | |
void | async_create_manager (void) |
Add one manager to manager list. | |
aid_t | async_data_read (int phoneid, void *dst, size_t size, ipc_call_t *dataptr) |
Start IPC_M_DATA_READ using the async framework. | |
int | async_data_read_finalize (ipc_callid_t callid, const void *src, size_t size) |
Wrapper for answering the IPC_M_DATA_READ calls using the async framework. | |
int | async_data_read_forward_fast (int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr) |
Wrapper for forwarding any read request. | |
bool | async_data_read_receive (ipc_callid_t *callid, size_t *size) |
Wrapper for receiving the IPC_M_DATA_READ calls using the async framework. | |
int | async_data_read_start_generic (int phoneid, void *dst, size_t size, int flags) |
Wrapper for IPC_M_DATA_READ calls using the async framework. | |
int | async_data_write_accept (void **data, const bool nullterm, const size_t min_size, const size_t max_size, const size_t granularity, size_t *received) |
Wrapper for receiving binary data or strings. | |
int | async_data_write_finalize (ipc_callid_t callid, void *dst, size_t size) |
Wrapper for answering the IPC_M_DATA_WRITE calls using the async framework. | |
int | async_data_write_forward_fast (int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr) |
Wrapper for forwarding any data that is about to be received. | |
bool | async_data_write_receive (ipc_callid_t *callid, size_t *size) |
Wrapper for receiving the IPC_M_DATA_WRITE calls using the async framework. | |
int | async_data_write_start_generic (int phoneid, const void *src, size_t size, int flags) |
Wrapper for IPC_M_DATA_WRITE calls using the async framework. | |
void | async_data_write_void (sysarg_t retval) |
Wrapper for voiding any data that is about to be received. | |
void | async_destroy_manager (void) |
Remove one manager from manager list. | |
int | async_forward_fast (ipc_callid_t callid, int phoneid, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode) |
int | async_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) |
ipc_callid_t | async_get_call_timeout (ipc_call_t *call, suseconds_t usecs) |
Return new incoming message for the current (fibril-local) connection. | |
int | async_hangup (int phone) |
Wrapper for ipc_hangup. | |
void | async_insert_timeout (awaiter_t *wd) |
Sort in current fibril's timeout request. | |
static int | async_manager_fibril (void *arg) |
Function to start async_manager as a standalone fibril. | |
static int | async_manager_worker (void) |
Endless loop dispatching incoming calls and answers. | |
void | async_msg_0 (int phone, sysarg_t imethod) |
void | async_msg_1 (int phone, sysarg_t imethod, sysarg_t arg1) |
void | async_msg_2 (int phone, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2) |
void | async_msg_3 (int phone, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3) |
void | async_msg_4 (int phone, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4) |
void | async_msg_5 (int phone, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5) |
fid_t | async_new_connection (sysarg_t in_task_hash, sysarg_t in_phone_hash, ipc_callid_t callid, ipc_call_t *call, void(*cfibril)(ipc_callid_t, ipc_call_t *)) |
Create a new fibril for a new connection. | |
void | async_poke (void) |
Interrupt one thread of this task from waiting for IPC. | |
sysarg_t | async_req_fast (int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t *r1, sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5) |
Pseudo-synchronous message sending - fast version. | |
sysarg_t | async_req_slow (int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *r1, sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5) |
Pseudo-synchronous message sending - slow version. | |
aid_t | async_send_fast (int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr) |
Send message and return id of the sent message. | |
aid_t | async_send_slow (int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, ipc_call_t *dataptr) |
Send message and return id of the sent message. | |
void | async_set_client_connection (async_client_conn_t conn) |
Setter for client_connection function pointer. | |
void | async_set_client_data_constructor (async_client_data_ctor_t ctor) |
void | async_set_client_data_destructor (async_client_data_dtor_t dtor) |
void | async_set_interrupt_received (async_client_conn_t intr) |
Setter for interrupt_received function pointer. | |
int | async_share_in_finalize (ipc_callid_t callid, void *src, unsigned int flags) |
Wrapper for answering the IPC_M_SHARE_IN calls using the async framework. | |
bool | async_share_in_receive (ipc_callid_t *callid, size_t *size) |
Wrapper for receiving the IPC_M_SHARE_IN calls using the async framework. | |
int | async_share_in_start (int phoneid, void *dst, size_t size, sysarg_t arg, unsigned int *flags) |
Wrapper for IPC_M_SHARE_IN calls using the async framework. | |
int | async_share_out_finalize (ipc_callid_t callid, void *dst) |
Wrapper for answering the IPC_M_SHARE_OUT calls using the async framework. | |
bool | async_share_out_receive (ipc_callid_t *callid, size_t *size, unsigned int *flags) |
Wrapper for receiving the IPC_M_SHARE_OUT calls using the async framework. | |
int | async_share_out_start (int phoneid, void *src, unsigned int flags) |
Wrapper for IPC_M_SHARE_OUT calls using the async framework. | |
void | async_usleep (suseconds_t timeout) |
Wait for specified time. | |
void | async_wait_for (aid_t amsgid, sysarg_t *retval) |
Wait for a message sent by the async framework. | |
int | async_wait_timeout (aid_t amsgid, sysarg_t *retval, suseconds_t timeout) |
Wait for a message sent by the async framework, timeout variant. | |
static int | client_compare (unsigned long key[], hash_count_t keys, link_t *item) |
static hash_index_t | client_hash (unsigned long key[]) |
static void | client_remove (link_t *item) |
static int | conn_compare (unsigned long key[], hash_count_t keys, link_t *item) |
Compare hash table item with a key. | |
static hash_index_t | conn_hash (unsigned long key[]) |
Compute hash into the connection hash table based on the source phone hash. | |
static void | conn_remove (link_t *item) |
static int | connection_fibril (void *arg) |
Wrapper for client connection fibril. | |
static void | default_client_connection (ipc_callid_t callid, ipc_call_t *call) |
Default fibril function that gets called to handle new connection. | |
static void * | default_client_data_constructor (void) |
static void | default_client_data_destructor (void *data) |
static void | default_interrupt_received (ipc_callid_t callid, ipc_call_t *call) |
Default fibril function that gets called to handle interrupt notifications. | |
static void | handle_call (ipc_callid_t callid, ipc_call_t *call) |
Handle a call that was received. | |
static void | handle_expired_timeouts (void) |
Fire all timeouts that expired. | |
static int | notification_fibril (void *arg) |
Notification fibril. | |
static bool | process_notification (ipc_callid_t callid, ipc_call_t *call) |
Process interrupt notification. | |
static void | reply_received (void *arg, int retval, ipc_call_t *data) |
Reply received callback. | |
static bool | route_call (ipc_callid_t callid, ipc_call_t *call) |
Try to route a call to an appropriate connection fibril. | |
Variables | |
static async_client_data_ctor_t | async_client_data_create |
static async_client_data_dtor_t | async_client_data_destroy |
atomic_t | async_futex = FUTEX_INITIALIZER |
static async_client_conn_t | client_connection = default_client_connection |
Pointer to a fibril function that will be used to handle connections. | |
static hash_table_t | client_hash_table |
static hash_table_operations_t | client_hash_table_ops |
Operations for the client hash table. | |
static hash_table_t | conn_hash_table |
static hash_table_operations_t | conn_hash_table_ops |
Operations for the connection hash table. | |
static fibril_local connection_t * | FIBRIL_connection |
Identifier of the incoming connection handled by the current fibril. | |
static async_client_conn_t | interrupt_received = default_interrupt_received |
Pointer to a fibril function that will be used to handle interrupt notifications. | |
atomic_t | threads_in_ipc_wait = { 0 } |
Number of threads waiting for IPC in the kernel. |
Definition in file async.c.