Changeset 8b5690f in mainline for uspace/lib/c/include


Ignore:
Timestamp:
2011-02-03T05:11:01Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ba38f72c
Parents:
22027b6e (diff), 86d7bfa (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

Location:
uspace/lib/c/include
Files:
53 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/adt/hash_table.h

    r22027b6e r8b5690f  
    4141typedef unsigned long hash_count_t;
    4242typedef unsigned long hash_index_t;
    43 typedef struct hash_table hash_table_t;
    44 typedef struct hash_table_operations hash_table_operations_t;
     43
     44/** Set of operations for hash table. */
     45typedef struct {
     46        /** Hash function.
     47         *
     48         * @param key Array of keys needed to compute hash index.
     49         *            All keys must be passed.
     50         *
     51         * @return Index into hash table.
     52         *
     53         */
     54        hash_index_t (*hash)(unsigned long key[]);
     55       
     56        /** Hash table item comparison function.
     57         *
     58         * @param key Array of keys that will be compared with item. It is
     59         *            not necessary to pass all keys.
     60         *
     61         * @return True if the keys match, false otherwise.
     62         *
     63         */
     64        int (*compare)(unsigned long key[], hash_count_t keys, link_t *item);
     65       
     66        /** Hash table item removal callback.
     67         *
     68         * @param item Item that was removed from the hash table.
     69         *
     70         */
     71        void (*remove_callback)(link_t *item);
     72} hash_table_operations_t;
    4573
    4674/** Hash table structure. */
    47 struct hash_table {
     75typedef struct {
    4876        link_t *entry;
    4977        hash_count_t entries;
    5078        hash_count_t max_keys;
    5179        hash_table_operations_t *op;
    52 };
    53 
    54 /** Set of operations for hash table. */
    55 struct hash_table_operations {
    56         /** Hash function.
    57          *
    58          * @param key   Array of keys needed to compute hash index. All keys
    59          *              must be passed.
    60          *
    61          * @return      Index into hash table.
    62          */
    63         hash_index_t (* hash)(unsigned long key[]);
    64        
    65         /** Hash table item comparison function.
    66          *
    67          * @param key   Array of keys that will be compared with item. It is
    68          *              not necessary to pass all keys.
    69          *
    70          * @return      true if the keys match, false otherwise.
    71          */
    72         int (*compare)(unsigned long key[], hash_count_t keys, link_t *item);
    73 
    74         /** Hash table item removal callback.
    75          *
    76          * @param item  Item that was removed from the hash table.
    77          */
    78         void (*remove_callback)(link_t *item);
    79 };
     80} hash_table_t;
    8081
    8182#define hash_table_get_instance(item, type, member) \
  • uspace/lib/c/include/async.h

    r22027b6e r8b5690f  
    3333 */
    3434
     35#if ((defined(LIBC_IPC_H_)) && (!defined(LIBC_ASYNC_C_)))
     36        #error Do not intermix low-level IPC interface and async framework
     37#endif
     38
    3539#ifndef LIBC_ASYNC_H_
    3640#define LIBC_ASYNC_H_
    3741
    38 #include <ipc/ipc.h>
     42#include <ipc/common.h>
    3943#include <async_sess.h>
    4044#include <fibril.h>
     
    4246#include <atomic.h>
    4347#include <bool.h>
     48#include <task.h>
    4449
    4550typedef ipc_callid_t aid_t;
    46 typedef void (*async_client_conn_t)(ipc_callid_t callid, ipc_call_t *call);
    47 
    48 extern atomic_t async_futex;
     51
     52typedef void *(*async_client_data_ctor_t)(void);
     53typedef void (*async_client_data_dtor_t)(void *);
     54
     55typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *);
    4956
    5057extern atomic_t threads_in_ipc_wait;
    5158
    52 extern int __async_init(void);
    53 extern ipc_callid_t async_get_call_timeout(ipc_call_t *call, suseconds_t usecs);
    54 
    55 static inline ipc_callid_t async_get_call(ipc_call_t *data)
    56 {
    57         return async_get_call_timeout(data, 0);
    58 }
    59 
    60 static inline void async_manager(void)
    61 {
    62         fibril_switch(FIBRIL_TO_MANAGER);
    63 }
     59#define async_manager() \
     60        fibril_switch(FIBRIL_TO_MANAGER)
     61
     62#define async_get_call(data) \
     63        async_get_call_timeout(data, 0)
     64
     65extern ipc_callid_t async_get_call_timeout(ipc_call_t *, suseconds_t);
    6466
    6567/*
     
    8587            (arg5), (dataptr))
    8688
    87 extern aid_t async_send_fast(int phoneid, sysarg_t method, sysarg_t arg1,
    88     sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr);
    89 extern aid_t async_send_slow(int phoneid, sysarg_t method, sysarg_t arg1,
    90     sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5,
    91     ipc_call_t *dataptr);
    92 extern void async_wait_for(aid_t amsgid, sysarg_t *result);
    93 extern int async_wait_timeout(aid_t amsgid, sysarg_t *retval,
    94     suseconds_t timeout);
    95 
    96 extern fid_t async_new_connection(sysarg_t in_phone_hash, ipc_callid_t callid,
    97     ipc_call_t *call, void (*cthread)(ipc_callid_t, ipc_call_t *));
    98 extern void async_usleep(suseconds_t timeout);
     89extern aid_t async_send_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     90    sysarg_t, ipc_call_t *);
     91extern aid_t async_send_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     92    sysarg_t, sysarg_t, ipc_call_t *);
     93extern void async_wait_for(aid_t, sysarg_t *);
     94extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
     95
     96extern fid_t async_new_connection(sysarg_t, sysarg_t, ipc_callid_t,
     97    ipc_call_t *, void (*)(ipc_callid_t, ipc_call_t *));
     98extern void async_usleep(suseconds_t);
    9999extern void async_create_manager(void);
    100100extern void async_destroy_manager(void);
    101101
    102 extern void async_set_client_connection(async_client_conn_t conn);
    103 extern void async_set_interrupt_received(async_client_conn_t conn);
    104 
    105 /* Wrappers for simple communication */
    106 #define async_msg_0(phone, method) \
    107         ipc_call_async_0((phone), (method), NULL, NULL, true)
    108 #define async_msg_1(phone, method, arg1) \
    109         ipc_call_async_1((phone), (method), (arg1), NULL, NULL, \
    110             true)
    111 #define async_msg_2(phone, method, arg1, arg2) \
    112         ipc_call_async_2((phone), (method), (arg1), (arg2), NULL, NULL, \
    113             true)
    114 #define async_msg_3(phone, method, arg1, arg2, arg3) \
    115         ipc_call_async_3((phone), (method), (arg1), (arg2), (arg3), NULL, NULL, \
    116             true)
    117 #define async_msg_4(phone, method, arg1, arg2, arg3, arg4) \
    118         ipc_call_async_4((phone), (method), (arg1), (arg2), (arg3), (arg4), NULL, \
    119             NULL, true)
    120 #define async_msg_5(phone, method, arg1, arg2, arg3, arg4, arg5) \
    121         ipc_call_async_5((phone), (method), (arg1), (arg2), (arg3), (arg4), \
    122             (arg5), NULL, NULL, true)
     102extern void async_set_client_data_constructor(async_client_data_ctor_t);
     103extern void async_set_client_data_destructor(async_client_data_dtor_t);
     104
     105extern void *async_client_data_get(void);
     106
     107extern void async_set_client_connection(async_client_conn_t);
     108extern void async_set_interrupt_received(async_client_conn_t);
     109
     110/*
     111 * Wrappers for simple communication.
     112 */
     113
     114extern void async_msg_0(int, sysarg_t);
     115extern void async_msg_1(int, sysarg_t, sysarg_t);
     116extern void async_msg_2(int, sysarg_t, sysarg_t, sysarg_t);
     117extern void async_msg_3(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
     118extern void async_msg_4(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
     119extern void async_msg_5(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     120    sysarg_t);
     121
     122/*
     123 * Wrappers for answer routines.
     124 */
     125
     126extern sysarg_t async_answer_0(ipc_callid_t, sysarg_t);
     127extern sysarg_t async_answer_1(ipc_callid_t, sysarg_t, sysarg_t);
     128extern sysarg_t async_answer_2(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t);
     129extern sysarg_t async_answer_3(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
     130    sysarg_t);
     131extern sysarg_t async_answer_4(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
     132    sysarg_t, sysarg_t);
     133extern sysarg_t async_answer_5(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t,
     134    sysarg_t, sysarg_t, sysarg_t);
     135
     136/*
     137 * Wrappers for forwarding routines.
     138 */
     139
     140extern int async_forward_fast(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t,
     141    unsigned int);
     142extern int async_forward_slow(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t,
     143    sysarg_t, sysarg_t, sysarg_t, unsigned int);
    123144
    124145/*
     
    128149 * and slow verion based on m.
    129150 */
     151
    130152#define async_req_0_0(phoneid, method) \
    131153        async_req_fast((phoneid), (method), 0, 0, 0, 0, NULL, NULL, NULL, NULL, \
     
    243265            (arg5), (rc1), (rc2), (rc3), (rc4), (rc5))
    244266
    245 extern sysarg_t async_req_fast(int phoneid, sysarg_t method, sysarg_t arg1,
    246     sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t *r1, sysarg_t *r2,
    247     sysarg_t *r3, sysarg_t *r4, sysarg_t *r5);
    248 extern sysarg_t async_req_slow(int phoneid, sysarg_t method, sysarg_t arg1,
    249     sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *r1,
    250     sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5);
     267extern sysarg_t async_req_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     268    sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
     269extern sysarg_t async_req_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
     270    sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
     271    sysarg_t *);
    251272
    252273static inline void async_serialize_start(void)
     
    260281}
    261282
     283extern int async_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t,
     284    async_client_conn_t);
    262285extern int async_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
    263286extern int async_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
     287extern int async_connect_kbox(task_id_t);
     288extern int async_hangup(int);
     289extern void async_poke(void);
    264290
    265291/*
    266292 * User-friendly wrappers for async_share_in_start().
    267293 */
     294
    268295#define async_share_in_start_0_0(phoneid, dst, size) \
    269296        async_share_in_start((phoneid), (dst), (size), 0, NULL)
     
    275302        async_share_in_start((phoneid), (dst), (size), (arg), (flags))
    276303
    277 extern int async_share_in_start(int, void *, size_t, sysarg_t, int *);
    278 extern int async_share_in_receive(ipc_callid_t *, size_t *);
    279 extern int async_share_in_finalize(ipc_callid_t, void *, int );
    280 extern int async_share_out_start(int, void *, int);
    281 extern int async_share_out_receive(ipc_callid_t *, size_t *, int *);
     304extern int async_share_in_start(int, void *, size_t, sysarg_t, unsigned int *);
     305extern bool async_share_in_receive(ipc_callid_t *, size_t *);
     306extern int async_share_in_finalize(ipc_callid_t, void *, unsigned int);
     307
     308extern int async_share_out_start(int, void *, unsigned int);
     309extern bool async_share_out_receive(ipc_callid_t *, size_t *, unsigned int *);
    282310extern int async_share_out_finalize(ipc_callid_t, void *);
    283311
     
    285313 * User-friendly wrappers for async_data_read_forward_fast().
    286314 */
     315
    287316#define async_data_read_forward_0_0(phoneid, method, answer) \
    288317        async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL)
     
    312341
    313342extern int async_data_read_start(int, void *, size_t);
    314 extern int async_data_read_receive(ipc_callid_t *, size_t *);
     343extern bool async_data_read_receive(ipc_callid_t *, size_t *);
    315344extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
    316345
     
    321350 * User-friendly wrappers for async_data_write_forward_fast().
    322351 */
     352
    323353#define async_data_write_forward_0_0(phoneid, method, answer) \
    324354        async_data_write_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL)
     
    350380
    351381extern int async_data_write_start(int, const void *, size_t);
    352 extern int async_data_write_receive(ipc_callid_t *, size_t *);
     382extern bool async_data_write_receive(ipc_callid_t *, size_t *);
    353383extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
    354384
    355385extern int async_data_write_accept(void **, const bool, const size_t,
    356386    const size_t, const size_t, size_t *);
    357 extern void async_data_write_void(const int);
     387extern void async_data_write_void(sysarg_t);
    358388
    359389extern int async_data_write_forward_fast(int, sysarg_t, sysarg_t, sysarg_t,
  • uspace/lib/c/include/async_sess.h

    r22027b6e r8b5690f  
    4545} async_sess_t;
    4646
    47 extern void _async_sess_init(void);
    4847extern void async_session_create(async_sess_t *, int, sysarg_t);
    4948extern void async_session_destroy(async_sess_t *);
  • uspace/lib/c/include/byteorder.h

    r22027b6e r8b5690f  
    8080#endif
    8181
    82 #define htons(n)        host2uint16_t_be((n))
    83 #define htonl(n)        host2uint32_t_be((n))
    84 #define ntohs(n)        uint16_t_be2host((n))
    85 #define ntohl(n)        uint32_t_be2host((n))
     82#define htons(n)  host2uint16_t_be((n))
     83#define htonl(n)  host2uint32_t_be((n))
     84#define ntohs(n)  uint16_t_be2host((n))
     85#define ntohl(n)  uint32_t_be2host((n))
    8686
    8787static inline uint64_t uint64_t_byteorder_swap(uint64_t n)
  • uspace/lib/c/include/ddi.h

    r22027b6e r8b5690f  
    3636#define LIBC_DDI_H_
    3737
     38#include <sys/types.h>
     39#include <kernel/ddi/irq.h>
    3840#include <task.h>
    3941
     
    4244extern int iospace_enable(task_id_t, void *, unsigned long);
    4345extern int pio_enable(void *, size_t, void **);
    44 extern int interrupt_enable(int);
    45 extern int interrupt_disable(int);
     46extern int register_irq(int, int, int, irq_code_t *);
     47extern int unregister_irq(int, int);
    4648
    4749#endif
  • uspace/lib/c/include/devman.h

    r22027b6e r8b5690f  
    4141#include <bool.h>
    4242
    43 
    4443extern int devman_get_phone(devman_interface_t, unsigned int);
    4544extern void devman_hangup_phone(devman_interface_t);
  • uspace/lib/c/include/err.h

    r22027b6e r8b5690f  
    3939
    4040#define errx(status, fmt, ...) \
    41         { \
     41        do { \
    4242                printf((fmt), ##__VA_ARGS__); \
    43                 _exit(status); \
    44         }
     43                exit(status); \
     44        } while (0)
    4545
    4646#endif
  • uspace/lib/c/include/errno.h

    r22027b6e r8b5690f  
    3939#include <fibril.h>
    4040
     41#define errno _errno
     42
    4143extern int _errno;
    42 
    43 #define errno _errno
    4444
    4545#define EMFILE        (-18)
     
    5757
    5858/** An API function is called while another blocking function is in progress. */
    59 #define EINPROGRESS     (-10036)
     59#define EINPROGRESS  (-10036)
    6060
    6161/** The socket identifier is not valid. */
    62 #define ENOTSOCK        (-10038)
     62#define ENOTSOCK  (-10038)
    6363
    6464/** The destination address required. */
    65 #define EDESTADDRREQ    (-10039)
     65#define EDESTADDRREQ  (-10039)
    6666
    6767/** Protocol is not supported.  */
    68 #define EPROTONOSUPPORT (-10043)
     68#define EPROTONOSUPPORT  (-10043)
    6969
    7070/** Socket type is not supported. */
    71 #define ESOCKTNOSUPPORT (-10044)
     71#define ESOCKTNOSUPPORT  (-10044)
    7272
    7373/** Protocol family is not supported. */
    74 #define EPFNOSUPPORT    (-10046)
     74#define EPFNOSUPPORT  (-10046)
    7575
    7676/** Address family is not supported. */
    77 #define EAFNOSUPPORT    (-10047)
     77#define EAFNOSUPPORT  (-10047)
    7878
    7979/** Address is already in use. */
    80 #define EADDRINUSE      (-10048)
     80#define EADDRINUSE  (-10048)
    8181
    8282/** The socket is not connected or bound. */
    83 #define ENOTCONN        (-10057)
     83#define ENOTCONN  (-10057)
    8484
    8585/** The requested operation was not performed. Try again later. */
    86 #define EAGAIN          (-11002)
     86#define EAGAIN  (-11002)
    8787
    88 /** No data.
    89  */
    90 #define NO_DATA         (-11004)
     88/** No data. */
     89#define NO_DATA (-11004)
    9190
    9291#endif
  • uspace/lib/c/include/event.h

    r22027b6e r8b5690f  
    3737
    3838#include <kernel/ipc/event_types.h>
    39 #include <ipc/ipc.h>
    4039
    4140extern int event_subscribe(event_type_t, sysarg_t);
  • uspace/lib/c/include/io/console.h

    r22027b6e r8b5690f  
    3636#define LIBC_IO_CONSOLE_H_
    3737
    38 #include <ipc/ipc.h>
    3938#include <bool.h>
    4039
  • uspace/lib/c/include/io/screenbuffer.h

    r22027b6e r8b5690f  
    3838#include <stdint.h>
    3939#include <sys/types.h>
    40 #include <ipc/ipc.h>
    4140#include <bool.h>
    4241
  • uspace/lib/c/include/ipc/adb.h

    r22027b6e r8b5690f  
    3232/** @file
    3333 * @brief ADB device interface.
    34  */ 
     34 */
    3535
    3636#ifndef LIBC_IPC_ADB_H_
    3737#define LIBC_IPC_ADB_H_
    3838
    39 #include <ipc/ipc.h>
     39#include <ipc/common.h>
    4040
    4141typedef enum {
    4242        ADB_REG_WRITE = IPC_FIRST_USER_METHOD
    4343} adb_request_t;
    44 
    4544
    4645typedef enum {
  • uspace/lib/c/include/ipc/arp.h

    r22027b6e r8b5690f  
    3939#define LIBC_ARP_MESSAGES_
    4040
    41 #include <ipc/ipc.h>
    4241#include <ipc/net.h>
    4342
     
    6968/*@{*/
    7069
    71 /** Returns the protocol service message parameter.
    72  * @param[in] call The message call structure.
     70/** Return the protocol service message parameter.
     71 *
     72 * @param[in] call Message call structure.
     73 *
    7374 */
    74 #define ARP_GET_NETIF(call) \
    75         ({ \
    76                 services_t service = (services_t) IPC_GET_ARG2(*call); \
    77                 service; \
    78         })
     75#define ARP_GET_NETIF(call) ((services_t) IPC_GET_ARG2(call))
    7976
    8077/*@}*/
  • uspace/lib/c/include/ipc/bd.h

    r22027b6e r8b5690f  
    3131 */
    3232/** @file
    33  */ 
     33 */
    3434
    3535#ifndef LIBC_IPC_BD_H_
    3636#define LIBC_IPC_BD_H_
    3737
    38 #include <ipc/ipc.h>
     38#include <ipc/common.h>
    3939
    4040typedef enum {
  • uspace/lib/c/include/ipc/char.h

    r22027b6e r8b5690f  
    3232/** @file
    3333 * @brief Character device interface.
    34  */ 
     34 */
    3535
    3636#ifndef LIBC_IPC_CHAR_H_
    3737#define LIBC_IPC_CHAR_H_
    3838
    39 #include <ipc/ipc.h>
     39#include <ipc/common.h>
    4040
    4141typedef enum {
    4242        CHAR_WRITE_BYTE = IPC_FIRST_USER_METHOD
    4343} char_request_t;
    44 
    4544
    4645typedef enum {
  • uspace/lib/c/include/ipc/clipboard.h

    r22027b6e r8b5690f  
    3636#define LIBC_IPC_CLIPBOARD_H_
    3737
    38 #include <ipc/ipc.h>
    39 
    4038typedef enum {
    4139        CLIPBOARD_PUT_DATA = IPC_FIRST_USER_METHOD,
  • uspace/lib/c/include/ipc/common.h

    r22027b6e r8b5690f  
    11/*
    2  * Copyright (c) 2008 Lukas Mejdrech
     2 * Copyright (c) 2011 Martin Decky
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup icmp
     29/** @addtogroup libcipc
    3030 * @{
    3131 */
    32 
    3332/** @file
    34  * ICMP module functions.
    35  * The functions are used as ICMP module entry points.
    3633 */
    3734
    38 #ifndef NET_ICMP_MODULE_H_
    39 #define NET_ICMP_MODULE_H_
     35#ifndef LIBC_IPC_COMMON_H_
     36#define LIBC_IPC_COMMON_H_
    4037
    41 #include <async.h>
    42 #include <ipc/ipc.h>
     38#include <sys/types.h>
     39#include <atomic.h>
     40#include <kernel/ipc/ipc.h>
    4341
    44 extern int icmp_initialize(async_client_conn_t);
    45 extern int icmp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    46     int *);
     42#define IPC_FLAG_BLOCKING  0x01
     43
     44typedef struct {
     45        sysarg_t args[IPC_CALL_LEN];
     46        sysarg_t in_task_hash;
     47        sysarg_t in_phone_hash;
     48} ipc_call_t;
     49
     50typedef sysarg_t ipc_callid_t;
     51
     52extern atomic_t async_futex;
    4753
    4854#endif
  • uspace/lib/c/include/ipc/console.h

    r22027b6e r8b5690f  
    3636#define LIBC_IPC_CONSOLE_H_
    3737
    38 #include <ipc/ipc.h>
    3938#include <ipc/vfs.h>
    4039
  • uspace/lib/c/include/ipc/dev_iface.h

    r22027b6e r8b5690f  
    3030#define LIBC_IPC_DEV_IFACE_H_
    3131
    32 #include <ipc/ipc.h>
    3332#include <malloc.h>
    3433#include <unistd.h>
  • uspace/lib/c/include/ipc/devman.h

    r22027b6e r8b5690f  
    3030 * @{
    3131 */
    32  
     32
    3333#ifndef LIBC_IPC_DEVMAN_H_
    3434#define LIBC_IPC_DEVMAN_H_
    3535
     36#include <ipc/common.h>
    3637#include <adt/list.h>
    37 #include <ipc/ipc.h>
    38 #include <stdlib.h>
    39 #include <stdio.h>
    40 #include <str.h>
     38#include <malloc.h>
     39#include <mem.h>
    4140
    42 #define DEVMAN_NAME_MAXLEN 256
     41#define DEVMAN_NAME_MAXLEN  256
    4342
    4443typedef sysarg_t devman_handle_t;
     
    6766} match_id_list_t;
    6867
    69 
    70 static inline match_id_t * create_match_id()
     68static inline match_id_t *create_match_id(void)
    7169{
    7270        match_id_t *id = malloc(sizeof(match_id_t));
     
    8583}
    8684
    87 static inline void add_match_id(match_id_list_t *ids, match_id_t *id) 
     85static inline void add_match_id(match_id_list_t *ids, match_id_t *id)
    8886{
    8987        match_id_t *mid = NULL;
    90         link_t *link = ids->ids.next;   
     88        link_t *link = ids->ids.next;
    9189       
    9290        while (link != &ids->ids) {
     
    9896        }
    9997       
    100         list_insert_before(&id->link, link);   
     98        list_insert_before(&id->link, link);
    10199}
    102100
  • uspace/lib/c/include/ipc/devmap.h

    r22027b6e r8b5690f  
    3434#define DEVMAP_DEVMAP_H_
    3535
    36 #include <atomic.h>
    37 #include <ipc/ipc.h>
    38 #include <adt/list.h>
     36#include <ipc/common.h>
    3937
    4038#define DEVMAP_NAME_MAXLEN  255
  • uspace/lib/c/include/ipc/fb.h

    r22027b6e r8b5690f  
    3131 */
    3232/** @file
    33  */ 
     33 */
    3434
    3535#ifndef LIBC_FB_H_
    3636#define LIBC_FB_H_
    3737
    38 #include <ipc/ipc.h>
     38#include <ipc/common.h>
    3939
    4040typedef enum {
  • uspace/lib/c/include/ipc/icmp.h

    r22027b6e r8b5690f  
    3333/** @file
    3434 * ICMP module messages.
    35  * @see icmp_interface.h
     35 * @see icmp_remote.h
    3636 */
    3737
     
    3939#define LIBC_ICMP_MESSAGES_
    4040
    41 #include <ipc/ipc.h>
    4241#include <ipc/net.h>
    4342#include <sys/types.h>
    4443#include <sys/time.h>
    45 
    4644#include <net/icmp_codes.h>
    4745
    4846/** ICMP module messages. */
    4947typedef enum {
    50         /** Sends echo request. @see icmp_echo() */
     48        /** Send echo request. @see icmp_echo() */
    5149        NET_ICMP_ECHO = NET_ICMP_FIRST,
    5250       
    5351        /**
    54          * Sends destination unreachable error message.
     52         * Send destination unreachable error message.
    5553         * @see icmp_destination_unreachable_msg()
    5654         */
     
    5856       
    5957        /**
    60          * Sends source quench error message.
     58         * Send source quench error message.
    6159         * @see icmp_source_quench_msg()
    6260         */
     
    6462       
    6563        /**
    66          * Sends time exceeded error message.
     64         * Send time exceeded error message.
    6765         * @see icmp_time_exceeded_msg()
    6866         */
     
    7068       
    7169        /**
    72          * Sends parameter problem error message.
     70         * Send parameter problem error message.
    7371         * @see icmp_parameter_problem_msg()
    7472         */
    75         NET_ICMP_PARAMETERPROB,
    76        
    77         /** Initializes new connection. */
    78         NET_ICMP_INIT
    79 } icmp_messages;
     73        NET_ICMP_PARAMETERPROB
     74} icmp_messages_t;
    8075
    8176/** @name ICMP specific message parameters definitions */
    8277/*@{*/
    8378
    84 /** Returns the ICMP code message parameter.
     79/** Return the ICMP code message parameter.
    8580 *
    86  * @param[in] call      The message call structure.
     81 * @param[in] call Message call structure.
     82 *
    8783 */
    88 #define ICMP_GET_CODE(call) \
    89         ({ \
    90                 icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); \
    91                 code; \
    92         })
     84#define ICMP_GET_CODE(call)  ((icmp_code_t) IPC_GET_ARG1(call))
    9385
    94 /** Returns the ICMP link MTU message parameter.
     86/** Return the ICMP link MTU message parameter.
    9587 *
    96  * @param[in] call      The message call structure.
     88 * @param[in] call Message call structure.
     89 *
    9790 */
    98 #define ICMP_GET_MTU(call) \
    99         ({ \
    100                 icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); \
    101                 mtu; \
    102         })
     91#define ICMP_GET_MTU(call)  ((icmp_param_t) IPC_GET_ARG3(call))
    10392
    104 /** Returns the pointer message parameter.
     93/** Return the pointer message parameter.
    10594 *
    106  * @param[in] call      The message call structure.
     95 * @param[in] call Message call structure.
     96 *
    10797 */
    108 #define ICMP_GET_POINTER(call) \
    109         ({ \
    110                 icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); \
    111                 pointer; \
    112         })
     98#define ICMP_GET_POINTER(call)  ((icmp_param_t) IPC_GET_ARG3(call))
    11399
    114 /** Returns the size message parameter.
     100/** Return the size message parameter.
    115101 *
    116  * @param[in] call      The message call structure.
     102 * @param[in] call Message call structure.
     103 *
    117104 */
    118 #define ICMP_GET_SIZE(call) \
    119         ({ \
    120                 size_t size = (size_t) IPC_GET_ARG1(call); \
    121                 size; \
    122         })
     105#define ICMP_GET_SIZE(call)  ((size_t) IPC_GET_ARG1(call))
    123106
    124 /** Returns the timeout message parameter.
     107/** Return the timeout message parameter.
    125108 *
    126  * @param[in] call      The message call structure.
     109 * @param[in] call Message call structure.
     110 *
    127111 */
    128 #define ICMP_GET_TIMEOUT(call) \
    129         ({ \
    130                 suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); \
    131                 timeout; \
    132         })
     112#define ICMP_GET_TIMEOUT(call)  ((suseconds_t) IPC_GET_ARG2(call))
    133113
    134 /** Returns the time to live message parameter.
     114/** Return the time to live message parameter.
    135115 *
    136  * @param[in] call      The message call structure.
     116 * @param[in] call Message call structure.
     117 *
    137118 */
    138 #define ICMP_GET_TTL(call) \
    139         ({ \
    140                 ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); \
    141                 ttl; \
    142         })
     119#define ICMP_GET_TTL(call)  ((ip_ttl_t) IPC_GET_ARG3(call))
    143120
    144 /** Returns the type of service message parameter.
     121/** Return the type of service message parameter.
    145122 *
    146  * @param[in] call      The message call structure.
     123 * @param[in] call Message call structure.
     124 *
    147125 */
    148 #define ICMP_GET_TOS(call) \
    149         ({ \
    150                 ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); \
    151                 tos; \
    152         })
     126#define ICMP_GET_TOS(call)  ((ip_tos_t) IPC_GET_ARG4(call))
    153127
    154 /** Returns the dont fragment message parameter.
     128/** Return the dont fragment message parameter.
    155129 *
    156  * @param[in] call      The message call structure.
     130 * @param[in] call Message call structure.
    157131 */
    158 #define ICMP_GET_DONT_FRAGMENT(call) \
    159         ({ \
    160                 int dont_fragment = (int) IPC_GET_ARG5(call); \
    161                 dont_fragment; \
    162         })
     132#define ICMP_GET_DONT_FRAGMENT(call)  ((int) IPC_GET_ARG5(call))
    163133
    164134/*@}*/
  • uspace/lib/c/include/ipc/il.h

    r22027b6e r8b5690f  
    3333/** @file
    3434 * Internetwork layer modules messages.
    35  * @see il_interface.h
     35 * @see il_remote.h
    3636 * @see ip_interface.h
    3737 */
     
    4040#define LIBC_IL_MESSAGES_H_
    4141
    42 #include <ipc/ipc.h>
    4342#include <ipc/net.h>
    4443
    4544/** Internet layer modules messages. */
    4645typedef enum {
    47         /** New device message.
    48          * @see ip_device_req()
    49          */
    50         NET_IL_DEVICE = NET_IL_FIRST,
    5146        /** Device state changed message.
    5247         * @see il_device_state_msg()
    5348         */
    54         NET_IL_DEVICE_STATE,
     49        NET_IL_DEVICE_STATE = NET_IL_FIRST,
     50       
    5551        /** Device MTU changed message.
    5652         * @see il_mtu_changed_msg()
    5753         */
    5854        NET_IL_MTU_CHANGED,
    59         /** Packet size message.
    60          * @see il_packet_size_req()
    61          */
    62         NET_IL_PACKET_SPACE,
     55       
    6356        /** Packet received message.
    6457         * @see il_received_msg()
    6558         */
    66         NET_IL_RECEIVED,
    67         /** Packet send message.
    68          * @see il_send_msg()
    69          */
    70         NET_IL_SEND
     59        NET_IL_RECEIVED
    7160} il_messages;
    7261
     
    7564
    7665/** Return the protocol number message parameter.
    77  * @param[in] call The message call structure.
     66 *
     67 * @param[in] call Message call structure.
     68 *
    7869 */
    79 #define IL_GET_PROTO(call)      (int) IPC_GET_ARG1(*call)
     70#define IL_GET_PROTO(call)  ((int) IPC_GET_ARG1(call))
    8071
    8172/** Return the registering service message parameter.
    82  * @param[in] call The message call structure.
     73 *
     74 * @param[in] call Message call structure.
     75 *
    8376 */
    84 #define IL_GET_SERVICE(call)    (services_t) IPC_GET_ARG2(*call)
     77#define IL_GET_SERVICE(call)  ((services_t) IPC_GET_ARG2(call))
    8578
    8679/*@}*/
  • uspace/lib/c/include/ipc/ip.h

    r22027b6e r8b5690f  
    3939#define LIBC_IP_MESSAGES_H_
    4040
    41 #include <ipc/ipc.h>
    4241#include <ipc/net.h>
    43 
    4442#include <net/in.h>
    4543#include <net/ip_codes.h>
     
    4745/** IP module messages. */
    4846typedef enum {
     47        /** New device message.
     48         * @see ip_device_req()
     49         */
     50        NET_IP_DEVICE = NET_IP_FIRST,
     51       
    4952        /** Adds the routing entry.
    5053         * @see ip_add_route()
    5154         */
    52         NET_IP_ADD_ROUTE = NET_IP_FIRST,
     55        NET_IP_ADD_ROUTE,
     56       
    5357        /** Gets the actual route information.
    5458         * @see ip_get_route()
    5559         */
    5660        NET_IP_GET_ROUTE,
     61       
    5762        /** Processes the received error notification.
    5863         * @see ip_received_error_msg()
    5964         */
    6065        NET_IP_RECEIVED_ERROR,
     66       
    6167        /** Sets the default gateway.
    6268         * @see ip_set_default_gateway()
    6369         */
    64         NET_IP_SET_GATEWAY
     70        NET_IP_SET_GATEWAY,
     71       
     72        /** Packet size message.
     73         * @see ip_packet_size_req()
     74         */
     75        NET_IP_PACKET_SPACE,
     76       
     77        /** Packet send message.
     78         * @see ip_send_msg()
     79         */
     80        NET_IP_SEND
    6581} ip_messages;
    6682
     
    6884/*@{*/
    6985
    70 /** Returns the address message parameter.
    71  * @param[in] call The message call structure.
     86/** Return the address message parameter.
     87 *
     88 * @param[in] call Message call structure.
     89 *
    7290 */
    7391#define IP_GET_ADDRESS(call) \
    7492        ({ \
    7593                in_addr_t addr; \
    76                 addr.s_addr = IPC_GET_ARG3(*call); \
     94                addr.s_addr = IPC_GET_ARG3(call); \
    7795                addr; \
    7896        })
    7997
    80 /** Returns the gateway message parameter.
    81  * @param[in] call The message call structure.
     98/** Return the gateway message parameter.
     99 *
     100 * @param[in] call Message call structure.
     101 *
    82102 */
    83103#define IP_GET_GATEWAY(call) \
    84104        ({ \
    85105                in_addr_t addr; \
    86                 addr.s_addr = IPC_GET_ARG2(*call); \
     106                addr.s_addr = IPC_GET_ARG2(call); \
    87107                addr; \
    88108        })
    89109
    90 /** Sets the header length in the message answer.
    91  * @param[out] answer The message answer structure.
     110/** Set the header length in the message answer.
     111 *
     112 * @param[out] answer Message answer structure.
     113 *
    92114 */
    93 #define IP_SET_HEADERLEN(answer, value) \
    94         do { \
    95                 sysarg_t argument = (sysarg_t) (value); \
    96                 IPC_SET_ARG2(*answer, argument); \
    97         } while (0)
     115#define IP_SET_HEADERLEN(answer, value)  IPC_SET_ARG2(answer, (sysarg_t) (value))
    98116
    99 /** Returns the network mask message parameter.
    100  * @param[in] call The message call structure.
     117/** Return the network mask message parameter.
     118 *
     119 * @param[in] call Message call structure.
     120 *
    101121 */
    102122#define IP_GET_NETMASK(call) \
    103123        ({ \
    104124                in_addr_t addr; \
    105                 addr.s_addr = IPC_GET_ARG4(*call); \
     125                addr.s_addr = IPC_GET_ARG4(call); \
    106126                addr; \
    107127        })
    108128
    109 /** Returns the protocol message parameter.
    110  * @param[in] call The message call structure.
     129/** Return the protocol message parameter.
     130 *
     131 * @param[in] call Message call structure.
     132 *
    111133 */
    112 #define IP_GET_PROTOCOL(call) \
    113         ({ \
    114                 ip_protocol_t protocol = (ip_protocol_t) IPC_GET_ARG1(*call); \
    115                 protocol; \
    116         })
     134#define IP_GET_PROTOCOL(call)  ((ip_protocol_t) IPC_GET_ARG1(call))
    117135
    118136/*@}*/
  • uspace/lib/c/include/ipc/ipc.h

    r22027b6e r8b5690f  
    3333 */
    3434
    35 #ifndef LIBIPC_IPC_H_
    36 #define LIBIPC_IPC_H_
    37 
     35#if ((defined(LIBC_ASYNC_H_)) && (!defined(LIBC_ASYNC_C_)))
     36        #error Do not intermix low-level IPC interface and async framework
     37#endif
     38
     39#ifndef LIBC_IPC_H_
     40#define LIBC_IPC_H_
     41
     42#include <sys/types.h>
     43#include <ipc/common.h>
     44#include <kernel/synch/synch.h>
    3845#include <task.h>
    39 #include <kernel/ipc/ipc.h>
    40 #include <kernel/ddi/irq.h>
    41 #include <sys/types.h>
    42 #include <kernel/synch/synch.h>
    43 
    44 #define IPC_FLAG_BLOCKING  0x01
    45 
    46 typedef struct {
    47         sysarg_t args[IPC_CALL_LEN];
    48         sysarg_t in_phone_hash;
    49 } ipc_call_t;
    50 
    51 typedef sysarg_t ipc_callid_t;
    52 
    53 typedef void (* ipc_async_callback_t)(void *, int, ipc_call_t *);
     46
     47typedef void (*ipc_async_callback_t)(void *, int, ipc_call_t *);
    5448
    5549/*
     
    5953 * possible, the fast version is used.
    6054 */
     55
    6156#define ipc_call_sync_0_0(phoneid, method) \
    6257        ipc_call_sync_fast((phoneid), (method), 0, 0, 0, 0, 0, 0, 0, 0)
     
    188183    sysarg_t *);
    189184
    190 extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, uint32_t, int);
    191 extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *, uint32_t);
     185extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, sysarg_t, unsigned int);
    192186extern void ipc_poke(void);
    193187
    194 static inline ipc_callid_t ipc_wait_for_call(ipc_call_t *data)
    195 {
    196         return ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT);
    197 }
    198 
     188#define ipc_wait_for_call(data) \
     189        ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT);
     190
     191extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *, sysarg_t);
    199192extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *);
    200193
     
    205198 * to m.
    206199 */
     200
    207201#define ipc_answer_0(callid, retval) \
    208202        ipc_answer_fast((callid), (retval), 0, 0, 0, 0)
     
    229223 * to m.
    230224 */
     225
    231226#define ipc_call_async_0(phoneid, method, private, callback, can_preempt) \
    232227        ipc_call_async_fast((phoneid), (method), 0, 0, 0, 0, (private), \
     
    254249
    255250extern void ipc_call_async_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    256     sysarg_t, void *, ipc_async_callback_t, int);
     251    sysarg_t, void *, ipc_async_callback_t, bool);
    257252extern void ipc_call_async_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    258     sysarg_t, sysarg_t, void *, ipc_async_callback_t, int);
    259 
    260 extern int ipc_connect_to_me(int, int, int, int, sysarg_t *);
    261 extern int ipc_connect_me_to(int, int, int, int);
    262 extern int ipc_connect_me_to_blocking(int, int, int, int);
     253    sysarg_t, sysarg_t, void *, ipc_async_callback_t, bool);
     254
     255extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t *,
     256    sysarg_t *);
     257extern int ipc_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
     258extern int ipc_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
     259
    263260extern int ipc_hangup(int);
    264 extern int ipc_register_irq(int, int, int, irq_code_t *);
    265 extern int ipc_unregister_irq(int, int);
    266 extern int ipc_forward_fast(ipc_callid_t, int, int, sysarg_t, sysarg_t, int);
    267 extern int ipc_forward_slow(ipc_callid_t, int, int, sysarg_t, sysarg_t,
    268     sysarg_t, sysarg_t, sysarg_t, int);
     261
     262extern int ipc_forward_fast(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t,
     263    unsigned int);
     264extern int ipc_forward_slow(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t,
     265    sysarg_t, sysarg_t, sysarg_t, unsigned int);
    269266
    270267/*
    271268 * User-friendly wrappers for ipc_share_in_start().
    272269 */
     270
    273271#define ipc_share_in_start_0_0(phoneid, dst, size) \
    274272        ipc_share_in_start((phoneid), (dst), (size), 0, NULL)
     
    280278        ipc_share_in_start((phoneid), (dst), (size), (arg), (flags))
    281279
    282 extern int ipc_share_in_start(int, void *, size_t, sysarg_t, int *);
    283 extern int ipc_share_in_finalize(ipc_callid_t, void *, int );
    284 extern int ipc_share_out_start(int, void *, int);
     280extern int ipc_share_in_start(int, void *, size_t, sysarg_t, unsigned int *);
     281extern int ipc_share_in_finalize(ipc_callid_t, void *, unsigned int);
     282extern int ipc_share_out_start(int, void *, unsigned int);
    285283extern int ipc_share_out_finalize(ipc_callid_t, void *);
    286284extern int ipc_data_read_start(int, void *, size_t);
  • uspace/lib/c/include/ipc/irc.h

    r22027b6e r8b5690f  
    3636#define LIBC_IRC_H_
    3737
    38 #include <ipc/ipc.h>
     38#include <ipc/common.h>
    3939
    4040typedef enum {
  • uspace/lib/c/include/ipc/kbd.h

    r22027b6e r8b5690f  
    3838#define LIBC_IPC_KBD_H_
    3939
    40 #include <ipc/ipc.h>
     40#include <ipc/common.h>
    4141
    4242typedef enum {
  • uspace/lib/c/include/ipc/loader.h

    r22027b6e r8b5690f  
    3131 */
    3232/** @file
    33  */ 
     33 */
    3434
    3535#ifndef LIBC_IPC_LOADER_H_
    3636#define LIBC_IPC_LOADER_H_
    3737
    38 #include <ipc/ipc.h>
     38#include <ipc/common.h>
    3939
    4040typedef enum {
  • uspace/lib/c/include/ipc/mouse.h

    r22027b6e r8b5690f  
    3737#define LIBC_IPC_MOUSE_H_
    3838
    39 #include <ipc/ipc.h>
     39#include <ipc/common.h>
    4040
    4141typedef enum {
  • uspace/lib/c/include/ipc/net.h

    r22027b6e r8b5690f  
    3838#define LIBC_NET_MESSAGES_H_
    3939
    40 #include <ipc/ipc.h>
    4140#include <ipc/services.h>
    42 
    4341#include <net/device.h>
    4442#include <net/packet.h>
    4543
    46 /** Returns a value indicating whether the value is in the interval.
    47  * @param[in] item      The value to be checked.
    48  * @param[in] first_inclusive The first value in the interval inclusive.
    49  * @param[in] last_exclusive The first value after the interval.
     44/** Return a value indicating whether the value is in the interval.
     45 *
     46 * @param[in] item            Value to be checked.
     47 * @param[in] first_inclusive First value in the interval inclusive.
     48 * @param[in] last_exclusive  First value after the interval.
     49 *
    5050 */
    5151#define IS_IN_INTERVAL(item, first_inclusive, last_exclusive) \
     
    5555/*@{*/
    5656
    57 /** The number of ARP messages. */
    58 #define NET_ARP_COUNT           5
    59 
    60 /** The number of Ethernet messages. */
    61 #define NET_ETH_COUNT           0
    62 
    63 /** The number of ICMP messages. */
    64 #define NET_ICMP_COUNT          6
    65 
    66 /** The number of inter-network messages. */
    67 #define NET_IL_COUNT            6
    68 
    69 /** The number of IP messages. */
    70 #define NET_IP_COUNT            4
    71 
    72 /** The number of general networking messages. */
    73 #define NET_NET_COUNT           3
    74 
    75 /** The number of network interface driver messages. */
    76 #define NET_NETIF_COUNT         6
    77 
    78 /** The number of network interface layer messages. */
    79 #define NET_NIL_COUNT           7
    80 
    81 /** The number of packet management system messages. */
    82 #define NET_PACKET_COUNT        5
    83 
    84 /** The number of socket messages. */
    85 #define NET_SOCKET_COUNT        14
    86 
    87 /** The number of TCP messages. */
    88 #define NET_TCP_COUNT           0
    89 
    90 /** The number of transport layer messages. */
    91 #define NET_TL_COUNT            1
    92 
    93 /** The number of UDP messages. */
    94 #define NET_UDP_COUNT           0
     57#define NET_ARP_COUNT     5   /**< Number of ARP messages. */
     58#define NET_ETH_COUNT     0   /**< Number of Ethernet messages. */
     59#define NET_ICMP_COUNT    6   /**< Number of ICMP messages. */
     60#define NET_IL_COUNT      6   /**< Number of inter-network messages. */
     61#define NET_IP_COUNT      4   /**< Number of IP messages. */
     62#define NET_NET_COUNT     3   /**< Number of general networking messages. */
     63#define NET_NETIF_COUNT   6   /**< Number of network interface driver messages. */
     64#define NET_NIL_COUNT     7   /**< Number of network interface layer messages. */
     65#define NET_PACKET_COUNT  5   /**< Number of packet management system messages. */
     66#define NET_SOCKET_COUNT  14  /**< Number of socket messages. */
     67#define NET_TCP_COUNT     0   /**< Number of TCP messages. */
     68#define NET_TL_COUNT      1   /**< Number of transport layer messages. */
     69#define NET_UDP_COUNT     0   /**< Number of UDP messages. */
    9570
    9671/*@}*/
     
    10075/*@{*/
    10176
    102 /** The first networking message. */
    103 #define NET_FIRST               2000
    104 
    105 /** The first network interface layer message. */
    106 #define NET_NETIF_FIRST         NET_FIRST
    107 
    108 /** The last network interface layer message. */
    109 #define NET_NETIF_LAST          (NET_NETIF_FIRST + NET_NETIF_COUNT)
    110 
    111 /** The first general networking message. */
    112 #define NET_NET_FIRST           (NET_NETIF_LAST + 0)
    113 
    114 /** The last general networking message. */
    115 #define NET_NET_LAST            (NET_NET_FIRST + NET_NET_COUNT)
    116 
    117 /** The first network interface layer message. */
    118 #define NET_NIL_FIRST           (NET_NET_LAST + 0)
    119 
    120 /** The last network interface layer message. */
    121 #define NET_NIL_LAST            (NET_NIL_FIRST + NET_NIL_COUNT)
    122 
    123 /** The first Ethernet message. */
    124 #define NET_ETH_FIRST           (NET_NIL_LAST + 0)
    125 
    126 /** The last Ethernet message. */
    127 #define NET_ETH_LAST            (NET_ETH_FIRST + NET_ETH_COUNT)
    128 
    129 /** The first inter-network message. */
    130 #define NET_IL_FIRST            (NET_ETH_LAST + 0)
    131 
    132 /** The last inter-network message. */
    133 #define NET_IL_LAST             (NET_IL_FIRST + NET_IL_COUNT)
    134 
    135 /** The first IP message. */
    136 #define NET_IP_FIRST            (NET_IL_LAST + 0)
    137 
    138 /** The last IP message. */
    139 #define NET_IP_LAST             (NET_IP_FIRST + NET_IP_COUNT)
    140 
    141 /** The first ARP message. */
    142 #define NET_ARP_FIRST           (NET_IP_LAST + 0)
    143 
    144 /** The last ARP message. */
    145 #define NET_ARP_LAST            (NET_ARP_FIRST + NET_ARP_COUNT)
    146 
    147 /** The first ICMP message. */
    148 #define NET_ICMP_FIRST          (NET_ARP_LAST + 0)
    149 
    150 /** The last ICMP message. */
    151 #define NET_ICMP_LAST           (NET_ICMP_FIRST + NET_ICMP_COUNT)
    152 
    153 /** The first ICMP message. */
    154 #define NET_TL_FIRST            (NET_ICMP_LAST + 0)
    155 
    156 /** The last ICMP message. */
    157 #define NET_TL_LAST             (NET_TL_FIRST + NET_TL_COUNT)
    158 
    159 /** The first UDP message. */
    160 #define NET_UDP_FIRST           (NET_TL_LAST + 0)
    161 
    162 /** The last UDP message. */
    163 #define NET_UDP_LAST            (NET_UDP_FIRST + NET_UDP_COUNT)
    164 
    165 /** The first TCP message. */
    166 #define NET_TCP_FIRST           (NET_UDP_LAST + 0)
    167 
    168 /** The last TCP message. */
    169 #define NET_TCP_LAST            (NET_TCP_FIRST + NET_TCP_COUNT)
    170 
    171 /** The first socket message. */
    172 #define NET_SOCKET_FIRST        (NET_TCP_LAST + 0)
    173 
    174 /** The last socket message. */
    175 #define NET_SOCKET_LAST         (NET_SOCKET_FIRST + NET_SOCKET_COUNT)
    176 
    177 /** The first packet management system message. */
    178 #define NET_PACKET_FIRST        (NET_SOCKET_LAST + 0)
    179 
    180 /** The last packet management system message. */
    181 #define NET_PACKET_LAST         (NET_PACKET_FIRST + NET_PACKET_COUNT)
    182 
    183 /** The last networking message. */
    184 #define NET_LAST                NET_PACKET_LAST
    185 
    186 /** The number of networking messages. */
    187 #define NET_COUNT               (NET_LAST - NET_FIRST)
    188 
    189 /** Returns a value indicating whether the IPC call is a generic networking
    190  * message.
    191  * @param[in] call The IPC call to be checked.
     77
     78/** First networking message. */
     79#define NET_FIRST  2000
     80
     81/** First network interface layer message. */
     82#define NET_NETIF_FIRST  NET_FIRST
     83
     84/** Last network interface layer message. */
     85#define NET_NETIF_LAST  (NET_NETIF_FIRST + NET_NETIF_COUNT)
     86
     87/** First general networking message. */
     88#define NET_NET_FIRST  (NET_NETIF_LAST + 0)
     89
     90/** Last general networking message. */
     91#define NET_NET_LAST  (NET_NET_FIRST + NET_NET_COUNT)
     92
     93/** First network interface layer message. */
     94#define NET_NIL_FIRST  (NET_NET_LAST + 0)
     95
     96/** Last network interface layer message. */
     97#define NET_NIL_LAST  (NET_NIL_FIRST + NET_NIL_COUNT)
     98
     99/** First Ethernet message. */
     100#define NET_ETH_FIRST  (NET_NIL_LAST + 0)
     101
     102/** Last Ethernet message. */
     103#define NET_ETH_LAST  (NET_ETH_FIRST + NET_ETH_COUNT)
     104
     105/** First inter-network message. */
     106#define NET_IL_FIRST  (NET_ETH_LAST + 0)
     107
     108/** Last inter-network message. */
     109#define NET_IL_LAST  (NET_IL_FIRST + NET_IL_COUNT)
     110
     111/** First IP message. */
     112#define NET_IP_FIRST  (NET_IL_LAST + 0)
     113
     114/** Last IP message. */
     115#define NET_IP_LAST  (NET_IP_FIRST + NET_IP_COUNT)
     116
     117/** First ARP message. */
     118#define NET_ARP_FIRST  (NET_IP_LAST + 0)
     119
     120/** Last ARP message. */
     121#define NET_ARP_LAST  (NET_ARP_FIRST + NET_ARP_COUNT)
     122
     123/** First ICMP message. */
     124#define NET_ICMP_FIRST  (NET_ARP_LAST + 0)
     125
     126/** Last ICMP message. */
     127#define NET_ICMP_LAST  (NET_ICMP_FIRST + NET_ICMP_COUNT)
     128
     129/** First ICMP message. */
     130#define NET_TL_FIRST  (NET_ICMP_LAST + 0)
     131
     132/** Last ICMP message. */
     133#define NET_TL_LAST  (NET_TL_FIRST + NET_TL_COUNT)
     134
     135/** First UDP message. */
     136#define NET_UDP_FIRST  (NET_TL_LAST + 0)
     137
     138/** Last UDP message. */
     139#define NET_UDP_LAST  (NET_UDP_FIRST + NET_UDP_COUNT)
     140
     141/** First TCP message. */
     142#define NET_TCP_FIRST  (NET_UDP_LAST + 0)
     143
     144/** Last TCP message. */
     145#define NET_TCP_LAST  (NET_TCP_FIRST + NET_TCP_COUNT)
     146
     147/** First socket message. */
     148#define NET_SOCKET_FIRST  (NET_TCP_LAST + 0)
     149
     150/** Last socket message. */
     151#define NET_SOCKET_LAST  (NET_SOCKET_FIRST + NET_SOCKET_COUNT)
     152
     153/** First packet management system message. */
     154#define NET_PACKET_FIRST  (NET_SOCKET_LAST + 0)
     155
     156/** Last packet management system message. */
     157#define NET_PACKET_LAST  (NET_PACKET_FIRST + NET_PACKET_COUNT)
     158
     159/** Last networking message. */
     160#define NET_LAST  NET_PACKET_LAST
     161
     162/** Number of networking messages. */
     163#define NET_COUNT  (NET_LAST - NET_FIRST)
     164
     165/** Check if the IPC call is a generic networking message.
     166 *
     167 * @param[in] call IPC call to be checked.
     168 *
    192169 */
    193170#define IS_NET_MESSAGE(call) \
    194         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_FIRST, NET_LAST)
    195 
    196 /** Returns a value indicating whether the IPC call is an ARP message.
    197  * @param[in] call The IPC call to be checked.
     171        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_FIRST, NET_LAST)
     172
     173/** Check if the IPC call is an ARP message.
     174 *
     175 * @param[in] call IPC call to be checked.
     176 *
    198177 */
    199178#define IS_NET_ARP_MESSAGE(call) \
    200         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_ARP_FIRST, NET_ARP_LAST)
    201 
    202 /** Returns a value indicating whether the IPC call is an Ethernet message.
    203  * @param[in] call The IPC call to be checked.
     179        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ARP_FIRST, NET_ARP_LAST)
     180
     181/** Check if the IPC call is an Ethernet message.
     182 *
     183 * @param[in] call IPC call to be checked.
     184 *
    204185 */
    205186#define IS_NET_ETH_MESSAGE(call) \
    206         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_ETH_FIRST, NET_ETH_LAST)
    207 
    208 /** Returns a value indicating whether the IPC call is an ICMP message.
    209  * @param[in] call The IPC call to be checked.
     187        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ETH_FIRST, NET_ETH_LAST)
     188
     189/** Check if the IPC call is an ICMP message.
     190 *
     191 * @param[in] call IPC call to be checked.
     192 *
    210193 */
    211194#define IS_NET_ICMP_MESSAGE(call) \
    212         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_ICMP_FIRST, NET_ICMP_LAST)
    213 
    214 /** Returns a value indicating whether the IPC call is an inter-network layer
    215  * message.
    216  * @param[in] call The IPC call to be checked.
     195        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ICMP_FIRST, NET_ICMP_LAST)
     196
     197/** Check if the IPC call is an inter-network layer message.
     198 *
     199 * @param[in] call IPC call to be checked.
     200 *
    217201 */
    218202#define IS_NET_IL_MESSAGE(call) \
    219         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_IL_FIRST, NET_IL_LAST)
    220 
    221 /** Returns a value indicating whether the IPC call is an IP message.
    222  * @param[in] call The IPC call to be checked.
     203        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_IL_FIRST, NET_IL_LAST)
     204
     205/** Check if the IPC call is an IP message.
     206 *
     207 * @param[in] call IPC call to be checked.
     208 *
    223209 */
    224210#define IS_NET_IP_MESSAGE(call) \
    225         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_IP_FIRST, NET_IP_LAST)
    226 
    227 /** Returns a value indicating whether the IPC call is a generic networking
    228  * message.
    229  * @param[in] call The IPC call to be checked.
     211        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_IP_FIRST, NET_IP_LAST)
     212
     213/** Check if the IPC call is a generic networking message.
     214 *
     215 * @param[in] call IPC call to be checked.
     216 *
    230217 */
    231218#define IS_NET_NET_MESSAGE(call) \
    232         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_NET_FIRST, NET_NET_LAST)
    233 
    234 /** Returns a value indicating whether the IPC call is a network interface layer
    235  * message.
    236  * @param[in] call The IPC call to be checked.
     219        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_NET_FIRST, NET_NET_LAST)
     220
     221/** Check if the IPC call is a network interface layer message.
     222 *
     223 * @param[in] call IPC call to be checked.
     224 *
    237225 */
    238226#define IS_NET_NIL_MESSAGE(call) \
    239         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_NIL_FIRST, NET_NIL_LAST)
    240 
    241 /** Returns a value indicating whether the IPC call is a packet manaagement
    242  * system message.
    243  * @param[in] call The IPC call to be checked.
     227        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_NIL_FIRST, NET_NIL_LAST)
     228
     229/** Check if the IPC call is a packet manaagement system message.
     230 *
     231 * @param[in] call IPC call to be checked.
     232 *
    244233 */
    245234#define IS_NET_PACKET_MESSAGE(call) \
    246         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_PACKET_FIRST, NET_PACKET_LAST)
    247 
    248 /** Returns a value indicating whether the IPC call is a socket message.
    249  * @param[in] call The IPC call to be checked.
     235        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_PACKET_FIRST, NET_PACKET_LAST)
     236
     237/** Check if the IPC call is a socket message.
     238 *
     239 * @param[in] call IPC call to be checked.
     240 *
    250241 */
    251242#define IS_NET_SOCKET_MESSAGE(call) \
    252         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_SOCKET_FIRST, NET_SOCKET_LAST)
    253 
    254 /** Returns a value indicating whether the IPC call is a TCP message.
    255  * @param[in] call The IPC call to be checked.
     243        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_SOCKET_FIRST, NET_SOCKET_LAST)
     244
     245/** Check if the IPC call is a TCP message.
     246 *
     247 * @param[in] call IPC call to be checked.
     248 *
    256249 */
    257250#define IS_NET_TCP_MESSAGE(call) \
    258         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_TCP_FIRST, NET_TCP_LAST)
    259 
    260 /** Returns a value indicating whether the IPC call is a transport layer message.
    261  * @param[in] call The IPC call to be checked.
     251        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_TCP_FIRST, NET_TCP_LAST)
     252
     253/** Check if the IPC call is a transport layer message.
     254 *
     255 * @param[in] call IPC call to be checked.
     256 *
    262257 */
    263258#define IS_NET_TL_MESSAGE(call) \
    264         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_TL_FIRST, NET_TL_LAST)
    265 
    266 /** Returns a value indicating whether the IPC call is a UDP message.
    267  * @param[in] call The IPC call to be checked.
     259        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_TL_FIRST, NET_TL_LAST)
     260
     261/** Check if the IPC call is a UDP message.
     262 *
     263 * @param[in] call IPC call to be checked.
     264 *
    268265 */
    269266#define IS_NET_UDP_MESSAGE(call) \
    270         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_UDP_FIRST, NET_UDP_LAST)
     267        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_UDP_FIRST, NET_UDP_LAST)
    271268
    272269/*@}*/
     
    275272/*@{*/
    276273
    277 /** Returns the device identifier message argument.
    278  * @param[in] call The message call structure.
    279  */
    280 #define IPC_GET_DEVICE(call) \
    281         ({ \
    282                 device_id_t device_id = (device_id_t) IPC_GET_ARG1(*call); \
    283                 device_id; \
    284         })
    285 
    286 /** Returns the packet identifier message argument.
    287  * @param[in] call The message call structure.
    288  */
    289 #define IPC_GET_PACKET(call) \
    290         ({ \
    291                 packet_id_t packet_id = (packet_id_t) IPC_GET_ARG2(*call); \
    292                 packet_id; \
    293         })
    294 
    295 /** Returns the count message argument.
    296  * @param[in] call The message call structure.
    297  */
    298 #define IPC_GET_COUNT(call) \
    299         ({ \
    300                 size_t size = (size_t) IPC_GET_ARG2(*call); \
    301                 size; \
    302         })
    303 
    304 /** Returns the device state message argument.
    305  * @param[in] call The message call structure.
    306  */
    307 #define IPC_GET_STATE(call) \
    308         ({ \
    309                 device_state_t state = (device_state_t) IPC_GET_ARG2(*call); \
    310                 state; \
    311         })
    312 
    313 /** Returns the maximum transmission unit message argument.
    314  * @param[in] call The message call structure.
    315  */
    316 #define IPC_GET_MTU(call) \
    317         ({ \
    318                 size_t size = (size_t) IPC_GET_ARG2(*call); \
    319                 size; \
    320         })
    321 
    322 /** Returns the device driver service message argument.
    323  * @param[in] call The message call structure.
    324  */
    325 #define IPC_GET_SERVICE(call) \
    326         ({ \
    327                 services_t service = (services_t) IPC_GET_ARG3(*call); \
    328                 service; \
    329         })
    330 
    331 /** Returns the target service message argument.
    332  * @param[in] call The message call structure.
    333  */
    334 #define IPC_GET_TARGET(call) \
    335         ({ \
    336                 services_t service = (services_t) IPC_GET_ARG3(*call); \
    337                 service; \
    338         })
    339 
    340 /** Returns the sender service message argument.
    341  * @param[in] call The message call structure.
    342  */
    343 #define IPC_GET_SENDER(call) \
    344         ({ \
    345                 services_t service = (services_t) IPC_GET_ARG3(*call); \
    346                 service; \
    347         })
    348 
    349 /** Returns the error service message argument.
    350  * @param[in] call The message call structure.
    351  */
    352 #define IPC_GET_ERROR(call) \
    353         ({ \
    354                 services_t service = (services_t) IPC_GET_ARG4(*call); \
    355                 service; \
    356         })
    357 
    358 /** Returns the phone message argument.
    359  * @param[in] call The message call structure.
    360  */
    361 #define IPC_GET_PHONE(call) \
    362         ({ \
    363                 int phone = (int) IPC_GET_ARG5(*call); \
    364                 phone; \
    365         })
    366 
    367 /** Sets the device identifier in the message answer.
    368  * @param[out] answer The message answer structure.
    369  */
    370 #define IPC_SET_DEVICE(answer, value) \
    371         do { \
    372                 sysarg_t argument = (sysarg_t) (value); \
    373                 IPC_SET_ARG1(*answer, argument); \
    374         } while (0)
    375 
    376 /** Sets the minimum address length in the message answer.
    377  * @param[out] answer The message answer structure.
    378  */
    379 #define IPC_SET_ADDR(answer, value) \
    380         do { \
    381                 sysarg_t argument = (sysarg_t) (value); \
    382                 IPC_SET_ARG1(*answer, argument); \
    383         } while (0)
    384 
    385 /** Sets the minimum prefix size in the message answer.
    386  * @param[out] answer The message answer structure.
    387  */
    388 #define IPC_SET_PREFIX(answer, value) \
    389         do { \
    390                 sysarg_t argument = (sysarg_t) (value); \
    391                 IPC_SET_ARG2(*answer, argument); \
    392         } while (0)
    393 
    394 /** Sets the maximum content size in the message answer.
    395  * @param[out] answer The message answer structure.
    396  */
    397 #define IPC_SET_CONTENT(answer, value) \
    398         do { \
    399                 sysarg_t argument = (sysarg_t) (value); \
    400                 IPC_SET_ARG3(*answer, argument); \
    401         } while (0)
    402 
    403 /** Sets the minimum suffix size in the message answer.
    404  * @param[out] answer The message answer structure.
    405  */
    406 #define IPC_SET_SUFFIX(answer, value) \
    407         do { \
    408                 sysarg_t argument = (sysarg_t) (value); \
    409                 IPC_SET_ARG4(*answer, argument); \
    410         } while (0)
     274/** Return the device identifier message argument.
     275 *
     276 * @param[in] call Message call structure.
     277 *
     278 */
     279#define IPC_GET_DEVICE(call)  ((device_id_t) IPC_GET_ARG1(call))
     280
     281/** Return the packet identifier message argument.
     282 *
     283 * @param[in] call Message call structure.
     284 *
     285 */
     286#define IPC_GET_PACKET(call)  ((packet_id_t) IPC_GET_ARG2(call))
     287
     288/** Return the count message argument.
     289 *
     290 * @param[in] call Message call structure.
     291 *
     292 */
     293#define IPC_GET_COUNT(call)  ((size_t) IPC_GET_ARG2(call))
     294
     295/** Return the device state message argument.
     296 *
     297 * @param[in] call Message call structure.
     298 *
     299 */
     300#define IPC_GET_STATE(call)  ((device_state_t) IPC_GET_ARG2(call))
     301
     302/** Return the maximum transmission unit message argument.
     303 *
     304 * @param[in] call Message call structure.
     305 *
     306 */
     307#define IPC_GET_MTU(call)  ((size_t) IPC_GET_ARG2(call))
     308
     309/** Return the device driver service message argument.
     310 *
     311 * @param[in] call Message call structure.
     312 *
     313 */
     314#define IPC_GET_SERVICE(call)  ((services_t) IPC_GET_ARG3(call))
     315
     316/** Return the target service message argument.
     317 *
     318 * @param[in] call Message call structure.
     319 *
     320 */
     321#define IPC_GET_TARGET(call)  ((services_t) IPC_GET_ARG3(call))
     322
     323/** Return the sender service message argument.
     324 *
     325 * @param[in] call Message call structure.
     326 *
     327 */
     328#define IPC_GET_SENDER(call)  ((services_t) IPC_GET_ARG3(call))
     329
     330/** Return the error service message argument.
     331 &
     332 * @param[in] call Message call structure.
     333 *
     334 */
     335#define IPC_GET_ERROR(call)  ((services_t) IPC_GET_ARG4(call))
     336
     337/** Return the phone message argument.
     338 *
     339 * @param[in] call Message call structure.
     340 *
     341 */
     342#define IPC_GET_PHONE(call)  ((int) IPC_GET_ARG5(call))
     343
     344/** Set the device identifier in the message answer.
     345 *
     346 * @param[out] answer Message answer structure.
     347 * @param[in]  value  Value to set.
     348 *
     349 */
     350#define IPC_SET_DEVICE(answer, value)  IPC_SET_ARG1(answer, (sysarg_t) (value))
     351
     352/** Set the minimum address length in the message answer.
     353 *
     354 * @param[out] answer Message answer structure.
     355 * @param[in]  value  Value to set.
     356 *
     357 */
     358#define IPC_SET_ADDR(answer, value)  IPC_SET_ARG1(answer, (sysarg_t) (value))
     359
     360/** Set the minimum prefix size in the message answer.
     361 *
     362 * @param[out] answer Message answer structure.
     363 * @param[in]  value  Value to set.
     364 *
     365 */
     366#define IPC_SET_PREFIX(answer, value)  IPC_SET_ARG2(answer, (sysarg_t) (value))
     367
     368/** Set the maximum content size in the message answer.
     369 *
     370 * @param[out] answer Message answer structure.
     371 * @param[in]  value  Value to set.
     372 *
     373 */
     374#define IPC_SET_CONTENT(answer, value)  IPC_SET_ARG3(answer, (sysarg_t) (value))
     375
     376/** Set the minimum suffix size in the message answer.
     377 *
     378 * @param[out] answer Message answer structure.
     379 * @param[in]  value  Value to set.
     380 *
     381 */
     382#define IPC_SET_SUFFIX(answer, value)  IPC_SET_ARG4(answer, (sysarg_t) (value))
    411383
    412384/*@}*/
  • uspace/lib/c/include/ipc/net_net.h

    r22027b6e r8b5690f  
    3939#define LIBC_NET_NET_MESSAGES_H_
    4040
    41 #include <ipc/ipc.h>
    4241#include <ipc/net.h>
    4342
  • uspace/lib/c/include/ipc/netif.h

    r22027b6e r8b5690f  
    3838#define LIBC_NETIF_MESSAGES_H_
    3939
    40 #include <ipc/ipc.h>
    4140#include <ipc/net.h>
    4241
     
    4746         */
    4847        NET_NETIF_PROBE = NET_NETIF_FIRST,
     48       
    4949        /** Send packet message.
    5050         * @see netif_send_msg()
    5151         */
    5252        NET_NETIF_SEND,
     53       
    5354        /** Start device message.
    5455         * @see netif_start_req()
    5556         */
    5657        NET_NETIF_START,
     58       
    5759        /** Get device usage statistics message.
    5860         * @see netif_stats_req()
    5961         */
    6062        NET_NETIF_STATS,
     63       
    6164        /** Stop device message.
    6265         * @see netif_stop_req()
    6366         */
    6467        NET_NETIF_STOP,
     68       
    6569        /** Get device address message.
    6670         * @see netif_get_addr_req()
     
    7377
    7478/** Return the interrupt number message parameter.
    75  * @param[in] call The message call structure.
     79 *
     80 * @param[in] call Mmessage call structure.
     81 *
    7682 */
    77 #define NETIF_GET_IRQ(call) \
    78         ({ \
    79                 int irq = (int) IPC_GET_ARG2(*call); \
    80                 irq; \
    81         })
     83#define NETIF_GET_IRQ(call) ((int) IPC_GET_ARG2(call))
    8284
    8385/** Return the input/output address message parameter.
    84  * @param[in] call The message call structure.
     86 *
     87 * @param[in] call Message call structure.
     88 *
    8589 */
    86 #define NETIF_GET_IO(call) \
    87         ({ \
    88                 int io = (int) IPC_GET_ARG3(*call); \
    89                 io; \
    90         })
     90#define NETIF_GET_IO(call) ((void *) IPC_GET_ARG3(call))
    9191
    9292/*@}*/
  • uspace/lib/c/include/ipc/nil.h

    r22027b6e r8b5690f  
    3838#define LIBC_NIL_MESSAGES_H_
    3939
    40 #include <ipc/ipc.h>
    4140#include <ipc/net.h>
    4241
     
    7776
    7877/** Return the protocol service message parameter. */
    79 #define NIL_GET_PROTO(call) \
    80         ({ \
    81                 services_t service = (services_t) IPC_GET_ARG2(*call); \
    82                 service; \
    83         })
     78#define NIL_GET_PROTO(call)  ((services_t) IPC_GET_ARG2(call))
    8479
    8580/*@}*/
  • uspace/lib/c/include/ipc/ns.h

    r22027b6e r8b5690f  
    3333 */
    3434
    35 #ifndef LIBIPC_NS_H_
    36 #define LIBIPC_NS_H_
     35#ifndef LIBC_NS_H_
     36#define LIBC_NS_H_
    3737
    38 #include <ipc/ipc.h>
     38#include <sys/types.h>
     39#include <ipc/common.h>
    3940
    4041typedef enum {
     
    4546} ns_request_t;
    4647
     48extern int service_register(sysarg_t);
     49extern int service_connect(sysarg_t, sysarg_t, sysarg_t);
     50extern int service_connect_blocking(sysarg_t, sysarg_t, sysarg_t);
     51
    4752#endif
    4853
  • uspace/lib/c/include/ipc/packet.h

    r22027b6e r8b5690f  
    3838#define LIBC_PACKET_MESSAGES_
    3939
    40 #include <ipc/ipc.h>
    4140#include <ipc/net.h>
    4241
     
    7069} packet_messages;
    7170
    72 /** Returns the protocol service message parameter. */
    73 #define ARP_GET_PROTO(call)     (services_t) IPC_GET_ARG2(*call)
     71/** Return the protocol service message parameter. */
     72#define ARP_GET_PROTO(call)  ((services_t) IPC_GET_ARG2(call))
    7473
    75 /** Returns the packet identifier message parameter. */
    76 #define IPC_GET_ID(call)        (packet_id_t) IPC_GET_ARG1(*call)
     74/** Return the packet identifier message parameter. */
     75#define IPC_GET_ID(call)  ((packet_id_t) IPC_GET_ARG1(call))
    7776
    78 /** Returns the maximal content length message parameter. */
    79 #define IPC_GET_CONTENT(call)   (size_t) IPC_GET_ARG1(*call)
     77/** Return the maximal content length message parameter. */
     78#define IPC_GET_CONTENT(call)  ((size_t) IPC_GET_ARG1(call))
    8079
    81 /** Returns the maximal address length message parameter. */
    82 #define IPC_GET_ADDR_LEN(call)  (size_t) IPC_GET_ARG2(*call)
     80/** Return the maximal address length message parameter. */
     81#define IPC_GET_ADDR_LEN(call)  ((size_t) IPC_GET_ARG2(call))
    8382
    84 /** Returns the maximal prefix length message parameter. */
    85 #define IPC_GET_PREFIX(call)    (size_t) IPC_GET_ARG3(*call)
     83/** Return the maximal prefix length message parameter. */
     84#define IPC_GET_PREFIX(call)  ((size_t) IPC_GET_ARG3(call))
    8685
    87 /** Returns the maximal suffix length message parameter. */
    88 #define IPC_GET_SUFFIX(call)    (size_t) IPC_GET_ARG4(*call)
     86/** Return the maximal suffix length message parameter. */
     87#define IPC_GET_SUFFIX(call)  ((size_t) IPC_GET_ARG4(call))
    8988
    9089#endif
  • uspace/lib/c/include/ipc/services.h

    r22027b6e r8b5690f  
    3535 */
    3636
    37 #ifndef LIBIPC_SERVICES_H_
    38 #define LIBIPC_SERVICES_H_
     37#ifndef LIBC_SERVICES_H_
     38#define LIBC_SERVICES_H_
    3939
    4040typedef enum {
     
    5454        SERVICE_NETWORKING,
    5555        SERVICE_LO,
    56         SERVICE_DP8390,
     56        SERVICE_NE2000,
    5757        SERVICE_ETHERNET,
    5858        SERVICE_NILDUMMY,
     
    6666} services_t;
    6767
    68 /* Memory area to be received from NS */
    69 #define SERVICE_MEM_REALTIME    1
    70 #define SERVICE_MEM_KLOG        2
    71 
    7268#endif
    7369
  • uspace/lib/c/include/ipc/socket.h

    r22027b6e r8b5690f  
    3838#define LIBC_SOCKET_MESSAGES_H_
    3939
    40 #include <ipc/ipc.h>
    4140#include <ipc/net.h>
    4241
  • uspace/lib/c/include/ipc/tl.h

    r22027b6e r8b5690f  
    3939#define LIBC_TL_MESSAGES_H_
    4040
    41 #include <ipc/ipc.h>
    4241#include <ipc/net.h>
    4342
  • uspace/lib/c/include/ipc/vfs.h

    r22027b6e r8b5690f  
    3636#define LIBC_IPC_VFS_H_
    3737
    38 #include <ipc/ipc.h>
     38#include <ipc/common.h>
    3939#include <sys/types.h>
    4040#include <bool.h>
  • uspace/lib/c/include/libc.h

    r22027b6e r8b5690f  
    6262        __syscall6(p1, p2, p3, p4, p5, p6, id)
    6363
    64 extern void __main(void *pcb_ptr);
    65 extern void __exit(void);
    66 
    6764#endif
    6865
  • uspace/lib/c/include/loader/pcb.h

    r22027b6e r8b5690f  
    5252        /** Program entry point. */
    5353        entry_point_t entry;
    54 
     54       
    5555        /** Current working directory. */
    5656        char *cwd;
  • uspace/lib/c/include/malloc.h

    r22027b6e r8b5690f  
    3838#include <sys/types.h>
    3939
    40 extern void __heap_init(void);
    4140extern uintptr_t get_max_heap_addr(void);
    4241
  • uspace/lib/c/include/net/icmp_common.h

    r22027b6e r8b5690f  
    4141#include <sys/time.h>
    4242
    43 /** Default timeout for incoming connections in microseconds. */
    44 #define ICMP_CONNECT_TIMEOUT    (1 * 1000 * 1000)
     43/** Default timeout for incoming connections in microseconds (1 sec). */
     44#define ICMP_CONNECT_TIMEOUT  1000000
    4545
    46 extern int icmp_connect_module(services_t, suseconds_t);
     46extern int icmp_connect_module(suseconds_t);
    4747
    4848#endif
  • uspace/lib/c/include/net/in.h

    r22027b6e r8b5690f  
    4343
    4444/** INET string address maximum length. */
    45 #define INET_ADDRSTRLEN         (4 * 3 + 3 + 1)
     45#define INET_ADDRSTRLEN  (4 * 3 + 3 + 1)
    4646
    4747/** Type definition of the INET address.
    4848 * @see in_addr
    4949 */
    50 typedef struct in_addr          in_addr_t;
     50typedef struct in_addr in_addr_t;
    5151
    5252/** Type definition of the INET socket address.
  • uspace/lib/c/include/net/modules.h

    r22027b6e r8b5690f  
    4343
    4444#include <async.h>
    45 
    46 #include <ipc/ipc.h>
    4745#include <ipc/services.h>
    48 
    4946#include <sys/time.h>
    5047
    5148/** Connect to the needed module function type definition.
    5249 *
    53  * @param[in] need      The needed module service.
    54  * @return              The phone of the needed service.
     50 * @param[in] need The needed module service.
     51 *
     52 * @return The phone of the needed service.
     53 *
    5554 */
    5655typedef int connect_module_t(services_t need);
    5756
    58 extern void answer_call(ipc_callid_t, int, ipc_call_t *, int);
     57extern void answer_call(ipc_callid_t, int, ipc_call_t *, size_t);
    5958extern int bind_service(services_t, sysarg_t, sysarg_t, sysarg_t,
    6059    async_client_conn_t);
     
    6463extern int connect_to_service_timeout(services_t, suseconds_t);
    6564extern int data_reply(void *, size_t);
    66 extern void refresh_answer(ipc_call_t *, int *);
     65extern void refresh_answer(ipc_call_t *, size_t *);
    6766
    6867#endif
  • uspace/lib/c/include/setjmp.h

    r22027b6e r8b5690f  
    4141
    4242extern int setjmp(jmp_buf env);
    43 extern void longjmp(jmp_buf env,int val) __attribute__((__noreturn__));
     43extern void longjmp(jmp_buf env, int val) __attribute__((noreturn));
    4444
    4545#endif
  • uspace/lib/c/include/stdlib.h

    r22027b6e r8b5690f  
    4040#include <stacktrace.h>
    4141
    42 #define abort() \
    43         do { \
    44                 stacktrace_print(); \
    45                 _exit(1); \
    46         } while (0)
     42#define RAND_MAX  714025
    4743
    48 #define core() \
    49         *((int *) 0) = 0xbadbad;
    50 
    51 #define exit(status)  _exit((status))
    52 
    53 #define RAND_MAX  714025
     44#define rand()       random()
     45#define srand(seed)  srandom(seed)
    5446
    5547extern long int random(void);
    5648extern void srandom(unsigned int seed);
    5749
    58 static inline int rand(void)
    59 {
    60         return random();
    61 }
    62 
    63 static inline void srand(unsigned int seed)
    64 {
    65         srandom(seed);
    66 }
     50extern void abort(void) __attribute__((noreturn));
    6751
    6852#endif
  • uspace/lib/c/include/syscall.h

    r22027b6e r8b5690f  
    3232/**
    3333 * @file
    34  * @brief       Syscall function declaration for architectures that don't
    35  *              inline syscalls or architectures that handle syscalls
    36  *              according to the number of arguments.
     34 * @brief Syscall function declaration for architectures that don't
     35 *        inline syscalls or architectures that handle syscalls
     36 *        according to the number of arguments.
    3737 */
    3838
     
    4040#define LIBC_SYSCALL_H_
    4141
    42 #ifndef LIBARCH_SYSCALL_GENERIC
    43 #error "You can't include this file directly."
     42#ifndef LIBARCH_SYSCALL_GENERIC
     43        #error You cannot include this file directly
    4444#endif
    4545
     
    4747#include <kernel/syscall/syscall.h>
    4848
    49 #define __syscall0      __syscall
    50 #define __syscall1      __syscall
    51 #define __syscall2      __syscall
    52 #define __syscall3      __syscall
    53 #define __syscall4      __syscall
    54 #define __syscall5      __syscall
    55 #define __syscall6      __syscall
     49#define __syscall0  __syscall
     50#define __syscall1  __syscall
     51#define __syscall2  __syscall
     52#define __syscall3  __syscall
     53#define __syscall4  __syscall
     54#define __syscall5  __syscall
     55#define __syscall6  __syscall
    5656
    5757extern sysarg_t __syscall(const sysarg_t p1, const sysarg_t p2,
  • uspace/lib/c/include/thread.h

    r22027b6e r8b5690f  
    3636#define LIBC_THREAD_H_
    3737
    38 #include <kernel/proc/uarg.h>
    3938#include <libarch/thread.h>
    4039#include <sys/types.h>
     
    4241typedef uint64_t thread_id_t;
    4342
    44 extern void __thread_entry(void);
    45 extern void __thread_main(uspace_arg_t *);
    46 
    4743extern int thread_create(void (*)(void *), void *, const char *, thread_id_t *);
    48 extern void thread_exit(int) __attribute__ ((noreturn));
     44extern void thread_exit(int) __attribute__((noreturn));
    4945extern void thread_detach(thread_id_t);
    5046extern int thread_join(thread_id_t);
  • uspace/lib/c/include/tls.h

    r22027b6e r8b5690f  
    5757extern void tls_free_variant_1(tcb_t *, size_t);
    5858#endif
     59
    5960#ifdef CONFIG_TLS_VARIANT_2
    6061extern tcb_t *tls_alloc_variant_2(void **, size_t);
  • uspace/lib/c/include/udebug.h

    r22027b6e r8b5690f  
    3838#include <kernel/udebug/udebug.h>
    3939#include <sys/types.h>
    40 #include <libarch/types.h>
    4140
    4241typedef sysarg_t thash_t;
    4342
    44 int udebug_begin(int phoneid);
    45 int udebug_end(int phoneid);
    46 int udebug_set_evmask(int phoneid, udebug_evmask_t mask);
    47 int udebug_thread_read(int phoneid, void *buffer, size_t n,
    48         size_t *copied, size_t *needed);
    49 int udebug_name_read(int phoneid, void *buffer, size_t n,
    50         size_t *copied, size_t *needed);
    51 int udebug_areas_read(int phoneid, void *buffer, size_t n,
    52         size_t *copied, size_t *needed);
    53 int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n);
    54 int udebug_args_read(int phoneid, thash_t tid, sysarg_t *buffer);
    55 int udebug_regs_read(int phoneid, thash_t tid, void *buffer);
    56 int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type,
    57         sysarg_t *val0, sysarg_t *val1);
    58 int udebug_stop(int phoneid, thash_t tid);
     43int udebug_begin(int);
     44int udebug_end(int);
     45int udebug_set_evmask(int, udebug_evmask_t);
     46int udebug_thread_read(int, void *, size_t , size_t *, size_t *);
     47int udebug_name_read(int, void *, size_t, size_t *, size_t *);
     48int udebug_areas_read(int, void *, size_t, size_t *, size_t *);
     49int udebug_mem_read(int, void *, uintptr_t, size_t);
     50int udebug_args_read(int, thash_t, sysarg_t *);
     51int udebug_regs_read(int, thash_t, void *);
     52int udebug_go(int, thash_t, udebug_event_t *, sysarg_t *, sysarg_t *);
     53int udebug_stop(int, thash_t);
    5954
    6055#endif
  • uspace/lib/c/include/unistd.h

    r22027b6e r8b5690f  
    4141
    4242#ifndef NULL
    43         #define NULL    ((void *) 0)
     43        #define NULL  ((void *) 0)
    4444#endif
    4545
     
    7474extern int chdir(const char *);
    7575
    76 extern void _exit(int) __attribute__((noreturn));
     76extern void exit(int) __attribute__((noreturn));
    7777extern int usleep(useconds_t);
    7878extern unsigned int sleep(unsigned int);
  • uspace/lib/c/include/vfs/vfs.h

    r22027b6e r8b5690f  
    5757extern int unmount(const char *);
    5858
    59 extern void __stdio_init(int filc, fdi_node_t *filv[]);
    60 extern void __stdio_done(void);
    61 
    6259extern int open_node(fdi_node_t *, int);
    6360extern int fd_phone(int);
Note: See TracChangeset for help on using the changeset viewer.