Changes in / [e768aea:8119363] in mainline
- Files:
-
- 17 added
- 1 deleted
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
re768aea r8119363 139 139 nic/rtl8169 \ 140 140 nic/ar9271 \ 141 nic/virtio-net \ 141 142 block/ahci 142 143 -
kernel/generic/include/stdbool.h
re768aea r8119363 41 41 #define true 1 42 42 43 #define __bool_true_false_are_defined 143 #define __bool_true_false_are_defined 1 44 44 45 45 #endif -
tools/ew.py
re768aea r8119363 146 146 return ' -device rtl8139,vlan=0' 147 147 148 def qemu_nic_virtio_options(): 149 return ' -device virtio-net,vlan=0' 150 148 151 def qemu_net_options(): 149 152 if is_override('nonet'): … … 158 161 if 'ne2k' in overrides['net'].keys(): 159 162 nic_options += qemu_nic_ne2k_options() 163 if 'virtio-net' in overrides['net'].keys(): 164 nic_options += qemu_nic_virtio_options() 160 165 else: 161 166 # Use the default NIC … … 326 331 def usage(): 327 332 print("%s - emulator wrapper for running HelenOS\n" % os.path.basename(sys.argv[0])) 328 print("%s [-d] [-h] [-net e1k|rtl8139|ne2k ] [-nohdd] [-nokvm] [-nonet] [-nosnd] [-nousb] [-noxhci] [-notablet]\n" %333 print("%s [-d] [-h] [-net e1k|rtl8139|ne2k|virtio-net] [-nohdd] [-nokvm] [-nonet] [-nosnd] [-nousb] [-noxhci] [-notablet]\n" % 329 334 os.path.basename(sys.argv[0])) 330 335 print("-d\tDry run: do not run the emulation, just print the command line.") … … 360 365 elif sys.argv[i] == 'ne2k': 361 366 overrides['net']['ne2k'] = True 367 elif sys.argv[i] == 'virtio-net': 368 overrides['net']['virtio-net'] = True 362 369 else: 363 370 usage() -
uspace/Makefile
re768aea r8119363 181 181 drv/nic/rtl8169 \ 182 182 drv/nic/ar9271 \ 183 drv/nic/virtio-net \ 183 184 drv/platform/amdm37x \ 184 185 drv/platform/icp \ … … 251 252 lib/bithenge \ 252 253 lib/posix \ 253 lib/ieee80211 254 lib/ieee80211 \ 255 lib/virtio 254 256 255 257 BASE_BUILDS := $(addsuffix .build,$(BASE_LIBS)) -
uspace/Makefile.common
re768aea r8119363 165 165 ifneq ($(TEST_SOURCES),) 166 166 TEST_OUTPUTS = $(TEST_BINARY) $(TEST_BINARY).disasm 167 TEST_CFLAGS = -I$(LIB_PREFIX)/pcut/include -D__helenos__ 167 TEST_CFLAGS = -I$(LIB_PREFIX)/pcut/include -D__helenos__ $(EXTRA_TEST_CFLAGS) 168 168 TEST_BINARY_LIBS = $(LIB_PREFIX)/pcut/libpcut.a 169 169 EXTRA_CLEAN += $(TEST_OUTPUTS) $(TEST_BINARY).map -
uspace/drv/bus/pci/pciintel/pci.c
re768aea r8119363 738 738 739 739 if (pio_enable_resource(&bus->pio_win, 740 &hw_resources.resources[0], 741 (void **) &bus->conf_space)) {740 &hw_resources.resources[0], (void **) &bus->conf_space, 741 NULL, NULL)) { 742 742 ddf_msg(LVL_ERROR, 743 743 "Failed to map configuration space."); … … 759 759 760 760 if (pio_enable_resource(&bus->pio_win, 761 &hw_resources.resources[0], 762 (void **) &bus->conf_addr_reg)) {761 &hw_resources.resources[0], (void **) &bus->conf_addr_reg, 762 NULL, NULL)) { 763 763 ddf_msg(LVL_ERROR, 764 764 "Failed to enable configuration ports."); … … 767 767 } 768 768 if (pio_enable_resource(&bus->pio_win, 769 &hw_resources.resources[1], 770 (void **) &bus->conf_data_reg)) {769 &hw_resources.resources[1], (void **) &bus->conf_data_reg, 770 NULL, NULL)) { 771 771 ddf_msg(LVL_ERROR, 772 772 "Failed to enable configuration ports."); -
uspace/lib/bithenge/src/helenos/common.h
re768aea r8119363 73 73 } 74 74 75 static inline void *memchr(const void *s, int c, size_t n)76 {77 for (size_t i = 0; i < n; i++)78 if (((char *)s)[i] == c)79 return (void *)(s + i);80 return NULL;81 }82 83 75 static inline errno_t bithenge_parse_int(const char *start, bithenge_int_t *result) 84 76 { -
uspace/lib/c/Makefile
re768aea r8119363 41 41 EXTRA_OUTPUT = $(LINKER_SCRIPTS) 42 42 EXTRA_CLEAN = $(LINKER_SCRIPTS) 43 EXTRA_TEST_CFLAGS = -Wno-deprecated-declarations 43 44 LIBRARY = libc 44 45 SOVERSION = 0.0 … … 132 133 generic/malloc.c \ 133 134 generic/stdio/scanf.c \ 135 generic/stdio/sprintf.c \ 134 136 generic/stdio/sscanf.c \ 135 137 generic/stdio/sstream.c \ 138 generic/stdio/vsprintf.c \ 136 139 generic/sysinfo.c \ 137 140 generic/ipc.c \ … … 149 152 generic/adt/prodcons.c \ 150 153 generic/time.c \ 154 generic/tmpfile.c \ 151 155 generic/stdio.c \ 152 156 generic/stdlib.c \ … … 189 193 test/fibril/timer.c \ 190 194 test/main.c \ 195 test/mem.c \ 191 196 test/io/table.c \ 192 197 test/stdio/scanf.c \ … … 194 199 test/qsort.c \ 195 200 test/sprintf.c \ 201 test/stdio.c \ 196 202 test/stdlib.c \ 197 203 test/str.c -
uspace/lib/c/arch/arm32/include/libarch/fibril_context.h
re768aea r8119363 49 49 uint32_t r7; 50 50 uint32_t r8; 51 /* r9 */51 /* r9 */ 52 52 uint32_t tls; 53 53 uint32_t r10; … … 57 57 58 58 #endif 59 -
uspace/lib/c/generic/async/client.c
re768aea r8119363 190 190 free(msg); 191 191 } 192 193 192 194 193 /** Mutex protecting inactive_exch_list and avail_phone_cv. -
uspace/lib/c/generic/ddi.c
re768aea r8119363 220 220 /** Enable PIO for specified HW resource wrt. to the PIO window. 221 221 * 222 * @param win PIO window. May be NULL if the resources are known to be 223 * absolute. 224 * @param res Resources specifying the I/O range wrt. to the PIO window. 225 * @param virt Virtual address for application's PIO operations. 222 * @param win PIO window. May be NULL if the resources are known to be 223 * absolute. 224 * @param res Resources specifying the I/O range wrt. to the PIO window. 225 * @param[out] virt Virtual address for application's PIO operations. 226 * @param[out] phys If non-NULL, physical address of the resource 227 * @param[out] size If non-NULL, size of the enabled resource. 226 228 * 227 229 * @return EOK on success. … … 229 231 * 230 232 */ 231 errno_t pio_enable_resource(pio_window_t *win, hw_resource_t *res, void **virt) 233 errno_t pio_enable_resource(pio_window_t *win, hw_resource_t *res, void **virt, 234 uintptr_t *phys, size_t *size) 232 235 { 233 236 uintptr_t addr; 234 size_t s ize;237 size_t sz; 235 238 236 239 switch (res->type) { … … 242 245 addr += win->io.base; 243 246 } 244 s ize= res->res.io_range.size;247 sz = res->res.io_range.size; 245 248 break; 246 249 case MEM_RANGE: … … 251 254 addr += win->mem.base; 252 255 } 253 s ize= res->res.mem_range.size;256 sz = res->res.mem_range.size; 254 257 break; 255 258 default: … … 257 260 } 258 261 259 return pio_enable((void *) addr, size, virt); 262 if (phys) 263 *phys = addr; 264 if (size) 265 *size = sz; 266 267 return pio_enable((void *) addr, sz, virt); 260 268 } 261 269 -
uspace/lib/c/generic/io/printf_core.c
re768aea r8119363 39 39 #include <stdio.h> 40 40 #include <stddef.h> 41 #include <stdlib.h> 41 42 #include <io/printf_core.h> 42 43 #include <ctype.h> -
uspace/lib/c/generic/io/snprintf.c
re768aea r8119363 35 35 #include <stdarg.h> 36 36 #include <stdio.h> 37 #include <io/printf_core.h>38 37 39 38 /** Print formatted to the given buffer with limited size. -
uspace/lib/c/generic/mem.c
re768aea r8119363 1 1 /* 2 2 * Copyright (c) 2005 Martin Decky 3 * Copyright (c) 20 08 Jiri Svoboda3 * Copyright (c) 2018 Jiri Svoboda 4 4 * All rights reserved. 5 5 * … … 252 252 } 253 253 254 /** Search memory area. 255 * 256 * @param s Memory area 257 * @param c Character (byte) to search for 258 * @param n Size of memory area in bytes 259 * 260 * @return Pointer to the first occurrence of @a c in the first @a n 261 * bytes of @a s or @c NULL if not found. 262 */ 263 void *memchr(const void *s, int c, size_t n) 264 { 265 uint8_t *u = (uint8_t *) s; 266 unsigned char uc = (unsigned char) c; 267 size_t i; 268 269 for (i = 0; i < n; i++) { 270 if (u[i] == uc) 271 return (void *) &u[i]; 272 } 273 274 return NULL; 275 } 276 254 277 /** @} 255 278 */ -
uspace/lib/c/generic/stdio.c
re768aea r8119363 1 1 /* 2 * Copyright (c) 201 7Jiri Svoboda2 * Copyright (c) 2018 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 34 34 35 35 #include <errno.h> 36 #include <stdbool.h> 36 37 #include <stdio.h> 38 #include <str.h> 39 #include <str_error.h> 40 #include <tmpfile.h> 37 41 #include <vfs/vfs.h> 42 43 /** Static buffer for tmpnam function */ 44 static char tmpnam_buf[L_tmpnam]; 45 46 /** Get stream position. 47 * 48 * @param stream Stream 49 * @param pos Place to store position 50 * 51 * @return Zero on success, non-zero on failure 52 */ 53 int fgetpos(FILE *stream, fpos_t *pos) 54 { 55 off64_t p; 56 57 p = ftell64(stream); 58 if (p < 0) 59 return -1; 60 61 pos->pos = p; 62 return 0; 63 } 64 65 /** Get stream position. 66 * 67 * @param stream Stream 68 * @param pos Position 69 * 70 * @return Zero on sucess, non-zero on failure 71 */ 72 int fsetpos(FILE *stream, const fpos_t *pos) 73 { 74 int rc; 75 76 rc = fseek64(stream, pos->pos, SEEK_SET); 77 if (rc < 0) 78 return -1; 79 80 return 0; 81 } 38 82 39 83 /** Rename file or directory (C standard) */ … … 44 88 rc = vfs_rename_path(old_path, new_path); 45 89 if (rc != EOK) { 90 /* 91 * Note that ISO C leaves the value of errno undefined, 92 * whereas according to UN*X standards, it is set. 93 */ 46 94 errno = rc; 47 95 return -1; … … 58 106 rc = vfs_unlink_path(path); 59 107 if (rc != EOK) { 108 /* 109 * Note that ISO C leaves the value of errno undefined, 110 * whereas according to UN*X standards, it is set. 111 */ 60 112 errno = rc; 61 113 return -1; … … 65 117 } 66 118 119 /** Create a temporary file. 120 * 121 * @return Open stream descriptor or @c NULL on error. In that case 122 * errno is set (UN*X). Note that ISO C leaves the value of errno 123 * undefined. 124 */ 125 FILE *tmpfile(void) 126 { 127 int file; 128 FILE *stream; 129 130 file = __tmpfile(); 131 if (file < 0) { 132 printf("file is < 0\n"); 133 errno = EEXIST; 134 return NULL; 135 } 136 137 stream = fdopen(file, "w+"); 138 if (stream == NULL) { 139 printf("stream = NULL\n"); 140 vfs_put(file); 141 errno = EACCES; 142 return NULL; 143 } 144 145 return stream; 146 } 147 148 /** Create name for a temporary file. 149 * 150 * @param s Pointer to array of at least L_tmpnam bytes or @c NULL. 151 * @return The pointer @a s or pointer to internal static buffer on success, 152 * @c NULL on error. 153 */ 154 char *tmpnam(char *s) 155 { 156 char *p; 157 158 p = (s != NULL) ? s : tmpnam_buf; 159 return __tmpnam(p); 160 } 161 162 /** Print error message and string representation of @c errno. 163 * 164 * @param s Error message 165 */ 166 void perror(const char *s) 167 { 168 if (s != NULL && *s != '\0') 169 fprintf(stderr, "%s: %s\n", s, str_error(errno)); 170 else 171 fprintf(stderr, "%s\n", str_error(errno)); 172 } 173 174 67 175 /** @} 68 176 */ -
uspace/lib/c/generic/stdlib.c
re768aea r8119363 195 195 } 196 196 197 /** Compute the absolute value of an integer. 198 * 199 * If the result cannot be represented, the behavior is undefined. 200 * 201 * @param j Integer 202 * @return The absolute value of @a j 203 */ 204 int abs(int j) 205 { 206 int aj; 207 208 if (j < 0) { 209 aj = -j; 210 assert(aj >= 0); 211 } else { 212 aj = j; 213 } 214 215 return aj; 216 } 217 218 /** Compute the absolute value of a long integer. 219 * 220 * If the result cannot be represented, the behavior is undefined. 221 * 222 * @param j Long integer 223 * @return The absolute value of @a j 224 */ 225 long labs(long j) 226 { 227 long aj; 228 229 if (j < 0) { 230 aj = -j; 231 assert(aj >= 0); 232 } else { 233 aj = j; 234 } 235 236 return aj; 237 } 238 239 /** Compute the absolute value of a long long integer. 240 * 241 * If the result cannot be represented, the behavior is undefined. 242 * 243 * @param j Long long integer 244 * @return The absolute value of @a j 245 */ 246 long long llabs(long long j) 247 { 248 long long aj; 249 250 if (j < 0) { 251 aj = -j; 252 assert(aj >= 0); 253 } else { 254 aj = j; 255 } 256 257 return aj; 258 } 259 197 260 /** Compute quotient and remainder of int division. 198 261 * -
uspace/lib/c/generic/vfs/vfs.c
re768aea r8119363 285 285 { 286 286 size_t abs_size; 287 char *abs = vfs_absolutize(path, &abs_size);288 if ( !abs)287 char *abs_path = vfs_absolutize(path, &abs_size); 288 if (abs_path == NULL) 289 289 return ENOMEM; 290 290 291 291 int fd; 292 errno_t rc = vfs_lookup(abs , WALK_DIRECTORY, &fd);292 errno_t rc = vfs_lookup(abs_path, WALK_DIRECTORY, &fd); 293 293 if (rc != EOK) { 294 free(abs );294 free(abs_path); 295 295 return rc; 296 296 } … … 305 305 306 306 cwd_fd = fd; 307 cwd_path = abs ;307 cwd_path = abs_path; 308 308 cwd_size = abs_size; 309 309 -
uspace/lib/c/include/adt/hash_table.h
re768aea r8119363 102 102 void *); 103 103 104 105 104 #endif 106 105 -
uspace/lib/c/include/cc.h
re768aea r8119363 44 44 #endif 45 45 46 47 46 #endif 48 47 -
uspace/lib/c/include/ddi.h
re768aea r8119363 40 40 #include <stdint.h> 41 41 #include <sys/time.h> 42 #include <byteorder.h> 42 43 #include <abi/ddi/irq.h> 43 44 #include <device/hw_res.h> … … 64 65 65 66 extern errno_t pio_enable_range(addr_range_t *, void **); 66 extern errno_t pio_enable_resource(pio_window_t *, hw_resource_t *, void **); 67 extern errno_t pio_enable_resource(pio_window_t *, hw_resource_t *, void **, 68 uintptr_t *, size_t *); 67 69 extern errno_t pio_enable(void *, size_t, void **); 68 70 extern errno_t pio_disable(void *, size_t); … … 85 87 extern uint64_t pio_read_64(const ioport64_t *); 86 88 89 static inline void pio_write_le16(ioport16_t *reg, uint16_t val) 90 { 91 pio_write_16(reg, host2uint16_t_le(val)); 92 } 93 static inline void pio_write_be16(ioport16_t *reg, uint16_t val) 94 { 95 pio_write_16(reg, host2uint16_t_be(val)); 96 } 97 static inline void pio_write_le32(ioport32_t *reg, uint32_t val) 98 { 99 pio_write_32(reg, host2uint32_t_le(val)); 100 } 101 static inline void pio_write_be32(ioport32_t *reg, uint32_t val) 102 { 103 pio_write_32(reg, host2uint32_t_be(val)); 104 } 105 static inline void pio_write_le64(ioport64_t *reg, uint64_t val) 106 { 107 pio_write_64(reg, host2uint64_t_le(val)); 108 } 109 static inline void pio_write_be64(ioport64_t *reg, uint64_t val) 110 { 111 pio_write_64(reg, host2uint64_t_be(val)); 112 } 113 114 static inline uint16_t pio_read_le16(const ioport16_t *reg) 115 { 116 return uint16_t_le2host(pio_read_16(reg)); 117 } 118 static inline uint16_t pio_read_be16(const ioport16_t *reg) 119 { 120 return uint16_t_be2host(pio_read_16(reg)); 121 } 122 static inline uint32_t pio_read_le32(const ioport32_t *reg) 123 { 124 return uint32_t_le2host(pio_read_32(reg)); 125 } 126 static inline uint32_t pio_read_be32(const ioport32_t *reg) 127 { 128 return uint32_t_be2host(pio_read_32(reg)); 129 } 130 static inline uint64_t pio_read_le64(const ioport64_t *reg) 131 { 132 return uint64_t_le2host(pio_read_64(reg)); 133 } 134 static inline uint64_t pio_read_be64(const ioport64_t *reg) 135 { 136 return uint64_t_be2host(pio_read_64(reg)); 137 } 138 87 139 static inline uint8_t pio_change_8(ioport8_t *reg, uint8_t val, uint8_t mask, 88 140 useconds_t delay) -
uspace/lib/c/include/fibril_synch.h
re768aea r8119363 67 67 typedef struct { 68 68 fibril_owner_info_t oi; /**< Keep this the first thing. */ 69 unsigned writers;70 unsigned readers;69 unsigned int writers; 70 unsigned int readers; 71 71 list_t waiters; 72 72 } fibril_rwlock_t; … … 145 145 /** A counting semaphore for fibrils. */ 146 146 typedef struct { 147 long count;147 long int count; 148 148 list_t waiters; 149 149 } fibril_semaphore_t; -
uspace/lib/c/include/ipc/common.h
re768aea r8119363 50 50 task_id_t in_task_id; 51 51 sysarg_t in_phone_hash; 52 unsigned flags;52 unsigned int flags; 53 53 struct async_call *label; 54 54 cap_call_handle_t cap_handle; -
uspace/lib/c/include/macros.h
re768aea r8119363 38 38 #define min(a, b) ((a) < (b) ? (a) : (b)) 39 39 #define max(a, b) ((a) > (b) ? (a) : (b)) 40 #define abs(a)((a) >= 0 ? (a) : -(a))40 #define mabs(a) ((a) >= 0 ? (a) : -(a)) 41 41 42 42 #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) -
uspace/lib/c/include/mem.h
re768aea r8119363 1 1 /* 2 2 * Copyright (c) 2005 Martin Decky 3 * Copyright (c) 2018 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 49 50 extern int memcmp(const void *, const void *, size_t) 50 51 __attribute__((nonnull(1, 2))); 52 extern void *memchr(const void *, int, size_t) 53 __attribute__((nonnull(1))); 51 54 52 55 #endif -
uspace/lib/c/include/stdbool.h
re768aea r8119363 41 41 #define true 1 42 42 43 #define __bool_true_false_are_defined 143 #define __bool_true_false_are_defined 1 44 44 45 45 #endif -
uspace/lib/c/include/stdio.h
re768aea r8119363 1 1 /* 2 2 * Copyright (c) 2005 Martin Decky 3 * Copyright (c) 2018 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 36 37 #define LIBC_STDIO_H_ 37 38 39 #include <offset.h> 38 40 #include <stdarg.h> 39 41 #include <io/verify.h> 42 #include <_bits/NULL.h> 40 43 #include <_bits/size_t.h> 41 44 #include <_bits/wchar_t.h> 42 45 #include <_bits/wint_t.h> 43 46 44 #define EOF (-1)45 46 #ifndef SEEK_SET47 #define SEEK_SET 048 #endif49 50 #ifndef SEEK_CUR51 #define SEEK_CUR 152 #endif53 54 #ifndef SEEK_END55 #define SEEK_END 256 #endif57 58 /** Default size for stream I/O buffers */59 #define BUFSIZ 409660 61 /** Recommended size of fixed-size array for holding file names. */62 #define FILENAME_MAX 409663 64 47 /** Forward declaration */ 65 48 struct _IO_FILE; 66 49 typedef struct _IO_FILE FILE; 50 51 /** File position */ 52 typedef struct { 53 off64_t pos; 54 } fpos_t; 55 56 #ifndef _HELENOS_SOURCE 57 #define _IONBF 0 58 #define _IOLBF 1 59 #define _IOFBF 2 60 #endif 61 62 /** Default size for stream I/O buffers */ 63 #define BUFSIZ 4096 64 65 #define EOF (-1) 66 67 /** Max number of files that is guaranteed to be able to open at the same time */ 68 #define FOPEN_MAX VFS_MAX_OPEN_FILES 69 70 /** Recommended size of fixed-size array for holding file names. */ 71 #define FILENAME_MAX 4096 72 73 /** Length of "/tmp/tmp.XXXXXX" + 1 */ 74 #define L_tmpnam 16 75 76 #ifndef SEEK_SET 77 #define SEEK_SET 0 78 #endif 79 80 #ifndef SEEK_CUR 81 #define SEEK_CUR 1 82 #endif 83 84 #ifndef SEEK_END 85 #define SEEK_END 2 86 #endif 87 88 /** Minimum number of unique temporary file names */ 89 #define TMP_MAX 1000000 67 90 68 91 extern FILE *stdin; … … 74 97 extern int fgetc(FILE *); 75 98 extern char *fgets(char *, int, FILE *); 99 extern char *gets(char *, size_t) __attribute__((deprecated)); 76 100 77 101 extern int getchar(void); … … 104 128 extern int vasprintf(char **, const char *, va_list); 105 129 extern int asprintf(char **, const char *, ...) 106 #endif107 130 _HELENOS_PRINTF_ATTRIBUTE(2, 3); 131 #endif 108 132 extern int vsnprintf(char *, size_t, const char *, va_list); 133 134 extern int sprintf(char *, const char *, ...) 135 __attribute__((deprecated)) _HELENOS_PRINTF_ATTRIBUTE(2, 3); 136 extern int vsprintf(char *, const char *, va_list) __attribute__((deprecated)); 109 137 110 138 /* Formatted input */ … … 124 152 extern size_t fwrite(const void *, size_t, size_t, FILE *); 125 153 154 extern int fgetpos(FILE *, fpos_t *); 155 extern int fsetpos(FILE *, const fpos_t *); 156 126 157 extern int fseek(FILE *, long, int); 127 158 extern void rewind(FILE *); … … 133 164 extern void clearerr(FILE *); 134 165 166 extern void perror(const char *); 167 135 168 extern void setvbuf(FILE *, void *, int, size_t); 136 169 extern void setbuf(FILE *, void *); 137 170 138 171 /* Misc file functions */ 172 extern int remove(const char *); 139 173 extern int rename(const char *, const char *); 140 extern int remove(const char *); 141 142 #ifndef _HELENOS_SOURCE 143 #define _IONBF 0 144 #define _IOLBF 1 145 #define _IOFBF 2 146 147 extern char *gets(char *, size_t); 148 149 #endif 174 175 extern FILE *tmpfile(void); 176 extern char *tmpnam(char *s) __attribute__((deprecated)); 150 177 151 178 #ifdef _HELENOS_SOURCE -
uspace/lib/c/include/stdlib.h
re768aea r8119363 87 87 extern int system(const char *); 88 88 89 extern int abs(int); 90 extern long labs(long); 91 extern long long llabs(long long); 92 89 93 extern int atoi(const char *); 90 94 extern long atol(const char *); -
uspace/lib/c/include/vfs/vfs.h
re768aea r8119363 45 45 #include <offset.h> 46 46 47 #define MAX_OPEN_FILES12847 #define VFS_MAX_OPEN_FILES 128 48 48 49 49 enum vfs_change_state_type { -
uspace/lib/c/test/main.c
re768aea r8119363 34 34 PCUT_IMPORT(circ_buf); 35 35 PCUT_IMPORT(fibril_timer); 36 PCUT_IMPORT(mem); 36 37 PCUT_IMPORT(odict); 37 38 PCUT_IMPORT(qsort); 38 39 PCUT_IMPORT(scanf); 39 40 PCUT_IMPORT(sprintf); 41 PCUT_IMPORT(stdio); 40 42 PCUT_IMPORT(stdlib); 41 43 PCUT_IMPORT(str); -
uspace/lib/c/test/stdlib.c
re768aea r8119363 361 361 } 362 362 363 /** abs function of positive number */ 364 PCUT_TEST(abs_pos) 365 { 366 int i; 367 368 i = abs(1); 369 PCUT_ASSERT_TRUE(i == 1); 370 } 371 372 /** abs function of negative number */ 373 PCUT_TEST(abs_neg) 374 { 375 int i; 376 377 i = abs(-1); 378 PCUT_ASSERT_TRUE(i == 1); 379 } 380 381 /** labs function of positive number */ 382 PCUT_TEST(labs_pos) 383 { 384 long li; 385 386 li = labs(1); 387 PCUT_ASSERT_TRUE(li == 1); 388 } 389 390 /** labs function of negative number */ 391 PCUT_TEST(labs_neg) 392 { 393 long li; 394 395 li = labs(-1); 396 PCUT_ASSERT_TRUE(li == 1); 397 } 398 399 /** llabs function of positive number */ 400 PCUT_TEST(llabs_pos) 401 { 402 long long lli; 403 404 lli = llabs(1); 405 PCUT_ASSERT_TRUE(lli == 1); 406 } 407 408 /** llabs function of negative number */ 409 PCUT_TEST(llabs_neg) 410 { 411 long long lli; 412 413 lli = llabs(-1); 414 PCUT_ASSERT_TRUE(lli == 1); 415 } 416 363 417 /** Integer division */ 364 418 PCUT_TEST(div_func) -
uspace/lib/drv/include/pci_dev_iface.h
re768aea r8119363 42 42 #define PCI_VENDOR_ID 0x00 43 43 #define PCI_DEVICE_ID 0x02 44 #define PCI_STATUS 0x06 44 45 #define PCI_SUB_CLASS 0x0A 45 46 #define PCI_BASE_CLASS 0x0B 47 #define PCI_BAR0 0x10 48 #define PCI_CAP_PTR 0x34 49 50 #define PCI_BAR_COUNT 6 51 52 #define PCI_STATUS_CAP_LIST (1 << 4) 53 54 #define PCI_CAP_ID(c) ((c) + 0x0) 55 #define PCI_CAP_NEXT(c) ((c) + 0x1) 56 57 #define PCI_CAP_PMID 0x1 58 #define PCI_CAP_VENDORSPECID 0x9 46 59 47 60 extern errno_t pci_config_space_read_8(async_sess_t *, uint32_t, uint8_t *); … … 52 65 extern errno_t pci_config_space_write_16(async_sess_t *, uint32_t, uint16_t); 53 66 extern errno_t pci_config_space_write_32(async_sess_t *, uint32_t, uint32_t); 67 68 static inline errno_t 69 pci_config_space_cap_first(async_sess_t *sess, uint8_t *c, uint8_t *id) 70 { 71 errno_t rc; 72 uint16_t status; 73 74 rc = pci_config_space_read_16(sess, PCI_STATUS, &status); 75 if (rc != EOK) 76 return rc; 77 78 if (!(status & PCI_STATUS_CAP_LIST)) { 79 *c = 0; 80 return EOK; 81 } 82 83 rc = pci_config_space_read_8(sess, PCI_CAP_PTR, c); 84 if (rc != EOK) 85 return rc; 86 if (!c) 87 return EOK; 88 return pci_config_space_read_8(sess, PCI_CAP_ID(*c), id); 89 } 90 91 static inline errno_t 92 pci_config_space_cap_next(async_sess_t *sess, uint8_t *c, uint8_t *id) 93 { 94 errno_t rc = pci_config_space_read_8(sess, PCI_CAP_NEXT(*c), c); 95 if (rc != EOK) 96 return rc; 97 if (!c) 98 return EOK; 99 return pci_config_space_read_8(sess, PCI_CAP_ID(*c), id); 100 } 54 101 55 102 /** PCI device communication interface. */ -
uspace/lib/posix/Makefile
re768aea r8119363 82 82 TEST_SOURCES = \ 83 83 test/main.c \ 84 test/scanf.c 84 test/stdio.c \ 85 test/stdlib.c \ 86 test/unistd.c 87 88 EXTRA_TEST_CFLAGS = -Wno-deprecated-declarations 85 89 86 90 EXPORT_CPPFLAGS = \ -
uspace/lib/posix/include/posix/stdio.h
re768aea r8119363 48 48 extern int fileno(FILE *); 49 49 50 #define P_tmpdir "/tmp" 51 50 52 /* Identifying the Terminal */ 51 53 #undef L_ctermid … … 59 61 FILE *__restrict__ stream); 60 62 61 /* Error Messages */62 extern void perror(const char *s);63 64 /* File Positioning */65 typedef struct {66 off64_t offset;67 } fpos_t;68 69 extern int fsetpos(FILE *stream, const fpos_t *pos);70 extern int fgetpos(FILE *__restrict__ stream, fpos_t *__restrict__ pos);71 63 extern int fseeko(FILE *stream, off_t offset, int whence); 72 64 extern off_t ftello(FILE *stream); … … 76 68 _HELENOS_PRINTF_ATTRIBUTE(2, 3); 77 69 extern int vdprintf(int fildes, const char *__restrict__ format, va_list ap); 78 extern int sprintf(char *__restrict__ s, const char *__restrict__ format, ...)79 _HELENOS_PRINTF_ATTRIBUTE(2, 3);80 extern int vsprintf(char *__restrict__ s, const char *__restrict__ format, va_list ap);81 70 82 71 /* File Locking */ … … 90 79 91 80 /* Temporary Files */ 92 #undef L_tmpnam93 #define L_tmpnam PATH_MAX94 extern char *tmpnam(char *s);95 81 extern char *tempnam(const char *dir, const char *pfx); 96 extern FILE *tmpfile(void);97 82 98 83 #endif /* POSIX_STDIO_H_ */ -
uspace/lib/posix/include/posix/stdlib.h
re768aea r8119363 42 42 #include <_bits/NULL.h> 43 43 44 /* Absolute Value */45 extern int abs(int i);46 extern long labs(long i);47 extern long long llabs(long long i);48 49 44 /* Environment Access */ 50 45 extern int putenv(char *string); … … 63 58 64 59 /* Legacy Declarations */ 65 extern char *mktemp(char *tmpl) ;60 extern char *mktemp(char *tmpl) __attribute__((deprecated)); 66 61 extern int bsd_getloadavg(double loadavg[], int nelem); 67 62 -
uspace/lib/posix/include/posix/string.h
re768aea r8119363 36 36 #ifndef POSIX_STRING_H_ 37 37 #define POSIX_STRING_H_ 38 39 #include "sys/types.h"40 41 38 /* 42 39 * TODO: not implemented due to missing locale support … … 48 45 49 46 #include <_bits/NULL.h> 47 #include <_bits/size_t.h> 50 48 51 /* 52 * These are the same as in HelenOS libc. 53 * It would be possible to directly include <str.h> and <mem.h> but 54 * it is better not to pollute POSIX namespace with other functions 55 * defined in that header. 56 * 57 * Because libposix is always linked with libc, providing only these 58 * forward declarations ought to be enough. 59 */ 60 61 /* From mem.h */ 62 // #define bzero(ptr, len) memset((ptr), 0, (len)) 63 extern void *memset(void *, int, size_t) 64 __attribute__((nonnull(1))); 65 extern void *memcpy(void *, const void *, size_t) 66 __attribute__((nonnull(1, 2))); 67 extern void *memmove(void *, const void *, size_t) 68 __attribute__((nonnull(1, 2))); 69 49 #include "libc/mem.h" 70 50 71 51 /* Copying and Concatenation */ … … 80 60 extern char *strndup(const char *s, size_t n); 81 61 82 /* String/Array Comparison */ 83 extern int memcmp(const void *mem1, const void *mem2, size_t n); 62 /* String Comparison */ 84 63 extern int strcmp(const char *s1, const char *s2); 85 64 extern int strncmp(const char *s1, const char *s2, size_t n); 86 65 87 66 /* Search Functions */ 88 extern void *memchr(const void *mem, int c, size_t n);89 67 extern char *strchr(const char *s, int c); 90 68 extern char *strrchr(const char *s, int c); … … 122 100 #endif 123 101 124 125 102 #endif // POSIX_STRING_H_ 126 103 -
uspace/lib/posix/src/internal/common.h
re768aea r8119363 66 66 } 67 67 68 extern aoff64_t posix_pos[ MAX_OPEN_FILES];68 extern aoff64_t posix_pos[VFS_MAX_OPEN_FILES]; 69 69 70 70 #endif /* LIBPOSIX_COMMON_H_ */ -
uspace/lib/posix/src/stdio.c
re768aea r8119363 2 2 * Copyright (c) 2011 Jiri Zarevucky 3 3 * Copyright (c) 2011 Petr Koupy 4 * Copyright (c) 2018 Jiri Svoboda 4 5 * All rights reserved. 5 6 * … … 38 39 39 40 #include <assert.h> 40 41 41 #include <errno.h> 42 42 #include <stdbool.h> 43 #include <tmpfile.h> 44 45 #include "posix/fcntl.h" 43 46 #include "posix/stdlib.h" 44 47 #include "posix/string.h" 48 #include "posix/sys/stat.h" 45 49 #include "posix/sys/types.h" 46 50 #include "posix/unistd.h" … … 169 173 170 174 /** 171 * Write error messages to standard error.172 *173 * @param s Error message.174 */175 void perror(const char *s)176 {177 if (s == NULL || s[0] == '\0') {178 fprintf(stderr, "%s\n", strerror(errno));179 } else {180 fprintf(stderr, "%s: %s\n", s, strerror(errno));181 }182 }183 184 /** Restores stream a to position previously saved with fgetpos().185 *186 * @param stream Stream to restore187 * @param pos Position to restore188 * @return Zero on success, non-zero (with errno set) on failure189 */190 int fsetpos(FILE *stream, const fpos_t *pos)191 {192 return fseek64(stream, pos->offset, SEEK_SET);193 }194 195 /** Saves the stream's position for later use by fsetpos().196 *197 * @param stream Stream to save198 * @param pos Place to store the position199 * @return Zero on success, non-zero (with errno set) on failure200 */201 int fgetpos(FILE *restrict stream, fpos_t *restrict pos)202 {203 off64_t ret = ftell64(stream);204 if (ret != -1) {205 pos->offset = ret;206 return 0;207 } else {208 return -1;209 }210 }211 212 /**213 175 * Reposition a file-position indicator in a stream. 214 176 * … … 320 282 321 283 /** 322 * Print formatted output to the string.323 *324 * @param s Output string.325 * @param format Format description.326 * @return Either the number of printed characters (excluding null byte) or327 * negative value on error.328 */329 int sprintf(char *s, const char *restrict format, ...)330 {331 va_list list;332 va_start(list, format);333 int result = vsprintf(s, format, list);334 va_end(list);335 return result;336 }337 338 /**339 * Print formatted output to the string.340 *341 * @param s Output string.342 * @param format Format description.343 * @param ap Print arguments.344 * @return Either the number of printed characters (excluding null byte) or345 * negative value on error.346 */347 int vsprintf(char *s, const char *restrict format, va_list ap)348 {349 return vsnprintf(s, INT_MAX, format, ap);350 }351 352 /**353 284 * Acquire file stream for the thread. 354 285 * … … 426 357 } 427 358 428 /** 429 * Get a unique temporary file name (obsolete). 430 * 431 * @param s Buffer for the file name. Must be at least L_tmpnam bytes long. 432 * @return The value of s on success, NULL on failure. 433 */ 434 char *tmpnam(char *s) 435 { 436 assert(L_tmpnam >= strlen("/tmp/tnXXXXXX")); 437 438 static char buffer[L_tmpnam + 1]; 439 if (s == NULL) { 440 s = buffer; 441 } 442 443 strcpy(s, "/tmp/tnXXXXXX"); 444 mktemp(s); 445 446 if (*s == '\0') { 447 /* Errno set by mktemp(). */ 448 return NULL; 449 } 450 451 return s; 452 } 453 454 /** 455 * Get an unique temporary file name with additional constraints (obsolete). 359 /** Determine if directory is an 'appropriate' temporary directory. 360 * 361 * @param dir Directory path 362 * @return @c true iff directory is appropriate. 363 */ 364 static bool is_appropriate_tmpdir(const char *dir) 365 { 366 struct stat sbuf; 367 368 /* Must not be NULL */ 369 if (dir == NULL) 370 return false; 371 372 /* Must not be empty */ 373 if (dir[0] == '\0') 374 return false; 375 376 if (stat(dir, &sbuf) != 0) 377 return false; 378 379 /* Must be a directory */ 380 if ((sbuf.st_mode & S_IFMT) != S_IFDIR) 381 return false; 382 383 /* Must be writable */ 384 if (access(dir, W_OK) != 0) 385 return false; 386 387 return true; 388 } 389 390 /** Construct unique file name. 391 * 392 * Never use this function. 456 393 * 457 394 * @param dir Path to directory, where the file should be created. … … 461 398 char *tempnam(const char *dir, const char *pfx) 462 399 { 463 /* Sequence number of the filename. */ 464 static int seq = 0; 465 466 size_t dir_len = strlen(dir); 467 if (dir[dir_len - 1] == '/') { 468 dir_len--; 469 } 470 471 size_t pfx_len = strlen(pfx); 472 if (pfx_len > 5) { 473 pfx_len = 5; 474 } 475 476 char *result = malloc(dir_len + /* slash*/ 1 + 477 pfx_len + /* three-digit seq */ 3 + /* .tmp */ 4 + /* nul */ 1); 478 479 if (result == NULL) { 480 errno = ENOMEM; 400 const char *dpref; 401 char *d; 402 char *buf; 403 int rc; 404 405 d = getenv("TMPDIR"); 406 if (is_appropriate_tmpdir(d)) 407 dpref = d; 408 else if (is_appropriate_tmpdir(dir)) 409 dpref = dir; 410 else if (is_appropriate_tmpdir(P_tmpdir)) 411 dpref = P_tmpdir; 412 else 413 dpref = "/"; 414 415 if (dpref[strlen(dpref) - 1] != '/') 416 rc = asprintf(&buf, "%s/%sXXXXXX", dpref, pfx); 417 else 418 rc = asprintf(&buf, "%s%sXXXXXX", dpref, pfx); 419 420 if (rc < 0) 421 return NULL; 422 423 rc = __tmpfile_templ(buf, false); 424 if (rc != 0) { 425 free(buf); 481 426 return NULL; 482 427 } 483 428 484 char *res_ptr = result; 485 strncpy(res_ptr, dir, dir_len); 486 res_ptr += dir_len; 487 strncpy(res_ptr, pfx, pfx_len); 488 res_ptr += pfx_len; 489 490 for (; seq < 1000; ++seq) { 491 snprintf(res_ptr, 8, "%03d.tmp", seq); 492 493 int orig_errno = errno; 494 errno = EOK; 495 /* Check if the file exists. */ 496 if (access(result, F_OK) == -1) { 497 if (errno == ENOENT) { 498 errno = orig_errno; 499 break; 500 } else { 501 /* errno set by access() */ 502 return NULL; 503 } 504 } 505 } 506 507 if (seq == 1000) { 508 free(result); 509 errno = EINVAL; 510 return NULL; 511 } 512 513 return result; 514 } 515 516 /** 517 * Create and open an unique temporary file. 518 * The file is automatically removed when the stream is closed. 519 * 520 * @param dir Path to directory, where the file should be created. 521 * @param pfx Optional prefix up to 5 characters long. 522 * @return Newly allocated unique path for temporary file. NULL on failure. 523 */ 524 FILE *tmpfile(void) 525 { 526 char filename[] = "/tmp/tfXXXXXX"; 527 int fd = mkstemp(filename); 528 if (fd == -1) { 529 /* errno set by mkstemp(). */ 530 return NULL; 531 } 532 533 /* Unlink the created file, so that it's removed on close(). */ 534 unlink(filename); 535 return fdopen(fd, "w+"); 429 return buf; 536 430 } 537 431 -
uspace/lib/posix/src/stdlib.c
re768aea r8119363 38 38 39 39 #include <errno.h> 40 #include <tmpfile.h> 40 41 41 42 #include "posix/fcntl.h" … … 49 50 #include "libc/vfs/vfs.h" 50 51 #include "libc/stats.h" 51 52 /**53 * Integer absolute value.54 *55 * @param i Input value.56 * @return Absolute value of the parameter.57 */58 int abs(int i)59 {60 return i < 0 ? -i : i;61 }62 63 /**64 * Long integer absolute value.65 *66 * @param i Input value.67 * @return Absolute value of the parameter.68 */69 long labs(long i)70 {71 return i < 0 ? -i : i;72 }73 74 /**75 * Long long integer absolute value.76 *77 * @param i Input value.78 * @return Absolute value of the parameter.79 */80 long long llabs(long long i)81 {82 return i < 0 ? -i : i;83 }84 52 85 53 /** … … 196 164 int mkstemp(char *tmpl) 197 165 { 198 int fd = -1; 199 200 char *tptr = tmpl + strlen(tmpl) - 6; 201 202 while (fd < 0) { 203 if (*mktemp(tmpl) == '\0') { 204 /* Errno set by mktemp(). */ 205 return -1; 206 } 207 208 fd = open(tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); 209 210 if (fd == -1) { 211 /* Restore template to it's original state. */ 212 snprintf(tptr, 7, "XXXXXX"); 213 } 214 } 215 216 return fd; 166 int tmpl_len; 167 int file; 168 169 tmpl_len = strlen(tmpl); 170 if (tmpl_len < 6) { 171 errno = EINVAL; 172 return -1; 173 } 174 175 char *tptr = tmpl + tmpl_len - 6; 176 if (strcmp(tptr, "XXXXXX") != 0) { 177 errno = EINVAL; 178 return -1; 179 } 180 181 file = __tmpfile_templ(tmpl, true); 182 if (file < 0) { 183 errno = EIO; // XXX could be more specific 184 return -1; 185 } 186 187 return file; 217 188 } 218 189 … … 227 198 char *mktemp(char *tmpl) 228 199 { 229 int tmpl_len = strlen(tmpl); 200 int tmpl_len; 201 int rc; 202 203 tmpl_len = strlen(tmpl); 230 204 if (tmpl_len < 6) { 231 205 errno = EINVAL; … … 241 215 } 242 216 243 static int seq = 0; 244 245 for (; seq < 1000000; ++seq) { 246 snprintf(tptr, 7, "%06d", seq); 247 248 int orig_errno = errno; 249 errno = 0; 250 /* Check if the file exists. */ 251 if (access(tmpl, F_OK) == -1) { 252 if (errno == ENOENT) { 253 errno = orig_errno; 254 break; 255 } else { 256 /* errno set by access() */ 257 *tmpl = '\0'; 258 return tmpl; 259 } 260 } 261 } 262 263 if (seq == 10000000) { 264 errno = EEXIST; 217 rc = __tmpfile_templ(tmpl, false); 218 if (rc != 0) { 219 errno = EIO; // XXX could be more specific 265 220 *tmpl = '\0'; 266 221 return tmpl; -
uspace/lib/posix/src/stdlib/strtold.c
re768aea r8119363 52 52 #ifndef HUGE_VALL 53 53 #define HUGE_VALL (+1.0l / +0.0l) 54 #endif55 56 #ifndef abs57 #define abs(x) (((x) < 0) ? -(x) : (x))58 54 #endif 59 55 -
uspace/lib/posix/src/string.c
re768aea r8119363 288 288 289 289 return 0; 290 }291 292 /**293 * Find byte in memory.294 *295 * @param mem Memory area in which to look for the byte.296 * @param c Byte to look for.297 * @param n Maximum number of bytes to be inspected.298 * @return Pointer to the specified byte on success,299 * NULL pointer otherwise.300 */301 void *memchr(const void *mem, int c, size_t n)302 {303 assert(mem != NULL);304 305 const unsigned char *s = mem;306 307 for (size_t i = 0; i < n; ++i) {308 if (s[i] == (unsigned char) c) {309 return (void *) &s[i];310 }311 }312 return NULL;313 290 } 314 291 -
uspace/lib/posix/src/unistd.c
re768aea r8119363 39 39 #include <errno.h> 40 40 41 #include "posix/dirent.h" 41 42 #include "posix/string.h" 43 #include "posix/sys/types.h" 42 44 #include "posix/fcntl.h" 43 45 … … 51 53 52 54 // FIXME: replace with a hash table 53 aoff64_t posix_pos[ MAX_OPEN_FILES];55 aoff64_t posix_pos[VFS_MAX_OPEN_FILES]; 54 56 55 57 /* Array of environment variable strings (NAME=VALUE). */ … … 368 370 */ 369 371 int fd = open(path, O_RDONLY); 370 if (fd < 0) 371 return -1; 372 close(fd); 373 return 0; 372 if (fd >= 0) { 373 close(fd); 374 return 0; 375 } 376 DIR *dir = opendir(path); 377 if (dir != NULL) { 378 closedir(dir); 379 return 0; 380 } 381 return -1; 374 382 } else { 375 383 /* Invalid amode argument. */ -
uspace/lib/posix/test/main.c
re768aea r8119363 1 1 /* 2 * Copyright (c) 201 4 Vojtech Horky2 * Copyright (c) 2018 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 31 31 PCUT_INIT; 32 32 33 PCUT_IMPORT(scanf); 33 PCUT_IMPORT(stdio); 34 PCUT_IMPORT(stdlib); 35 PCUT_IMPORT(unistd); 34 36 35 37 PCUT_MAIN(); -
uspace/srv/vfs/vfs_file.c
re768aea r8119363 71 71 fibril_mutex_lock(&vfs_data->lock); 72 72 if (!vfs_data->files) { 73 vfs_data->files = malloc( MAX_OPEN_FILES * sizeof(vfs_file_t *));73 vfs_data->files = malloc(VFS_MAX_OPEN_FILES * sizeof(vfs_file_t *)); 74 74 if (!vfs_data->files) { 75 75 fibril_mutex_unlock(&vfs_data->lock); 76 76 return false; 77 77 } 78 memset(vfs_data->files, 0, MAX_OPEN_FILES * sizeof(vfs_file_t *));78 memset(vfs_data->files, 0, VFS_MAX_OPEN_FILES * sizeof(vfs_file_t *)); 79 79 } 80 80 fibril_mutex_unlock(&vfs_data->lock); … … 90 90 return; 91 91 92 for (i = 0; i < MAX_OPEN_FILES; i++) {92 for (i = 0; i < VFS_MAX_OPEN_FILES; i++) { 93 93 if (vfs_data->files[i]) 94 94 (void) _vfs_fd_free(vfs_data, i); … … 199 199 unsigned int i; 200 200 if (desc) 201 i = MAX_OPEN_FILES - 1;201 i = VFS_MAX_OPEN_FILES - 1; 202 202 else 203 203 i = 0; … … 233 233 i--; 234 234 } else { 235 if (i == MAX_OPEN_FILES - 1)235 if (i == VFS_MAX_OPEN_FILES - 1) 236 236 break; 237 237 … … 261 261 static errno_t _vfs_fd_free_locked(vfs_client_data_t *vfs_data, int fd) 262 262 { 263 if ((fd < 0) || (fd >= MAX_OPEN_FILES) || !vfs_data->files[fd]) {263 if ((fd < 0) || (fd >= VFS_MAX_OPEN_FILES) || !vfs_data->files[fd]) { 264 264 return EBADF; 265 265 } … … 311 311 312 312 fibril_mutex_lock(&VFS_DATA->lock); 313 if ((fd < 0) || (fd >= MAX_OPEN_FILES)) {313 if ((fd < 0) || (fd >= VFS_MAX_OPEN_FILES)) { 314 314 fibril_mutex_unlock(&VFS_DATA->lock); 315 315 return EBADF; … … 342 342 343 343 fibril_mutex_lock(&vfs_data->lock); 344 if ((fd >= 0) && (fd < MAX_OPEN_FILES)) {344 if ((fd >= 0) && (fd < VFS_MAX_OPEN_FILES)) { 345 345 vfs_file_t *file = vfs_data->files[fd]; 346 346 if (file != NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.