Changeset 4c53333 in mainline for uspace/lib/c/include


Ignore:
Timestamp:
2013-07-11T08:21:10Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
64e63ce1
Parents:
80445cf (diff), c8bb1633 (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:
31 added
58 edited
5 moved

Legend:

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

    r80445cf r4c53333  
    11/*
    22 * Copyright (c) 2006 Jakub Jermar
     3 * Copyright (c) 2012 Adam Hraska
     4 *
    35 * All rights reserved.
    46 *
     
    3840#include <adt/list.h>
    3941#include <unistd.h>
    40 #include <bool.h>
     42#include <stdbool.h>
     43#include <macros.h>
    4144
    42 typedef unsigned long hash_count_t;
    43 typedef unsigned long hash_index_t;
     45/** Opaque hash table link type. */
     46typedef struct ht_link {
     47        link_t link;
     48} ht_link_t;
    4449
    4550/** Set of operations for hash table. */
    4651typedef struct {
    47         /** Hash function.
    48          *
    49          * @param key Array of keys needed to compute hash index.
    50          *            All keys must be passed.
    51          *
    52          * @return Index into hash table.
    53          *
    54          */
    55         hash_index_t (*hash)(unsigned long key[]);
     52        /** Returns the hash of the key stored in the item (ie its lookup key). */
     53        size_t (*hash)(const ht_link_t *item);
    5654       
    57         /** Hash table item comparison function.
    58          *
    59          * @param key Array of keys that will be compared with item. It is
    60          *            not necessary to pass all keys.
    61          *
    62          * @return True if the keys match, false otherwise.
    63          *
    64          */
    65         int (*compare)(unsigned long key[], hash_count_t keys, link_t *item);
     55        /** Returns the hash of the key. */
     56        size_t (*key_hash)(void *key);
    6657       
     58        /** True if the items are equal (have the same lookup keys). */
     59        bool (*equal)(const ht_link_t *item1, const ht_link_t *item2);
     60
     61        /** Returns true if the key is equal to the item's lookup key. */
     62        bool (*key_equal)(void *key, const ht_link_t *item);
     63
    6764        /** Hash table item removal callback.
     65         *
     66         * Must not invoke any mutating functions of the hash table.
    6867         *
    6968         * @param item Item that was removed from the hash table.
    70          *
    7169         */
    72         void (*remove_callback)(link_t *item);
    73 } hash_table_operations_t;
     70        void (*remove_callback)(ht_link_t *item);
     71} hash_table_ops_t;
    7472
    7573/** Hash table structure. */
    7674typedef struct {
    77         list_t *entry;
    78         hash_count_t entries;
    79         hash_count_t max_keys;
    80         hash_table_operations_t *op;
     75        hash_table_ops_t *op;
     76        list_t *bucket;
     77        size_t bucket_cnt;
     78        size_t full_item_cnt;
     79        size_t item_cnt;
     80        size_t max_load;
     81        bool apply_ongoing;
    8182} hash_table_t;
    8283
    83 #define hash_table_get_instance(item, type, member) \
    84     list_get_instance((item), type, member)
     84#define hash_table_get_inst(item, type, member) \
     85        member_to_inst((item), type, member)
    8586
    86 extern bool hash_table_create(hash_table_t *, hash_count_t, hash_count_t,
    87     hash_table_operations_t *);
     87extern bool hash_table_create(hash_table_t *, size_t, size_t,
     88        hash_table_ops_t *);
     89extern void hash_table_destroy(hash_table_t *);
     90
     91extern bool hash_table_empty(hash_table_t *);
     92extern size_t hash_table_size(hash_table_t *);
     93
    8894extern void hash_table_clear(hash_table_t *);
    89 extern void hash_table_insert(hash_table_t *, unsigned long [], link_t *);
    90 extern link_t *hash_table_find(hash_table_t *, unsigned long []);
    91 extern void hash_table_remove(hash_table_t *, unsigned long [], hash_count_t);
    92 extern void hash_table_destroy(hash_table_t *);
    93 extern void hash_table_apply(hash_table_t *, void (*)(link_t *, void *),
    94     void *);
     95extern void hash_table_insert(hash_table_t *, ht_link_t *);
     96extern bool hash_table_insert_unique(hash_table_t *, ht_link_t *);
     97extern ht_link_t *hash_table_find(const hash_table_t *, void *);
     98extern ht_link_t *hash_table_find_next(const hash_table_t *, ht_link_t *);
     99extern size_t hash_table_remove(hash_table_t *, void *);
     100extern void hash_table_remove_item(hash_table_t *, ht_link_t *);
     101extern void hash_table_apply(hash_table_t *, bool (*)(ht_link_t *, void *),
     102        void *);
     103
    95104
    96105#endif
  • uspace/lib/c/include/adt/list.h

    r80445cf r4c53333  
    7171            iterator != &(list).head; iterator = iterator->next)
    7272
     73/** Unlike list_foreach(), allows removing items while traversing a list.
     74 *
     75 * @code
     76 * list_t mylist;
     77 * typedef struct item {
     78 *     int value;
     79 *     link_t item_link;
     80 * } item_t;
     81 *
     82 * //..
     83 *
     84 * // Print each list element's value and remove the element from the list.
     85 * list_foreach_safe(mylist, cur_link, next_link) {
     86 *     item_t *cur_item = list_get_instance(cur_link, item_t, item_link);
     87 *     printf("%d\n", cur_item->value);
     88 *     list_remove(cur_link);
     89 * }
     90 * @endcode
     91 *
     92 * @param list List to traverse.
     93 * @param iterator Iterator to the current element of the list.
     94 *             The item this iterator points may be safely removed
     95 *             from the list.
     96 * @param next_iter Iterator to the next element of the list.
     97 */
     98#define list_foreach_safe(list, iterator, next_iter) \
     99        for (link_t *iterator = (list).head.next, \
     100                *next_iter = iterator->next; \
     101                iterator != &(list).head; \
     102                iterator = next_iter, next_iter = iterator->next)
     103
    73104#define assert_link_not_used(link) \
    74105        assert(((link)->prev == NULL) && ((link)->next == NULL))
     106
     107/** Returns true if the link is definitely part of a list. False if not sure. */
     108static inline int link_in_use(link_t *link)
     109{
     110        return link->prev != NULL && link->next != NULL;
     111}
    75112
    76113/** Initialize doubly-linked circular list link
  • uspace/lib/c/include/as.h

    r80445cf r4c53333  
    4141#include <libarch/config.h>
    4242
     43#define AS_AREA_ANY    ((void *) -1)
     44#define AS_MAP_FAILED  ((void *) -1)
     45
    4346static inline size_t SIZE2PAGES(size_t size)
    4447{
  • uspace/lib/c/include/async.h

    r80445cf r4c53333  
    4444#include <sys/time.h>
    4545#include <atomic.h>
    46 #include <bool.h>
     46#include <stdbool.h>
    4747#include <task.h>
    4848
     
    156156extern void async_set_client_connection(async_client_conn_t);
    157157extern void async_set_interrupt_received(async_interrupt_handler_t);
     158extern void async_set_interrupt_handler_stack_size(size_t);
    158159
    159160/*
     
    321322    sysarg_t *, sysarg_t *);
    322323
    323 extern async_sess_t *async_connect_me(exch_mgmt_t, async_exch_t *);
     324extern async_sess_t *async_clone_establish(exch_mgmt_t, async_exch_t *);
    324325extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t,
    325326    sysarg_t, sysarg_t);
  • uspace/lib/c/include/atomicdflt.h

    r80445cf r4c53333  
    4141
    4242#include <stdint.h>
    43 #include <bool.h>
     43#include <stdbool.h>
    4444
    4545typedef struct atomic {
  • uspace/lib/c/include/bitops.h

    r80445cf r4c53333  
    107107}
    108108
     109extern int __popcountsi2(int);
     110
    109111#endif
    110112
  • uspace/lib/c/include/cfg.h

    r80445cf r4c53333  
    4141#include <adt/list.h>
    4242#include <sys/types.h>
    43 #include <bool.h>
     43#include <stdbool.h>
    4444
    4545/**
  • uspace/lib/c/include/ddi.h

    r80445cf r4c53333  
    3636#define LIBC_DDI_H_
    3737
     38#include <stdbool.h>
    3839#include <sys/types.h>
     40#include <sys/time.h>
    3941#include <abi/ddi/irq.h>
    4042#include <task.h>
     
    5052extern int dmamem_unmap_anonymous(void *);
    5153
    52 extern int iospace_enable(task_id_t, void *, unsigned long);
    5354extern int pio_enable(void *, size_t, void **);
     55
     56typedef void (*trace_fnc)(const volatile void *place, uint32_t val,
     57    volatile void* base, size_t size, void *data, bool write);
     58
     59extern int pio_trace_enable(void *, size_t, trace_fnc, void *);
     60extern void pio_trace_log(const volatile void *, uint32_t val, bool write);
     61extern void pio_trace_disable(void *);
     62
     63extern void pio_write_8(ioport8_t *, uint8_t);
     64extern void pio_write_16(ioport16_t *, uint16_t);
     65extern void pio_write_32(ioport32_t *, uint32_t);
     66
     67extern uint8_t pio_read_8(const ioport8_t *);
     68extern uint16_t pio_read_16(const ioport16_t *);
     69extern uint32_t pio_read_32(const ioport32_t *);
     70
     71static inline uint8_t pio_change_8(
     72    ioport8_t *reg, uint8_t val, uint8_t mask, useconds_t delay)
     73{
     74        uint8_t v = pio_read_8(reg);
     75        udelay(delay);
     76        pio_write_8(reg, (v & ~mask) | val);
     77        return v;
     78}
     79
     80static inline uint16_t pio_change_16(
     81    ioport16_t *reg, uint16_t val, uint16_t mask, useconds_t delay)
     82{
     83        uint16_t v = pio_read_16(reg);
     84        udelay(delay);
     85        pio_write_16(reg, (v & ~mask) | val);
     86        return v;
     87}
     88
     89static inline uint32_t pio_change_32(
     90    ioport32_t *reg, uint32_t val, uint32_t mask, useconds_t delay)
     91{
     92        uint32_t v = pio_read_32(reg);
     93        udelay(delay);
     94        pio_write_32(reg, (v & ~mask) | val);
     95        return v;
     96}
     97
     98static inline uint8_t pio_set_8(ioport8_t *r, uint8_t v, useconds_t d)
     99{
     100        return pio_change_8(r, v, 0, d);
     101}
     102static inline uint16_t pio_set_16(ioport16_t *r, uint16_t v, useconds_t d)
     103{
     104        return pio_change_16(r, v, 0, d);
     105}
     106static inline uint32_t pio_set_32(ioport32_t *r, uint32_t v, useconds_t d)
     107{
     108        return pio_change_32(r, v, 0, d);
     109}
     110
     111static inline uint8_t pio_clear_8(ioport8_t *r, uint8_t v, useconds_t d)
     112{
     113        return pio_change_8(r, 0, v, d);
     114}
     115static inline uint16_t pio_clear_16(ioport16_t *r, uint16_t v, useconds_t d)
     116{
     117        return pio_change_16(r, 0, v, d);
     118}
     119static inline uint32_t pio_clear_32(ioport32_t *r, uint32_t v, useconds_t d)
     120{
     121        return pio_change_32(r, 0, v, d);
     122}
    54123
    55124extern int irq_register(int, int, int, irq_code_t *);
  • uspace/lib/c/include/device/hw_res.h

    r80445cf r4c53333  
    3838#include <ipc/dev_iface.h>
    3939#include <async.h>
    40 #include <bool.h>
     40#include <stdbool.h>
    4141
    4242#define DMA_MODE_ON_DEMAND  0
  • uspace/lib/c/include/device/hw_res_parsed.h

    r80445cf r4c53333  
    127127        free(list->dma_channels.channels);
    128128       
    129         bzero(list, sizeof(hw_res_list_parsed_t));
     129        memset(list, 0, sizeof(hw_res_list_parsed_t));
    130130}
    131131
     
    136136static inline void hw_res_list_parsed_init(hw_res_list_parsed_t *list)
    137137{
    138         bzero(list, sizeof(hw_res_list_parsed_t));
     138        memset(list, 0, sizeof(hw_res_list_parsed_t));
    139139}
    140140
  • uspace/lib/c/include/devman.h

    r80445cf r4c53333  
    4040#include <ipc/loc.h>
    4141#include <async.h>
    42 #include <bool.h>
     42#include <stdbool.h>
    4343
    4444extern async_exch_t *devman_exchange_begin_blocking(devman_interface_t);
     
    6464    size_t *);
    6565extern int devman_fun_get_name(devman_handle_t, char *, size_t);
     66extern int devman_fun_get_driver_name(devman_handle_t, char *, size_t);
    6667extern int devman_fun_get_path(devman_handle_t, char *, size_t);
    6768extern int devman_fun_online(devman_handle_t);
  • uspace/lib/c/include/errno.h

    r80445cf r4c53333  
    3737
    3838#include <abi/errno.h>
    39 #include <fibril.h>
    4039
    4140#define errno  (*(__errno()))
  • uspace/lib/c/include/fibril.h

    r80445cf r4c53333  
    8686extern void context_restore(context_t *ctx) __attribute__((noreturn));
    8787
    88 extern fid_t fibril_create(int (*func)(void *), void *arg);
     88#define FIBRIL_DFLT_STK_SIZE    0
     89
     90#define fibril_create(func, arg) \
     91        fibril_create_generic((func), (arg), FIBRIL_DFLT_STK_SIZE)
     92extern fid_t fibril_create_generic(int (*func)(void *), void *arg, size_t);
     93extern void fibril_destroy(fid_t fid);
    8994extern fibril_t *fibril_setup(void);
    9095extern void fibril_teardown(fibril_t *f);
  • uspace/lib/c/include/fibril_synch.h

    r80445cf r4c53333  
    4040#include <libarch/tls.h>
    4141#include <sys/time.h>
    42 #include <bool.h>
     42#include <stdbool.h>
    4343
    4444typedef struct {
  • uspace/lib/c/include/inet/inet.h

    r80445cf r4c53333  
    3636#define LIBC_INET_INET_H_
    3737
     38#include <inet/addr.h>
    3839#include <sys/types.h>
    3940
    4041#define INET_TTL_MAX 255
    41 
    42 typedef struct {
    43         uint32_t ipv4;
    44 } inet_addr_t;
    4542
    4643typedef struct {
  • uspace/lib/c/include/inet/inetcfg.h

    r80445cf r4c53333  
    3838#include <inet/inet.h>
    3939#include <sys/types.h>
    40 
    41 /** Network address */
    42 typedef struct {
    43         /** Address */
    44         uint32_t ipv4;
    45         /** Number of valid bits in @c ipv4 */
    46         int bits;
    47 } inet_naddr_t;
    4840
    4941/** Address object info */
  • uspace/lib/c/include/inet/inetping.h

    r80445cf r4c53333  
    4040
    4141typedef struct {
    42         inet_addr_t src;
    43         inet_addr_t dest;
     42        uint32_t src;
     43        uint32_t dest;
    4444        uint16_t seq_no;
    4545        void *data;
     
    5353extern int inetping_init(inetping_ev_ops_t *);
    5454extern int inetping_send(inetping_sdu_t *);
    55 extern int inetping_get_srcaddr(inet_addr_t *, inet_addr_t *);
    56 
     55extern int inetping_get_srcaddr(uint32_t, uint32_t *);
    5756
    5857#endif
  • uspace/lib/c/include/inet/iplink.h

    r80445cf r4c53333  
    3838#include <async.h>
    3939#include <sys/types.h>
     40#include <inet/addr.h>
    4041
    4142struct iplink_ev_ops;
     
    4647} iplink_t;
    4748
    48 typedef struct {
    49         uint32_t ipv4;
    50 } iplink_addr_t;
    51 
    52 /** IP link Service Data Unit */
     49/** Internet link Service Data Unit */
    5350typedef struct {
    5451        /** Local source address */
    55         iplink_addr_t lsrc;
     52        inet_addr_t src;
    5653        /** Local destination address */
    57         iplink_addr_t ldest;
     54        inet_addr_t dest;
    5855        /** Serialized IP packet */
    5956        void *data;
     
    6259} iplink_sdu_t;
    6360
     61/** Internet link receive Service Data Unit */
     62typedef struct {
     63        /** Serialized datagram */
     64        void *data;
     65        /** Size of @c data in bytes */
     66        size_t size;
     67} iplink_recv_sdu_t;
     68
    6469typedef struct iplink_ev_ops {
    65         int (*recv)(iplink_t *, iplink_sdu_t *);
     70        int (*recv)(iplink_t *, iplink_recv_sdu_t *, uint16_t);
    6671} iplink_ev_ops_t;
    6772
     
    6974extern void iplink_close(iplink_t *);
    7075extern int iplink_send(iplink_t *, iplink_sdu_t *);
    71 extern int iplink_addr_add(iplink_t *, iplink_addr_t *);
    72 extern int iplink_addr_remove(iplink_t *, iplink_addr_t *);
     76extern int iplink_addr_add(iplink_t *, inet_addr_t *);
     77extern int iplink_addr_remove(iplink_t *, inet_addr_t *);
    7378extern int iplink_get_mtu(iplink_t *, size_t *);
    7479
  • uspace/lib/c/include/inet/iplink_srv.h

    r80445cf r4c53333  
    3838#include <async.h>
    3939#include <fibril_synch.h>
    40 #include <bool.h>
     40#include <stdbool.h>
    4141#include <sys/types.h>
     42#include <inet/addr.h>
     43#include <inet/iplink.h>
    4244
    4345struct iplink_ops;
     
    5153} iplink_srv_t;
    5254
    53 typedef struct {
    54         uint32_t ipv4;
    55 } iplink_srv_addr_t;
    56 
    57 /** IP link Service Data Unit */
    58 typedef struct {
    59         /** Local source address */
    60         iplink_srv_addr_t lsrc;
    61         /** Local destination address */
    62         iplink_srv_addr_t ldest;
    63         /** Serialized IP packet */
    64         void *data;
    65         /** Size of @c data in bytes */
    66         size_t size;
    67 } iplink_srv_sdu_t;
    68 
    6955typedef struct iplink_ops {
    7056        int (*open)(iplink_srv_t *);
    7157        int (*close)(iplink_srv_t *);
    72         int (*send)(iplink_srv_t *, iplink_srv_sdu_t *);
     58        int (*send)(iplink_srv_t *, iplink_sdu_t *);
    7359        int (*get_mtu)(iplink_srv_t *, size_t *);
    74         int (*addr_add)(iplink_srv_t *, iplink_srv_addr_t *);
    75         int (*addr_remove)(iplink_srv_t *, iplink_srv_addr_t *);
     60        int (*addr_add)(iplink_srv_t *, inet_addr_t *);
     61        int (*addr_remove)(iplink_srv_t *, inet_addr_t *);
    7662} iplink_ops_t;
    7763
     
    7965
    8066extern int iplink_conn(ipc_callid_t, ipc_call_t *, void *);
    81 extern int iplink_ev_recv(iplink_srv_t *, iplink_srv_sdu_t *);
     67extern int iplink_ev_recv(iplink_srv_t *, iplink_recv_sdu_t *, uint16_t);
    8268
    8369#endif
  • uspace/lib/c/include/io/charfield.h

    r80445cf r4c53333  
    11/*
    22 * Copyright (c) 2006 Josef Cejka
     3 * Copyright (c) 2011 Petr Koupy
    34 * All rights reserved.
    45 *
     
    3334 */
    3435
    35 #ifndef IMGMAP_SCREENBUFFER_H__
    36 #define IMGMAP_SCREENBUFFER_H__
     36#ifndef LIBC_IO_CHARFIELD_H_
     37#define LIBC_IO_CHARFIELD_H_
    3738
    3839#include <sys/types.h>
    39 #include <bool.h>
     40#include <stdbool.h>
    4041#include <io/color.h>
    4142#include <io/style.h>
    42 #include "fb.h"
     43#include <io/pixel.h>
    4344
    4445typedef enum {
    45         SCREENBUFFER_FLAG_NONE = 0,
    46         SCREENBUFFER_FLAG_SHARED = 1
    47 } screenbuffer_flag_t;
     46        CHAR_FLAG_NONE = 0,
     47        CHAR_FLAG_DIRTY = 1
     48} char_flags_t;
    4849
    4950typedef enum {
     
    5253        CHAR_ATTR_RGB
    5354} char_attr_type_t;
    54 
    55 typedef enum {
    56         CHAR_FLAG_NONE = 0,
    57         CHAR_FLAG_DIRTY = 1
    58 } char_flags_t;
    5955
    6056typedef struct {
     
    6561
    6662typedef struct {
    67         pixel_t bgcolor;  /**< Background color */
    68         pixel_t fgcolor;  /**< Foreground color */
     63        pixel_t bgcolor;
     64        pixel_t fgcolor;
    6965} char_attr_rgb_t;
    7066
     
    8076} char_attrs_t;
    8177
    82 /** One field on screen. It contain one character and its attributes. */
    8378typedef struct {
    84         wchar_t ch;          /**< Character itself */
    85         char_attrs_t attrs;  /**< Character attributes */
    86         char_flags_t flags;  /**< Character flags */
     79        wchar_t ch;
     80        char_attrs_t attrs;
     81        char_flags_t flags;
    8782} charfield_t;
    8883
    89 /** Compare two sets of attributes.
    90  *
    91  * @param a1 First attribute.
    92  * @param a2 Second attribute.
    93  *
    94  * @return True on equality
    95  *
    96  */
    9784static inline bool attrs_same(char_attrs_t a1, char_attrs_t a2)
    9885{
     
    115102}
    116103
    117 extern screenbuffer_t *screenbuffer_create(sysarg_t, sysarg_t,
    118     screenbuffer_flag_t);
    119 
    120 extern charfield_t *screenbuffer_field_at(screenbuffer_t *, sysarg_t, sysarg_t);
    121 extern bool screenbuffer_cursor_at(screenbuffer_t *, sysarg_t, sysarg_t);
    122 
    123 extern sysarg_t screenbuffer_get_top_row(screenbuffer_t *);
    124 
    125 extern sysarg_t screenbuffer_putchar(screenbuffer_t *, wchar_t, bool);
    126 extern sysarg_t screenbuffer_newline(screenbuffer_t *);
    127 extern sysarg_t screenbuffer_tabstop(screenbuffer_t *, sysarg_t);
    128 extern sysarg_t screenbuffer_backspace(screenbuffer_t *);
    129 
    130 extern void screenbuffer_clear(screenbuffer_t *);
    131 extern void screenbuffer_clear_row(screenbuffer_t *, sysarg_t);
    132 
    133 extern void screenbuffer_set_cursor(screenbuffer_t *, sysarg_t, sysarg_t);
    134 extern void screenbuffer_set_cursor_visibility(screenbuffer_t *, bool);
    135 extern bool screenbuffer_get_cursor_visibility(screenbuffer_t *);
    136 
    137 extern void screenbuffer_get_cursor(screenbuffer_t *, sysarg_t *, sysarg_t *);
    138 
    139 extern void screenbuffer_set_style(screenbuffer_t *, console_style_t);
    140 extern void screenbuffer_set_color(screenbuffer_t *, console_color_t,
    141     console_color_t, console_color_attr_t);
    142 extern void screenbuffer_set_rgb_color(screenbuffer_t *, pixel_t, pixel_t);
    143 
    144104#endif
    145105
  • uspace/lib/c/include/io/con_srv.h

    r80445cf r4c53333  
    11/*
    2  * Copyright (c) 2006 Jakub Jermar
    3  * Copyright (c) 2011 Radim Vansa
     2 * Copyright (c) 2012 Jiri Svoboda
    43 * All rights reserved.
    54 *
     
    3433 */
    3534
    36 #ifndef LIBC_HASH_SET_H_
    37 #define LIBC_HASH_SET_H_
     35#ifndef LIBC_CON_SRV_H_
     36#define LIBC_CON_SRV_H_
    3837
    3938#include <adt/list.h>
    40 #include <unistd.h>
     39#include <async.h>
     40#include <fibril_synch.h>
     41#include <io/color.h>
     42#include <io/concaps.h>
     43#include <io/cons_event.h>
     44#include <io/pixel.h>
     45#include <io/style.h>
     46#include <stdbool.h>
     47#include <sys/time.h>
     48#include <sys/types.h>
    4149
    42 #define HASH_SET_MIN_SIZE  8
     50typedef struct con_ops con_ops_t;
    4351
    44 typedef unsigned long (*hash_set_hash)(const link_t *);
    45 typedef int (*hash_set_equals)(const link_t *, const link_t *);
     52/** Service setup (per sevice) */
     53typedef struct {
     54        con_ops_t *ops;
     55        void *sarg;
     56        /** Period to check for abort */
     57        suseconds_t abort_timeout;
     58        bool aborted;
     59} con_srvs_t;
    4660
    47 /** Hash table structure. */
     61/** Server structure (per client session) */
    4862typedef struct {
    49         list_t *table;
    50        
    51         /** Current table size */
    52         size_t size;
    53        
    54         /**
    55          * Current number of entries. If count > size,
    56          * the table is rehashed into table with double
    57          * size. If (4 * count < size) && (size > min_size),
    58          * the table is rehashed into table with half the size.
    59          */
    60         size_t count;
    61        
    62         /** Hash function */
    63         hash_set_hash hash;
    64        
    65         /** Hash table item equals function */
    66         hash_set_equals equals;
    67 } hash_set_t;
     63        con_srvs_t *srvs;
     64        async_sess_t *client_sess;
     65        void *carg;
     66} con_srv_t;
    6867
    69 extern int hash_set_init(hash_set_t *, hash_set_hash, hash_set_equals, size_t);
    70 extern int hash_set_insert(hash_set_t *, link_t *);
    71 extern link_t *hash_set_find(hash_set_t *, const link_t *);
    72 extern int hash_set_contains(const hash_set_t *, const link_t *);
    73 extern size_t hash_set_count(const hash_set_t *);
    74 extern link_t *hash_set_remove(hash_set_t *, const link_t *);
    75 extern void hash_set_remove_selected(hash_set_t *,
    76     int (*)(link_t *, void *), void *);
    77 extern void hash_set_destroy(hash_set_t *);
    78 extern void hash_set_apply(hash_set_t *, void (*)(link_t *, void *), void *);
    79 extern void hash_set_clear(hash_set_t *, void (*)(link_t *, void *), void *);
     68struct con_ops {
     69        int (*open)(con_srvs_t *, con_srv_t *);
     70        int (*close)(con_srv_t *);
     71        int (*read)(con_srv_t *, void *, size_t);
     72        int (*write)(con_srv_t *, void *, size_t);
     73        void (*sync)(con_srv_t *);
     74        void (*clear)(con_srv_t *);
     75        void (*set_pos)(con_srv_t *, sysarg_t col, sysarg_t row);
     76        int (*get_pos)(con_srv_t *, sysarg_t *, sysarg_t *);
     77        int (*get_size)(con_srv_t *, sysarg_t *, sysarg_t *);
     78        int (*get_color_cap)(con_srv_t *, console_caps_t *);
     79        void (*set_style)(con_srv_t *, console_style_t);
     80        void (*set_color)(con_srv_t *, console_color_t, console_color_t,
     81            console_color_attr_t);
     82        void (*set_rgb_color)(con_srv_t *, pixel_t, pixel_t);
     83        void (*set_cursor_visibility)(con_srv_t *, bool);
     84        int (*get_event)(con_srv_t *, cons_event_t *);
     85};
     86
     87extern void con_srvs_init(con_srvs_t *);
     88
     89extern int con_conn(ipc_callid_t, ipc_call_t *, con_srvs_t *);
    8090
    8191#endif
  • uspace/lib/c/include/io/console.h

    r80445cf r4c53333  
    3737
    3838#include <sys/time.h>
     39#include <io/concaps.h>
     40#include <io/kbd_event.h>
     41#include <io/cons_event.h>
    3942#include <io/keycode.h>
    4043#include <async.h>
    41 #include <bool.h>
     44#include <stdbool.h>
    4245#include <stdio.h>
    43 
    44 typedef enum {
    45         CONSOLE_CAP_NONE = 0,
    46         CONSOLE_CAP_STYLE = 1,
    47         CONSOLE_CAP_INDEXED = 2,
    48         CONSOLE_CAP_RGB = 4
    49 } console_caps_t;
    5046
    5147/** Console control structure. */
     
    7066} console_ctrl_t;
    7167
    72 typedef enum {
    73         KEY_PRESS,
    74         KEY_RELEASE
    75 } kbd_event_type_t;
    76 
    77 /** Console event structure. */
    78 typedef struct {
    79         /** List handle */
    80         link_t link;
    81        
    82         /** Press or release event. */
    83         kbd_event_type_t type;
    84        
    85         /** Keycode of the key that was pressed or released. */
    86         keycode_t key;
    87        
    88         /** Bitmask of modifiers held. */
    89         keymod_t mods;
    90        
    91         /** The character that was generated or '\0' for none. */
    92         wchar_t c;
    93 } kbd_event_t;
    94 
    9568extern console_ctrl_t *console_init(FILE *, FILE *);
    9669extern void console_done(console_ctrl_t *);
     
    11083extern void console_cursor_visibility(console_ctrl_t *, bool);
    11184extern int console_get_color_cap(console_ctrl_t *, sysarg_t *);
    112 extern bool console_get_kbd_event(console_ctrl_t *, kbd_event_t *);
    113 extern bool console_get_kbd_event_timeout(console_ctrl_t *, kbd_event_t *,
     85extern bool console_get_event(console_ctrl_t *, cons_event_t *);
     86extern bool console_get_event_timeout(console_ctrl_t *, cons_event_t *,
    11487    suseconds_t *);
    11588
  • uspace/lib/c/include/io/klog.h

    r80445cf r4c53333  
    3838#include <sys/types.h>
    3939#include <stdarg.h>
     40#include <io/verify.h>
    4041
    4142extern size_t klog_write(const void *, size_t);
    4243extern void klog_update(void);
    43 extern int klog_printf(const char *, ...);
     44extern void klog_command(const void *, size_t);
     45extern int klog_printf(const char *, ...)
     46    PRINTF_ATTRIBUTE(1, 2);
    4447extern int klog_vprintf(const char *, va_list);
    4548
  • uspace/lib/c/include/io/log.h

    r80445cf r4c53333  
    3636
    3737#include <stdarg.h>
     38#include <inttypes.h>
     39#include <io/verify.h>
    3840
     41/** Log message level. */
    3942typedef enum {
     43        /** Fatal error, program is not able to recover at all. */
    4044        LVL_FATAL,
     45        /** Serious error but the program can recover from it. */
    4146        LVL_ERROR,
     47        /** Easily recoverable problem. */
    4248        LVL_WARN,
     49        /** Information message that ought to be printed by default. */
    4350        LVL_NOTE,
     51        /** Debugging purpose message. */
    4452        LVL_DEBUG,
     53        /** More detailed debugging message. */
    4554        LVL_DEBUG2,
    46 
     55       
    4756        /** For checking range of values */
    4857        LVL_LIMIT
    4958} log_level_t;
    5059
    51 extern int log_init(const char *, log_level_t);
    52 extern void log_msg(log_level_t, const char *, ...);
    53 extern void log_msgv(log_level_t, const char *, va_list);
     60/** Log itself (logging target). */
     61typedef sysarg_t log_t;
     62/** Formatting directive for printing log_t. */
     63#define PRIlogctx PRIxn
     64
     65/** Default log (target). */
     66#define LOG_DEFAULT ((log_t) -1)
     67
     68/** Use when creating new top-level log. */
     69#define LOG_NO_PARENT ((log_t) 0)
     70
     71extern const char *log_level_str(log_level_t);
     72extern int log_level_from_str(const char *, log_level_t *);
     73
     74extern int log_init(const char *);
     75extern log_t log_create(const char *, log_t);
     76
     77extern void log_msg(log_t, log_level_t, const char *, ...)
     78    PRINTF_ATTRIBUTE(3, 4);
     79extern void log_msgv(log_t, log_level_t, const char *, va_list);
    5480
    5581#endif
  • uspace/lib/c/include/io/visualizer.h

    r80445cf r4c53333  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2011 Petr Koupy
    33 * All rights reserved.
    44 *
     
    3030 * @{
    3131 */
    32 
    3332/** @file
    34  * Generic module functions.
    35  *
    36  * @todo MAKE IT POSSIBLE TO REMOVE THIS FILE VIA EITHER REPLACING PART OF ITS
    37  * FUNCTIONALITY OR VIA INTEGRATING ITS FUNCTIONALITY MORE TIGHTLY WITH THE REST
    38  * OF THE SYSTEM.
    3933 */
    4034
    41 #ifndef LIBC_MODULES_H_
    42 #define LIBC_MODULES_H_
     35#ifndef LIBC_IO_VISUALIZER_H_
     36#define LIBC_IO_VISUALIZER_H_
    4337
     38#include <sys/types.h>
    4439#include <async.h>
    45 #include <ipc/services.h>
    46 #include <sys/time.h>
     40#include <io/mode.h>
    4741
    48 /** Connect to module function type definition.
    49  *
    50  * @return Session to the service.
    51  *
    52  */
    53 typedef async_sess_t *connect_module_t(services_t);
     42extern int visualizer_claim(async_sess_t *, sysarg_t);
     43extern int visualizer_yield(async_sess_t *);
    5444
    55 extern void answer_call(ipc_callid_t, int, ipc_call_t *, size_t);
    56 extern async_sess_t *bind_service(services_t, sysarg_t, sysarg_t, sysarg_t,
    57     async_client_conn_t);
    58 extern async_sess_t *connect_to_service(services_t);
    59 extern int data_reply(void *, size_t);
    60 extern void refresh_answer(ipc_call_t *, size_t *);
     45extern int visualizer_enumerate_modes(async_sess_t *, vslmode_t *, sysarg_t);
     46extern int visualizer_get_default_mode(async_sess_t *, vslmode_t *);
     47extern int visualizer_get_current_mode(async_sess_t *, vslmode_t *);
     48extern int visualizer_get_mode(async_sess_t *, vslmode_t *, sysarg_t);
     49extern int visualizer_set_mode(async_sess_t *, sysarg_t, sysarg_t, void *);
     50
     51extern int visualizer_update_damaged_region(async_sess_t *,
     52    sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
     53
     54extern int visualizer_suspend(async_sess_t *);
     55extern int visualizer_wakeup(async_sess_t *);
    6156
    6257#endif
  • uspace/lib/c/include/ipc/console.h

    r80445cf r4c53333  
    4343        CONSOLE_GET_EVENT,
    4444        CONSOLE_GET_POS,
    45         CONSOLE_GOTO,
     45        CONSOLE_SET_POS,
    4646        CONSOLE_CLEAR,
    4747        CONSOLE_SET_STYLE,
    4848        CONSOLE_SET_COLOR,
    4949        CONSOLE_SET_RGB_COLOR,
    50         CONSOLE_CURSOR_VISIBILITY
     50        CONSOLE_SET_CURSOR_VISIBILITY
    5151} console_request_t;
    5252
  • uspace/lib/c/include/ipc/dev_iface.h

    r80445cf r4c53333  
    3838        /** Character device interface */
    3939        CHAR_DEV_IFACE,
     40
     41        /** Graphic device interface */
     42        GRAPH_DEV_IFACE,
    4043       
    4144        /** Network interface controller interface */
     
    5154        /** Interface provided by USB HID devices. */
    5255        USBHID_DEV_IFACE,
     56        /** Interface provided by Real Time Clock devices */
     57        CLOCK_DEV_IFACE,
     58        /** Interface provided by battery powered devices */
     59        BATTERY_DEV_IFACE,
     60        /** Interface provided by AHCI devices. */
     61        AHCI_DEV_IFACE,
    5362
    5463        DEV_IFACE_MAX
  • uspace/lib/c/include/ipc/devman.h

    r80445cf r4c53333  
    157157        DEVMAN_FUN_GET_CHILD,
    158158        DEVMAN_FUN_GET_NAME,
     159        DEVMAN_FUN_GET_DRIVER_NAME,
    159160        DEVMAN_FUN_ONLINE,
    160161        DEVMAN_FUN_OFFLINE,
  • uspace/lib/c/include/ipc/inet.h

    r80445cf r4c53333  
    4545        INET_PORT_CFG,
    4646        /** Ping service port */
    47         INET_PORT_PING
     47        INET_PORT_PING,
     48        /** Ping6 service port */
     49        INET_PORT_PING6
    4850} inet_port_t;
    4951
     
    8890} inetping_request_t;
    8991
     92/** Events on Inet ping6 port */
     93typedef enum {
     94        INETPING6_EV_RECV = IPC_FIRST_USER_METHOD
     95} inetping6_event_t;
     96
     97/** Requests on Inet ping6 port */
     98typedef enum {
     99        INETPING6_SEND = IPC_FIRST_USER_METHOD,
     100        INETPING6_GET_SRCADDR
     101} inetping6_request_t;
     102
    90103#endif
    91104
  • uspace/lib/c/include/ipc/input.h

    r80445cf r4c53333  
    4646        INPUT_EVENT_KEY = IPC_FIRST_USER_METHOD,
    4747        INPUT_EVENT_MOVE,
     48        INPUT_EVENT_ABS_MOVE,
    4849        INPUT_EVENT_BUTTON
    4950} input_notif_t;
  • uspace/lib/c/include/ipc/ipc.h

    r80445cf r4c53333  
    4747
    4848typedef void (*ipc_async_callback_t)(void *, int, ipc_call_t *);
    49 
    50 /*
    51  * User-friendly wrappers for ipc_call_sync_fast() and ipc_call_sync_slow().
    52  * They are in the form ipc_call_sync_m_n(), where m denotes the number of
    53  * arguments of payload and n denotes number of return values. Whenever
    54  * possible, the fast version is used.
    55  */
    56 
    57 #define ipc_call_sync_0_0(phoneid, method) \
    58         ipc_call_sync_fast((phoneid), (method), 0, 0, 0, 0, 0, 0, 0, 0)
    59 #define ipc_call_sync_0_1(phoneid, method, res1) \
    60         ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), 0, 0, 0, 0)
    61 #define ipc_call_sync_0_2(phoneid, method, res1, res2) \
    62         ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), 0, 0, 0)
    63 #define ipc_call_sync_0_3(phoneid, method, res1, res2, res3) \
    64         ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
    65             0, 0)
    66 #define ipc_call_sync_0_4(phoneid, method, res1, res2, res3, res4) \
    67         ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
    68             (res4), 0)
    69 #define ipc_call_sync_0_5(phoneid, method, res1, res2, res3, res4, res5) \
    70         ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
    71             (res4), (res5))
    72 
    73 #define ipc_call_sync_1_0(phoneid, method, arg1) \
    74         ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, 0, 0, 0, 0, 0)
    75 #define ipc_call_sync_1_1(phoneid, method, arg1, res1) \
    76         ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), 0, 0, 0, 0)
    77 #define ipc_call_sync_1_2(phoneid, method, arg1, res1, res2) \
    78         ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), 0, \
    79             0, 0)
    80 #define ipc_call_sync_1_3(phoneid, method, arg1, res1, res2, res3) \
    81         ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
    82             (res3), 0, 0)
    83 #define ipc_call_sync_1_4(phoneid, method, arg1, res1, res2, res3, res4) \
    84         ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
    85             (res3), (res4), 0)
    86 #define ipc_call_sync_1_5(phoneid, method, arg1, res1, res2, res3, res4, \
    87     res5) \
    88         ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
    89             (res3), (res4), (res5))
    90 
    91 #define ipc_call_sync_2_0(phoneid, method, arg1, arg2) \
    92         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, 0, 0, 0, \
    93             0, 0)
    94 #define ipc_call_sync_2_1(phoneid, method, arg1, arg2, res1) \
    95         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), 0, 0, \
    96             0, 0)
    97 #define ipc_call_sync_2_2(phoneid, method, arg1, arg2, res1, res2) \
    98         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
    99             (res2), 0, 0, 0)
    100 #define ipc_call_sync_2_3(phoneid, method, arg1, arg2, res1, res2, res3) \
    101         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
    102             (res2), (res3), 0, 0)
    103 #define ipc_call_sync_2_4(phoneid, method, arg1, arg2, res1, res2, res3, \
    104     res4) \
    105         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
    106             (res2), (res3), (res4), 0)
    107 #define ipc_call_sync_2_5(phoneid, method, arg1, arg2, res1, res2, res3, \
    108     res4, res5)\
    109         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
    110             (res2), (res3), (res4), (res5))
    111 
    112 #define ipc_call_sync_3_0(phoneid, method, arg1, arg2, arg3) \
    113         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, 0, 0, \
    114             0, 0)
    115 #define ipc_call_sync_3_1(phoneid, method, arg1, arg2, arg3, res1) \
    116         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
    117             0, 0, 0, 0)
    118 #define ipc_call_sync_3_2(phoneid, method, arg1, arg2, arg3, res1, res2) \
    119         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
    120             (res2), 0, 0, 0)
    121 #define ipc_call_sync_3_3(phoneid, method, arg1, arg2, arg3, res1, res2, \
    122     res3) \
    123         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
    124             (res1), (res2), (res3), 0, 0)
    125 #define ipc_call_sync_3_4(phoneid, method, arg1, arg2, arg3, res1, res2, \
    126     res3, res4) \
    127         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
    128             (res1), (res2), (res3), (res4), 0)
    129 #define ipc_call_sync_3_5(phoneid, method, arg1, arg2, arg3, res1, res2, \
    130     res3, res4, res5) \
    131         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
    132             (res1), (res2), (res3), (res4), (res5))
    133 
    134 #define ipc_call_sync_4_0(phoneid, method, arg1, arg2, arg3, arg4) \
    135         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
    136             0, 0, 0, 0, 0)
    137 #define ipc_call_sync_4_1(phoneid, method, arg1, arg2, arg3, arg4, res1) \
    138         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
    139             (res1), 0, 0, 0, 0)
    140 #define ipc_call_sync_4_2(phoneid, method, arg1, arg2, arg3, arg4, res1, res2) \
    141         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
    142             (res1), (res2), 0, 0, 0)
    143 #define ipc_call_sync_4_3(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
    144     res3) \
    145         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    146             (arg4), 0, (res1), (res2), (res3), 0, 0)
    147 #define ipc_call_sync_4_4(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
    148     res3, res4) \
    149         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    150             (arg4), 0, (res1), (res2), (res3), (res4), 0)
    151 #define ipc_call_sync_4_5(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
    152     res3, res4, res5) \
    153         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    154             (arg4), 0, (res1), (res2), (res3), (res4), (res5))
    155 
    156 #define ipc_call_sync_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \
    157         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    158             (arg5), 0, 0, 0, 0, 0)
    159 #define ipc_call_sync_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1) \
    160         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    161             (arg5), (res1), 0, 0, 0, 0)
    162 #define ipc_call_sync_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
    163     res2) \
    164         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    165             (arg4), (arg5), (res1), (res2), 0, 0, 0)
    166 #define ipc_call_sync_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
    167     res2, res3) \
    168         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    169             (arg4), (arg5), (res1), (res2), (res3), 0, 0)
    170 #define ipc_call_sync_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
    171     res2, res3, res4) \
    172         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    173             (arg4), (arg5), (res1), (res2), (res3), (res4), 0)
    174 #define ipc_call_sync_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
    175     res2, res3, res4, res5) \
    176         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    177             (arg4), (arg5), (res1), (res2), (res3), (res4), (res5))
    178 
    179 extern int ipc_call_sync_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    180     sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
    181 
    182 extern int ipc_call_sync_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    183     sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
    184     sysarg_t *);
    18549
    18650extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, sysarg_t, unsigned int);
     
    254118    sysarg_t, sysarg_t, void *, ipc_async_callback_t, bool);
    255119
    256 extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, task_id_t *,
    257     sysarg_t *);
    258 extern int ipc_connect_me(int);
    259 extern int ipc_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
    260 extern int ipc_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
    261 
    262120extern int ipc_hangup(int);
    263121
     
    267125    sysarg_t, sysarg_t, sysarg_t, unsigned int);
    268126
    269 /*
    270  * User-friendly wrappers for ipc_share_in_start().
    271  */
    272 
    273 #define ipc_share_in_start_0_0(phoneid, size, dst) \
    274         ipc_share_in_start((phoneid), (size), 0, NULL, (dst))
    275 #define ipc_share_in_start_0_1(phoneid, size, flags, dst) \
    276         ipc_share_in_start((phoneid), (size), 0, (flags), (dst))
    277 #define ipc_share_in_start_1_0(phoneid, size, arg, dst) \
    278         ipc_share_in_start((phoneid), (size), (arg), NULL, (dst))
    279 #define ipc_share_in_start_1_1(phoneid, size, arg, flags, dst) \
    280         ipc_share_in_start((phoneid), (size), (arg), (flags), (dst))
    281 
    282 extern int ipc_share_in_start(int, size_t, sysarg_t, unsigned int *, void **);
    283 extern int ipc_share_in_finalize(ipc_callid_t, void *, unsigned int);
    284 extern int ipc_share_out_start(int, void *, unsigned int);
    285 extern int ipc_share_out_finalize(ipc_callid_t, void **);
    286 extern int ipc_data_read_start(int, void *, size_t);
    287 extern int ipc_data_read_finalize(ipc_callid_t, const void *, size_t);
    288 extern int ipc_data_write_start(int, const void *, size_t);
    289 extern int ipc_data_write_finalize(ipc_callid_t, void *, size_t);
    290 
    291127extern int ipc_connect_kbox(task_id_t);
    292128
  • uspace/lib/c/include/ipc/loc.h

    r80445cf r4c53333  
    5656        LOC_SERVICE_GET_ID,
    5757        LOC_SERVICE_GET_NAME,
     58        LOC_SERVICE_GET_SERVER_NAME,
    5859        LOC_NAMESPACE_GET_ID,
    5960        LOC_CALLBACK_CREATE,
  • uspace/lib/c/include/ipc/mouseev.h

    r80445cf r4c53333  
    4747typedef enum {
    4848        MOUSEEV_MOVE_EVENT = IPC_FIRST_USER_METHOD,
     49        MOUSEEV_ABS_MOVE_EVENT,
    4950        MOUSEEV_BUTTON_EVENT
    5051} mouseev_notif_t;
  • uspace/lib/c/include/ipc/services.h

    r80445cf r4c53333  
    4545        SERVICE_VFS        = FOURCC('v', 'f', 's', ' '),
    4646        SERVICE_LOC        = FOURCC('l', 'o', 'c', ' '),
     47        SERVICE_LOGGER     = FOURCC('l', 'o', 'g', 'g'),
    4748        SERVICE_DEVMAN     = FOURCC('d', 'e', 'v', 'n'),
    4849        SERVICE_IRC        = FOURCC('i', 'r', 'c', ' '),
     
    5253} services_t;
    5354
    54 #define SERVICE_NAME_INET     "net/inet"
    55 #define SERVICE_NAME_INETCFG  "net/inetcfg"
    56 #define SERVICE_NAME_INETPING "net/inetping"
     55#define SERVICE_NAME_DNSR       "net/dnsr"
     56#define SERVICE_NAME_INET       "net/inet"
     57#define SERVICE_NAME_INETCFG    "net/inetcfg"
     58#define SERVICE_NAME_INETPING   "net/inetping"
     59#define SERVICE_NAME_INETPING6  "net/inetping6"
    5760
    5861#endif
  • uspace/lib/c/include/ipc/vfs.h

    r80445cf r4c53333  
    3838#include <ipc/common.h>
    3939#include <sys/types.h>
    40 #include <bool.h>
     40#include <stdbool.h>
    4141
    4242#define FS_NAME_MAXLEN  20
  • uspace/lib/c/include/loc.h

    r80445cf r4c53333  
    3838#include <ipc/loc.h>
    3939#include <async.h>
    40 #include <bool.h>
     40#include <stdbool.h>
    4141
    4242typedef void (*loc_cat_change_cb_t)(void);
     
    5656    unsigned int);
    5757extern int loc_service_get_name(service_id_t, char **);
     58extern int loc_service_get_server_name(service_id_t, char **);
    5859extern int loc_namespace_get_id(const char *, service_id_t *,
    5960    unsigned int);
  • uspace/lib/c/include/macros.h

    r80445cf r4c53333  
    3838#define min(a, b)  ((a) < (b) ? (a) : (b))
    3939#define max(a, b)  ((a) > (b) ? (a) : (b))
     40#define abs(a)     ((a) >= 0 ? (a) : -(a))
     41
    4042
    4143#define KiB2SIZE(kb)  ((kb) << 10)
     
    5254            | ((((uint64_t) (up)) & 0xffffffff) << 32))
    5355
     56#ifndef member_to_inst
     57#define member_to_inst(ptr_member, type, member_identif) \
     58        ((type*) (((void*)(ptr_member)) - ((void*)&(((type*)0)->member_identif))))
    5459#endif
     60
     61
     62#endif
     63
     64#define _paddname(line) PADD_ ## line ## __
     65#define _padd(width, line) uint ## width ## _t _paddname(line)
     66#define PADD32 _padd(32, __LINE__)
     67#define PADD16 _padd(16, __LINE__)
     68#define PADD8 _padd(8, __LINE__)
    5569
    5670/** @}
  • uspace/lib/c/include/mem.h

    r80445cf r4c53333  
    3737
    3838#include <sys/types.h>
     39#include <cc.h>
    3940
    40 #define bzero(ptr, len)  memset((ptr), 0, (len))
    41 
    42 extern void *memset(void *, int, size_t);
    43 extern void *memcpy(void *, const void *, size_t);
     41extern void *memset(void *, int, size_t)
     42    ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns");
     43extern void *memcpy(void *, const void *, size_t)
     44    ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns");
    4445extern void *memmove(void *, const void *, size_t);
    45 
    46 extern int bcmp(const void *, const void *, size_t);
     46extern int memcmp(const void *, const void *, size_t);
    4747
    4848#endif
  • uspace/lib/c/include/net/in.h

    r80445cf r4c53333  
    4545#define INET_ADDRSTRLEN  (4 * 3 + 3 + 1)
    4646
    47 #define INADDR_ANY 0
    48 
    49 /** Type definition of the INET address.
    50  * @see in_addr
    51  */
    52 typedef struct in_addr in_addr_t;
    53 
    54 /** Type definition of the INET socket address.
    55  * @see sockaddr_in
    56  */
    57 typedef struct sockaddr_in      sockaddr_in_t;
     47#define INADDR_ANY  0
    5848
    5949/** INET address. */
    60 struct in_addr {
     50typedef struct in_addr {
    6151        /** 4 byte IP address. */
    6252        uint32_t s_addr;
    63 };
     53} in_addr_t;
    6454
    6555/** INET socket address.
    6656 * @see sockaddr
    6757 */
    68 struct sockaddr_in {
     58typedef struct sockaddr_in {
    6959        /** Address family. Should be AF_INET. */
    7060        uint16_t sin_family;
     
    7262        uint16_t sin_port;
    7363        /** Internet address. */
    74         struct in_addr sin_addr;
     64        in_addr_t sin_addr;
    7565        /** Padding to meet the sockaddr size. */
    7666        uint8_t sin_zero[8];
    77 };
     67} sockaddr_in_t;
    7868
    7969#endif
  • uspace/lib/c/include/net/in6.h

    r80445cf r4c53333  
    4343
    4444/** INET6 string address maximum length. */
    45 #define INET6_ADDRSTRLEN        (8 * 4 + 7 + 1)
    46 
    47 /** Type definition of the INET6 address.
    48  * @see in6_addr
    49  */
    50 typedef struct in6_addr in6_addr_t;
    51 
    52 /** Type definition of the INET6 socket address.
    53  * @see sockaddr_in6
    54  */
    55 typedef struct sockaddr_in6     sockaddr_in6_t;
     45#define INET6_ADDRSTRLEN  (8 * 4 + 7 + 1)
    5646
    5747/** INET6 address. */
    58 struct in6_addr {
     48typedef struct in6_addr {
    5949        /** 16 byte IPv6 address. */
    60         unsigned char s6_addr[16];
    61 };
     50        uint8_t s6_addr[16];
     51} in6_addr_t;
    6252
    6353/** INET6 socket address.
    6454 * @see sockaddr
    6555 */
    66 struct sockaddr_in6 {
     56typedef struct sockaddr_in6 {
    6757        /** Address family. Should be AF_INET6. */
    6858        uint16_t sin6_family;
     
    7565        /** Scope identifier. */
    7666        uint32_t sin6_scope_id;
    77 };
     67} sockaddr_in6_t;
     68
     69extern const in6_addr_t in6addr_any;
    7870
    7971#endif
  • uspace/lib/c/include/net/inet.h

    r80445cf r4c53333  
    4141#include <byteorder.h>
    4242
    43 /** Type definition of the socket address.
    44  * @see sockaddr
    45  */
    46 typedef struct sockaddr         sockaddr_t;
    47 
    4843/** Type definition of the address information.
    4944 * @see addrinfo
    5045 */
    51 typedef struct addrinfo         addrinfo_t;
     46typedef struct addrinfo addrinfo_t;
    5247
    5348/** Socket address. */
    54 struct sockaddr {
     49typedef struct sockaddr {
    5550        /** Address family. @see socket.h */
    5651        uint16_t sa_family;
    5752        /** 14 byte protocol address. */
    5853        uint8_t sa_data[14];
    59 };
     54} sockaddr_t;
    6055
    6156extern int inet_ntop(uint16_t, const uint8_t *, char *, size_t);
  • uspace/lib/c/include/net/ip_protocols.h

    r80445cf r4c53333  
    4444/*@{*/
    4545
    46 #define IPPROTO_ICMP    1
    47 #define IPPROTO_TCP     6
    48 #define IPPROTO_UDP     17
     46#define IPPROTO_ICMP    1
     47#define IPPROTO_TCP     6
     48#define IPPROTO_UDP     17
     49#define IPPROTO_ICMPV6  58
    4950
    5051/*@}*/
  • uspace/lib/c/include/net/socket_codes.h

    r80445cf r4c53333  
    4545
    4646enum {
    47         AF_UNKNOWN = 0,
    48         AF_INET,        /* IPv4 address */
    49         AF_INET6        /* IPv6 address */
     47        AF_NONE = 0,
     48        AF_INET,  /* IPv4 address */
     49        AF_INET6  /* IPv6 address */
    5050};
    5151
     
    5353
    5454/** @name Protocol families definitions
    55  *  Same as address families.
     55 * Same as address families.
    5656 */
    5757/*@{*/
    5858
    59 #define PF_INET         AF_INET
    60 #define PF_INET6        AF_INET6
     59#define PF_INET   AF_INET
     60#define PF_INET6  AF_INET6
    6161
    6262/*@}*/
  • uspace/lib/c/include/nic/nic.h

    r80445cf r4c53333  
    4040
    4141#include <nic/eth_phys.h>
    42 #include <bool.h>
     42#include <stdbool.h>
    4343
    4444/** Ethernet address length. */
  • uspace/lib/c/include/ns.h

    r80445cf r4c53333  
    3737
    3838#include <sys/types.h>
     39#include <ipc/services.h>
    3940#include <task.h>
    4041#include <async.h>
    4142
    4243extern int service_register(sysarg_t);
    43 extern async_sess_t *service_connect(exch_mgmt_t, sysarg_t, sysarg_t, sysarg_t);
    44 extern async_sess_t *service_connect_blocking(exch_mgmt_t, sysarg_t, sysarg_t,
     44extern async_sess_t *service_connect(exch_mgmt_t, services_t, sysarg_t, sysarg_t);
     45extern async_sess_t *service_connect_blocking(exch_mgmt_t, services_t, sysarg_t,
    4546    sysarg_t);
     47extern async_sess_t *service_bind(services_t, sysarg_t, sysarg_t, sysarg_t,
     48    async_client_conn_t);
    4649
    4750extern int ns_ping(void);
  • uspace/lib/c/include/rtld/dynamic.h

    r80445cf r4c53333  
    3636#define LIBC_RTLD_DYNAMIC_H_
    3737
    38 #include <bool.h>
     38#include <stdbool.h>
    3939#include <rtld/elf_dyn.h>
    4040#include <libarch/rtld/dynamic.h>
  • uspace/lib/c/include/setjmp.h

    r80445cf r4c53333  
    3838#include <libarch/fibril.h>
    3939
    40 typedef context_t jmp_buf;
     40typedef context_t jmp_buf[1];
    4141
    4242extern int setjmp(jmp_buf env);
     
    4747/** @}
    4848 */
    49 
  • uspace/lib/c/include/sort.h

    r80445cf r4c53333  
    3737
    3838#include <sys/types.h>
    39 #include <bool.h>
     39#include <stdbool.h>
    4040
    4141typedef int (* sort_cmp_t)(void *, void *, void *);
  • uspace/lib/c/include/stack.h

    r80445cf r4c53333  
    11/*
    2  * Copyright (c) 2006 Martin Decky
     2 * Copyright (c) 2012 Jakub Jermar
    33 * All rights reserved.
    44 *
     
    3333 */
    3434
    35 #ifndef LIBC_BOOL_H_
    36 #define LIBC_BOOL_H_
     35#ifndef LIBC_STACK_H_
     36#define LIBC_STACK_H_
    3737
    3838#include <libarch/types.h>
    39 #include <abi/bool.h>
    4039
    41 #define false  0
    42 #define true   1
     40extern size_t stack_size_get(void);
    4341
    4442#endif
  • uspace/lib/c/include/stacktrace.h

    r80445cf r4c53333  
    3838
    3939#include <sys/types.h>
    40 #include <bool.h>
     40#include <stdbool.h>
    4141
    4242typedef struct {
  • uspace/lib/c/include/stats.h

    r80445cf r4c53333  
    3939#include <thread.h>
    4040#include <stdint.h>
    41 #include <bool.h>
     41#include <stdbool.h>
    4242#include <sys/types.h>
    4343#include <abi/sysinfo.h>
  • uspace/lib/c/include/stdarg.h

    r80445cf r4c53333  
    4343#define va_arg(ap, type)    __builtin_va_arg(ap, type)
    4444#define va_end(ap)          __builtin_va_end(ap)
     45#define va_copy(dst, src)   __builtin_va_copy(dst, src)
    4546
    4647#endif
  • uspace/lib/c/include/stdbool.h

    r80445cf r4c53333  
    11/*
    2  * Copyright (c) 2011 Jiri Zarevucky
     2 * Copyright (c) 2006 Martin Decky
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libposix
     29/** @addtogroup libc
    3030 * @{
    3131 */
    32 /** @file Boolean type and values.
     32/** @file
    3333 */
    3434
    35 #ifndef POSIX_STDBOOL_H_
    36 #define POSIX_STDBOOL_H_
    37 
    38 #ifdef LIBC_BOOL_H_
    39         #error "You can't include bool.h and stdbool.h at the same time."
    40 #endif
     35#ifndef LIBC_BOOL_H_
    4136#define LIBC_BOOL_H_
    4237
    43 #define bool _Bool
    44 #define true 1
    45 #define false 0
     38#include <libarch/types.h>
     39#include <abi/bool.h>
     40
     41#define false  0
     42#define true   1
     43
    4644#define __bool_true_false_are_defined 1
    4745
    48 #endif /* POSIX_STDBOOL_H_ */
     46#endif
     47
     48/** @}
     49 */
  • uspace/lib/c/include/stdio.h

    r80445cf r4c53333  
    3939#include <stdarg.h>
    4040#include <str.h>
    41 #include <adt/list.h>
    42 
    43 #ifndef NVERIFY_PRINTF
    44 
    45 #define PRINTF_ATTRIBUTE(start, end) \
    46         __attribute__((format(gnu_printf, start, end)))
    47 
    48 #else /* NVERIFY_PRINTF */
    49 
    50 #define PRINTF_ATTRIBUTE(start, end)
    51 
    52 #endif /* NVERIFY_PRINTF */
     41#include <io/verify.h>
     42#include <abi/klog.h>
    5343
    5444#define EOF  (-1)
     
    6252                int _n = snprintf(_buf, sizeof(_buf), fmt, ##__VA_ARGS__); \
    6353                if (_n > 0) \
    64                         (void) __SYSCALL3(SYS_KLOG, 1, (sysarg_t) _buf, str_size(_buf)); \
     54                        (void) __SYSCALL3(SYS_KLOG, KLOG_WRITE, (sysarg_t) _buf, str_size(_buf)); \
    6555        }
    6656
     
    153143
    154144extern void setvbuf(FILE *, void *, int, size_t);
     145extern void setbuf(FILE *, void *);
    155146
    156147/* Misc file functions */
  • uspace/lib/c/include/str.h

    r80445cf r4c53333  
    3939#include <mem.h>
    4040#include <sys/types.h>
    41 #include <bool.h>
     41#include <stdbool.h>
    4242
    4343#define U_SPECIAL  '?'
     
    5656
    5757extern wchar_t str_decode(const char *str, size_t *offset, size_t sz);
     58extern wchar_t str_decode_reverse(const char *str, size_t *offset, size_t sz);
    5859extern int chr_encode(const wchar_t ch, char *str, size_t *offset, size_t sz);
    5960
     
    7374extern size_t wstr_nlength(const wchar_t *str, size_t size);
    7475
     76extern size_t chr_width(wchar_t ch);
     77extern size_t str_width(const char *str);
     78
    7579extern bool ascii_check(wchar_t ch);
    7680extern bool chr_check(wchar_t ch);
     
    7882extern int str_cmp(const char *s1, const char *s2);
    7983extern int str_lcmp(const char *s1, const char *s2, size_t max_len);
     84
     85extern bool str_test_prefix(const char *s, const char *p);
    8086
    8187extern void str_cpy(char *dest, size_t size, const char *src);
     
    103109extern char *str_ndup(const char *, size_t max_size);
    104110
    105 extern int str_uint8_t(const char *, char **, unsigned int, bool, uint8_t *);
    106 extern int str_uint16_t(const char *, char **, unsigned int, bool, uint16_t *);
    107 extern int str_uint32_t(const char *, char **, unsigned int, bool, uint32_t *);
    108 extern int str_uint64_t(const char *, char **, unsigned int, bool, uint64_t *);
    109 extern int str_size_t(const char *, char **, unsigned int, bool, size_t *);
     111extern int str_uint8_t(const char *, const char **, unsigned int, bool,
     112    uint8_t *);
     113extern int str_uint16_t(const char *, const char **, unsigned int, bool,
     114    uint16_t *);
     115extern int str_uint32_t(const char *, const char **, unsigned int, bool,
     116    uint32_t *);
     117extern int str_uint64_t(const char *, const char **, unsigned int, bool,
     118    uint64_t *);
     119extern int str_size_t(const char *, const char **, unsigned int, bool,
     120    size_t *);
    110121
    111122extern void order_suffix(const uint64_t, uint64_t *, char *);
  • uspace/lib/c/include/sys/mman.h

    r80445cf r4c53333  
    3939#include <sys/types.h>
    4040
    41 #define MAP_FAILED  ((void *) -1)
     41#define MAP_FAILED  AS_MAP_FAILED
    4242
    4343#define MAP_SHARED     (1 << 0)
  • uspace/lib/c/include/sys/stat.h

    r80445cf r4c53333  
    3737
    3838#include <sys/types.h>
    39 #include <bool.h>
     39#include <stdbool.h>
    4040#include <ipc/vfs.h>
    4141#include <ipc/loc.h>
  • uspace/lib/c/include/sys/time.h

    r80445cf r4c53333  
    11/*
    22 * Copyright (c) 2006 Ondrej Palkovsky
     3 * Copyright (c) 2011 Petr Koupy
     4 * Copyright (c) 2011 Jiri Zarevucky
    35 * All rights reserved.
    46 *
     
    3941
    4042#define DST_NONE 0
     43#define ASCTIME_BUF_LEN 26
    4144
    4245typedef long time_t;
     
    4548typedef uint32_t useconds_t;
    4649typedef uint32_t mseconds_t;
     50
     51struct tm {
     52        int tm_sec;         /* Seconds [0,60]. */
     53        int tm_min;         /* Minutes [0,59]. */
     54        int tm_hour;        /* Hour [0,23]. */
     55        int tm_mday;        /* Day of month [1,31]. */
     56        int tm_mon;         /* Month of year [0,11]. */
     57        int tm_year;        /* Years since 1900. */
     58        int tm_wday;        /* Day of week [0,6] (Sunday = 0). */
     59        int tm_yday;        /* Day of year [0,365]. */
     60        int tm_isdst;       /* Daylight Savings flag. */
     61};
    4762
    4863struct timeval {
     
    6176extern int tv_gteq(struct timeval *tv1, struct timeval *tv2);
    6277extern int gettimeofday(struct timeval *tv, struct timezone *tz);
     78extern int getuptime(struct timeval *tv);
    6379
    6480extern void udelay(useconds_t);
     81
     82extern time_t mktime(struct tm *tm);
     83extern int time_utc2tm(const time_t time, struct tm *result);
     84extern int time_utc2str(const time_t time, char *buf);
     85extern void time_tm2str(const struct tm *timeptr, char *buf);
     86extern int time_local2tm(const time_t time, struct tm *result);
     87extern int time_local2str(const time_t time, char *buf);
     88extern double difftime(time_t time1, time_t time0);
     89extern size_t strftime(char *restrict s, size_t maxsize,
     90    const char *restrict format, const struct tm *restrict tm);
    6591
    6692#endif
  • uspace/lib/c/include/sys/types.h

    r80445cf r4c53333  
    5050typedef volatile uint32_t ioport32_t;
    5151
     52typedef int16_t unaligned_int16_t __attribute__ ((aligned(1)));
     53typedef int32_t unaligned_int32_t __attribute__ ((aligned(1)));
     54typedef int64_t unaligned_int64_t __attribute__ ((aligned(1)));
     55
     56typedef uint16_t unaligned_uint16_t __attribute__ ((aligned(1)));
     57typedef uint32_t unaligned_uint32_t __attribute__ ((aligned(1)));
     58typedef uint64_t unaligned_uint64_t __attribute__ ((aligned(1)));
     59
    5260#endif
    5361
  • uspace/lib/c/include/sysinfo.h

    r80445cf r4c53333  
    3737
    3838#include <sys/types.h>
    39 #include <bool.h>
     39#include <stdbool.h>
    4040#include <abi/sysinfo.h>
    4141
  • uspace/lib/c/include/task.h

    r80445cf r4c53333  
    3838#include <sys/types.h>
    3939#include <abi/proc/task.h>
     40#include <stdarg.h>
    4041
    4142typedef enum {
     
    4849extern int task_kill(task_id_t);
    4950
    50 extern task_id_t task_spawn(const char *, const char *const[], int *);
    5151extern int task_spawnv(task_id_t *, const char *path, const char *const []);
    5252extern int task_spawnvf(task_id_t *, const char *path, const char *const [],
    5353    int *const []);
     54extern int task_spawn(task_id_t *, const char *path, int, va_list ap);
    5455extern int task_spawnl(task_id_t *, const char *path, ...);
    5556
  • uspace/lib/c/include/tls.h

    r80445cf r4c53333  
    4848extern char _tbss_end;
    4949
    50 extern tcb_t *__make_tls(void);
    51 extern tcb_t *__alloc_tls(void **, size_t);
    52 extern void __free_tls(tcb_t *);
    53 extern void __free_tls_arch(tcb_t *, size_t);
     50extern tcb_t *tls_make(void);
     51extern tcb_t *tls_alloc_arch(void **, size_t);
     52extern void tls_free(tcb_t *);
     53extern void tls_free_arch(tcb_t *, size_t);
    5454
    5555#ifdef CONFIG_TLS_VARIANT_1
  • uspace/lib/c/include/unistd.h

    r80445cf r4c53333  
    5858#define getpagesize()  (PAGE_SIZE)
    5959
    60 extern int dup2(int oldfd, int newfd);
     60extern int dup2(int, int);
    6161
    6262extern ssize_t write(int, const void *, size_t);
     
    7373extern int unlink(const char *);
    7474
    75 extern char *getcwd(char *buf, size_t);
     75extern char *getcwd(char *, size_t);
    7676extern int rmdir(const char *);
    7777extern int chdir(const char *);
Note: See TracChangeset for help on using the changeset viewer.