Changeset 2b3dd78 in mainline for uspace/lib/c
- Timestamp:
- 2018-01-31T12:02:00Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5595841
- Parents:
- a0a9cc2 (diff), 14d789c (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
- Files:
-
- 1 added
- 40 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
ra0a9cc2 r2b3dd78 85 85 generic/str.c \ 86 86 generic/str_error.c \ 87 generic/strtol.c \ 87 88 generic/l18n/langs.c \ 88 89 generic/fibril.c \ -
uspace/lib/c/arch/ia32/include/libarch/syscall.h
ra0a9cc2 r2b3dd78 48 48 #define __syscall6 __syscall_slow 49 49 50 extern sysarg_t (* 50 extern sysarg_t (*__syscall_fast_func)(const sysarg_t, const sysarg_t, 51 51 const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t, 52 52 const syscall_t); -
uspace/lib/c/arch/ia32/src/rtld/reloc.c
ra0a9cc2 r2b3dd78 38 38 #include <stdlib.h> 39 39 #include <inttypes.h> 40 #include <str.h> 40 41 41 42 #include <libarch/rtld/elf_dyn.h> -
uspace/lib/c/generic/getopt.c
ra0a9cc2 r2b3dd78 49 49 int optopt = '?'; /* character checked for validity */ 50 50 int optreset; /* reset getopt */ 51 c onst char*optarg; /* argument associated with option */51 char *optarg; /* argument associated with option */ 52 52 53 53 … … 67 67 #define INORDER (int)1 68 68 69 #define EMSG "" 69 static char EMSG[] = ""; 70 70 71 71 static int getopt_internal(int, char **, const char *); … … 73 73 static void permute_args(int, int, int, char **); 74 74 75 static c onst char *place = EMSG; /* option letter processing */75 static char *place = EMSG; /* option letter processing */ 76 76 77 77 /* XXX: set optreset to 1 rather than these two */ … … 336 336 if (retval == -2) { 337 337 char *current_argv; 338 c onst char *has_equal;338 char *has_equal; 339 339 size_t current_argv_len; 340 340 int i, ambiguous, match; -
uspace/lib/c/generic/inet/addr.c
ra0a9cc2 r2b3dd78 42 42 #include <bitops.h> 43 43 #include <inttypes.h> 44 #include <str.h> 44 45 45 46 #define INET_PREFIXSTRSIZE 5 -
uspace/lib/c/generic/io/io.c
ra0a9cc2 r2b3dd78 799 799 } 800 800 801 int fseek (FILE *stream, longoffset, int whence)801 int fseek64(FILE *stream, off64_t offset, int whence) 802 802 { 803 803 errno_t rc; … … 814 814 stream->ungetc_chars = 0; 815 815 816 struct stat st;816 vfs_stat_t st; 817 817 switch (whence) { 818 818 case SEEK_SET: … … 837 837 } 838 838 839 long ftell(FILE *stream) 840 { 841 /* The native position is too large for the C99-ish interface. */ 842 if (stream->pos - stream->ungetc_chars > LONG_MAX) 843 return EOF; 844 839 off64_t ftell64(FILE *stream) 840 { 845 841 if (stream->error) 846 842 return EOF; … … 853 849 854 850 return stream->pos - stream->ungetc_chars; 851 } 852 853 int fseek(FILE *stream, long offset, int whence) 854 { 855 return fseek64(stream, offset, whence); 856 } 857 858 long ftell(FILE *stream) 859 { 860 off64_t off = ftell64(stream); 861 862 /* The native position is too large for the C99-ish interface. */ 863 if (off > LONG_MAX) 864 return EOF; 865 866 return off; 855 867 } 856 868 -
uspace/lib/c/generic/io/log.c
ra0a9cc2 r2b3dd78 41 41 #include <io/log.h> 42 42 #include <ipc/logger.h> 43 #include <str.h> 43 44 #include <ns.h> 44 45 -
uspace/lib/c/generic/io/table.c
ra0a9cc2 r2b3dd78 40 40 #include <stdio.h> 41 41 #include <stdlib.h> 42 #include <str.h> 42 43 43 44 static table_column_t *table_column_first(table_t *); -
uspace/lib/c/generic/malloc.c
ra0a9cc2 r2b3dd78 33 33 /** @file 34 34 */ 35 36 #define _HELENOS_SOURCE37 35 38 36 #include <malloc.h> … … 876 874 * 877 875 */ 878 void *realloc(const void *addr, const size_t size) 879 { 876 void *realloc(void * const addr, const size_t size) 877 { 878 if (size == 0) { 879 free(addr); 880 return NULL; 881 } 882 880 883 if (addr == NULL) 881 884 return malloc(size); … … 985 988 * 986 989 */ 987 void free( const void *addr)990 void free(void * const addr) 988 991 { 989 992 if (addr == NULL) -
uspace/lib/c/generic/rtld/dynamic.c
ra0a9cc2 r2b3dd78 37 37 #include <stdio.h> 38 38 #include <inttypes.h> 39 #include <str.h> 39 40 40 41 #include <rtld/elf_dyn.h> -
uspace/lib/c/generic/rtld/module.c
ra0a9cc2 r2b3dd78 41 41 #include <stdio.h> 42 42 #include <stdlib.h> 43 #include <str.h> 43 44 44 45 #include <rtld/rtld.h> -
uspace/lib/c/generic/rtld/rtld.c
ra0a9cc2 r2b3dd78 40 40 #include <rtld/rtld_debug.h> 41 41 #include <stdlib.h> 42 #include <str.h> 42 43 43 44 rtld_t *runtime_env; -
uspace/lib/c/generic/rtld/symbol.c
ra0a9cc2 r2b3dd78 37 37 #include <stdio.h> 38 38 #include <stdlib.h> 39 #include <str.h> 39 40 40 41 #include <elf/elf.h> -
uspace/lib/c/generic/stdlib.c
ra0a9cc2 r2b3dd78 35 35 #include <stdlib.h> 36 36 37 static longglbl_seed = 1;37 static int glbl_seed = 1; 38 38 39 long int random(void)39 int rand(void) 40 40 { 41 41 return glbl_seed = ((1366 * glbl_seed + 150889) % RAND_MAX); 42 42 } 43 43 44 void srand om(unsigned int seed)44 void srand(unsigned int seed) 45 45 { 46 46 glbl_seed = seed % RAND_MAX; -
uspace/lib/c/generic/str.c
ra0a9cc2 r2b3dd78 1273 1273 } 1274 1274 1275 /** Convert string to a number.1276 * Core of strtol and strtoul functions.1277 *1278 * @param nptr Pointer to string.1279 * @param endptr If not NULL, function stores here pointer to the first1280 * invalid character.1281 * @param base Zero or number between 2 and 36 inclusive.1282 * @param sgn It's set to 1 if minus found.1283 * @return Result of conversion.1284 */1285 static unsigned long1286 _strtoul(const char *nptr, char **endptr, int base, char *sgn)1287 {1288 unsigned char c;1289 unsigned long result = 0;1290 unsigned long a, b;1291 const char *str = nptr;1292 const char *tmpptr;1293 1294 while (isspace(*str))1295 str++;1296 1297 if (*str == '-') {1298 *sgn = 1;1299 ++str;1300 } else if (*str == '+')1301 ++str;1302 1303 if (base) {1304 if ((base == 1) || (base > 36)) {1305 /* FIXME: set errno to EINVAL */1306 return 0;1307 }1308 if ((base == 16) && (*str == '0') && ((str[1] == 'x') ||1309 (str[1] == 'X'))) {1310 str += 2;1311 }1312 } else {1313 base = 10;1314 1315 if (*str == '0') {1316 base = 8;1317 if ((str[1] == 'X') || (str[1] == 'x')) {1318 base = 16;1319 str += 2;1320 }1321 }1322 }1323 1324 tmpptr = str;1325 1326 while (*str) {1327 c = *str;1328 c = (c >= 'a' ? c - 'a' + 10 : (c >= 'A' ? c - 'A' + 10 :1329 (c <= '9' ? c - '0' : 0xff)));1330 if (c >= base) {1331 break;1332 }1333 1334 a = (result & 0xff) * base + c;1335 b = (result >> 8) * base + (a >> 8);1336 1337 if (b > (ULONG_MAX >> 8)) {1338 /* overflow */1339 /* FIXME: errno = ERANGE*/1340 return ULONG_MAX;1341 }1342 1343 result = (b << 8) + (a & 0xff);1344 ++str;1345 }1346 1347 if (str == tmpptr) {1348 /*1349 * No number was found => first invalid character is the first1350 * character of the string.1351 */1352 /* FIXME: set errno to EINVAL */1353 str = nptr;1354 result = 0;1355 }1356 1357 if (endptr)1358 *endptr = (char *) str;1359 1360 if (nptr == str) {1361 /*FIXME: errno = EINVAL*/1362 return 0;1363 }1364 1365 return result;1366 }1367 1368 /** Convert initial part of string to long int according to given base.1369 * The number may begin with an arbitrary number of whitespaces followed by1370 * optional sign (`+' or `-'). If the base is 0 or 16, the prefix `0x' may be1371 * inserted and the number will be taken as hexadecimal one. If the base is 01372 * and the number begin with a zero, number will be taken as octal one (as with1373 * base 8). Otherwise the base 0 is taken as decimal.1374 *1375 * @param nptr Pointer to string.1376 * @param endptr If not NULL, function stores here pointer to the first1377 * invalid character.1378 * @param base Zero or number between 2 and 36 inclusive.1379 * @return Result of conversion.1380 */1381 long int strtol(const char *nptr, char **endptr, int base)1382 {1383 char sgn = 0;1384 unsigned long number = 0;1385 1386 number = _strtoul(nptr, endptr, base, &sgn);1387 1388 if (number > LONG_MAX) {1389 if ((sgn) && (number == (unsigned long) (LONG_MAX) + 1)) {1390 /* FIXME: set 0 to errno */1391 return number;1392 }1393 /* FIXME: set ERANGE to errno */1394 return (sgn ? LONG_MIN : LONG_MAX);1395 }1396 1397 return (sgn ? -number : number);1398 }1399 1275 1400 1276 /** Duplicate string. … … 1457 1333 str_ncpy(dest, size + 1, src, size); 1458 1334 return dest; 1459 }1460 1461 /** Convert initial part of string to unsigned long according to given base.1462 * The number may begin with an arbitrary number of whitespaces followed by1463 * optional sign (`+' or `-'). If the base is 0 or 16, the prefix `0x' may be1464 * inserted and the number will be taken as hexadecimal one. If the base is 01465 * and the number begin with a zero, number will be taken as octal one (as with1466 * base 8). Otherwise the base 0 is taken as decimal.1467 *1468 * @param nptr Pointer to string.1469 * @param endptr If not NULL, function stores here pointer to the first1470 * invalid character1471 * @param base Zero or number between 2 and 36 inclusive.1472 * @return Result of conversion.1473 */1474 unsigned long strtoul(const char *nptr, char **endptr, int base)1475 {1476 char sgn = 0;1477 unsigned long number = 0;1478 1479 number = _strtoul(nptr, endptr, base, &sgn);1480 1481 return (sgn ? -number : number);1482 1335 } 1483 1336 -
uspace/lib/c/generic/uuid.c
ra0a9cc2 r2b3dd78 52 52 /* XXX This is a rather poor way of generating random numbers */ 53 53 gettimeofday(&tv, NULL); 54 srand om(tv.tv_sec ^ tv.tv_usec);54 srand(tv.tv_sec ^ tv.tv_usec); 55 55 56 56 for (i = 0; i < uuid_bytes; i++) 57 uuid->b[i] = rand om();57 uuid->b[i] = rand(); 58 58 59 59 /* Version 4 UUID from random or pseudo-random numbers */ -
uspace/lib/c/generic/vfs/mtab.c
ra0a9cc2 r2b3dd78 40 40 #include <errno.h> 41 41 #include <assert.h> 42 #include <str.h> 42 43 43 static void process_mp(const char *path, struct stat *stat, list_t *mtab_list)44 static void process_mp(const char *path, vfs_stat_t *stat, list_t *mtab_list) 44 45 { 45 46 mtab_ent_t *ent; … … 53 54 ent->service_id = stat->service_id; 54 55 55 struct statfsstfs;56 vfs_statfs_t stfs; 56 57 if (vfs_statfs_path(path, &stfs) == EOK) 57 58 str_cpy(ent->fs_name, sizeof(ent->fs_name), stfs.fs_name); … … 74 75 while ((dirent = readdir(dir)) != NULL) { 75 76 char *child; 76 struct stat st;77 vfs_stat_t st; 77 78 errno_t rc; 78 79 int ret; … … 122 123 errno_t vfs_get_mtab_list(list_t *mtab_list) 123 124 { 124 struct stat st;125 vfs_stat_t st; 125 126 126 127 errno_t rc = vfs_stat_path("/", &st); -
uspace/lib/c/generic/vfs/vfs.c
ra0a9cc2 r2b3dd78 352 352 async_sess_t *vfs_fd_session(int file, iface_t iface) 353 353 { 354 struct stat stat;354 vfs_stat_t stat; 355 355 errno_t rc = vfs_stat(file, &stat); 356 356 if (rc != EOK) … … 1052 1052 * @return EOK on success or an error code 1053 1053 */ 1054 errno_t vfs_stat(int file, struct stat *stat)1054 errno_t vfs_stat(int file, vfs_stat_t *stat) 1055 1055 { 1056 1056 errno_t rc; … … 1060 1060 1061 1061 req = async_send_1(exch, VFS_IN_STAT, file, NULL); 1062 rc = async_data_read_start(exch, (void *) stat, sizeof( struct stat));1062 rc = async_data_read_start(exch, (void *) stat, sizeof(vfs_stat_t)); 1063 1063 if (rc != EOK) { 1064 1064 vfs_exchange_end(exch); … … 1086 1086 * @return EOK on success or an error code 1087 1087 */ 1088 errno_t vfs_stat_path(const char *path, struct stat *stat)1088 errno_t vfs_stat_path(const char *path, vfs_stat_t *stat) 1089 1089 { 1090 1090 int file; … … 1107 1107 * @return EOK on success or an error code 1108 1108 */ 1109 errno_t vfs_statfs(int file, struct statfs*st)1109 errno_t vfs_statfs(int file, vfs_statfs_t *st) 1110 1110 { 1111 1111 errno_t rc, ret; … … 1132 1132 * @return EOK on success or an error code 1133 1133 */ 1134 errno_t vfs_statfs_path(const char *path, struct statfs*st)1134 errno_t vfs_statfs_path(const char *path, vfs_statfs_t *st) 1135 1135 { 1136 1136 int file; -
uspace/lib/c/include/adt/hash_table.h
ra0a9cc2 r2b3dd78 84 84 member_to_inst((item), type, member) 85 85 86 extern bool hash_table_create(hash_table_t *, size_t, size_t, 87 86 extern bool hash_table_create(hash_table_t *, size_t, size_t, 87 hash_table_ops_t *); 88 88 extern void hash_table_destroy(hash_table_t *); 89 89 … … 98 98 extern size_t hash_table_remove(hash_table_t *, void *); 99 99 extern void hash_table_remove_item(hash_table_t *, ht_link_t *); 100 extern void hash_table_apply(hash_table_t *, bool (*)(ht_link_t *, void *), 101 100 extern void hash_table_apply(hash_table_t *, bool (*)(ht_link_t *, void *), 101 void *); 102 102 103 103 -
uspace/lib/c/include/async.h
ra0a9cc2 r2b3dd78 34 34 35 35 #if ((defined(LIBC_IPC_H_)) && (!defined(LIBC_ASYNC_C_))) 36 36 #error Do not intermix low-level IPC interface and async framework 37 37 #endif 38 38 -
uspace/lib/c/include/ctype.h
ra0a9cc2 r2b3dd78 61 61 } 62 62 63 static inline int isblank(int c) 64 { 65 return c == ' ' || c == '\t'; 66 } 67 68 static inline int iscntrl(int c) 69 { 70 return (c >= 0 && c < 0x20) || c == 0x7E; 71 } 72 73 static inline int isprint(int c) 74 { 75 return c >= 0 && c < 0x80 && !iscntrl(c); 76 } 77 78 static inline int isgraph(int c) 79 { 80 return isprint(c) && c != ' '; 81 } 82 63 83 static inline int isspace(int c) 64 84 { … … 75 95 return 0; 76 96 } 97 } 98 99 static inline int ispunct(int c) 100 { 101 return !isspace(c) && !isalnum(c) && isprint(c); 102 } 103 104 static inline int isxdigit(int c) 105 { 106 return isdigit(c) || 107 (c >= 'a' && c <= 'f') || 108 (c >= 'A' && c <= 'F'); 77 109 } 78 110 -
uspace/lib/c/include/getopt.h
ra0a9cc2 r2b3dd78 57 57 58 58 /* HelenOS Port - These need to be exposed for legacy getopt() */ 59 extern c onst char *optarg;59 extern char *optarg; 60 60 extern int optind, opterr, optopt; 61 61 extern int optreset; -
uspace/lib/c/include/gsort.h
ra0a9cc2 r2b3dd78 39 39 #include <stdbool.h> 40 40 41 typedef int (* 41 typedef int (*sort_cmp_t)(void *, void *, void *); 42 42 43 43 extern bool gsort(void *, size_t, size_t, sort_cmp_t, void *); -
uspace/lib/c/include/inttypes.h
ra0a9cc2 r2b3dd78 38 38 #include <_bits/inttypes.h> 39 39 40 #ifndef __HELENOS_DISABLE_INTMAX__ 41 intmax_t strtoimax(const char *__restrict__ nptr, 42 char **__restrict__ endptr, int base); 43 uintmax_t strtoumax(const char *__restrict__ nptr, 44 char **__restrict__ endptr, int base); 45 #endif 46 40 47 #endif 41 48 -
uspace/lib/c/include/io/kio.h
ra0a9cc2 r2b3dd78 39 39 #include <stdarg.h> 40 40 #include <io/verify.h> 41 #include <_bits/errno.h> 42 #include <_bits/size_t.h> 41 43 42 44 extern errno_t kio_write(const void *, size_t, size_t *); … … 44 46 extern void kio_command(const void *, size_t); 45 47 extern int kio_printf(const char *, ...) 46 PRINTF_ATTRIBUTE(1, 2);48 _HELENOS_PRINTF_ATTRIBUTE(1, 2); 47 49 extern int kio_vprintf(const char *, va_list); 48 50 -
uspace/lib/c/include/io/log.h
ra0a9cc2 r2b3dd78 60 60 61 61 extern void log_msg(log_t, log_level_t, const char *, ...) 62 PRINTF_ATTRIBUTE(3, 4);62 _HELENOS_PRINTF_ATTRIBUTE(3, 4); 63 63 extern void log_msgv(log_t, log_level_t, const char *, va_list); 64 64 -
uspace/lib/c/include/io/verify.h
ra0a9cc2 r2b3dd78 36 36 #define LIBC_IO_VERIFY_H_ 37 37 38 #ifndef NVERIFY_PRINTF38 #ifndef _HELENOS_NVERIFY_PRINTF 39 39 40 40 #ifdef __clang__ 41 #define PRINTF_ATTRIBUTE(start, end) \41 #define _HELENOS_PRINTF_ATTRIBUTE(start, end) \ 42 42 __attribute__((format(__printf__, start, end))) 43 43 #else 44 #define PRINTF_ATTRIBUTE(start, end) \44 #define _HELENOS_PRINTF_ATTRIBUTE(start, end) \ 45 45 __attribute__((format(gnu_printf, start, end))) 46 46 #endif 47 47 48 #else /* NVERIFY_PRINTF */48 #else /* _HELENOS_NVERIFY_PRINTF */ 49 49 50 #define PRINTF_ATTRIBUTE(start, end)50 #define _HELENOS_PRINTF_ATTRIBUTE(start, end) 51 51 52 #endif /* NVERIFY_PRINTF */52 #endif /* _HELENOS_NVERIFY_PRINTF */ 53 53 54 54 #endif -
uspace/lib/c/include/ipc/devman.h
ra0a9cc2 r2b3dd78 74 74 /** Id of device model. 75 75 */ 76 c onst char *id;76 char *id; 77 77 /** Relevancy of device-to-driver match. 78 78 * The higher is the product of scores specified for the device by the bus driver and by the leaf driver, -
uspace/lib/c/include/ipc/ipc.h
ra0a9cc2 r2b3dd78 34 34 35 35 #if ((defined(LIBC_ASYNC_H_)) && (!defined(LIBC_ASYNC_C_))) 36 36 #error Do not intermix low-level IPC interface and async framework 37 37 #endif 38 38 -
uspace/lib/c/include/ipc/logger.h
ra0a9cc2 r2b3dd78 54 54 * Returns: error code 55 55 * Followed by: vfs_pass_handle() request. 56 */ 56 */ 57 57 LOGGER_CONTROL_SET_ROOT 58 58 } logger_control_request_t; -
uspace/lib/c/include/malloc.h
ra0a9cc2 r2b3dd78 38 38 #include <stddef.h> 39 39 40 extern void *malloc( constsize_t size)40 extern void *malloc(size_t size) 41 41 __attribute__((malloc)); 42 extern void *calloc( const size_t nmemb, constsize_t size)42 extern void *calloc(size_t nmemb, size_t size) 43 43 __attribute__((malloc)); 44 extern void *memalign( const size_t align, constsize_t size)44 extern void *memalign(size_t align, size_t size) 45 45 __attribute__((malloc)); 46 extern void *realloc( const void *addr, constsize_t size)46 extern void *realloc(void *addr, size_t size) 47 47 __attribute__((warn_unused_result)); 48 extern void free( constvoid *addr);48 extern void free(void *addr); 49 49 extern void *heap_check(void); 50 50 -
uspace/lib/c/include/rtld/rtld_debug.h
ra0a9cc2 r2b3dd78 42 42 43 43 #ifdef RTLD_DEBUG 44 44 #define DPRINTF(format, ...) printf(format, ##__VA_ARGS__) 45 45 #else 46 46 #define DPRINTF(format, ...) if (0) printf(format, ##__VA_ARGS__) 47 47 #endif 48 48 -
uspace/lib/c/include/stdio.h
ra0a9cc2 r2b3dd78 37 37 38 38 #include <stdarg.h> 39 #include <str.h>40 39 #include <io/verify.h> 41 #include <abi/kio.h> 40 #include <_bits/size_t.h> 41 #include <_bits/wchar_t.h> 42 42 43 43 #define EOF (-1) … … 58 58 #define BUFSIZ 4096 59 59 60 #define DEBUG(fmt, ...) \ 61 { \ 62 char _buf[256]; \ 63 int _n = snprintf(_buf, sizeof(_buf), fmt, ##__VA_ARGS__); \ 64 if (_n > 0) \ 65 (void) __SYSCALL3(SYS_KIO, KIO_WRITE, (sysarg_t) _buf, str_size(_buf)); \ 66 } 60 /** Forward declaration */ 61 struct _IO_FILE; 62 typedef struct _IO_FILE FILE; 63 64 extern FILE *stdin; 65 extern FILE *stdout; 66 extern FILE *stderr; 67 68 /* Character and string input functions */ 69 extern int fgetc(FILE *); 70 extern char *fgets(char *, int, FILE *); 71 72 extern int getchar(void); 73 74 /* Character and string output functions */ 75 extern int fputc(wchar_t, FILE *); 76 extern int fputs(const char *, FILE *); 77 78 extern int putchar(wchar_t); 79 extern int puts(const char *); 80 81 extern int ungetc(int, FILE *); 82 83 /* Formatted string output functions */ 84 extern int fprintf(FILE *, const char*, ...) 85 _HELENOS_PRINTF_ATTRIBUTE(2, 3); 86 extern int vfprintf(FILE *, const char *, va_list); 87 88 extern int printf(const char *, ...) 89 _HELENOS_PRINTF_ATTRIBUTE(1, 2); 90 extern int vprintf(const char *, va_list); 91 92 extern int snprintf(char *, size_t , const char *, ...) 93 _HELENOS_PRINTF_ATTRIBUTE(3, 4); 94 extern int vasprintf(char **, const char *, va_list); 95 extern int asprintf(char **, const char *, ...) 96 _HELENOS_PRINTF_ATTRIBUTE(2, 3); 97 extern int vsnprintf(char *, size_t, const char *, va_list); 98 99 /* File stream functions */ 100 extern FILE *fopen(const char *, const char *); 101 extern FILE *freopen(const char *, const char *, FILE *); 102 extern int fclose(FILE *); 103 104 extern size_t fread(void *, size_t, size_t, FILE *); 105 extern size_t fwrite(const void *, size_t, size_t, FILE *); 106 107 extern int fseek(FILE *, long, int); 108 extern void rewind(FILE *); 109 extern long ftell(FILE *); 110 extern int feof(FILE *); 111 112 extern int fflush(FILE *); 113 extern int ferror(FILE *); 114 extern void clearerr(FILE *); 115 116 extern void setvbuf(FILE *, void *, int, size_t); 117 extern void setbuf(FILE *, void *); 118 119 /* Misc file functions */ 120 extern int rename(const char *, const char *); 121 extern int remove(const char *); 122 123 #ifndef _HELENOS_SOURCE 124 #define _IONBF 0 125 #define _IOLBF 1 126 #define _IOFBF 2 127 #endif 128 129 #ifdef _HELENOS_SOURCE 130 131 /* Nonstandard extensions. */ 67 132 68 133 enum _buffer_type { … … 86 151 }; 87 152 88 /** Forward declaration */ 89 struct _IO_FILE; 90 typedef struct _IO_FILE FILE; 91 92 extern FILE *stdin; 93 extern FILE *stdout; 94 extern FILE *stderr; 95 96 /* Character and string input functions */ 97 extern int fgetc(FILE *); 98 extern char *fgets(char *, int, FILE *); 99 100 extern int getchar(void); 153 extern int vprintf_size(const char *, va_list); 154 extern int printf_size(const char *, ...) 155 _HELENOS_PRINTF_ATTRIBUTE(1, 2); 156 extern FILE *fdopen(int, const char *); 157 extern int fileno(FILE *); 101 158 extern char *gets(char *, size_t); 102 159 103 /* Character and string output functions */ 104 extern int fputc(wchar_t, FILE *); 105 extern int fputs(const char *, FILE *); 160 #include <offset.h> 106 161 107 extern int putchar(wchar_t);108 extern int puts(const char*);162 extern int fseek64(FILE *, off64_t, int); 163 extern off64_t ftell64(FILE *); 109 164 110 extern int ungetc(int, FILE *); 165 #endif 111 166 112 /* Formatted string output functions */113 extern int fprintf(FILE *, const char*, ...)114 PRINTF_ATTRIBUTE(2, 3);115 extern int vfprintf(FILE *, const char *, va_list);116 117 extern int printf(const char *, ...)118 PRINTF_ATTRIBUTE(1, 2);119 extern int vprintf(const char *, va_list);120 121 extern int snprintf(char *, size_t , const char *, ...)122 PRINTF_ATTRIBUTE(3, 4);123 extern int vasprintf(char **, const char *, va_list);124 extern int asprintf(char **, const char *, ...)125 PRINTF_ATTRIBUTE(2, 3);126 extern int vsnprintf(char *, size_t, const char *, va_list);127 128 extern int printf_size(const char *, ...)129 PRINTF_ATTRIBUTE(1, 2);130 extern int vprintf_size(const char *, va_list);131 132 /* File stream functions */133 extern FILE *fopen(const char *, const char *);134 extern FILE *fdopen(int, const char *);135 extern FILE *freopen(const char *, const char *, FILE *);136 extern int fclose(FILE *);137 138 extern size_t fread(void *, size_t, size_t, FILE *);139 extern size_t fwrite(const void *, size_t, size_t, FILE *);140 141 extern int fseek(FILE *, long, int);142 extern void rewind(FILE *);143 extern long ftell(FILE *);144 extern int feof(FILE *);145 extern int fileno(FILE *);146 147 extern int fflush(FILE *);148 extern int ferror(FILE *);149 extern void clearerr(FILE *);150 151 extern void setvbuf(FILE *, void *, int, size_t);152 extern void setbuf(FILE *, void *);153 154 /* Misc file functions */155 extern int rename(const char *, const char *);156 extern int remove(const char *);157 167 158 168 #endif -
uspace/lib/c/include/stdlib.h
ra0a9cc2 r2b3dd78 42 42 #define RAND_MAX 714025 43 43 44 #define rand() random() 45 #define srand(seed) srandom(seed) 46 47 extern long int random(void); 48 extern void srandom(unsigned int seed); 44 extern int rand(void); 45 extern void srand(unsigned int seed); 49 46 50 47 extern void abort(void) __attribute__((noreturn)); 51 48 extern void exit(int) __attribute__((noreturn)); 49 50 extern int atoi(const char *); 51 extern long atol(const char *); 52 extern long long atoll(const char *); 53 54 extern long strtol(const char *__restrict__, char **__restrict__, int); 55 extern long long strtoll(const char *__restrict__, char **__restrict__, int); 56 extern unsigned long strtoul(const char *__restrict__, char **__restrict__, int); 57 extern unsigned long long strtoull(const char *__restrict__, char **__restrict__, int); 52 58 53 59 #endif -
uspace/lib/c/include/syscall.h
ra0a9cc2 r2b3dd78 41 41 42 42 #ifndef LIBARCH_SYSCALL_GENERIC 43 43 #error You cannot include this file directly 44 44 #endif 45 45 -
uspace/lib/c/include/time.h
ra0a9cc2 r2b3dd78 31 31 */ 32 32 /** @file 33 */ 33 */ 34 34 35 35 #ifndef LIBC_TIME_H_ -
uspace/lib/c/include/udebug.h
ra0a9cc2 r2b3dd78 46 46 extern errno_t udebug_end(async_sess_t *); 47 47 extern errno_t udebug_set_evmask(async_sess_t *, udebug_evmask_t); 48 extern errno_t udebug_thread_read(async_sess_t *, void *, size_t 48 extern errno_t udebug_thread_read(async_sess_t *, void *, size_t, size_t *, 49 49 size_t *); 50 50 extern errno_t udebug_name_read(async_sess_t *, void *, size_t, size_t *, -
uspace/lib/c/include/vfs/inbox.h
ra0a9cc2 r2b3dd78 29 29 /** @addtogroup libc 30 30 * @{ 31 */ 31 */ 32 32 33 33 /** -
uspace/lib/c/include/vfs/vfs.h
ra0a9cc2 r2b3dd78 57 57 58 58 59 struct stat {59 typedef struct { 60 60 fs_handle_t fs_handle; 61 61 service_id_t service_id; … … 66 66 aoff64_t size; 67 67 service_id_t service; 68 } ;68 } vfs_stat_t; 69 69 70 struct statfs { 70 typedef struct { 71 71 char fs_name[FS_NAME_MAXLEN + 1]; 72 72 uint32_t f_bsize; /* fundamental file system block size */ 73 73 uint64_t f_blocks; /* total data blocks in file system */ 74 74 uint64_t f_bfree; /* free blocks in fs */ 75 } ;75 } vfs_statfs_t; 76 76 77 77 /** List of file system types */ … … 111 111 extern int vfs_root(void); 112 112 extern errno_t vfs_root_set(int); 113 extern errno_t vfs_stat(int, struct stat *);114 extern errno_t vfs_stat_path(const char *, struct stat *);115 extern errno_t vfs_statfs(int, struct statfs*);116 extern errno_t vfs_statfs_path(const char *, struct statfs*);113 extern errno_t vfs_stat(int, vfs_stat_t *); 114 extern errno_t vfs_stat_path(const char *, vfs_stat_t *); 115 extern errno_t vfs_statfs(int, vfs_statfs_t *); 116 extern errno_t vfs_statfs_path(const char *, vfs_statfs_t *); 117 117 extern errno_t vfs_sync(int); 118 118 extern errno_t vfs_unlink(int, const char *, int); -
uspace/lib/c/test/sprintf.c
ra0a9cc2 r2b3dd78 28 28 29 29 #include <stdio.h> 30 #include <str.h> 30 31 #include <pcut/pcut.h> 31 32
Note:
See TracChangeset
for help on using the changeset viewer.