Changeset 04803bf in mainline for uspace/lib/c/include
- Timestamp:
- 2011-03-21T22:00:17Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 143932e3
- Parents:
- b50b5af2 (diff), 7308e84 (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/c/include
- Files:
-
- 53 added
- 76 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/adt/hash_table.h
rb50b5af2 r04803bf 41 41 typedef unsigned long hash_count_t; 42 42 typedef unsigned long hash_index_t; 43 typedef struct hash_table hash_table_t; 44 typedef struct hash_table_operations hash_table_operations_t; 43 44 /** Set of operations for hash table. */ 45 typedef struct { 46 /** Hash function. 47 * 48 * @param key Array of keys needed to compute hash index. 49 * All keys must be passed. 50 * 51 * @return Index into hash table. 52 * 53 */ 54 hash_index_t (*hash)(unsigned long key[]); 55 56 /** Hash table item comparison function. 57 * 58 * @param key Array of keys that will be compared with item. It is 59 * not necessary to pass all keys. 60 * 61 * @return True if the keys match, false otherwise. 62 * 63 */ 64 int (*compare)(unsigned long key[], hash_count_t keys, link_t *item); 65 66 /** Hash table item removal callback. 67 * 68 * @param item Item that was removed from the hash table. 69 * 70 */ 71 void (*remove_callback)(link_t *item); 72 } hash_table_operations_t; 45 73 46 74 /** Hash table structure. */ 47 struct hash_table{75 typedef struct { 48 76 link_t *entry; 49 77 hash_count_t entries; 50 78 hash_count_t max_keys; 51 79 hash_table_operations_t *op; 52 }; 53 54 /** Set of operations for hash table. */ 55 struct hash_table_operations { 56 /** Hash function. 57 * 58 * @param key Array of keys needed to compute hash index. All keys 59 * must be passed. 60 * 61 * @return Index into hash table. 62 */ 63 hash_index_t (* hash)(unsigned long key[]); 64 65 /** Hash table item comparison function. 66 * 67 * @param key Array of keys that will be compared with item. It is 68 * not necessary to pass all keys. 69 * 70 * @return true if the keys match, false otherwise. 71 */ 72 int (*compare)(unsigned long key[], hash_count_t keys, link_t *item); 73 74 /** Hash table item removal callback. 75 * 76 * @param item Item that was removed from the hash table. 77 */ 78 void (*remove_callback)(link_t *item); 79 }; 80 } hash_table_t; 80 81 81 82 #define hash_table_get_instance(item, type, member) \ … … 88 89 extern void hash_table_remove(hash_table_t *, unsigned long [], hash_count_t); 89 90 extern void hash_table_destroy(hash_table_t *); 91 extern void hash_table_apply(hash_table_t *, void (*)(link_t *, void *), 92 void *); 90 93 91 94 #endif -
uspace/lib/c/include/as.h
rb50b5af2 r04803bf 41 41 #include <libarch/config.h> 42 42 43 static inline size_t SIZE2PAGES(size_t size) 44 { 45 if (size == 0) 46 return 0; 47 48 return (size_t) ((size - 1) >> PAGE_WIDTH) + 1; 49 } 50 51 static inline size_t PAGES2SIZE(size_t pages) 52 { 53 return (size_t) (pages << PAGE_WIDTH); 54 } 55 43 56 extern void *as_area_create(void *address, size_t size, int flags); 44 57 extern int as_area_resize(void *address, size_t size, int flags); -
uspace/lib/c/include/assert.h
rb50b5af2 r04803bf 51 51 52 52 #ifndef NDEBUG 53 # define assert(expr) if (!(expr)) { printf("Assertion failed (%s) at file '%s', line %d.\n", #expr, __FILE__, __LINE__); abort();} 54 #else 55 # define assert(expr) 56 #endif 53 54 #define assert(expr) \ 55 do { \ 56 if (!(expr)) { \ 57 printf("Assertion failed (%s) at file '%s', " \ 58 "line %d.\n", #expr, __FILE__, __LINE__); \ 59 abort(); \ 60 } \ 61 } while (0) 62 63 #else /* NDEBUG */ 64 65 #define assert(expr) 66 67 #endif /* NDEBUG */ 57 68 58 69 #endif -
uspace/lib/c/include/async.h
rb50b5af2 r04803bf 33 33 */ 34 34 35 #if ((defined(LIBC_IPC_H_)) && (!defined(LIBC_ASYNC_C_))) 36 #error Do not intermix low-level IPC interface and async framework 37 #endif 38 35 39 #ifndef LIBC_ASYNC_H_ 36 40 #define LIBC_ASYNC_H_ 37 41 38 #include <ipc/ipc.h> 42 #include <ipc/common.h> 43 #include <async_sess.h> 39 44 #include <fibril.h> 40 45 #include <sys/time.h> 41 46 #include <atomic.h> 42 47 #include <bool.h> 48 #include <task.h> 43 49 44 50 typedef ipc_callid_t aid_t; 45 typedef void (*async_client_conn_t)(ipc_callid_t callid, ipc_call_t *call); 46 47 extern atomic_t async_futex; 51 52 typedef void *(*async_client_data_ctor_t)(void); 53 typedef void (*async_client_data_dtor_t)(void *); 54 55 typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *); 48 56 49 57 extern atomic_t threads_in_ipc_wait; 50 58 51 extern int __async_init(void); 52 extern ipc_callid_t async_get_call_timeout(ipc_call_t *call, suseconds_t usecs); 53 54 static inline ipc_callid_t async_get_call(ipc_call_t *data) 55 { 56 return async_get_call_timeout(data, 0); 57 } 58 59 static inline void async_manager(void) 60 { 61 fibril_switch(FIBRIL_TO_MANAGER); 62 } 59 #define async_manager() \ 60 fibril_switch(FIBRIL_TO_MANAGER) 61 62 #define async_get_call(data) \ 63 async_get_call_timeout(data, 0) 64 65 extern ipc_callid_t async_get_call_timeout(ipc_call_t *, suseconds_t); 63 66 64 67 /* … … 84 87 (arg5), (dataptr)) 85 88 86 extern aid_t async_send_fast(int phoneid, ipcarg_t method, ipcarg_t arg1, 87 ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipc_call_t *dataptr); 88 extern aid_t async_send_slow(int phoneid, ipcarg_t method, ipcarg_t arg1, 89 ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, 90 ipc_call_t *dataptr); 91 extern void async_wait_for(aid_t amsgid, ipcarg_t *result); 92 extern int async_wait_timeout(aid_t amsgid, ipcarg_t *retval, 93 suseconds_t timeout); 94 95 extern fid_t async_new_connection(ipcarg_t in_phone_hash, ipc_callid_t callid, 96 ipc_call_t *call, void (*cthread)(ipc_callid_t, ipc_call_t *)); 97 extern void async_usleep(suseconds_t timeout); 89 extern aid_t async_send_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, 90 sysarg_t, ipc_call_t *); 91 extern aid_t async_send_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, 92 sysarg_t, sysarg_t, ipc_call_t *); 93 extern void async_wait_for(aid_t, sysarg_t *); 94 extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t); 95 96 extern fid_t async_new_connection(sysarg_t, sysarg_t, ipc_callid_t, 97 ipc_call_t *, void (*)(ipc_callid_t, ipc_call_t *)); 98 extern void async_usleep(suseconds_t); 98 99 extern void async_create_manager(void); 99 100 extern void async_destroy_manager(void); 100 101 101 extern void async_set_client_connection(async_client_conn_t conn); 102 extern void async_set_interrupt_received(async_client_conn_t conn); 103 104 /* Wrappers for simple communication */ 105 #define async_msg_0(phone, method) \ 106 ipc_call_async_0((phone), (method), NULL, NULL, true) 107 #define async_msg_1(phone, method, arg1) \ 108 ipc_call_async_1((phone), (method), (arg1), NULL, NULL, \ 109 true) 110 #define async_msg_2(phone, method, arg1, arg2) \ 111 ipc_call_async_2((phone), (method), (arg1), (arg2), NULL, NULL, \ 112 true) 113 #define async_msg_3(phone, method, arg1, arg2, arg3) \ 114 ipc_call_async_3((phone), (method), (arg1), (arg2), (arg3), NULL, NULL, \ 115 true) 116 #define async_msg_4(phone, method, arg1, arg2, arg3, arg4) \ 117 ipc_call_async_4((phone), (method), (arg1), (arg2), (arg3), (arg4), NULL, \ 118 NULL, true) 119 #define async_msg_5(phone, method, arg1, arg2, arg3, arg4, arg5) \ 120 ipc_call_async_5((phone), (method), (arg1), (arg2), (arg3), (arg4), \ 121 (arg5), NULL, NULL, true) 102 extern void async_set_client_data_constructor(async_client_data_ctor_t); 103 extern void async_set_client_data_destructor(async_client_data_dtor_t); 104 105 extern void *async_client_data_get(void); 106 107 extern void async_set_client_connection(async_client_conn_t); 108 extern void async_set_interrupt_received(async_client_conn_t); 109 110 /* 111 * Wrappers for simple communication. 112 */ 113 114 extern void async_msg_0(int, sysarg_t); 115 extern void async_msg_1(int, sysarg_t, sysarg_t); 116 extern void async_msg_2(int, sysarg_t, sysarg_t, sysarg_t); 117 extern void async_msg_3(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t); 118 extern void async_msg_4(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t); 119 extern void async_msg_5(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t, 120 sysarg_t); 121 122 /* 123 * Wrappers for answer routines. 124 */ 125 126 extern sysarg_t async_answer_0(ipc_callid_t, sysarg_t); 127 extern sysarg_t async_answer_1(ipc_callid_t, sysarg_t, sysarg_t); 128 extern sysarg_t async_answer_2(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t); 129 extern sysarg_t async_answer_3(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t, 130 sysarg_t); 131 extern sysarg_t async_answer_4(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t, 132 sysarg_t, sysarg_t); 133 extern sysarg_t async_answer_5(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t, 134 sysarg_t, sysarg_t, sysarg_t); 135 136 /* 137 * Wrappers for forwarding routines. 138 */ 139 140 extern int async_forward_fast(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t, 141 unsigned int); 142 extern int async_forward_slow(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t, 143 sysarg_t, sysarg_t, sysarg_t, unsigned int); 122 144 123 145 /* … … 127 149 * and slow verion based on m. 128 150 */ 151 129 152 #define async_req_0_0(phoneid, method) \ 130 153 async_req_fast((phoneid), (method), 0, 0, 0, 0, NULL, NULL, NULL, NULL, \ … … 242 265 (arg5), (rc1), (rc2), (rc3), (rc4), (rc5)) 243 266 244 extern ipcarg_t async_req_fast(int phoneid, ipcarg_t method, ipcarg_t arg1, 245 ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t *r1, ipcarg_t *r2, 246 ipcarg_t *r3, ipcarg_t *r4, ipcarg_t *r5); 247 extern ipcarg_t async_req_slow(int phoneid, ipcarg_t method, ipcarg_t arg1, 248 ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, ipcarg_t *r1, 249 ipcarg_t *r2, ipcarg_t *r3, ipcarg_t *r4, ipcarg_t *r5); 267 extern sysarg_t async_req_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, 268 sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *); 269 extern sysarg_t async_req_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, 270 sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, 271 sysarg_t *); 250 272 251 273 static inline void async_serialize_start(void) … … 259 281 } 260 282 283 extern int async_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, 284 async_client_conn_t); 285 extern int async_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t); 286 extern int async_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t); 287 extern int async_connect_kbox(task_id_t); 288 extern int async_hangup(int); 289 extern void async_poke(void); 290 291 /* 292 * User-friendly wrappers for async_share_in_start(). 293 */ 294 295 #define async_share_in_start_0_0(phoneid, dst, size) \ 296 async_share_in_start((phoneid), (dst), (size), 0, NULL) 297 #define async_share_in_start_0_1(phoneid, dst, size, flags) \ 298 async_share_in_start((phoneid), (dst), (size), 0, (flags)) 299 #define async_share_in_start_1_0(phoneid, dst, size, arg) \ 300 async_share_in_start((phoneid), (dst), (size), (arg), NULL) 301 #define async_share_in_start_1_1(phoneid, dst, size, arg, flags) \ 302 async_share_in_start((phoneid), (dst), (size), (arg), (flags)) 303 304 extern int async_share_in_start(int, void *, size_t, sysarg_t, unsigned int *); 305 extern bool async_share_in_receive(ipc_callid_t *, size_t *); 306 extern int async_share_in_finalize(ipc_callid_t, void *, unsigned int); 307 308 extern int async_share_out_start(int, void *, unsigned int); 309 extern bool async_share_out_receive(ipc_callid_t *, size_t *, unsigned int *); 310 extern int async_share_out_finalize(ipc_callid_t, void *); 311 312 /* 313 * User-friendly wrappers for async_data_read_forward_fast(). 314 */ 315 316 #define async_data_read_forward_0_0(phoneid, method, answer) \ 317 async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL) 318 #define async_data_read_forward_0_1(phoneid, method, answer) \ 319 async_data_read_forward_fast((phoneid), (method), 0, 0, 0, 0, (answer)) 320 #define async_data_read_forward_1_0(phoneid, method, arg1, answer) \ 321 async_data_read_forward_fast((phoneid), (method), (arg1), 0, 0, 0, NULL) 322 #define async_data_read_forward_1_1(phoneid, method, arg1, answer) \ 323 async_data_read_forward_fast((phoneid), (method), (arg1), 0, 0, 0, (answer)) 324 #define async_data_read_forward_2_0(phoneid, method, arg1, arg2, answer) \ 325 async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, NULL) 326 #define async_data_read_forward_2_1(phoneid, method, arg1, arg2, answer) \ 327 async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \ 328 (answer)) 329 #define async_data_read_forward_3_0(phoneid, method, arg1, arg2, arg3, answer) \ 330 async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \ 331 NULL) 332 #define async_data_read_forward_3_1(phoneid, method, arg1, arg2, arg3, answer) \ 333 async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \ 334 (answer)) 335 #define async_data_read_forward_4_0(phoneid, method, arg1, arg2, arg3, arg4, answer) \ 336 async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \ 337 (arg4), NULL) 338 #define async_data_read_forward_4_1(phoneid, method, arg1, arg2, arg3, arg4, answer) \ 339 async_data_read_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \ 340 (arg4), (answer)) 341 342 extern int async_data_read_start(int, void *, size_t); 343 extern bool async_data_read_receive(ipc_callid_t *, size_t *); 344 extern int async_data_read_finalize(ipc_callid_t, const void *, size_t); 345 346 extern int async_data_read_forward_fast(int, sysarg_t, sysarg_t, sysarg_t, 347 sysarg_t, sysarg_t, ipc_call_t *); 348 349 /* 350 * User-friendly wrappers for async_data_write_forward_fast(). 351 */ 352 353 #define async_data_write_forward_0_0(phoneid, method, answer) \ 354 async_data_write_forward_fast((phoneid), (method), 0, 0, 0, 0, NULL) 355 #define async_data_write_forward_0_1(phoneid, method, answer) \ 356 async_data_write_forward_fast((phoneid), (method), 0, 0, 0, 0, (answer)) 357 #define async_data_write_forward_1_0(phoneid, method, arg1, answer) \ 358 async_data_write_forward_fast((phoneid), (method), (arg1), 0, 0, 0, NULL) 359 #define async_data_write_forward_1_1(phoneid, method, arg1, answer) \ 360 async_data_write_forward_fast((phoneid), (method), (arg1), 0, 0, 0, \ 361 (answer)) 362 #define async_data_write_forward_2_0(phoneid, method, arg1, arg2, answer) \ 363 async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \ 364 NULL) 365 #define async_data_write_forward_2_1(phoneid, method, arg1, arg2, answer) \ 366 async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), 0, 0, \ 367 (answer)) 368 #define async_data_write_forward_3_0(phoneid, method, arg1, arg2, arg3, answer) \ 369 async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \ 370 0, NULL) 371 #define async_data_write_forward_3_1(phoneid, method, arg1, arg2, arg3, answer) \ 372 async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \ 373 0, (answer)) 374 #define async_data_write_forward_4_0(phoneid, method, arg1, arg2, arg3, arg4, answer) \ 375 async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \ 376 (arg4), NULL) 377 #define async_data_write_forward_4_1(phoneid, method, arg1, arg2, arg3, arg4, answer) \ 378 async_data_write_forward_fast((phoneid), (method), (arg1), (arg2), (arg3), \ 379 (arg4), (answer)) 380 381 extern int async_data_write_start(int, const void *, size_t); 382 extern bool async_data_write_receive(ipc_callid_t *, size_t *); 383 extern int async_data_write_finalize(ipc_callid_t, void *, size_t); 384 385 extern int async_data_write_accept(void **, const bool, const size_t, 386 const size_t, const size_t, size_t *); 387 extern void async_data_write_void(sysarg_t); 388 389 extern int async_data_write_forward_fast(int, sysarg_t, sysarg_t, sysarg_t, 390 sysarg_t, sysarg_t, ipc_call_t *); 391 261 392 #endif 262 393 -
uspace/lib/c/include/atomic.h
rb50b5af2 r04803bf 1 1 /* 2 * Copyright (c) 200 5Jakub Jermar2 * Copyright (c) 2009 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup ia3229 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef KERN_ia32_ARG_H_36 #define KERN_ia32_ARG_H_35 #ifndef LIBC_ATOMIC_H_ 36 #define LIBC_ATOMIC_H_ 37 37 38 #include < stackarg.h>38 #include <libarch/atomic.h> 39 39 40 40 #endif -
uspace/lib/c/include/bool.h
rb50b5af2 r04803bf 36 36 #define LIBC_BOOL_H_ 37 37 38 #define false 0 39 #define true 1 38 #include <libarch/types.h> 40 39 41 typedef short bool; 40 #define false 0 41 #define true 1 42 43 typedef uint8_t bool; 42 44 43 45 #endif -
uspace/lib/c/include/byteorder.h
rb50b5af2 r04803bf 80 80 #endif 81 81 82 #define htons(n) host2uint16_t_be((n)) 83 #define htonl(n) host2uint32_t_be((n)) 84 #define ntohs(n) uint16_t_be2host((n)) 85 #define ntohl(n) uint32_t_be2host((n)) 86 82 87 static inline uint64_t uint64_t_byteorder_swap(uint64_t n) 83 88 { -
uspace/lib/c/include/ddi.h
rb50b5af2 r04803bf 36 36 #define LIBC_DDI_H_ 37 37 38 #include <sys/types.h> 39 #include <kernel/ddi/irq.h> 38 40 #include <task.h> 39 41 … … 41 43 extern int physmem_map(void *, void *, unsigned long, int); 42 44 extern int iospace_enable(task_id_t, void *, unsigned long); 43 extern int preemption_control(int);44 45 extern int pio_enable(void *, size_t, void **); 46 extern int register_irq(int, int, int, irq_code_t *); 47 extern int unregister_irq(int, int); 45 48 46 49 #endif -
uspace/lib/c/include/devmap.h
rb50b5af2 r04803bf 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); … … 43 44 44 45 extern int devmap_driver_register(const char *, async_client_conn_t); 45 extern int devmap_device_register(const char *, dev_handle_t *); 46 extern int devmap_device_register(const char *, devmap_handle_t *); 47 extern int devmap_device_register_with_iface(const char *, devmap_handle_t *, sysarg_t); 46 48 47 extern int devmap_device_get_handle(const char *, dev_handle_t *, unsigned int); 48 extern int devmap_device_connect(dev_handle_t, unsigned int); 49 extern int devmap_device_get_handle(const char *, devmap_handle_t *, unsigned int); 50 extern int devmap_namespace_get_handle(const char *, devmap_handle_t *, unsigned int); 51 extern devmap_handle_type_t devmap_handle_probe(devmap_handle_t); 52 53 extern int devmap_device_connect(devmap_handle_t, unsigned int); 49 54 50 55 extern int devmap_null_create(void); 51 56 extern void devmap_null_destroy(int); 52 57 53 extern ipcarg_t devmap_device_get_count(void); 54 extern ipcarg_t devmap_device_get_devices(ipcarg_t, dev_desc_t *); 58 extern size_t devmap_count_namespaces(void); 59 extern size_t devmap_count_devices(devmap_handle_t); 60 61 extern size_t devmap_get_namespaces(dev_desc_t **); 62 extern size_t devmap_get_devices(devmap_handle_t, dev_desc_t **); 55 63 56 64 #endif -
uspace/lib/c/include/err.h
rb50b5af2 r04803bf 36 36 #define LIBC_ERR_H_ 37 37 38 #define errx(status, fmt, ...) { \ 39 printf((fmt), ##__VA_ARGS__); \ 40 _exit(status); \ 41 } 38 #include <stdio.h> 39 40 #define errx(status, fmt, ...) \ 41 do { \ 42 printf((fmt), ##__VA_ARGS__); \ 43 exit(status); \ 44 } while (0) 42 45 43 46 #endif -
uspace/lib/c/include/errno.h
rb50b5af2 r04803bf 39 39 #include <fibril.h> 40 40 41 #define errno _errno 42 41 43 extern int _errno; 42 44 43 #define errno _errno 44 45 #define EMFILE (-17) 45 #define EMFILE (-18) 46 46 #define ENAMETOOLONG (-256) 47 47 #define EISDIR (-257) … … 56 56 #define EMLINK (-266) 57 57 58 /** An API function is called while another blocking function is in progress. */ 59 #define EINPROGRESS (-10036) 60 61 /** The socket identifier is not valid. */ 62 #define ENOTSOCK (-10038) 63 64 /** The destination address required. */ 65 #define EDESTADDRREQ (-10039) 66 67 /** Protocol is not supported. */ 68 #define EPROTONOSUPPORT (-10043) 69 70 /** Socket type is not supported. */ 71 #define ESOCKTNOSUPPORT (-10044) 72 73 /** Protocol family is not supported. */ 74 #define EPFNOSUPPORT (-10046) 75 76 /** Address family is not supported. */ 77 #define EAFNOSUPPORT (-10047) 78 79 /** Address is already in use. */ 80 #define EADDRINUSE (-10048) 81 82 /** The socket is not connected or bound. */ 83 #define ENOTCONN (-10057) 84 85 /** The requested operation was not performed. Try again later. */ 86 #define EAGAIN (-11002) 87 88 /** No data. */ 89 #define NO_DATA (-11004) 90 58 91 #endif 59 92 -
uspace/lib/c/include/event.h
rb50b5af2 r04803bf 37 37 38 38 #include <kernel/ipc/event_types.h> 39 #include <ipc/ipc.h>40 39 41 extern int event_subscribe(event_type_t, ipcarg_t);40 extern int event_subscribe(event_type_t, sysarg_t); 42 41 43 42 #endif -
uspace/lib/c/include/fcntl.h
rb50b5af2 r04803bf 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/c/include/fibril.h
rb50b5af2 r04803bf 40 40 #include <libarch/tls.h> 41 41 42 #ifndef context_set 43 #define context_set(c, _pc, stack, size, ptls) \ 42 #define context_set_generic(c, _pc, stack, size, ptls) \ 44 43 (c)->pc = (sysarg_t) (_pc); \ 45 44 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 46 45 (c)->tls = (sysarg_t) (ptls); 47 #endif /* context_set */48 46 49 #define FIBRIL_SERIALIZED 1 50 #define FIBRIL_WRITER 2 47 #define FIBRIL_SERIALIZED 1 48 #define FIBRIL_WRITER 2 49 50 struct fibril; 51 52 typedef struct { 53 struct fibril *owned_by; 54 } fibril_owner_info_t; 51 55 52 56 typedef enum { … … 59 63 typedef sysarg_t fid_t; 60 64 61 struct fibril {65 typedef struct fibril { 62 66 link_t link; 63 67 context_t ctx; … … 70 74 int retval; 71 75 int flags; 72 }; 73 typedef struct fibril fibril_t; 76 77 fibril_owner_info_t *waits_for; 78 } fibril_t; 74 79 75 80 /** Fibril-local variable specifier */ 76 81 #define fibril_local __thread 77 82 78 extern int context_save(context_t *c ) __attribute__((returns_twice));79 extern void context_restore(context_t *c ) __attribute__((noreturn));83 extern int context_save(context_t *ctx) __attribute__((returns_twice)); 84 extern void context_restore(context_t *ctx) __attribute__((noreturn)); 80 85 81 86 extern fid_t fibril_create(int (*func)(void *), void *arg); … … 89 94 extern void fibril_inc_sercount(void); 90 95 extern void fibril_dec_sercount(void); 96 extern int fibril_get_sercount(void); 91 97 92 static inline int fibril_yield(void) { 98 static inline int fibril_yield(void) 99 { 93 100 return fibril_switch(FIBRIL_PREEMPT); 94 101 } -
uspace/lib/c/include/fibril_synch.h
rb50b5af2 r04803bf 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 { 45 fibril_owner_info_t oi; /* Keep this the first thing. */ 44 46 int counter; 45 47 link_t waiters; 46 48 } fibril_mutex_t; 47 49 48 #define FIBRIL_MUTEX_INITIALIZE(name) \ 49 fibril_mutex_t name = { \ 50 #define FIBRIL_MUTEX_INITIALIZER(name) \ 51 { \ 52 .oi = { \ 53 .owned_by = NULL \ 54 }, \ 50 55 .counter = 1, \ 51 56 .waiters = { \ … … 54 59 } \ 55 60 } 61 62 #define FIBRIL_MUTEX_INITIALIZE(name) \ 63 fibril_mutex_t name = FIBRIL_MUTEX_INITIALIZER(name) 56 64 57 65 typedef struct { 66 fibril_owner_info_t oi; /* Keep this the first thing. */ 58 67 unsigned writers; 59 68 unsigned readers; … … 61 70 } fibril_rwlock_t; 62 71 63 #define FIBRIL_RWLOCK_INITIALIZE(name) \ 64 fibril_rwlock_t name = { \ 72 #define FIBRIL_RWLOCK_INITIALIZER(name) \ 73 { \ 74 .oi = { \ 75 .owned_by = NULL \ 76 }, \ 65 77 .readers = 0, \ 66 78 .writers = 0, \ … … 71 83 } 72 84 85 #define FIBRIL_RWLOCK_INITIALIZE(name) \ 86 fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name) 87 73 88 typedef struct { 74 89 link_t waiters; 75 90 } fibril_condvar_t; 76 91 77 #define FIBRIL_CONDVAR_INITIALIZE (name) \78 fibril_condvar_t name ={ \92 #define FIBRIL_CONDVAR_INITIALIZER(name) \ 93 { \ 79 94 .waiters = { \ 80 95 .next = &name.waiters, \ … … 83 98 } 84 99 100 #define FIBRIL_CONDVAR_INITIALIZE(name) \ 101 fibril_condvar_t name = FIBRIL_CONDVAR_INITIALIZER(name) 102 85 103 extern void fibril_mutex_initialize(fibril_mutex_t *); 86 104 extern void fibril_mutex_lock(fibril_mutex_t *); 87 105 extern bool fibril_mutex_trylock(fibril_mutex_t *); 88 106 extern void fibril_mutex_unlock(fibril_mutex_t *); 107 extern bool fibril_mutex_is_locked(fibril_mutex_t *); 89 108 90 109 extern void fibril_rwlock_initialize(fibril_rwlock_t *); … … 93 112 extern void fibril_rwlock_read_unlock(fibril_rwlock_t *); 94 113 extern void fibril_rwlock_write_unlock(fibril_rwlock_t *); 114 extern bool fibril_rwlock_is_read_locked(fibril_rwlock_t *); 115 extern bool fibril_rwlock_is_write_locked(fibril_rwlock_t *); 116 extern bool fibril_rwlock_is_locked(fibril_rwlock_t *); 95 117 96 118 extern void fibril_condvar_initialize(fibril_condvar_t *); 119 extern int fibril_condvar_wait_timeout(fibril_condvar_t *, fibril_mutex_t *, 120 suseconds_t); 97 121 extern void fibril_condvar_wait(fibril_condvar_t *, fibril_mutex_t *); 98 122 extern void fibril_condvar_signal(fibril_condvar_t *); -
uspace/lib/c/include/futex.h
rb50b5af2 r04803bf 39 39 #include <sys/types.h> 40 40 41 #define FUTEX_INITIALIZER 41 #define FUTEX_INITIALIZER {1} 42 42 43 43 typedef atomic_t futex_t; … … 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/c/include/inttypes.h
rb50b5af2 r04803bf 1 1 /* 2 * Copyright (c) 20 05 Ondrej Palkovsky2 * Copyright (c) 2010 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_INTTYPES_H_ 36 #define LIBC_INTTYPES_H_ 37 37 38 #include < stdarg.h>38 #include <libarch/inttypes.h> 39 39 40 40 #endif … … 42 42 /** @} 43 43 */ 44 -
uspace/lib/c/include/io/color.h
rb50b5af2 r04803bf 36 36 #define LIBC_IO_COLOR_H_ 37 37 38 enum console_color{38 typedef enum { 39 39 COLOR_BLACK = 0, 40 40 COLOR_BLUE = 1, … … 48 48 CATTR_BRIGHT = 8, 49 49 CATTR_BLINK = 8 50 } ;50 } console_color_t; 51 51 52 52 #endif -
uspace/lib/c/include/io/console.h
rb50b5af2 r04803bf 36 36 #define LIBC_IO_CONSOLE_H_ 37 37 38 #include <ipc/ipc.h>39 38 #include <bool.h> 40 39 … … 44 43 } console_ev_type_t; 45 44 46 enum {45 typedef enum { 47 46 CONSOLE_CCAP_NONE = 0, 48 47 CONSOLE_CCAP_STYLE, 49 48 CONSOLE_CCAP_INDEXED, 50 49 CONSOLE_CCAP_RGB 51 } ;50 } console_caps_t; 52 51 53 52 /** Console event structure. */ … … 68 67 extern void console_clear(int phone); 69 68 70 extern int console_get_size(int phone, ipcarg_t *rows, ipcarg_t *cols); 71 extern void console_goto(int phone, ipcarg_t row, ipcarg_t col); 69 extern int console_get_size(int phone, sysarg_t *cols, sysarg_t *rows); 70 extern int console_get_pos(int phone, sysarg_t *col, sysarg_t *row); 71 extern void console_set_pos(int phone, sysarg_t col, sysarg_t row); 72 72 73 extern void console_set_style(int phone, int style); 74 extern void console_set_color(int phone, int fg_color, int bg_color, int flags); 75 extern void console_set_rgb_color(int phone, int fg_color, int bg_color); 73 extern void console_set_style(int phone, uint8_t style); 74 extern void console_set_color(int phone, uint8_t fg_color, uint8_t bg_color, 75 uint8_t flags); 76 extern void console_set_rgb_color(int phone, uint32_t fg_color, uint32_t bg_color); 76 77 77 78 extern void console_cursor_visibility(int phone, bool show); 78 extern int console_get_color_cap(int phone, int *ccap);79 extern int console_get_color_cap(int phone, sysarg_t *ccap); 79 80 extern void console_kcon_enable(int phone); 80 81 -
uspace/lib/c/include/io/keycode.h
rb50b5af2 r04803bf 51 51 * they really are organized here by position, rather than by label. 52 52 */ 53 enum keycode{53 typedef enum { 54 54 55 55 /* Main block row 1 */ … … 199 199 } keycode_t; 200 200 201 enum keymod{201 typedef enum { 202 202 KM_LSHIFT = 0x001, 203 203 KM_RSHIFT = 0x002, -
uspace/lib/c/include/io/klog.h
rb50b5af2 r04803bf 33 33 */ 34 34 35 #ifndef LIBC_ STREAM_H_36 #define LIBC_ STREAM_H_35 #ifndef LIBC_IO_KLOG_H_ 36 #define LIBC_IO_KLOG_H_ 37 37 38 38 #include <sys/types.h> 39 39 40 extern size_t klog_write(const void * buf, size_t size);40 extern size_t klog_write(const void *, size_t); 41 41 extern void klog_update(void); 42 42 -
uspace/lib/c/include/io/printf_core.h
rb50b5af2 r04803bf 40 40 41 41 /** Structure for specifying output methods for different printf clones. */ 42 typedef struct printf_spec{42 typedef struct { 43 43 /* String output function, returns number of printed characters or EOF */ 44 44 int (*str_write)(const char *, size_t, void *); … … 51 51 } printf_spec_t; 52 52 53 int printf_core(const char *fmt, printf_spec_t *ps, va_list ap);53 extern int printf_core(const char *, printf_spec_t *, va_list); 54 54 55 55 #endif -
uspace/lib/c/include/io/screenbuffer.h
rb50b5af2 r04803bf 33 33 */ 34 34 35 #ifndef SCREENBUFFER_H__36 #define SCREENBUFFER_H__35 #ifndef LIBC_SCREENBUFFER_H__ 36 #define LIBC_SCREENBUFFER_H__ 37 37 38 38 #include <stdint.h> … … 40 40 #include <bool.h> 41 41 42 #define DEFAULT_FOREGROUND 0x0 /**< default console foreground color */ 43 #define DEFAULT_BACKGROUND 0xf0f0f0 /**< default console background color */ 42 typedef enum { 43 at_style, 44 at_idx, 45 at_rgb 46 } attr_type_t; 44 47 45 48 typedef struct { … … 58 61 } attr_rgb_t; 59 62 63 typedef union { 64 attr_style_t s; 65 attr_idx_t i; 66 attr_rgb_t r; 67 } attr_val_t; 68 60 69 typedef 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; 70 attr_type_t t; 71 attr_val_t a; 71 72 } attrs_t; 72 73 … … 82 83 keyfield_t *buffer; /**< Screen content - characters and 83 84 their attributes (used as a circular buffer) */ 84 s ize_t size_x;/**< Number of columns */85 s ize_t size_y;/**< Number of rows */85 sysarg_t size_x; /**< Number of columns */ 86 sysarg_t size_y; /**< Number of rows */ 86 87 87 88 /** Coordinates of last printed character for determining cursor position */ 88 s ize_t position_x;89 s ize_t position_y;89 sysarg_t position_x; 90 sysarg_t position_y; 90 91 91 92 attrs_t attrs; /**< Current attributes. */ … … 107 108 * 108 109 */ 109 static inline keyfield_t *get_field_at(screenbuffer_t *scr, s ize_t x, size_t y)110 static inline keyfield_t *get_field_at(screenbuffer_t *scr, sysarg_t x, sysarg_t y) 110 111 { 111 112 return scr->buffer + x + ((y + scr->top_line) % scr->size_y) * scr->size_x; … … 120 121 * 121 122 */ 122 static inline intattrs_same(attrs_t a1, attrs_t a2)123 static inline bool attrs_same(attrs_t a1, attrs_t a2) 123 124 { 124 125 if (a1.t != a2.t) 125 return 0;126 return false; 126 127 127 128 switch (a1.t) { … … 137 138 } 138 139 139 return 0;140 return false; 140 141 } 141 142 143 extern void screenbuffer_putchar(screenbuffer_t *, wchar_t); 144 extern screenbuffer_t *screenbuffer_init(screenbuffer_t *, sysarg_t, sysarg_t); 142 145 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); 146 extern void screenbuffer_clear(screenbuffer_t *); 147 extern void screenbuffer_clear_line(screenbuffer_t *, sysarg_t); 148 extern void screenbuffer_copy_buffer(screenbuffer_t *, keyfield_t *); 149 extern void screenbuffer_goto(screenbuffer_t *, sysarg_t, sysarg_t); 150 extern void screenbuffer_set_style(screenbuffer_t *, uint8_t); 151 extern void screenbuffer_set_color(screenbuffer_t *, uint8_t, uint8_t, uint8_t); 152 extern void screenbuffer_set_rgb_color(screenbuffer_t *, uint32_t, uint32_t); 155 153 156 154 #endif -
uspace/lib/c/include/io/style.h
rb50b5af2 r04803bf 36 36 #define LIBC_IO_STYLE_H_ 37 37 38 enum console_style{38 typedef enum { 39 39 STYLE_NORMAL = 0, 40 STYLE_EMPHASIS = 1 41 }; 40 STYLE_EMPHASIS = 1, 41 STYLE_INVERTED = 2, 42 STYLE_SELECTED = 3 43 } console_style_t; 42 44 43 45 #endif -
uspace/lib/c/include/ipc/bd.h
rb50b5af2 r04803bf 31 31 */ 32 32 /** @file 33 */ 33 */ 34 34 35 35 #ifndef LIBC_IPC_BD_H_ 36 36 #define LIBC_IPC_BD_H_ 37 37 38 #include <ipc/ ipc.h>38 #include <ipc/common.h> 39 39 40 40 typedef enum { 41 BD_READ_BLOCK = IPC_FIRST_USER_METHOD, 42 BD_WRITE_BLOCK 41 BD_GET_BLOCK_SIZE = IPC_FIRST_USER_METHOD, 42 BD_GET_NUM_BLOCKS, 43 BD_READ_BLOCKS, 44 BD_WRITE_BLOCKS 43 45 } bd_request_t; 44 46 -
uspace/lib/c/include/ipc/console.h
rb50b5af2 r04803bf 36 36 #define LIBC_IPC_CONSOLE_H_ 37 37 38 #include <ipc/ipc.h>39 38 #include <ipc/vfs.h> 40 39 … … 43 42 CONSOLE_GET_COLOR_CAP, 44 43 CONSOLE_GET_EVENT, 44 CONSOLE_GET_POS, 45 45 CONSOLE_GOTO, 46 46 CONSOLE_CLEAR, -
uspace/lib/c/include/ipc/devmap.h
rb50b5af2 r04803bf 34 34 #define DEVMAP_DEVMAP_H_ 35 35 36 #include <atomic.h> 37 #include <ipc/ipc.h> 38 #include <adt/list.h> 36 #include <ipc/common.h> 39 37 40 38 #define DEVMAP_NAME_MAXLEN 255 41 39 42 typedef ipcarg_t dev_handle_t; 40 typedef sysarg_t devmap_handle_t; 41 42 typedef enum { 43 DEV_HANDLE_NONE, 44 DEV_HANDLE_NAMESPACE, 45 DEV_HANDLE_DEVICE 46 } devmap_handle_type_t; 43 47 44 48 typedef enum { … … 47 51 DEVMAP_DEVICE_REGISTER, 48 52 DEVMAP_DEVICE_UNREGISTER, 49 DEVMAP_DEVICE_GET_NAME,50 53 DEVMAP_DEVICE_GET_HANDLE, 51 DEVMAP_DEVICE_NULL_CREATE, 52 DEVMAP_DEVICE_NULL_DESTROY, 53 DEVMAP_DEVICE_GET_COUNT, 54 DEVMAP_DEVICE_GET_DEVICES 54 DEVMAP_NAMESPACE_GET_HANDLE, 55 DEVMAP_HANDLE_PROBE, 56 DEVMAP_NULL_CREATE, 57 DEVMAP_NULL_DESTROY, 58 DEVMAP_GET_NAMESPACE_COUNT, 59 DEVMAP_GET_DEVICE_COUNT, 60 DEVMAP_GET_NAMESPACES, 61 DEVMAP_GET_DEVICES 55 62 } devmap_request_t; 56 63 … … 72 79 73 80 typedef struct { 74 dev _handle_t handle;81 devmap_handle_t handle; 75 82 char name[DEVMAP_NAME_MAXLEN + 1]; 76 83 } dev_desc_t; -
uspace/lib/c/include/ipc/fb.h
rb50b5af2 r04803bf 31 31 */ 32 32 /** @file 33 */ 33 */ 34 34 35 35 #ifndef LIBC_FB_H_ 36 36 #define LIBC_FB_H_ 37 37 38 #include <ipc/ ipc.h>38 #include <ipc/common.h> 39 39 40 40 typedef enum { -
uspace/lib/c/include/ipc/ipc.h
rb50b5af2 r04803bf 33 33 */ 34 34 35 #ifndef LIBIPC_IPC_H_ 36 #define LIBIPC_IPC_H_ 37 35 #if ((defined(LIBC_ASYNC_H_)) && (!defined(LIBC_ASYNC_C_))) 36 #error Do not intermix low-level IPC interface and async framework 37 #endif 38 39 #ifndef LIBC_IPC_H_ 40 #define LIBC_IPC_H_ 41 42 #include <sys/types.h> 43 #include <ipc/common.h> 44 #include <kernel/synch/synch.h> 38 45 #include <task.h> 39 #include <kernel/ipc/ipc.h> 40 #include <kernel/ddi/irq.h> 41 #include <sys/types.h> 42 #include <kernel/synch/synch.h> 43 44 #define IPC_FLAG_BLOCKING 0x01 45 46 typedef sysarg_t ipcarg_t; 47 48 typedef struct { 49 ipcarg_t args[IPC_CALL_LEN]; 50 ipcarg_t in_phone_hash; 51 } ipc_call_t; 52 53 typedef sysarg_t ipc_callid_t; 54 55 typedef void (* ipc_async_callback_t)(void *, int, ipc_call_t *); 46 47 typedef void (*ipc_async_callback_t)(void *, int, ipc_call_t *); 56 48 57 49 /* … … 61 53 * possible, the fast version is used. 62 54 */ 55 63 56 #define ipc_call_sync_0_0(phoneid, method) \ 64 57 ipc_call_sync_fast((phoneid), (method), 0, 0, 0, 0, 0, 0, 0, 0) … … 183 176 (arg4), (arg5), (res1), (res2), (res3), (res4), (res5)) 184 177 185 extern int ipc_call_sync_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t, 186 ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *); 187 188 extern int ipc_call_sync_slow(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t, 189 ipcarg_t, ipcarg_t, ipcarg_t *, ipcarg_t *, ipcarg_t *, ipcarg_t *, 190 ipcarg_t *); 191 192 extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, uint32_t, int); 193 extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *, uint32_t); 178 extern int ipc_call_sync_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, 179 sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *); 180 181 extern int ipc_call_sync_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, 182 sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, 183 sysarg_t *); 184 185 extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, sysarg_t, unsigned int); 194 186 extern void ipc_poke(void); 195 187 196 static inline ipc_callid_t ipc_wait_for_call(ipc_call_t *data) 197 { 198 return ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT); 199 } 200 188 #define ipc_wait_for_call(data) \ 189 ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT); 190 191 extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *, sysarg_t); 201 192 extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *); 202 193 … … 207 198 * to m. 208 199 */ 200 209 201 #define ipc_answer_0(callid, retval) \ 210 202 ipc_answer_fast((callid), (retval), 0, 0, 0, 0) … … 220 212 ipc_answer_slow((callid), (retval), (arg1), (arg2), (arg3), (arg4), (arg5)) 221 213 222 extern ipcarg_t ipc_answer_fast(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t,223 ipcarg_t, ipcarg_t);224 extern ipcarg_t ipc_answer_slow(ipc_callid_t, ipcarg_t, ipcarg_t, ipcarg_t,225 ipcarg_t, ipcarg_t, ipcarg_t);214 extern sysarg_t ipc_answer_fast(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t, 215 sysarg_t, sysarg_t); 216 extern sysarg_t ipc_answer_slow(ipc_callid_t, sysarg_t, sysarg_t, sysarg_t, 217 sysarg_t, sysarg_t, sysarg_t); 226 218 227 219 /* … … 231 223 * to m. 232 224 */ 225 233 226 #define ipc_call_async_0(phoneid, method, private, callback, can_preempt) \ 234 227 ipc_call_async_fast((phoneid), (method), 0, 0, 0, 0, (private), \ … … 255 248 (arg4), (arg5), (private), (callback), (can_preempt)) 256 249 257 extern void ipc_call_async_fast(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t, 258 ipcarg_t, void *, ipc_async_callback_t, int); 259 extern void ipc_call_async_slow(int, ipcarg_t, ipcarg_t, ipcarg_t, ipcarg_t, 260 ipcarg_t, ipcarg_t, void *, ipc_async_callback_t, int); 261 262 extern int ipc_connect_to_me(int, int, int, int, ipcarg_t *); 263 extern int ipc_connect_me_to(int, int, int, int); 264 extern int ipc_connect_me_to_blocking(int, int, int, int); 250 extern void ipc_call_async_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, 251 sysarg_t, void *, ipc_async_callback_t, bool); 252 extern void ipc_call_async_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t, 253 sysarg_t, sysarg_t, void *, ipc_async_callback_t, bool); 254 255 extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t *, 256 sysarg_t *); 257 extern int ipc_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t); 258 extern int ipc_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t); 259 265 260 extern int ipc_hangup(int); 266 extern int ipc_register_irq(int, int, int, irq_code_t *); 267 extern int ipc_ unregister_irq(int, int);268 extern int ipc_forward_fast(ipc_callid_t, int, int, ipcarg_t, ipcarg_t,int);269 extern int ipc_forward_slow(ipc_callid_t, int, int, ipcarg_t, ipcarg_t,270 ipcarg_t, ipcarg_t, ipcarg_t,int);261 262 extern int ipc_forward_fast(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t, 263 unsigned int); 264 extern int ipc_forward_slow(ipc_callid_t, int, sysarg_t, sysarg_t, sysarg_t, 265 sysarg_t, sysarg_t, sysarg_t, unsigned int); 271 266 272 267 /* 273 268 * User-friendly wrappers for ipc_share_in_start(). 274 269 */ 270 275 271 #define ipc_share_in_start_0_0(phoneid, dst, size) \ 276 272 ipc_share_in_start((phoneid), (dst), (size), 0, NULL) … … 282 278 ipc_share_in_start((phoneid), (dst), (size), (arg), (flags)) 283 279 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 extern int ipc_share_in_finalize(ipc_callid_t, void *, int ); 287 extern int ipc_share_out_start(int, void *, int); 288 extern int ipc_share_out_receive(ipc_callid_t *, size_t *, int *); 280 extern int ipc_share_in_start(int, void *, size_t, sysarg_t, unsigned int *); 281 extern int ipc_share_in_finalize(ipc_callid_t, void *, unsigned int); 282 extern int ipc_share_out_start(int, void *, unsigned int); 289 283 extern int ipc_share_out_finalize(ipc_callid_t, void *); 290 284 extern int ipc_data_read_start(int, void *, size_t); 291 extern int ipc_data_read_receive(ipc_callid_t *, size_t *);292 285 extern int ipc_data_read_finalize(ipc_callid_t, const void *, size_t); 293 286 extern int ipc_data_write_start(int, const void *, size_t); 294 extern int ipc_data_write_receive(ipc_callid_t *, size_t *);295 287 extern int ipc_data_write_finalize(ipc_callid_t, void *, size_t); 296 288 -
uspace/lib/c/include/ipc/irc.h
rb50b5af2 r04803bf 31 31 */ 32 32 /** @file 33 */ 33 */ 34 34 35 #ifndef LIBC_ BUS_H_36 #define LIBC_ BUS_H_35 #ifndef LIBC_IRC_H_ 36 #define LIBC_IRC_H_ 37 37 38 #include <ipc/ ipc.h>38 #include <ipc/common.h> 39 39 40 40 typedef enum { 41 BUS_CLEAR_INTERRUPT = IPC_FIRST_USER_METHOD 42 } bus_request_t; 41 IRC_ENABLE_INTERRUPT = IPC_FIRST_USER_METHOD, 42 IRC_CLEAR_INTERRUPT 43 } irc_request_t; 43 44 44 45 #endif -
uspace/lib/c/include/ipc/kbd.h
rb50b5af2 r04803bf 38 38 #define LIBC_IPC_KBD_H_ 39 39 40 #include <ipc/ ipc.h>40 #include <ipc/common.h> 41 41 42 42 typedef enum { -
uspace/lib/c/include/ipc/loader.h
rb50b5af2 r04803bf 31 31 */ 32 32 /** @file 33 */ 33 */ 34 34 35 35 #ifndef LIBC_IPC_LOADER_H_ 36 36 #define LIBC_IPC_LOADER_H_ 37 37 38 #include <ipc/ ipc.h>38 #include <ipc/common.h> 39 39 40 40 typedef enum { 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/c/include/ipc/ns.h
rb50b5af2 r04803bf 33 33 */ 34 34 35 #ifndef LIB IPC_NS_H_36 #define LIB IPC_NS_H_35 #ifndef LIBC_NS_H_ 36 #define LIBC_NS_H_ 37 37 38 #include <ipc/ipc.h> 38 #include <sys/types.h> 39 #include <ipc/common.h> 39 40 40 41 typedef enum { … … 45 46 } ns_request_t; 46 47 48 extern int service_register(sysarg_t); 49 extern int service_connect(sysarg_t, sysarg_t, sysarg_t); 50 extern int service_connect_blocking(sysarg_t, sysarg_t, sysarg_t); 51 47 52 #endif 48 53 -
uspace/lib/c/include/ipc/services.h
rb50b5af2 r04803bf 35 35 */ 36 36 37 #ifndef LIB IPC_SERVICES_H_38 #define LIB IPC_SERVICES_H_37 #ifndef LIBC_SERVICES_H_ 38 #define LIBC_SERVICES_H_ 39 39 40 40 typedef enum { 41 SERVICE_LOAD = 1, 41 SERVICE_NONE = 0, 42 SERVICE_LOAD, 42 43 SERVICE_PCI, 43 SERVICE_KEYBOARD,44 44 SERVICE_VIDEO, 45 45 SERVICE_CONSOLE, 46 46 SERVICE_VFS, 47 47 SERVICE_DEVMAP, 48 SERVICE_DEVMAN, 48 49 SERVICE_FHC, 49 SERVICE_OBIO 50 SERVICE_OBIO, 51 SERVICE_APIC, 52 SERVICE_I8259, 53 SERVICE_CLIPBOARD, 54 SERVICE_NETWORKING, 55 SERVICE_LO, 56 SERVICE_NE2000, 57 SERVICE_ETHERNET, 58 SERVICE_NILDUMMY, 59 SERVICE_IP, 60 SERVICE_ARP, 61 SERVICE_RARP, 62 SERVICE_ICMP, 63 SERVICE_UDP, 64 SERVICE_TCP, 65 SERVICE_SOCKET 50 66 } services_t; 51 52 /* Memory area to be received from NS */53 #define SERVICE_MEM_REALTIME 154 #define SERVICE_MEM_KLOG 255 67 56 68 #endif -
uspace/lib/c/include/ipc/vfs.h
rb50b5af2 r04803bf 36 36 #define LIBC_IPC_VFS_H_ 37 37 38 #include <ipc/common.h> 38 39 #include <sys/types.h> 39 #include < ipc/ipc.h>40 #include <bool.h> 40 41 41 42 #define FS_NAME_MAXLEN 20 … … 55 56 /** Unique identifier of the fs. */ 56 57 char name[FS_NAME_MAXLEN + 1]; 58 bool concurrent_read_write; 59 bool write_retains_size; 57 60 } vfs_info_t; 58 61 … … 73 76 VFS_IN_UNLINK, 74 77 VFS_IN_RENAME, 75 VFS_IN_STAT 78 VFS_IN_STAT, 79 VFS_IN_DUP 76 80 } vfs_in_request_t; 77 81 … … 85 89 VFS_OUT_MOUNTED, 86 90 VFS_OUT_UNMOUNT, 91 VFS_OUT_UNMOUNTED, 87 92 VFS_OUT_SYNC, 88 93 VFS_OUT_STAT, … … 99 104 * No lookup flags used. 100 105 */ 101 #define L_NONE 106 #define L_NONE 0 102 107 103 108 /** … … 106 111 * with L_DIRECTORY. 107 112 */ 108 #define L_FILE 113 #define L_FILE 1 109 114 110 115 /** 111 * Lookup wil succeed only if the object is a directory. If L_CREATE is116 * Lookup will succeed only if the object is a directory. If L_CREATE is 112 117 * specified, an empty directory will be created. This flag is mutually 113 118 * exclusive with L_FILE. 114 119 */ 115 #define L_DIRECTORY 2 120 #define L_DIRECTORY 2 121 122 /** 123 * Lookup will succeed only if the object is a root directory. The flag is 124 * mutually exclusive with L_FILE and L_MP. 125 */ 126 #define L_ROOT 4 127 128 /** 129 * Lookup will succeed only if the object is a mount point. The flag is mutually 130 * exclusive with L_FILE and L_ROOT. 131 */ 132 #define L_MP 8 133 116 134 117 135 /** … … 119 137 * object already exists. L_EXCLUSIVE is implied when L_DIRECTORY is used. 120 138 */ 121 #define L_EXCLUSIVE 4139 #define L_EXCLUSIVE 16 122 140 123 141 /** 124 142 * L_CREATE is used for creating both regular files and directories. 125 143 */ 126 #define L_CREATE 8144 #define L_CREATE 32 127 145 128 146 /** 129 147 * L_LINK is used for linking to an already existing nodes. 130 148 */ 131 #define L_LINK 16149 #define L_LINK 64 132 150 133 151 /** … … 136 154 * VFS_UNLINK. 137 155 */ 138 #define L_UNLINK 32156 #define L_UNLINK 128 139 157 140 158 /** 141 * L_OPEN is used to indicate that the lookup operation is a part of VFS_ OPEN159 * L_OPEN is used to indicate that the lookup operation is a part of VFS_IN_OPEN 142 160 * call from the client. This means that the server might allocate some 143 161 * resources for the opened file. This flag cannot be passed directly by the 144 162 * client. 145 163 */ 146 #define L_OPEN 64164 #define L_OPEN 256 147 165 148 166 #endif -
uspace/lib/c/include/libc.h
rb50b5af2 r04803bf 40 40 #include <libarch/syscall.h> 41 41 42 #ifdef __32_BITS__ 43 44 /** Explicit 64-bit arguments passed to syscalls. */ 45 typedef uint64_t sysarg64_t; 46 47 #endif /* __32_BITS__ */ 48 42 49 #define __SYSCALL0(id) \ 43 50 __syscall0(0, 0, 0, 0, 0, 0, id) … … 53 60 __syscall5(p1, p2, p3, p4, p5, 0, id) 54 61 #define __SYSCALL6(id, p1, p2, p3, p4, p5, p6) \ 55 __syscall6(p1, p2, p3, p4, p5, p6, id) 56 57 extern void __main(void *pcb_ptr); 58 extern void __exit(void); 62 __syscall6(p1, p2, p3, p4, p5, p6, id) 59 63 60 64 #endif -
uspace/lib/c/include/loader/loader.h
rb50b5af2 r04803bf 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 extern int loader_set_args(loader_t *, c har *const[]);53 extern int loader_set_args(loader_t *, const char *const[]); 53 54 extern int loader_set_files(loader_t *, fdi_node_t *const[]); 54 55 extern int loader_load_program(loader_t *); -
uspace/lib/c/include/loader/pcb.h
rb50b5af2 r04803bf 53 53 entry_point_t entry; 54 54 55 /** Current working directory. */ 56 char *cwd; 57 55 58 /** Number of command-line arguments. */ 56 59 int argc; -
uspace/lib/c/include/macros.h
rb50b5af2 r04803bf 48 48 #define STRING_ARG(arg) #arg 49 49 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) 52 52 53 53 #define MERGE_LOUP32(lo, up) \ -
uspace/lib/c/include/malloc.h
rb50b5af2 r04803bf 38 38 #include <sys/types.h> 39 39 40 extern void __heap_init(void); 41 extern uintptr_t get_max_heap_addr(void); 42 43 extern void *malloc(const size_t size); 44 extern void *memalign(const size_t align, const size_t size); 40 extern void *malloc(const size_t size) 41 __attribute__((malloc)); 42 extern void *calloc(const size_t nmemb, const size_t size) 43 __attribute__((malloc)); 44 extern void *memalign(const size_t align, const size_t size) 45 __attribute__((malloc)); 45 46 extern void *realloc(const void *addr, const size_t size); 46 47 extern void free(const void *addr); -
uspace/lib/c/include/mem.h
rb50b5af2 r04803bf 44 44 extern void *memmove(void *, const void *, size_t); 45 45 46 extern int bcmp(const char *, const char*, size_t);46 extern int bcmp(const void *, const void *, size_t); 47 47 48 48 #endif -
uspace/lib/c/include/net/icmp_common.h
rb50b5af2 r04803bf 1 1 /* 2 * Copyright (c) 200 6 Jakub Jermar2 * Copyright (c) 2009 Lukas Mejdrech 3 3 * All rights reserved. 4 4 * … … 28 28 29 29 /** @addtogroup libc 30 * @{ 31 */ 32 /** @file 30 * @{ 33 31 */ 34 32 35 #ifndef LIBC_ATOMIC_H_ 36 #define LIBC_ATOMIC_H_ 33 /** @file 34 * ICMP module common interface. 35 */ 37 36 38 typedef struct atomic { 39 volatile long count; 40 } atomic_t; 37 #ifndef LIBC_ICMP_COMMON_H_ 38 #define LIBC_ICMP_COMMON_H_ 41 39 42 #include <libarch/atomic.h> 40 #include <ipc/services.h> 41 #include <sys/time.h> 43 42 44 static inline void atomic_set(atomic_t *val, long i) 45 { 46 val->count = i; 47 } 43 /** Default timeout for incoming connections in microseconds (1 sec). */ 44 #define ICMP_CONNECT_TIMEOUT 1000000 48 45 49 static inline long atomic_get(atomic_t *val) 50 { 51 return val->count; 52 } 46 extern int icmp_connect_module(suseconds_t); 53 47 54 48 #endif -
uspace/lib/c/include/net/ip_protocols.h
rb50b5af2 r04803bf 1 1 /* 2 * Copyright (c) 2009 Martin Decky2 * Copyright (c) 2009 Lukas Mejdrech 3 3 * All rights reserved. 4 4 * … … 28 28 29 29 /** @addtogroup libc 30 * @{ 31 */ 32 /** @file 30 * @{ 33 31 */ 34 32 35 #ifndef BOOT_MACROS_H_ 36 #define BOOT_MACROS_H_ 33 /** @file 34 * Internet protocol numbers according to the on-line IANA - Assigned Protocol 35 * numbers: 36 * 37 * http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml 38 */ 37 39 38 # define min(a, b) ((a) < (b) ? (a) : (b))39 #define max(a, b) ((a) > (b) ? (a) : (b))40 #ifndef LIBC_IP_PROTOCOLS_H_ 41 #define LIBC_IP_PROTOCOLS_H_ 40 42 41 #define SIZE2KB(size) ((size) >> 10) 42 #define SIZE2MB(size) ((size) >> 20) 43 /** @name IP protocols definitions */ 44 /*@{*/ 43 45 44 #define KB2SIZE(kb) ((kb) << 10) 45 #define MB2SIZE(mb) ((mb) << 20) 46 #define IPPROTO_ICMP 1 47 #define IPPROTO_TCP 6 48 #define IPPROTO_UDP 17 46 49 47 #define STRING(arg) STRING_ARG(arg) 48 #define STRING_ARG(arg) #arg 50 /*@}*/ 49 51 50 52 #endif -
uspace/lib/c/include/setjmp.h
rb50b5af2 r04803bf 41 41 42 42 extern int setjmp(jmp_buf env); 43 extern void longjmp(jmp_buf env, int val) __attribute__((__noreturn__));43 extern void longjmp(jmp_buf env, int val) __attribute__((noreturn)); 44 44 45 45 #endif -
uspace/lib/c/include/stdarg.h
rb50b5af2 r04803bf 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/c/include/stdio.h
rb50b5af2 r04803bf 38 38 #include <sys/types.h> 39 39 #include <stdarg.h> 40 #include <str ing.h>40 #include <str.h> 41 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 */ 42 53 43 54 #define EOF (-1) … … 56 67 #ifndef SEEK_SET 57 68 #define SEEK_SET 0 69 #endif 70 71 #ifndef SEEK_CUR 58 72 #define SEEK_CUR 1 73 #endif 74 75 #ifndef SEEK_END 59 76 #define SEEK_END 2 60 77 #endif … … 69 86 }; 70 87 88 enum _buffer_state { 89 /** Buffer is empty */ 90 _bs_empty, 91 92 /** Buffer contains data to be written */ 93 _bs_write, 94 95 /** Buffer contains prefetched data for reading */ 96 _bs_read 97 }; 98 71 99 typedef struct { 72 100 /** Linked list pointer. */ … … 88 116 int phone; 89 117 118 /** 119 * Non-zero if the stream needs sync on fflush(). XXX change 120 * console semantics so that sync is not needed. 121 */ 122 int need_sync; 123 90 124 /** Buffering type */ 91 125 enum _buffer_type btype; 126 92 127 /** Buffer */ 93 128 uint8_t *buf; 129 94 130 /** Buffer size */ 95 131 size_t buf_size; 132 133 /** Buffer state */ 134 enum _buffer_state buf_state; 135 96 136 /** Buffer I/O pointer */ 97 137 uint8_t *buf_head; 138 139 /** Points to end of occupied space when in read mode. */ 140 uint8_t *buf_tail; 98 141 } FILE; 99 142 … … 104 147 /* Character and string input functions */ 105 148 extern int fgetc(FILE *); 106 extern char *fgets(char *, size_t, FILE *);149 extern char *fgets(char *, int, FILE *); 107 150 108 151 extern int getchar(void); … … 117 160 118 161 /* Formatted string output functions */ 119 extern int fprintf(FILE *, const char*, ...); 162 extern int fprintf(FILE *, const char*, ...) 163 PRINTF_ATTRIBUTE(2, 3); 120 164 extern int vfprintf(FILE *, const char *, va_list); 121 165 122 extern int printf(const char *, ...); 166 extern int printf(const char *, ...) 167 PRINTF_ATTRIBUTE(1, 2); 123 168 extern int vprintf(const char *, va_list); 124 169 125 extern int snprintf(char *, size_t , const char *, ...); 126 extern int asprintf(char **, const char *, ...); 170 extern int snprintf(char *, size_t , const char *, ...) 171 PRINTF_ATTRIBUTE(3, 4); 172 extern int asprintf(char **, const char *, ...) 173 PRINTF_ATTRIBUTE(2, 3); 127 174 extern int vsnprintf(char *, size_t, const char *, va_list); 128 175 … … 135 182 extern size_t fwrite(const void *, size_t, size_t, FILE *); 136 183 137 extern int fseek(FILE *, long, int);184 extern int fseek(FILE *, off64_t, int); 138 185 extern void rewind(FILE *); 139 extern int ftell(FILE *);186 extern off64_t ftell(FILE *); 140 187 extern int feof(FILE *); 188 extern int fileno(FILE *); 141 189 142 190 extern int fflush(FILE *); -
uspace/lib/c/include/stdlib.h
rb50b5af2 r04803bf 38 38 #include <unistd.h> 39 39 #include <malloc.h> 40 41 #define abort() _exit(1) 42 #define exit(status) _exit((status)) 40 #include <stacktrace.h> 43 41 44 42 #define RAND_MAX 714025 43 44 #define rand() random() 45 #define srand(seed) srandom(seed) 45 46 46 47 extern long int random(void); 47 48 extern void srandom(unsigned int seed); 48 49 49 static inline int rand(void) 50 { 51 return random(); 52 } 53 54 static inline void srand(unsigned int seed) 55 { 56 srandom(seed); 57 } 50 extern void abort(void) __attribute__((noreturn)); 58 51 59 52 #endif -
uspace/lib/c/include/str.h
rb50b5af2 r04803bf 33 33 */ 34 34 35 #ifndef LIBC_STR ING_H_36 #define LIBC_STR ING_H_35 #ifndef LIBC_STR_H_ 36 #define LIBC_STR_H_ 37 37 38 38 #include <mem.h> … … 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); 87 88 extern int str_uint64(const char *, char **, unsigned int, bool, uint64_t *); 89 extern int str_size_t(const char *, char **, unsigned int, bool, size_t *); 90 91 extern void order_suffix(const uint64_t val, uint64_t *rv, char *suffix); 84 92 85 93 /* -
uspace/lib/c/include/sys/mman.h
rb50b5af2 r04803bf 41 41 #define MAP_FAILED ((void *) -1) 42 42 43 #define MAP_SHARED 44 #define MAP_PRIVATE 45 #define MAP_FIXED 46 #define MAP_ANONYMOUS 43 #define MAP_SHARED (1 << 0) 44 #define MAP_PRIVATE (1 << 1) 45 #define MAP_FIXED (1 << 2) 46 #define MAP_ANONYMOUS (1 << 3) 47 47 48 48 #define PROTO_READ AS_AREA_READ … … 50 50 #define PROTO_EXEC AS_AREA_EXEC 51 51 52 extern void *mmap(void 53 off_t offset);52 extern void *mmap(void *start, size_t length, int prot, int flags, int fd, 53 aoff64_t offset); 54 54 extern int munmap(void *start, size_t length); 55 55 -
uspace/lib/c/include/sys/stat.h
rb50b5af2 r04803bf 31 31 */ 32 32 /** @file 33 */ 33 */ 34 34 35 35 #ifndef LIBC_SYS_STAT_H_ … … 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 devmap_handle_t devmap_handle; 46 fs_index_t index; 47 unsigned int lnkcnt; 48 bool is_file; 49 bool is_directory; 50 aoff64_t size; 51 devmap_handle_t device; 55 52 }; 56 53 -
uspace/lib/c/include/sys/time.h
rb50b5af2 r04803bf 31 31 */ 32 32 /** @file 33 */ 33 */ 34 34 35 35 #ifndef LIBC_SYS_TIME_H_ … … 43 43 typedef long suseconds_t; 44 44 45 typedef uint32_t useconds_t; 46 typedef uint32_t mseconds_t; 47 45 48 struct timeval { 46 time_t 47 suseconds_t 49 time_t tv_sec; /* seconds */ 50 suseconds_t tv_usec; /* microseconds */ 48 51 }; 49 52 50 53 struct timezone { 51 int tz_minuteswest;/* minutes W of Greenwich */52 int tz_dsttime;/* type of dst correction */54 int tz_minuteswest; /* minutes W of Greenwich */ 55 int tz_dsttime; /* type of dst correction */ 53 56 }; 54 57 -
uspace/lib/c/include/sys/types.h
rb50b5af2 r04803bf 38 38 #include <libarch/types.h> 39 39 40 typedef long off_t; 41 typedef int mode_t; 40 typedef unsigned int mode_t; 42 41 43 typedef int32_t wchar_t; 42 /** Relative offset */ 43 typedef int64_t off64_t; 44 45 /** Absolute offset */ 46 typedef uint64_t aoff64_t; 44 47 45 48 typedef volatile uint8_t ioport8_t; -
uspace/lib/c/include/syscall.h
rb50b5af2 r04803bf 32 32 /** 33 33 * @file 34 * @brief 35 * 36 * 34 * @brief Syscall function declaration for architectures that don't 35 * inline syscalls or architectures that handle syscalls 36 * according to the number of arguments. 37 37 */ 38 38 … … 40 40 #define LIBC_SYSCALL_H_ 41 41 42 #ifndef 43 #error "You can't include this file directly." 42 #ifndef LIBARCH_SYSCALL_GENERIC 43 #error You cannot include this file directly 44 44 #endif 45 45 … … 47 47 #include <kernel/syscall/syscall.h> 48 48 49 #define __syscall0 50 #define __syscall1 51 #define __syscall2 52 #define __syscall3 53 #define __syscall4 54 #define __syscall5 55 #define __syscall6 49 #define __syscall0 __syscall 50 #define __syscall1 __syscall 51 #define __syscall2 __syscall 52 #define __syscall3 __syscall 53 #define __syscall4 __syscall 54 #define __syscall5 __syscall 55 #define __syscall6 __syscall 56 56 57 57 extern sysarg_t __syscall(const sysarg_t p1, const sysarg_t p2, -
uspace/lib/c/include/sysinfo.h
rb50b5af2 r04803bf 31 31 */ 32 32 /** @file 33 */ 33 */ 34 34 35 35 #ifndef LIBC_SYSINFO_H_ … … 37 37 38 38 #include <libc.h> 39 #include <sysinfo.h>40 #include <string.h>41 39 42 sysarg_t sysinfo_value(char *name); 40 /** Sysinfo value types 41 * 42 */ 43 typedef enum { 44 SYSINFO_VAL_UNDEFINED = 0, 45 SYSINFO_VAL_VAL = 1, 46 SYSINFO_VAL_DATA = 2 47 } sysinfo_item_tag_t; 48 49 extern sysinfo_item_tag_t sysinfo_get_tag(const char *); 50 extern int sysinfo_get_value(const char *, sysarg_t *); 51 extern void *sysinfo_get_data(const char *, size_t *); 43 52 44 53 #endif -
uspace/lib/c/include/task.h
rb50b5af2 r04803bf 46 46 47 47 extern 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); 48 extern int task_set_name(const char *); 49 extern int task_kill(task_id_t); 52 50 51 extern task_id_t task_spawn(const char *, const char *const[], int *); 52 extern int task_spawnv(task_id_t *, const char *path, const char *const []); 53 extern int task_spawnl(task_id_t *, const char *path, ...); 54 55 extern int task_wait(task_id_t id, task_exit_t *, int *); 56 extern int task_retval(int); 53 57 54 58 #endif -
uspace/lib/c/include/thread.h
rb50b5af2 r04803bf 36 36 #define LIBC_THREAD_H_ 37 37 38 #include <kernel/proc/uarg.h>39 38 #include <libarch/thread.h> 40 39 #include <sys/types.h> … … 42 41 typedef uint64_t thread_id_t; 43 42 44 extern void __thread_entry(void); 45 extern void __thread_main(uspace_arg_t *); 46 47 extern int thread_create(void (*)(void *), void *, char *, thread_id_t *); 48 extern void thread_exit(int) __attribute__ ((noreturn)); 43 extern int thread_create(void (*)(void *), void *, const char *, thread_id_t *); 44 extern void thread_exit(int) __attribute__((noreturn)); 49 45 extern void thread_detach(thread_id_t); 50 46 extern int thread_join(thread_id_t); -
uspace/lib/c/include/tls.h
rb50b5af2 r04803bf 57 57 extern void tls_free_variant_1(tcb_t *, size_t); 58 58 #endif 59 59 60 #ifdef CONFIG_TLS_VARIANT_2 60 61 extern tcb_t *tls_alloc_variant_2(void **, size_t); -
uspace/lib/c/include/udebug.h
rb50b5af2 r04803bf 38 38 #include <kernel/udebug/udebug.h> 39 39 #include <sys/types.h> 40 #include <libarch/types.h>41 40 42 41 typedef sysarg_t thash_t; 43 42 44 int udebug_begin(int phoneid); 45 int udebug_end(int phoneid); 46 int udebug_set_evmask(int phoneid, udebug_evmask_t mask); 47 int udebug_thread_read(int phoneid, void *buffer, size_t n, 48 size_t *copied, size_t *needed); 49 int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n); 50 int udebug_args_read(int phoneid, thash_t tid, sysarg_t *buffer); 51 int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type, 52 sysarg_t *val0, sysarg_t *val1); 53 int udebug_stop(int phoneid, thash_t tid); 43 int udebug_begin(int); 44 int udebug_end(int); 45 int udebug_set_evmask(int, udebug_evmask_t); 46 int udebug_thread_read(int, void *, size_t , size_t *, size_t *); 47 int udebug_name_read(int, void *, size_t, size_t *, size_t *); 48 int udebug_areas_read(int, void *, size_t, size_t *, size_t *); 49 int udebug_mem_read(int, void *, uintptr_t, size_t); 50 int udebug_args_read(int, thash_t, sysarg_t *); 51 int udebug_regs_read(int, thash_t, void *); 52 int udebug_go(int, thash_t, udebug_event_t *, sysarg_t *, sysarg_t *); 53 int udebug_stop(int, thash_t); 54 54 55 55 #endif -
uspace/lib/c/include/unistd.h
rb50b5af2 r04803bf 37 37 38 38 #include <sys/types.h> 39 #include <time.h> 39 40 #include <libarch/config.h> 40 41 41 42 #ifndef NULL 42 #define NULL 0 43 #define NULL ((void *) 0) 44 #endif 45 46 #ifndef SEEK_SET 47 #define SEEK_SET 0 48 #endif 49 50 #ifndef SEEK_CUR 51 #define SEEK_CUR 1 52 #endif 53 54 #ifndef SEEK_END 55 #define SEEK_END 2 43 56 #endif 44 57 45 58 #define getpagesize() (PAGE_SIZE) 46 59 47 #ifndef SEEK_SET 48 #define SEEK_SET 0 49 #define SEEK_CUR 1 50 #define SEEK_END 2 51 #endif 60 extern int dup2(int oldfd, int newfd); 52 61 53 62 extern ssize_t write(int, const void *, size_t); 54 63 extern ssize_t read(int, void *, size_t); 55 64 56 extern off _t lseek(int, off_t, int);57 extern int ftruncate(int, off_t);65 extern off64_t lseek(int, off64_t, int); 66 extern int ftruncate(int, aoff64_t); 58 67 59 68 extern int close(int); … … 65 74 extern int chdir(const char *); 66 75 67 extern void _exit(int status) __attribute__((noreturn));68 extern int usleep(u nsigned long usec);69 extern unsigned int sleep(unsigned int seconds);76 extern void exit(int) __attribute__((noreturn)); 77 extern int usleep(useconds_t); 78 extern unsigned int sleep(unsigned int); 70 79 71 80 #endif -
uspace/lib/c/include/vfs/vfs.h
rb50b5af2 r04803bf 43 43 /** 44 44 * This type is a libc version of the VFS triplet. 45 * It uniquel ly identifies a file system node within a file system instance.45 * It uniquely identifies a file system node within a file system instance. 46 46 */ 47 47 typedef struct { 48 48 fs_handle_t fs_handle; 49 dev _handle_t dev_handle;49 devmap_handle_t devmap_handle; 50 50 fs_index_t index; 51 51 } fdi_node_t; … … 55 55 extern int mount(const char *, const char *, const char *, const char *, 56 56 unsigned int); 57 58 extern void __stdio_init(int filc, fdi_node_t *filv[]); 59 extern void __stdio_done(void); 57 extern int unmount(const char *); 60 58 61 59 extern int open_node(fdi_node_t *, int);
Note:
See TracChangeset
for help on using the changeset viewer.