Changeset 985e26d2 in mainline for uspace/lib/libc/include
- Timestamp:
- 2010-01-07T19:06:59Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8190e63
- Parents:
- 743e17b (diff), eca2435 (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. - Location:
- uspace/lib/libc/include
- Files:
-
- 4 added
- 20 edited
- 4 moved
-
async.h (modified) (1 diff)
-
async_priv.h (moved) (moved from kernel/arch/mips32/include/arg.h ) (3 diffs)
-
atomic.h (modified) (2 diffs)
-
atomicdflt.h (moved) (moved from kernel/generic/include/stackarg.h ) (3 diffs)
-
clipboard.h (moved) (moved from kernel/arch/amd64/include/arg.h ) (4 diffs)
-
devmap.h (modified) (3 diffs)
-
fcntl.h (modified) (1 diff)
-
fibril_synch.h (moved) (moved from uspace/lib/libc/include/fibril_sync.h ) (3 diffs)
-
futex.h (modified) (1 diff)
-
io/console.h (modified) (1 diff)
-
ipc/char.h (added)
-
ipc/clipboard.h (added)
-
ipc/console.h (modified) (1 diff)
-
ipc/devmap.h (modified) (1 diff)
-
ipc/ipc.h (modified) (1 diff)
-
ipc/loader.h (modified) (1 diff)
-
ipc/mouse.h (added)
-
ipc/services.h (modified) (2 diffs)
-
ipc/vfs.h (modified) (1 diff)
-
loader/loader.h (modified) (1 diff)
-
loader/pcb.h (modified) (1 diff)
-
malloc.h (modified) (1 diff)
-
stacktrace.h (added)
-
stdarg.h (modified) (1 diff)
-
stdlib.h (modified) (1 diff)
-
string.h (modified) (2 diffs)
-
sys/stat.h (modified) (1 diff)
-
unistd.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/include/async.h
r743e17b r985e26d2 259 259 } 260 260 261 /* 262 * User-friendly wrappers for async_share_in_start(). 263 */ 264 #define async_share_in_start_0_0(phoneid, dst, size) \ 265 async_share_in_start((phoneid), (dst), (size), 0, NULL) 266 #define async_share_in_start_0_1(phoneid, dst, size, flags) \ 267 async_share_in_start((phoneid), (dst), (size), 0, (flags)) 268 #define async_share_in_start_1_0(phoneid, dst, size, arg) \ 269 async_share_in_start((phoneid), (dst), (size), (arg), NULL) 270 #define async_share_in_start_1_1(phoneid, dst, size, arg, flags) \ 271 async_share_in_start((phoneid), (dst), (size), (arg), (flags)) 272 273 extern int async_share_in_start(int, void *, size_t, ipcarg_t, int *); 274 extern int async_share_in_receive(ipc_callid_t *, size_t *); 275 extern int async_share_in_finalize(ipc_callid_t, void *, int ); 276 extern int async_share_out_start(int, void *, int); 277 extern int async_share_out_receive(ipc_callid_t *, size_t *, int *); 278 extern int async_share_out_finalize(ipc_callid_t, void *); 279 extern int async_data_read_start(int, void *, size_t); 280 extern int async_data_read_receive(ipc_callid_t *, size_t *); 281 extern int async_data_read_finalize(ipc_callid_t, const void *, size_t); 282 extern int async_data_write_start(int, const void *, size_t); 283 extern int async_data_write_receive(ipc_callid_t *, size_t *); 284 extern int async_data_write_finalize(ipc_callid_t, void *, size_t); 285 286 extern int async_data_blob_receive(char **, const size_t, size_t *); 287 extern int async_data_string_receive(char **, const size_t); 288 261 289 #endif 262 290 -
uspace/lib/libc/include/async_priv.h
r743e17b r985e26d2 1 1 /* 2 * Copyright (c) 200 5 Jakub Jermar2 * Copyright (c) 2006 Ondrej Palkovsky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup mips3229 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef KERN_mips32_ARG_H_36 #define KERN_mips32_ARG_H_35 #ifndef LIBC_ASYNC_PRIV_H_ 36 #define LIBC_ASYNC_PRIV_H_ 37 37 38 #include <arch/types.h> 38 #include <adt/list.h> 39 #include <fibril.h> 40 #include <sys/time.h> 41 #include <bool.h> 39 42 40 /** 41 * va_arg macro for MIPS32 - problem is that 64 bit values must be aligned on an 8-byte boundary (32bit values not) 42 * To satisfy this, paddings must be sometimes inserted. 43 */ 43 /** Structures of this type are used to track the timeout events. */ 44 typedef struct { 45 /** If true, this struct is in the timeout list. */ 46 bool inlist; 47 48 /** Timeout list link. */ 49 link_t link; 50 51 /** If true, we have timed out. */ 52 bool occurred; 44 53 45 typedef uintptr_t va_list; 54 /** Expiration time. */ 55 struct timeval expires; 56 } to_event_t; 46 57 47 #define va_start(ap, lst) \ 48 ((ap) = (va_list)&(lst) + sizeof(lst)) 58 /** Structures of this type are used to track the wakeup events. */ 59 typedef struct { 60 /** If true, this struct is in a synchronization object wait queue. */ 61 bool inlist; 62 63 /** Wait queue linkage. */ 64 link_t link; 65 } wu_event_t; 49 66 50 #define va_arg(ap, type) \51 (((type *)((ap) = (va_list)( (sizeof(type) <= 4) ? ((uintptr_t)((ap) + 2*4 - 1) & (~3)) : ((uintptr_t)((ap) + 2*8 -1) & (~7)) )))[-1])52 67 53 #define va_copy(dst,src) ((dst)=(src)) 68 /** Structures of this type represent a waiting fibril. */ 69 typedef struct { 70 /** Identification of and link to the waiting fibril. */ 71 fid_t fid; 72 73 /** If true, this fibril is currently active. */ 74 bool active; 54 75 55 #define va_end(ap) 76 /** Timeout wait data. */ 77 to_event_t to_event; 78 /** Wakeup wait data. */ 79 wu_event_t wu_event; 80 } awaiter_t; 81 82 extern void async_insert_timeout(awaiter_t *wd); 56 83 57 84 #endif -
uspace/lib/libc/include/atomic.h
r743e17b r985e26d2 1 1 /* 2 * Copyright (c) 200 6Jakub Jermar2 * Copyright (c) 2009 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 36 36 #define LIBC_ATOMIC_H_ 37 37 38 typedef struct atomic {39 volatile long count;40 } atomic_t;41 42 38 #include <libarch/atomic.h> 43 44 static inline void atomic_set(atomic_t *val, long i)45 {46 val->count = i;47 }48 49 static inline long atomic_get(atomic_t *val)50 {51 return val->count;52 }53 39 54 40 #endif -
uspace/lib/libc/include/atomicdflt.h
r743e17b r985e26d2 1 1 /* 2 * Copyright (c) 200 5Jakub Jermar2 * Copyright (c) 2006 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup generic29 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 /* 36 * Variable argument list manipulation macros 37 * for architectures using stack to pass arguments. 38 */ 39 40 #ifndef KERN_STACKARG_H_ 41 #define KERN_STACKARG_H_ 35 #ifndef LIBC_ATOMICDFLT_H_ 36 #define LIBC_ATOMICDFLT_H_ 42 37 43 #include <arch/types.h> 38 #ifndef LIBC_ARCH_ATOMIC_H_ 39 #error This file cannot be included directly, include atomic.h instead. 40 #endif 44 41 45 typedef struct va_list { 46 int pos; 47 uint8_t *last; 48 } va_list; 42 #include <bool.h> 49 43 50 #define va_start(ap, lst) \ 51 (ap).pos = sizeof(lst); \52 (ap).last = (uint8_t *) &(lst) 44 typedef struct atomic { 45 volatile long count; 46 } atomic_t; 53 47 54 #define va_arg(ap, type) \ 55 (*((type *)((ap).last + ((ap).pos += sizeof(type)) - sizeof(type)))) 48 static inline void atomic_set(atomic_t *val, long i) 49 { 50 val->count = i; 51 } 56 52 57 #define va_copy(dst, src) dst = src 58 #define va_end(ap) 53 static inline long atomic_get(atomic_t *val) 54 { 55 return val->count; 56 } 59 57 58 #ifndef CAS 59 static inline bool cas(atomic_t *val, long ov, long nv) 60 { 61 return __sync_bool_compare_and_swap(&val->count, ov, nv); 62 } 63 #endif 60 64 61 65 #endif -
uspace/lib/libc/include/clipboard.h
r743e17b r985e26d2 1 1 /* 2 * Copyright (c) 200 5 Ondrej Palkovsky2 * Copyright (c) 2009 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup amd6429 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef KERN_amd64_ARG_H_36 #define KERN_amd64_ARG_H_35 #ifndef LIBC_CLIPBOARD_H_ 36 #define LIBC_CLIPBOARD_H_ 37 37 38 #include <stdarg.h> 38 extern int clipboard_put_str(const char *); 39 extern int clipboard_get_str(char **); 39 40 40 41 #endif … … 42 43 /** @} 43 44 */ 44 -
uspace/lib/libc/include/devmap.h
r743e17b r985e26d2 38 38 #include <ipc/devmap.h> 39 39 #include <async.h> 40 #include <bool.h> 40 41 41 42 extern int devmap_get_phone(devmap_interface_t, unsigned int); … … 46 47 47 48 extern int devmap_device_get_handle(const char *, dev_handle_t *, unsigned int); 49 extern int devmap_namespace_get_handle(const char *, dev_handle_t *, unsigned int); 50 extern devmap_handle_type_t devmap_handle_probe(dev_handle_t); 51 48 52 extern int devmap_device_connect(dev_handle_t, unsigned int); 49 53 … … 51 55 extern void devmap_null_destroy(int); 52 56 53 extern ipcarg_t devmap_device_get_count(void); 54 extern ipcarg_t devmap_device_get_devices(ipcarg_t, dev_desc_t *); 57 extern size_t devmap_count_namespaces(void); 58 extern size_t devmap_count_devices(dev_handle_t); 59 60 extern size_t devmap_get_namespaces(dev_desc_t **); 61 extern size_t devmap_get_devices(dev_handle_t, dev_desc_t **); 55 62 56 63 #endif -
uspace/lib/libc/include/fcntl.h
r743e17b r985e26d2 43 43 #define O_RDWR 32 44 44 #define O_WRONLY 64 45 #define O_DESC 128 45 46 46 47 extern int open(const char *, int, ...); -
uspace/lib/libc/include/fibril_synch.h
r743e17b r985e26d2 33 33 */ 34 34 35 #ifndef LIBC_FIBRIL_SYNC _H_36 #define LIBC_FIBRIL_SYNC _H_35 #ifndef LIBC_FIBRIL_SYNCH_H_ 36 #define LIBC_FIBRIL_SYNCH_H_ 37 37 38 38 #include <async.h> … … 40 40 #include <adt/list.h> 41 41 #include <libarch/tls.h> 42 #include <sys/time.h> 42 43 43 44 typedef struct { … … 95 96 96 97 extern void fibril_condvar_initialize(fibril_condvar_t *); 98 extern int fibril_condvar_wait_timeout(fibril_condvar_t *, fibril_mutex_t *, 99 suseconds_t); 97 100 extern void fibril_condvar_wait(fibril_condvar_t *, fibril_mutex_t *); 98 101 extern void fibril_condvar_signal(fibril_condvar_t *); -
uspace/lib/libc/include/futex.h
r743e17b r985e26d2 46 46 extern int futex_down(futex_t *futex); 47 47 extern int futex_trydown(futex_t *futex); 48 extern int futex_down_timeout(futex_t *futex, uint32_t usec, int flags);49 48 extern int futex_up(futex_t *futex); 50 49 -
uspace/lib/libc/include/io/console.h
r743e17b r985e26d2 69 69 70 70 extern int console_get_size(int phone, int *cols, int *rows); 71 extern int console_get_pos(int phone, int *col, int *row); 71 72 extern void console_goto(int phone, int col, int row); 72 73 -
uspace/lib/libc/include/ipc/console.h
r743e17b r985e26d2 43 43 CONSOLE_GET_COLOR_CAP, 44 44 CONSOLE_GET_EVENT, 45 CONSOLE_GET_POS, 45 46 CONSOLE_GOTO, 46 47 CONSOLE_CLEAR, -
uspace/lib/libc/include/ipc/devmap.h
r743e17b r985e26d2 43 43 44 44 typedef enum { 45 DEV_HANDLE_NONE, 46 DEV_HANDLE_NAMESPACE, 47 DEV_HANDLE_DEVICE 48 } devmap_handle_type_t; 49 50 typedef enum { 45 51 DEVMAP_DRIVER_REGISTER = IPC_FIRST_USER_METHOD, 46 52 DEVMAP_DRIVER_UNREGISTER, 47 53 DEVMAP_DEVICE_REGISTER, 48 54 DEVMAP_DEVICE_UNREGISTER, 49 DEVMAP_DEVICE_GET_NAME,50 55 DEVMAP_DEVICE_GET_HANDLE, 51 DEVMAP_DEVICE_NULL_CREATE, 52 DEVMAP_DEVICE_NULL_DESTROY, 53 DEVMAP_DEVICE_GET_COUNT, 54 DEVMAP_DEVICE_GET_DEVICES 56 DEVMAP_NAMESPACE_GET_HANDLE, 57 DEVMAP_HANDLE_PROBE, 58 DEVMAP_NULL_CREATE, 59 DEVMAP_NULL_DESTROY, 60 DEVMAP_GET_NAMESPACE_COUNT, 61 DEVMAP_GET_DEVICE_COUNT, 62 DEVMAP_GET_NAMESPACES, 63 DEVMAP_GET_DEVICES 55 64 } devmap_request_t; 56 65 -
uspace/lib/libc/include/ipc/ipc.h
r743e17b r985e26d2 283 283 284 284 extern int ipc_share_in_start(int, void *, size_t, ipcarg_t, int *); 285 extern int ipc_share_in_receive(ipc_callid_t *, size_t *);286 285 extern int ipc_share_in_finalize(ipc_callid_t, void *, int ); 287 286 extern int ipc_share_out_start(int, void *, int); 288 extern int ipc_share_out_receive(ipc_callid_t *, size_t *, int *);289 287 extern int ipc_share_out_finalize(ipc_callid_t, void *); 290 288 extern int ipc_data_read_start(int, void *, size_t); 291 extern int ipc_data_read_receive(ipc_callid_t *, size_t *);292 289 extern int ipc_data_read_finalize(ipc_callid_t, const void *, size_t); 293 290 extern int ipc_data_write_start(int, const void *, size_t); 294 extern int ipc_data_write_receive(ipc_callid_t *, size_t *);295 291 extern int ipc_data_write_finalize(ipc_callid_t, void *, size_t); 296 292 -
uspace/lib/libc/include/ipc/loader.h
r743e17b r985e26d2 41 41 LOADER_HELLO = IPC_FIRST_USER_METHOD, 42 42 LOADER_GET_TASKID, 43 LOADER_SET_CWD, 43 44 LOADER_SET_PATHNAME, 44 45 LOADER_SET_ARGS, -
uspace/lib/libc/include/ipc/services.h
r743e17b r985e26d2 41 41 SERVICE_LOAD = 1, 42 42 SERVICE_PCI, 43 SERVICE_KEYBOARD,44 43 SERVICE_VIDEO, 45 44 SERVICE_CONSOLE, … … 47 46 SERVICE_DEVMAP, 48 47 SERVICE_FHC, 49 SERVICE_OBIO 48 SERVICE_OBIO, 49 SERVICE_CLIPBOARD 50 50 } services_t; 51 51 -
uspace/lib/libc/include/ipc/vfs.h
r743e17b r985e26d2 73 73 VFS_IN_UNLINK, 74 74 VFS_IN_RENAME, 75 VFS_IN_STAT 75 VFS_IN_STAT, 76 VFS_IN_DUP 76 77 } vfs_in_request_t; 77 78 -
uspace/lib/libc/include/loader/loader.h
r743e17b r985e26d2 49 49 extern loader_t *loader_connect(void); 50 50 extern int loader_get_task_id(loader_t *, task_id_t *); 51 extern int loader_set_cwd(loader_t *); 51 52 extern int loader_set_pathname(loader_t *, const char *); 52 53 extern int loader_set_args(loader_t *, char *const[]); -
uspace/lib/libc/include/loader/pcb.h
r743e17b r985e26d2 52 52 /** Program entry point. */ 53 53 entry_point_t entry; 54 55 /** Current working directory. */ 56 char *cwd; 54 57 55 58 /** Number of command-line arguments. */ -
uspace/lib/libc/include/malloc.h
r743e17b r985e26d2 42 42 43 43 extern void *malloc(const size_t size); 44 extern void *calloc(const size_t nmemb, const size_t size); 44 45 extern void *memalign(const size_t align, const size_t size); 45 46 extern void *realloc(const void *addr, const size_t size); -
uspace/lib/libc/include/stdarg.h
r743e17b r985e26d2 37 37 38 38 #include <sys/types.h> 39 #include <libarch/stackarg.h>40 41 #ifndef __VARARGS_DEFINED42 # define __VARARGS_DEFINED43 39 44 40 typedef __builtin_va_list va_list; 45 41 46 # define va_start(ap, last) __builtin_va_start(ap, last) 47 # define va_arg(ap, type) __builtin_va_arg(ap, type) 48 # define va_end(ap) __builtin_va_end(ap) 49 50 # endif 42 #define va_start(ap, last) __builtin_va_start(ap, last) 43 #define va_arg(ap, type) __builtin_va_arg(ap, type) 44 #define va_end(ap) __builtin_va_end(ap) 51 45 52 46 #endif -
uspace/lib/libc/include/stdlib.h
r743e17b r985e26d2 38 38 #include <unistd.h> 39 39 #include <malloc.h> 40 #include <stacktrace.h> 40 41 41 #define abort() _exit(1) 42 #define abort() \ 43 do { \ 44 stack_trace(); \ 45 _exit(1); \ 46 } while (0) 47 42 48 #define exit(status) _exit((status)) 43 49 -
uspace/lib/libc/include/string.h
r743e17b r985e26d2 73 73 extern void str_append(char *dest, size_t size, const char *src); 74 74 75 extern void wstr_nstr(char *dst, const wchar_t *src, size_t size); 75 extern void wstr_to_str(char *dest, size_t size, const wchar_t *src); 76 extern char *wstr_to_astr(const wchar_t *src); 77 extern void str_to_wstr(wchar_t *dest, size_t dlen, const char *src); 76 78 77 79 extern char *str_chr(const char *str, wchar_t ch); … … 82 84 83 85 extern char *str_dup(const char *); 86 extern char *str_ndup(const char *, size_t max_size); 84 87 85 88 /* -
uspace/lib/libc/include/sys/stat.h
r743e17b r985e26d2 42 42 43 43 struct stat { 44 fs_handle_t fs_handle; 45 dev_handle_t dev_handle; 46 fs_index_t index; 47 unsigned lnkcnt; 48 bool is_file; 49 off_t size; 50 union { 51 struct { 52 dev_handle_t device; 53 } devfs_stat; 54 }; 44 fs_handle_t fs_handle; 45 dev_handle_t dev_handle; 46 fs_index_t index; 47 unsigned int lnkcnt; 48 bool is_file; 49 bool is_directory; 50 off_t size; 51 dev_handle_t device; 55 52 }; 56 53 -
uspace/lib/libc/include/unistd.h
r743e17b r985e26d2 51 51 #endif 52 52 53 typedef uint32_t useconds_t; 54 55 extern int dup2(int oldfd, int newfd); 56 53 57 extern ssize_t write(int, const void *, size_t); 54 58 extern ssize_t read(int, void *, size_t); … … 66 70 67 71 extern void _exit(int status) __attribute__ ((noreturn)); 68 extern int usleep(u nsigned long usec);69 extern unsigned int sleep(unsigned int se conds);72 extern int usleep(useconds_t uses); 73 extern unsigned int sleep(unsigned int se); 70 74 71 75 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
