Changeset c621f4aa in mainline for uspace/lib/c/include


Ignore:
Timestamp:
2010-07-25T10:11:13Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
377cce8
Parents:
24a2517 (diff), a2da43c (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 with mainline.

Location:
uspace/lib/c/include
Files:
6 added
82 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/async.h

    r24a2517 rc621f4aa  
    259259}
    260260
     261extern int async_connect_me_to(int, ipcarg_t, ipcarg_t, ipcarg_t);
     262extern int async_connect_me_to_blocking(int, ipcarg_t, ipcarg_t, ipcarg_t);
     263
    261264/*
    262265 * User-friendly wrappers for async_share_in_start().
  • uspace/lib/c/include/atomicdflt.h

    r24a2517 rc621f4aa  
    3737
    3838#ifndef LIBC_ARCH_ATOMIC_H_
    39 #error This file cannot be included directly, include atomic.h instead.
     39        #error This file cannot be included directly, include atomic.h instead.
    4040#endif
    4141
     42#include <stdint.h>
    4243#include <bool.h>
    4344
    4445typedef struct atomic {
    45         volatile long count;
     46        volatile atomic_count_t count;
    4647} atomic_t;
    4748
    48 static inline void atomic_set(atomic_t *val, long i)
     49static inline void atomic_set(atomic_t *val, atomic_count_t i)
    4950{
    50         val->count = i;
     51        val->count = i;
    5152}
    5253
    53 static inline long atomic_get(atomic_t *val)
     54static inline atomic_count_t atomic_get(atomic_t *val)
    5455{
    55         return val->count;
     56        return val->count;
    5657}
    5758
    58 #ifndef CAS 
    59 static inline bool cas(atomic_t *val, long ov, long nv)
     59#ifndef CAS
     60static inline bool cas(atomic_t *val, atomic_count_t ov, atomic_count_t nv)
    6061{
    6162        return __sync_bool_compare_and_swap(&val->count, ov, nv);
  • uspace/lib/c/include/bool.h

    r24a2517 rc621f4aa  
    3636#define LIBC_BOOL_H_
    3737
    38 #define false 0
    39 #define true 1
     38#include <libarch/types.h>
    4039
    41 typedef short bool;
     40#define false  0
     41#define true   1
     42
     43typedef uint8_t bool;
    4244
    4345#endif
  • uspace/lib/c/include/errno.h

    r24a2517 rc621f4aa  
    4343#define errno _errno
    4444
    45 #define EMFILE        (-17)
     45#define EMFILE        (-18)
    4646#define ENAMETOOLONG  (-256)
    4747#define EISDIR        (-257)
  • uspace/lib/c/include/futex.h

    r24a2517 rc621f4aa  
    3939#include <sys/types.h>
    4040
    41 #define FUTEX_INITIALIZER     {1}
     41#define FUTEX_INITIALIZER  {1}
    4242
    4343typedef atomic_t futex_t;
  • uspace/lib/c/include/io/color.h

    r24a2517 rc621f4aa  
    3636#define LIBC_IO_COLOR_H_
    3737
    38 enum console_color {
     38typedef enum {
    3939        COLOR_BLACK   = 0,
    4040        COLOR_BLUE    = 1,
     
    4848        CATTR_BRIGHT  = 8,
    4949        CATTR_BLINK   = 8
    50 };
     50} console_color_t;
    5151
    5252#endif
  • uspace/lib/c/include/io/console.h

    r24a2517 rc621f4aa  
    4444} console_ev_type_t;
    4545
    46 enum {
     46typedef enum {
    4747        CONSOLE_CCAP_NONE = 0,
    4848        CONSOLE_CCAP_STYLE,
    4949        CONSOLE_CCAP_INDEXED,
    5050        CONSOLE_CCAP_RGB
    51 };
     51} console_caps_t;
    5252
    5353/** Console event structure. */
     
    6868extern void console_clear(int phone);
    6969
    70 extern int console_get_size(int phone, int *cols, int *rows);
    71 extern int console_get_pos(int phone, int *col, int *row);
    72 extern void console_goto(int phone, int col, int row);
     70extern int console_get_size(int phone, ipcarg_t *cols, ipcarg_t *rows);
     71extern int console_get_pos(int phone, ipcarg_t *col, ipcarg_t *row);
     72extern void console_set_pos(int phone, ipcarg_t col, ipcarg_t row);
    7373
    74 extern void console_set_style(int phone, int style);
    75 extern void console_set_color(int phone, int fg_color, int bg_color, int flags);
    76 extern void console_set_rgb_color(int phone, int fg_color, int bg_color);
     74extern void console_set_style(int phone, uint8_t style);
     75extern void console_set_color(int phone, uint8_t fg_color, uint8_t bg_color,
     76    uint8_t flags);
     77extern void console_set_rgb_color(int phone, uint32_t fg_color, uint32_t bg_color);
    7778
    7879extern void console_cursor_visibility(int phone, bool show);
    79 extern int console_get_color_cap(int phone, int *ccap);
     80extern int console_get_color_cap(int phone, ipcarg_t *ccap);
    8081extern void console_kcon_enable(int phone);
    8182
  • uspace/lib/c/include/io/keycode.h

    r24a2517 rc621f4aa  
    5151 * they really are organized here by position, rather than by label.
    5252 */
    53 enum keycode {
     53typedef enum {
    5454
    5555        /* Main block row 1 */
     
    199199} keycode_t;
    200200
    201 enum keymod {
     201typedef enum {
    202202        KM_LSHIFT      = 0x001,
    203203        KM_RSHIFT      = 0x002,
  • uspace/lib/c/include/io/klog.h

    r24a2517 rc621f4aa  
    3333 */
    3434
    35 #ifndef LIBC_STREAM_H_
    36 #define LIBC_STREAM_H_
     35#ifndef LIBC_IO_KLOG_H_
     36#define LIBC_IO_KLOG_H_
    3737
    3838#include <sys/types.h>
    3939
    40 extern size_t klog_write(const void *buf, size_t size);
     40extern size_t klog_write(const void *, size_t);
    4141extern void klog_update(void);
    4242
  • uspace/lib/c/include/io/printf_core.h

    r24a2517 rc621f4aa  
    4040
    4141/** Structure for specifying output methods for different printf clones. */
    42 typedef struct printf_spec {
     42typedef struct {
    4343        /* String output function, returns number of printed characters or EOF */
    4444        int (*str_write)(const char *, size_t, void *);
     
    5151} printf_spec_t;
    5252
    53 int printf_core(const char *fmt, printf_spec_t *ps, va_list ap);
     53extern int printf_core(const char *, printf_spec_t *, va_list);
    5454
    5555#endif
  • uspace/lib/c/include/io/screenbuffer.h

    r24a2517 rc621f4aa  
    3333 */
    3434
    35 #ifndef SCREENBUFFER_H__
    36 #define SCREENBUFFER_H__
     35#ifndef LIBC_SCREENBUFFER_H__
     36#define LIBC_SCREENBUFFER_H__
    3737
    3838#include <stdint.h>
    3939#include <sys/types.h>
     40#include <ipc/ipc.h>
    4041#include <bool.h>
    4142
    42 #define DEFAULT_FOREGROUND  0x0       /**< default console foreground color */
    43 #define DEFAULT_BACKGROUND  0xf0f0f0  /**< default console background color */
     43typedef enum {
     44        at_style,
     45        at_idx,
     46        at_rgb
     47} attr_type_t;
    4448
    4549typedef struct {
     
    5862} attr_rgb_t;
    5963
     64typedef union {
     65        attr_style_t s;
     66        attr_idx_t i;
     67        attr_rgb_t r;
     68} attr_val_t;
     69
    6070typedef struct {
    61         enum {
    62                 at_style,
    63                 at_idx,
    64                 at_rgb
    65         } t;
    66         union {
    67                 attr_style_t s;
    68                 attr_idx_t i;
    69                 attr_rgb_t r;
    70         } a;
     71        attr_type_t t;
     72        attr_val_t a;
    7173} attrs_t;
    7274
     
    8284        keyfield_t *buffer;      /**< Screen content - characters and
    8385                                      their attributes (used as a circular buffer) */
    84         size_t size_x;           /**< Number of columns  */
    85         size_t size_y;           /**< Number of rows */
     86        ipcarg_t size_x;         /**< Number of columns  */
     87        ipcarg_t size_y;         /**< Number of rows */
    8688       
    8789        /** Coordinates of last printed character for determining cursor position */
    88         size_t position_x;
    89         size_t position_y;
     90        ipcarg_t position_x;
     91        ipcarg_t position_y;
    9092       
    9193        attrs_t attrs;           /**< Current attributes. */
     
    107109 *
    108110 */
    109 static inline keyfield_t *get_field_at(screenbuffer_t *scr, size_t x, size_t y)
     111static inline keyfield_t *get_field_at(screenbuffer_t *scr, ipcarg_t x, ipcarg_t y)
    110112{
    111113        return scr->buffer + x + ((y + scr->top_line) % scr->size_y) * scr->size_x;
     
    120122 *
    121123 */
    122 static inline int attrs_same(attrs_t a1, attrs_t a2)
     124static inline bool attrs_same(attrs_t a1, attrs_t a2)
    123125{
    124126        if (a1.t != a2.t)
    125                 return 0;
     127                return false;
    126128       
    127129        switch (a1.t) {
     
    137139        }
    138140       
    139         return 0;
     141        return false;
    140142}
    141143
     144extern void screenbuffer_putchar(screenbuffer_t *, wchar_t);
     145extern screenbuffer_t *screenbuffer_init(screenbuffer_t *, ipcarg_t, ipcarg_t);
    142146
    143 void screenbuffer_putchar(screenbuffer_t *scr, wchar_t c);
    144 screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, size_t size_x, size_t size_y);
    145 
    146 void screenbuffer_clear(screenbuffer_t *scr);
    147 void screenbuffer_clear_line(screenbuffer_t *scr, size_t line);
    148 void screenbuffer_copy_buffer(screenbuffer_t *scr, keyfield_t *dest);
    149 void screenbuffer_goto(screenbuffer_t *scr, size_t x, size_t y);
    150 void screenbuffer_set_style(screenbuffer_t *scr, uint8_t style);
    151 void screenbuffer_set_color(screenbuffer_t *scr, uint8_t fg_color,
    152     uint8_t bg_color, uint8_t attr);
    153 void screenbuffer_set_rgb_color(screenbuffer_t *scr, uint32_t fg_color,
    154     uint32_t bg_color);
     147extern void screenbuffer_clear(screenbuffer_t *);
     148extern void screenbuffer_clear_line(screenbuffer_t *, ipcarg_t);
     149extern void screenbuffer_copy_buffer(screenbuffer_t *, keyfield_t *);
     150extern void screenbuffer_goto(screenbuffer_t *, ipcarg_t, ipcarg_t);
     151extern void screenbuffer_set_style(screenbuffer_t *, uint8_t);
     152extern void screenbuffer_set_color(screenbuffer_t *, uint8_t, uint8_t, uint8_t);
     153extern void screenbuffer_set_rgb_color(screenbuffer_t *, uint32_t, uint32_t);
    155154
    156155#endif
  • uspace/lib/c/include/io/style.h

    r24a2517 rc621f4aa  
    3636#define LIBC_IO_STYLE_H_
    3737
    38 enum console_style {
     38typedef enum {
    3939        STYLE_NORMAL   = 0,
    40         STYLE_EMPHASIS = 1
    41 };
     40        STYLE_EMPHASIS = 1,
     41        STYLE_INVERTED = 2,
     42        STYLE_SELECTED = 3
     43} console_style_t;
    4244
    4345#endif
  • uspace/lib/c/include/ipc/services.h

    r24a2517 rc621f4aa  
    4747        SERVICE_FHC,
    4848        SERVICE_OBIO,
    49         SERVICE_CLIPBOARD
     49        SERVICE_CLIPBOARD,
     50        SERVICE_NETWORKING,
     51        SERVICE_LO,
     52        SERVICE_DP8390,
     53        SERVICE_ETHERNET,
     54        SERVICE_NILDUMMY,
     55        SERVICE_IP,
     56        SERVICE_ARP,
     57        SERVICE_RARP,
     58        SERVICE_ICMP,
     59        SERVICE_UDP,
     60        SERVICE_TCP,
     61        SERVICE_SOCKET
    5062} services_t;
    5163
  • uspace/lib/c/include/loader/loader.h

    r24a2517 rc621f4aa  
    5151extern int loader_set_cwd(loader_t *);
    5252extern int loader_set_pathname(loader_t *, const char *);
    53 extern int loader_set_args(loader_t *, char *const[]);
     53extern int loader_set_args(loader_t *, const char *const[]);
    5454extern int loader_set_files(loader_t *, fdi_node_t *const[]);
    5555extern int loader_load_program(loader_t *);
  • uspace/lib/c/include/macros.h

    r24a2517 rc621f4aa  
    4848#define STRING_ARG(arg)  #arg
    4949
    50 #define LOWER32(arg)  ((arg) & 0xffffffff)
    51 #define UPPER32(arg)  (((arg) >> 32) & 0xffffffff)
     50#define LOWER32(arg)  (((uint64_t) (arg)) & 0xffffffff)
     51#define UPPER32(arg)  (((((uint64_t) arg)) >> 32) & 0xffffffff)
    5252
    5353#define MERGE_LOUP32(lo, up) \
  • uspace/lib/c/include/stacktrace.h

    r24a2517 rc621f4aa  
    5757extern void stacktrace_prepare(void);
    5858extern uintptr_t stacktrace_fp_get(void);
    59 extern uintptr_t stacktrace_pc_get();
     59extern uintptr_t stacktrace_pc_get(void);
    6060
    6161#endif
  • uspace/lib/c/include/stdio.h

    r24a2517 rc621f4aa  
    3838#include <sys/types.h>
    3939#include <stdarg.h>
    40 #include <string.h>
     40#include <str.h>
    4141#include <adt/list.h>
    4242
     
    4646#define BUFSIZ  4096
    4747
    48 #define DEBUG(fmt, ...) \
     48#define DEBUG(fmt, ...)se\
    4949        { \
    5050                char _buf[256]; \
     
    5656#ifndef SEEK_SET
    5757        #define SEEK_SET  0
     58#endif
     59
     60#ifndef SEEK_CUR
    5861        #define SEEK_CUR  1
     62#endif
     63
     64#ifndef SEEK_END
    5965        #define SEEK_END  2
    6066#endif
     
    6773        /** Full buffering */
    6874        _IOFBF
     75};
     76
     77enum _buffer_state {
     78        /** Buffer is empty */
     79        _bs_empty,
     80
     81        /** Buffer contains data to be written */
     82        _bs_write,
     83
     84        /** Buffer contains prefetched data for reading */
     85        _bs_read
    6986};
    7087
     
    88105        int phone;
    89106
     107        /**
     108         * Non-zero if the stream needs sync on fflush(). XXX change
     109         * console semantics so that sync is not needed.
     110         */
     111        int need_sync;
     112
    90113        /** Buffering type */
    91114        enum _buffer_type btype;
     115
    92116        /** Buffer */
    93117        uint8_t *buf;
     118
    94119        /** Buffer size */
    95120        size_t buf_size;
     121
     122        /** Buffer state */
     123        enum _buffer_state buf_state;
     124
    96125        /** Buffer I/O pointer */
    97126        uint8_t *buf_head;
     127
     128        /** Points to end of occupied space when in read mode. */
     129        uint8_t *buf_tail;
    98130} FILE;
    99131
     
    104136/* Character and string input functions */
    105137extern int fgetc(FILE *);
    106 extern char *fgets(char *, size_t, FILE *);
     138extern char *fgets(char *, int, FILE *);
    107139
    108140extern int getchar(void);
     
    135167extern size_t fwrite(const void *, size_t, size_t, FILE *);
    136168
    137 extern int fseek(FILE *, long, int);
     169extern int fseek(FILE *, off64_t, int);
    138170extern void rewind(FILE *);
    139 extern int ftell(FILE *);
     171extern off64_t ftell(FILE *);
    140172extern int feof(FILE *);
    141173
  • uspace/lib/c/include/str.h

    r24a2517 rc621f4aa  
    3333 */
    3434
    35 #ifndef LIBC_STRING_H_
    36 #define LIBC_STRING_H_
     35#ifndef LIBC_STR_H_
     36#define LIBC_STR_H_
    3737
    3838#include <mem.h>
     
    8686extern char *str_ndup(const char *, size_t max_size);
    8787
     88extern void order_suffix(const uint64_t val, uint64_t *rv, char *suffix);
     89
    8890/*
    8991 * TODO: Get rid of this.
  • uspace/lib/c/include/sys/mman.h

    r24a2517 rc621f4aa  
    4141#define MAP_FAILED  ((void *) -1)
    4242
    43 #define MAP_SHARED       (1 << 0)
    44 #define MAP_PRIVATE      (1 << 1)
    45 #define MAP_FIXED        (1 << 2)
    46 #define MAP_ANONYMOUS    (1 << 3)
     43#define MAP_SHARED     (1 << 0)
     44#define MAP_PRIVATE    (1 << 1)
     45#define MAP_FIXED      (1 << 2)
     46#define MAP_ANONYMOUS  (1 << 3)
    4747
    4848#define PROTO_READ   AS_AREA_READ
     
    5050#define PROTO_EXEC   AS_AREA_EXEC
    5151
    52 extern void *mmap(void  *start, size_t length, int prot, int flags, int fd,
    53     off_t offset);
     52extern void *mmap(void *start, size_t length, int prot, int flags, int fd,
     53    aoff64_t offset);
    5454extern int munmap(void *start, size_t length);
    5555
  • uspace/lib/c/include/sys/stat.h

    r24a2517 rc621f4aa  
    3131 */
    3232/** @file
    33  */ 
     33 */
    3434
    3535#ifndef LIBC_SYS_STAT_H_
     
    4848        bool is_file;
    4949        bool is_directory;
    50         off_t size;
     50        aoff64_t size;
    5151        dev_handle_t device;
    5252};
  • uspace/lib/c/include/sys/time.h

    r24a2517 rc621f4aa  
    3131 */
    3232/** @file
    33  */ 
     33 */
    3434
    3535#ifndef LIBC_SYS_TIME_H_
     
    4444
    4545struct timeval {
    46         time_t         tv_sec;        /* seconds */
    47         suseconds_t    tv_usec;  /* microseconds */
     46        time_t tv_sec;        /* seconds */
     47        suseconds_t tv_usec;  /* microseconds */
    4848};
    4949
    5050struct timezone {
    51         int  tz_minuteswest; /* minutes W of Greenwich */
    52         int  tz_dsttime;     /* type of dst correction */
     51        int tz_minuteswest; /* minutes W of Greenwich */
     52        int tz_dsttime;      /* type of dst correction */
    5353};
    5454
  • uspace/lib/c/include/sys/typefmt.h

    r24a2517 rc621f4aa  
    3939#include <inttypes.h>
    4040
    41 /* off_t */
    42 #define PRIdOFF "ld"
    43 #define PRIuOFF "lu"
    44 #define PRIxOFF "lx"
    45 #define PRIXOFF "lX"
    46 
    47 /* bn_t */
    48 #define PRIdBN PRId64
    49 #define PRIuBN PRIu64
    50 #define PRIxBN PRIx64
    51 #define PRIXBN PRIX64
     41/* off64_t */
     42#define PRIdOFF64 PRId64
     43#define PRIuOFF64 PRIu64
     44#define PRIxOFF64 PRIx64
     45#define PRIXOFF64 PRIX64
    5246
    5347/* (s)size_t */
  • uspace/lib/c/include/sys/types.h

    r24a2517 rc621f4aa  
    3838#include <libarch/types.h>
    3939
    40 typedef long off_t;
    41 typedef int mode_t;
    42 typedef uint64_t bn_t;  /**< Block number type. */
     40typedef unsigned int mode_t;
    4341
     42/** Relative offset */
     43typedef int64_t off64_t;
     44
     45/** Absolute offset */
     46typedef uint64_t aoff64_t;
     47
     48/** Unicode code point */
    4449typedef int32_t wchar_t;
    4550
  • uspace/lib/c/include/sysinfo.h

    r24a2517 rc621f4aa  
    3131 */
    3232/** @file
    33  */ 
     33 */
    3434
    3535#ifndef LIBC_SYSINFO_H_
     
    3737
    3838#include <libc.h>
    39 #include <sysinfo.h>
    40 #include <string.h>
    4139
    42 sysarg_t sysinfo_value(char *name);
     40/** Sysinfo value types
     41 *
     42 */
     43typedef enum {
     44        SYSINFO_VAL_UNDEFINED = 0,
     45        SYSINFO_VAL_VAL = 1,
     46        SYSINFO_VAL_DATA = 2
     47} sysinfo_item_tag_t;
     48
     49extern sysinfo_item_tag_t sysinfo_get_tag(const char *);
     50extern int sysinfo_get_value(const char *, sysarg_t *);
     51extern void *sysinfo_get_data(const char *, size_t *);
    4352
    4453#endif
  • uspace/lib/c/include/task.h

    r24a2517 rc621f4aa  
    4646
    4747extern task_id_t task_get_id(void);
    48 extern int task_set_name(const char *name);
    49 extern task_id_t task_spawn(const char *path, char *const argv[]);
    50 extern int task_wait(task_id_t id, task_exit_t *texit, int *retval);
    51 extern int task_retval(int val);
    52 
     48extern int task_set_name(const char *);
     49extern task_id_t task_spawn(const char *, const char *const[], int *);
     50extern int task_wait(task_id_t id, task_exit_t *, int *);
     51extern int task_retval(int);
    5352
    5453#endif
  • uspace/lib/c/include/thread.h

    r24a2517 rc621f4aa  
    4545extern void __thread_main(uspace_arg_t *);
    4646
    47 extern int thread_create(void (*)(void *), void *, char *, thread_id_t *);
     47extern int thread_create(void (*)(void *), void *, const char *, thread_id_t *);
    4848extern void thread_exit(int) __attribute__ ((noreturn));
    4949extern void thread_detach(thread_id_t);
  • uspace/lib/c/include/unistd.h

    r24a2517 rc621f4aa  
    4747#ifndef SEEK_SET
    4848        #define SEEK_SET  0
     49#endif
     50
     51#ifndef SEEK_CUR
    4952        #define SEEK_CUR  1
     53#endif
     54
     55#ifndef SEEK_END
    5056        #define SEEK_END  2
    5157#endif
     
    5864extern ssize_t read(int, void *, size_t);
    5965
    60 extern off_t lseek(int, off_t, int);
    61 extern int ftruncate(int, off_t);
     66extern off64_t lseek(int, off64_t, int);
     67extern int ftruncate(int, aoff64_t);
    6268
    6369extern int close(int);
     
    6975extern int chdir(const char *);
    7076
    71 extern void _exit(int status) __attribute__ ((noreturn));
    72 extern int usleep(useconds_t uses);
    73 extern unsigned int sleep(unsigned int se);
     77extern void _exit(int) __attribute__((noreturn));
     78extern int usleep(useconds_t);
     79extern unsigned int sleep(unsigned int);
    7480
    7581#endif
  • uspace/lib/c/include/vfs/vfs.h

    r24a2517 rc621f4aa  
    4343/**
    4444 * This type is a libc version of the VFS triplet.
    45  * It uniquelly identifies a file system node within a file system instance.
     45 * It uniquely identifies a file system node within a file system instance.
    4646 */
    4747typedef struct {
Note: See TracChangeset for help on using the changeset viewer.