Changeset 03362fbd in mainline for uspace/lib/c/include


Ignore:
Timestamp:
2013-02-09T23:14:45Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
22dfd38
Parents:
b5d2e57 (diff), 005b765 (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.

Conflict resulting from bool.h → stdbool.h move and ddf structs turning opaque.
Fails to boot to shell console.

Location:
uspace/lib/c/include
Files:
25 added
33 edited
3 moved

Legend:

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

    rb5d2e57 r03362fbd  
    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

    rb5d2e57 r03362fbd  
    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/async.h

    rb5d2e57 r03362fbd  
    4444#include <sys/time.h>
    4545#include <atomic.h>
    46 #include <bool.h>
     46#include <stdbool.h>
    4747#include <task.h>
    4848
  • uspace/lib/c/include/atomicdflt.h

    rb5d2e57 r03362fbd  
    4141
    4242#include <stdint.h>
    43 #include <bool.h>
     43#include <stdbool.h>
    4444
    4545typedef struct atomic {
  • uspace/lib/c/include/cfg.h

    rb5d2e57 r03362fbd  
    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

    rb5d2e57 r03362fbd  
    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

    rb5d2e57 r03362fbd  
    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/devman.h

    rb5d2e57 r03362fbd  
    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);
  • uspace/lib/c/include/fibril_synch.h

    rb5d2e57 r03362fbd  
    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/iplink_srv.h

    rb5d2e57 r03362fbd  
    3838#include <async.h>
    3939#include <fibril_synch.h>
    40 #include <bool.h>
     40#include <stdbool.h>
    4141#include <sys/types.h>
    4242
  • uspace/lib/c/include/io/charfield.h

    rb5d2e57 r03362fbd  
    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/console.h

    rb5d2e57 r03362fbd  
    3737
    3838#include <sys/time.h>
     39#include <io/concaps.h>
     40#include <io/kbd_event.h>
    3941#include <io/keycode.h>
    4042#include <async.h>
    41 #include <bool.h>
     43#include <stdbool.h>
    4244#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;
    5045
    5146/** Console control structure. */
     
    6964        aid_t input_aid;
    7065} console_ctrl_t;
    71 
    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;
    9466
    9567extern console_ctrl_t *console_init(FILE *, FILE *);
  • uspace/lib/c/include/io/klog.h

    rb5d2e57 r03362fbd  
    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

    rb5d2e57 r03362fbd  
    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/ipc/console.h

    rb5d2e57 r03362fbd  
    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

    rb5d2e57 r03362fbd  
    4444        /** Character device interface */
    4545        CHAR_DEV_IFACE,
     46
     47        /** Graphic device interface */
     48        GRAPH_DEV_IFACE,
    4649       
    4750        /** Network interface controller interface */
     
    5760        /** Interface provided by USB HID devices. */
    5861        USBHID_DEV_IFACE,
     62        /** Interface provided by Real Time Clock devices */
     63        CLOCK_DEV_IFACE,
     64        /** Interface provided by battery powered devices */
     65        BATTERY_DEV_IFACE,
    5966        /** Interface provided by AHCI devices. */
    6067        AHCI_DEV_IFACE,
  • uspace/lib/c/include/ipc/input.h

    rb5d2e57 r03362fbd  
    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

    rb5d2e57 r03362fbd  
    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_clone_establish(int);
    257 extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, task_id_t *,
    258     sysarg_t *);
    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/mouseev.h

    rb5d2e57 r03362fbd  
    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

    rb5d2e57 r03362fbd  
    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', ' '),
  • uspace/lib/c/include/ipc/vfs.h

    rb5d2e57 r03362fbd  
    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

    rb5d2e57 r03362fbd  
    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);
  • uspace/lib/c/include/macros.h

    rb5d2e57 r03362fbd  
    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/nic/nic.h

    rb5d2e57 r03362fbd  
    4040
    4141#include <nic/eth_phys.h>
    42 #include <bool.h>
     42#include <stdbool.h>
    4343
    4444/** Ethernet address length. */
  • uspace/lib/c/include/rtld/dynamic.h

    rb5d2e57 r03362fbd  
    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/sort.h

    rb5d2e57 r03362fbd  
    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

    rb5d2e57 r03362fbd  
    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

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

    rb5d2e57 r03362fbd  
    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/stdbool.h

    rb5d2e57 r03362fbd  
    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_
     35#ifndef LIBC_BOOL_H_
     36#define LIBC_BOOL_H_
    3737
    38 #ifdef LIBC_BOOL_H_
     38#include <libarch/types.h>
     39#include <abi/bool.h>
    3940
    40 #if (!defined(POSIX_STDIO_H_)) && \
    41     (!defined(POSIX_STDLIB_H_)) && \
    42     (!defined(POSIX_STRING_H_))
    43         #error "You can't include bool.h and stdbool.h at the same time."
     41#define false  0
     42#define true   1
     43
     44#define __bool_true_false_are_defined 1
     45
    4446#endif
    4547
    46 #endif /* LIBC_BOOL_H */
    47 
    48 #define LIBC_BOOL_H_
    49 
    50 #define bool _Bool
    51 #define true 1
    52 #define false 0
    53 #define __bool_true_false_are_defined 1
    54 
    55 #endif /* POSIX_STDBOOL_H_ */
     48/** @}
     49 */
  • uspace/lib/c/include/stdio.h

    rb5d2e57 r03362fbd  
    3939#include <stdarg.h>
    4040#include <str.h>
    41 
    42 #ifndef NVERIFY_PRINTF
    43 
    44 #define PRINTF_ATTRIBUTE(start, end) \
    45         __attribute__((format(gnu_printf, start, end)))
    46 
    47 #else /* NVERIFY_PRINTF */
    48 
    49 #define PRINTF_ATTRIBUTE(start, end)
    50 
    51 #endif /* NVERIFY_PRINTF */
     41#include <io/verify.h>
     42#include <abi/klog.h>
    5243
    5344#define EOF  (-1)
     
    6152                int _n = snprintf(_buf, sizeof(_buf), fmt, ##__VA_ARGS__); \
    6253                if (_n > 0) \
    63                         (void) __SYSCALL3(SYS_KLOG, 1, (sysarg_t) _buf, str_size(_buf)); \
     54                        (void) __SYSCALL3(SYS_KLOG, KLOG_WRITE, (sysarg_t) _buf, str_size(_buf)); \
    6455        }
    6556
  • uspace/lib/c/include/str.h

    rb5d2e57 r03362fbd  
    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);
  • uspace/lib/c/include/sys/stat.h

    rb5d2e57 r03362fbd  
    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

    rb5d2e57 r03362fbd  
    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/sysinfo.h

    rb5d2e57 r03362fbd  
    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

    rb5d2e57 r03362fbd  
    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
Note: See TracChangeset for help on using the changeset viewer.