Changeset df3c6f02 in mainline for uspace/lib/c/include
- Timestamp:
- 2011-05-31T22:58:56Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d362410
- Parents:
- 82582e4 (diff), 4ce90544 (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:
-
- 7 added
- 14 edited
- 3 moved
-
adt/fifo.h (modified) (1 diff)
-
adt/list.h (modified) (11 diffs)
-
adt/measured_strings.h (modified) (1 diff)
-
adt/prodcons.h (added)
-
as.h (modified) (1 diff)
-
assert.h (modified) (3 diffs)
-
dlfcn.h (moved) (moved from kernel/test/fpu/mips2_skip.c ) (2 diffs)
-
entry_point.h (moved) (moved from kernel/arch/sparc64/include/mm/cache.h ) (3 diffs)
-
errno.h (modified) (1 diff)
-
event.h (modified) (1 diff)
-
fibril.h (modified) (1 diff)
-
fibril_synch.h (modified) (2 diffs)
-
io/klog.h (modified) (1 diff)
-
loader/pcb.h (modified) (1 diff)
-
macros.h (modified) (1 diff)
-
malloc.h (modified) (1 diff)
-
rtld/dynamic.h (added)
-
rtld/elf_dyn.h (added)
-
rtld/module.h (added)
-
rtld/rtld.h (added)
-
rtld/rtld_arch.h (added)
-
rtld/rtld_debug.h (added)
-
rtld/symbol.h (moved) (moved from kernel/test/fpu/sse1_skip.c ) (2 diffs)
-
str.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/adt/fifo.h
r82582e4 rdf3c6f02 51 51 typedef unsigned long fifo_index_t; 52 52 53 #define FIFO_CREATE_STATIC(name, t, itms) \54 struct { \55 t fifo[(itms)]; \56 fifo_count_t items; \57 fifo_index_t head; \58 fifo_index_t tail; \53 #define FIFO_CREATE_STATIC(name, t, itms) \ 54 struct { \ 55 t fifo[(itms)]; \ 56 fifo_count_t items; \ 57 fifo_index_t head; \ 58 fifo_index_t tail; \ 59 59 } name 60 60 -
uspace/lib/c/include/adt/list.h
r82582e4 rdf3c6f02 47 47 * 48 48 * @param name Name of the new statically allocated list. 49 */ 50 #define LIST_INITIALIZE(name) link_t name = { \ 51 .prev = &name, \ 52 .next = &name \ 53 } 49 * 50 */ 51 #define LIST_INITIALIZE(name) \ 52 link_t name = { \ 53 .prev = &name, \ 54 .next = &name \ 55 } 56 57 #define list_get_instance(link, type, member) \ 58 ((type *) (((void *)(link)) - ((void *) &(((type *) NULL)->member)))) 59 60 #define list_foreach(list, iterator) \ 61 for (link_t *iterator = (list).next; \ 62 iterator != &(list); iterator = iterator->next) 54 63 55 64 /** Initialize doubly-linked circular list link … … 58 67 * 59 68 * @param link Pointer to link_t structure to be initialized. 69 * 60 70 */ 61 71 static inline void link_initialize(link_t *link) … … 69 79 * Initialize doubly-linked circular list. 70 80 * 71 * @param head Pointer to link_t structure representing head of the list. 72 */ 73 static inline void list_initialize(link_t *head) 74 { 75 head->prev = head; 76 head->next = head; 81 * @param list Pointer to link_t structure representing the list. 82 * 83 */ 84 static inline void list_initialize(link_t *list) 85 { 86 list->prev = list; 87 list->next = list; 77 88 } 78 89 … … 82 93 * 83 94 * @param link Pointer to link_t structure to be added. 84 * @param head Pointer to link_t structure representing head of the list. 85 */ 86 static inline void list_prepend(link_t *link, link_t *head) 87 { 88 link->next = head->next; 89 link->prev = head; 90 head->next->prev = link; 91 head->next = link; 95 * @param list Pointer to link_t structure representing the list. 96 * 97 */ 98 static inline void list_prepend(link_t *link, link_t *list) 99 { 100 link->next = list->next; 101 link->prev = list; 102 list->next->prev = link; 103 list->next = link; 92 104 } 93 105 … … 97 109 * 98 110 * @param link Pointer to link_t structure to be added. 99 * @param head Pointer to link_t structure representing head of the list. 100 */ 101 static inline void list_append(link_t *link, link_t *head) 102 { 103 link->prev = head->prev; 104 link->next = head; 105 head->prev->next = link; 106 head->prev = link; 107 } 108 109 /** Insert item before another item in doubly-linked circular list. */ 110 static inline void list_insert_before(link_t *l, link_t *r) 111 { 112 list_append(l, r); 113 } 114 115 /** Insert item after another item in doubly-linked circular list. */ 116 static inline void list_insert_after(link_t *r, link_t *l) 117 { 118 list_prepend(l, r); 111 * @param list Pointer to link_t structure representing the list. 112 * 113 */ 114 static inline void list_append(link_t *link, link_t *list) 115 { 116 link->prev = list->prev; 117 link->next = list; 118 list->prev->next = link; 119 list->prev = link; 120 } 121 122 /** Insert item before another item in doubly-linked circular list. 123 * 124 */ 125 static inline void list_insert_before(link_t *link, link_t *list) 126 { 127 list_append(link, list); 128 } 129 130 /** Insert item after another item in doubly-linked circular list. 131 * 132 */ 133 static inline void list_insert_after(link_t *link, link_t *list) 134 { 135 list_prepend(list, link); 119 136 } 120 137 … … 123 140 * Remove item from doubly-linked circular list. 124 141 * 125 * @param link Pointer to link_t structure to be removed from the list it is contained in. 142 * @param link Pointer to link_t structure to be removed from the list 143 * it is contained in. 144 * 126 145 */ 127 146 static inline void list_remove(link_t *link) … … 136 155 * Query emptiness of doubly-linked circular list. 137 156 * 138 * @param head Pointer to link_t structure representing head of the list. 139 */ 140 static inline int list_empty(link_t *head) 141 { 142 return ((head->next == head) ? 1 : 0); 143 } 144 157 * @param list Pointer to link_t structure representing the list. 158 * 159 */ 160 static inline int list_empty(link_t *list) 161 { 162 return (list->next == list); 163 } 164 165 /** Get head item of a list. 166 * 167 * @param list Pointer to link_t structure representing the list. 168 * 169 * @return Head item of the list. 170 * @return NULL if the list is empty. 171 * 172 */ 173 static inline link_t *list_head(link_t *list) 174 { 175 return ((list->next == list) ? NULL : list->next); 176 } 145 177 146 178 /** Split or concatenate headless doubly-linked circular list … … 151 183 * concatenates splitted lists and splits concatenated lists. 152 184 * 153 * @param part1 Pointer to link_t structure leading the first (half of the headless) list. 154 * @param part2 Pointer to link_t structure leading the second (half of the headless) list. 185 * @param part1 Pointer to link_t structure leading the first 186 * (half of the headless) list. 187 * @param part2 Pointer to link_t structure leading the second 188 * (half of the headless) list. 189 * 155 190 */ 156 191 static inline void headless_list_split_or_concat(link_t *part1, link_t *part2) … … 165 200 } 166 201 167 168 202 /** Split headless doubly-linked circular list 169 203 * 170 204 * Split headless doubly-linked circular list. 171 205 * 172 * @param part1 Pointer to link_t structure leading the first half of the headless list. 173 * @param part2 Pointer to link_t structure leading the second half of the headless list. 206 * @param part1 Pointer to link_t structure leading 207 * the first half of the headless list. 208 * @param part2 Pointer to link_t structure leading 209 * the second half of the headless list. 210 * 174 211 */ 175 212 static inline void headless_list_split(link_t *part1, link_t *part2) … … 182 219 * Concatenate two headless doubly-linked circular lists. 183 220 * 184 * @param part1 Pointer to link_t structure leading the first headless list. 185 * @param part2 Pointer to link_t structure leading the second headless list. 221 * @param part1 Pointer to link_t structure leading 222 * the first headless list. 223 * @param part2 Pointer to link_t structure leading 224 * the second headless list. 225 * 186 226 */ 187 227 static inline void headless_list_concat(link_t *part1, link_t *part2) … … 190 230 } 191 231 192 #define list_get_instance(link, type, member) ((type *) (((void *)(link)) - ((void *) &(((type *) NULL)->member)))) 193 194 extern int list_member(const link_t *link, const link_t *head); 195 extern void list_concat(link_t *head1, link_t *head2); 196 extern unsigned int list_count(const link_t *link); 232 /** Get n-th item of a list. 233 * 234 * @param list Pointer to link_t structure representing the list. 235 * @param n Item number (indexed from zero). 236 * 237 * @return n-th item of the list. 238 * @return NULL if no n-th item found. 239 * 240 */ 241 static inline link_t *list_nth(link_t *list, unsigned int n) 242 { 243 unsigned int cnt = 0; 244 245 list_foreach(*list, link) { 246 if (cnt == n) 247 return link; 248 249 cnt++; 250 } 251 252 return NULL; 253 } 254 255 extern int list_member(const link_t *, const link_t *); 256 extern void list_concat(link_t *, link_t *); 257 extern unsigned int list_count(const link_t *); 197 258 198 259 #endif -
uspace/lib/c/include/adt/measured_strings.h
r82582e4 rdf3c6f02 61 61 extern measured_string_t *measured_string_create_bulk(const uint8_t *, size_t); 62 62 extern measured_string_t *measured_string_copy(measured_string_t *); 63 63 64 extern int measured_strings_receive(measured_string_t **, uint8_t **, size_t); 64 65 extern int measured_strings_reply(const measured_string_t *, size_t); -
uspace/lib/c/include/as.h
r82582e4 rdf3c6f02 54 54 } 55 55 56 extern void *as_area_create(void * address, size_t size, int flags);57 extern int as_area_resize(void * address, size_t size, int flags);58 extern int as_area_change_flags(void * address, int flags);59 extern int as_area_destroy(void * address);60 extern void *set_maxheapsize(size_t mhs);61 extern void * as_get_mappable_page(size_t sz);56 extern void *as_area_create(void *, size_t, unsigned int); 57 extern int as_area_resize(void *, size_t, unsigned int); 58 extern int as_area_change_flags(void *, unsigned int); 59 extern int as_area_destroy(void *); 60 extern void *set_maxheapsize(size_t); 61 extern void *as_get_mappable_page(size_t); 62 62 63 63 #endif -
uspace/lib/c/include/assert.h
r82582e4 rdf3c6f02 40 40 * 41 41 * If NDEBUG is not set, the assert() macro 42 * evaluates expr and if it is false prints 42 * evaluates expr and if it is false prints 43 43 * error message and terminate program. 44 44 * … … 47 47 */ 48 48 49 #include <stdio.h>50 #include <stdlib.h>51 52 49 #ifndef NDEBUG 53 50 54 51 #define assert(expr) \ 55 52 do { \ 56 if (!(expr)) { \ 57 printf("Assertion failed (%s) at file '%s', " \ 58 "line %d.\n", #expr, __FILE__, __LINE__); \ 59 abort(); \ 60 } \ 53 if (!(expr)) \ 54 assert_abort(#expr, __FILE__, __LINE__); \ 61 55 } while (0) 62 56 … … 67 61 #endif /* NDEBUG */ 68 62 63 extern void assert_abort(const char *, const char *, unsigned int) 64 __attribute__((noreturn)); 65 69 66 #endif 70 67 -
uspace/lib/c/include/dlfcn.h
r82582e4 rdf3c6f02 1 1 /* 2 * Copyright (c) 200 9 Martin Decky2 * Copyright (c) 2008 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 #include <test.h> 29 /** @addtogroup rtld 30 * @{ 31 */ 32 /** @file 33 * @brief UNIX-like dynamic linker interface. 34 */ 30 35 31 const char *test_mips2(void) 32 { 33 return NULL; 34 } 36 #ifndef LIBC_DLFCN_H_ 37 #define LIBC_DLFCN_H_ 38 39 void *dlopen(const char *, int); 40 void *dlsym(void *, const char *); 41 42 #endif 43 44 /** 45 * @} 46 */ -
uspace/lib/c/include/entry_point.h
r82582e4 rdf3c6f02 1 1 /* 2 * Copyright (c) 20 06 Jakub Jermar2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup sparc64mm29 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef KERN_sparc64_CACHE_H_36 #define KERN_sparc64_CACHE_H_35 #ifndef LIBC_ENTRY_POINT_H_ 36 #define LIBC_ENTRY_POINT_H_ 37 37 38 #include <mm/page.h> 39 #include <mm/frame.h> 38 /* Defined in arch/ARCH/src/entryjmp.[c|s] */ 39 void entry_point_jmp(void *, void *); 40 40 41 41 #endif -
uspace/lib/c/include/errno.h
r82582e4 rdf3c6f02 39 39 #include <fibril.h> 40 40 41 #define errno _errno41 #define errno (*(__errno())) 42 42 43 extern int _errno;43 extern int *__errno(void) __attribute__((const)); 44 44 45 45 #define EMFILE (-18) -
uspace/lib/c/include/event.h
r82582e4 rdf3c6f02 39 39 40 40 extern int event_subscribe(event_type_t, sysarg_t); 41 extern int event_unmask(event_type_t); 41 42 42 43 #endif -
uspace/lib/c/include/fibril.h
r82582e4 rdf3c6f02 70 70 int (*func)(void *); 71 71 tcb_t *tcb; 72 72 73 73 struct fibril *clean_after_me; 74 74 int retval; 75 75 int flags; 76 76 77 77 fibril_owner_info_t *waits_for; 78 78 } fibril_t; -
uspace/lib/c/include/fibril_synch.h
r82582e4 rdf3c6f02 36 36 #define LIBC_FIBRIL_SYNCH_H_ 37 37 38 #include <async.h>39 38 #include <fibril.h> 40 39 #include <adt/list.h> 41 40 #include <libarch/tls.h> 42 41 #include <sys/time.h> 42 #include <bool.h> 43 43 44 44 typedef struct { 45 fibril_owner_info_t oi; /*Keep this the first thing. */45 fibril_owner_info_t oi; /**< Keep this the first thing. */ 46 46 int counter; 47 47 link_t waiters; … … 64 64 65 65 typedef struct { 66 fibril_owner_info_t oi; /*Keep this the first thing. */66 fibril_owner_info_t oi; /**< Keep this the first thing. */ 67 67 unsigned writers; 68 68 unsigned readers; -
uspace/lib/c/include/io/klog.h
r82582e4 rdf3c6f02 37 37 38 38 #include <sys/types.h> 39 #include <stdarg.h> 39 40 40 41 extern size_t klog_write(const void *, size_t); 41 42 extern void klog_update(void); 43 extern int klog_printf(const char *, ...); 44 extern int klog_vprintf(const char *, va_list); 42 45 43 46 #endif -
uspace/lib/c/include/loader/pcb.h
r82582e4 rdf3c6f02 72 72 /** Pointer to ELF dynamic section of the program. */ 73 73 void *dynamic; 74 /** Pointer to dynamic linker state structure (runtime_env_t). */ 75 void *rtld_runtime; 74 76 } pcb_t; 75 77 -
uspace/lib/c/include/macros.h
r82582e4 rdf3c6f02 39 39 #define max(a, b) ((a) > (b) ? (a) : (b)) 40 40 41 #define SIZE2KB(size) ((size) >> 10) 42 #define SIZE2MB(size) ((size) >> 20) 43 44 #define KB2SIZE(kb) ((kb) << 10) 45 #define MB2SIZE(mb) ((mb) << 20) 41 #define KiB2SIZE(kb) ((kb) << 10) 42 #define MiB2SIZE(mb) ((mb) << 20) 46 43 47 44 #define STRING(arg) STRING_ARG(arg) -
uspace/lib/c/include/malloc.h
r82582e4 rdf3c6f02 46 46 extern void *realloc(const void *addr, const size_t size); 47 47 extern void free(const void *addr); 48 extern void *heap_check(void); 48 49 49 50 #endif -
uspace/lib/c/include/rtld/symbol.h
r82582e4 rdf3c6f02 1 1 /* 2 * Copyright (c) 200 9 Martin Decky2 * Copyright (c) 2008 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 #include <test.h> 29 /** @addtogroup libc 30 * @{ 31 */ 32 /** @file 33 */ 30 34 31 const char *test_sse1(void) 32 { 33 return NULL; 34 } 35 #ifndef LIBC_RTLD_SYMBOL_H_ 36 #define LIBC_RTLD_SYMBOL_H_ 37 38 #include <rtld/rtld.h> 39 #include <elf.h> 40 41 elf_symbol_t *symbol_bfs_find(const char *name, module_t *start, module_t **mod); 42 elf_symbol_t *symbol_def_find(const char *name, module_t *origin, module_t **mod); 43 void *symbol_get_addr(elf_symbol_t *sym, module_t *m); 44 45 #endif 46 47 /** @} 48 */ -
uspace/lib/c/include/str.h
r82582e4 rdf3c6f02 89 89 extern int str_size_t(const char *, char **, unsigned int, bool, size_t *); 90 90 91 extern void order_suffix(const uint64_t val, uint64_t *rv, char *suffix); 91 extern void order_suffix(const uint64_t, uint64_t *, char *); 92 extern void bin_order_suffix(const uint64_t, uint64_t *, const char **, bool); 92 93 93 94 /*
Note:
See TracChangeset
for help on using the changeset viewer.
