Changeset ec18957a in mainline
- Timestamp:
- 2011-07-08T00:54:24Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9c1984f
- Parents:
- 3f466c33
- Location:
- uspace/lib/posix
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/Makefile
r3f466c33 rec18957a 40 40 SOURCES = \ 41 41 ctype.c \ 42 errno.c \ 42 43 fcntl.c \ 43 44 fnmatch.c \ -
uspace/lib/posix/fcntl.c
r3f466c33 rec18957a 37 37 #include "internal/common.h" 38 38 #include "fcntl.h" 39 39 40 #include "libc/unistd.h" 40 41 #include "libc/vfs/vfs.h" 41 #include <errno.h>42 #include "errno.h" 42 43 43 44 /** … … 65 66 rc = fd_node(fd, &node); 66 67 if (rc != EOK) { 67 // TODO: propagate a POSIX compatible errno68 errno = -rc; 68 69 return -1; 69 70 } … … 72 73 int newfd = open_node(&node, 0); 73 74 if (newfd < 0) { 74 // TODO: propagate a POSIX compatible errno75 errno = -newfd; 75 76 return -1; 76 77 } … … 81 82 rc = dup2(fd, newfd); 82 83 if (rc != EOK) { 83 // TODO: propagate a POSIX compatible errno84 errno = -rc; 84 85 return -1; 85 86 } -
uspace/lib/posix/stdio/scanf.c
r3f466c33 rec18957a 39 39 40 40 #include "../assert.h" 41 #include <errno.h> // FIXME: use POSIX errno41 #include "../errno.h" 42 42 43 43 #include "../stdio.h" -
uspace/lib/posix/stdlib.c
r3f466c33 rec18957a 39 39 #include "stdlib.h" 40 40 41 #include "errno.h" 42 41 43 #include "libc/sort.h" 42 44 #include "libc/str.h" 43 45 #include "libc/vfs/vfs.h" 44 #include <errno.h> // FIXME: use POSIX errno45 46 46 47 /** -
uspace/lib/posix/stdlib/strtol.c
r3f466c33 rec18957a 40 40 #include "../limits.h" 41 41 #include "../ctype.h" 42 #include <errno.h> // FIXME: use POSIX errno42 #include "../errno.h" 43 43 44 44 // TODO: documentation -
uspace/lib/posix/stdlib/strtold.c
r3f466c33 rec18957a 35 35 #define LIBPOSIX_INTERNAL 36 36 37 /* Has tobe first. */37 /* Must be first. */ 38 38 #include "../stdbool.h" 39 39 … … 45 45 #include "../stdint.h" 46 46 #include "../strings.h" 47 #include <errno.h> // FIXME: use POSIX errno47 #include "../errno.h" 48 48 49 49 #ifndef HUGE_VALL -
uspace/lib/posix/string.c
r3f466c33 rec18957a 510 510 char *posix_strerror(int errnum) 511 511 { 512 /* uses function from libc, we just have to negate errno513 * (POSIX uses positive errorcodes, HelenOS has negative) 512 /* Uses function from libc, we just have to negate errno 513 * (POSIX uses positive errorcodes, HelenOS has negative). 514 514 */ 515 return (char *) str_error(-errnum); 515 // FIXME: not all POSIX error codes are in libc 516 return (char *) str_error(-posix_abs(errnum)); 516 517 } 517 518 -
uspace/lib/posix/sys/stat.c
r3f466c33 rec18957a 39 39 #include "stat.h" 40 40 41 #include "../errno.h" 41 42 #include "../libc/mem.h" 42 43 … … 76 77 { 77 78 struct stat hst; 78 if (fstat(fd, &hst) == -1) { 79 // TODO: propagate a POSIX compatible errno 79 int rc = fstat(fd, &hst); 80 if (rc < 0) { 81 /* fstat() returns negative error code instead of using errno. 82 */ 83 errno = -rc; 80 84 return -1; 81 85 } … … 107 111 { 108 112 struct stat hst; 109 if (stat(path, &hst) == -1) { 110 // TODO: propagate a POSIX compatible errno 113 int rc = stat(path, &hst); 114 if (rc < 0) { 115 /* stat() returns negative error code instead of using errno. 116 */ 117 errno = -rc; 111 118 return -1; 112 119 } -
uspace/lib/posix/unistd.c
r3f466c33 rec18957a 38 38 #include "internal/common.h" 39 39 #include "unistd.h" 40 #include <task.h> 41 #include <errno.h>40 41 #include "errno.h" 42 42 #include "string.h" 43 43 #include "fcntl.h" 44 #include <stats.h> 44 45 #include "libc/task.h" 46 #include "libc/stats.h" 45 47 #include "libc/malloc.h" 46 48 … … 145 147 /* Check file existence by attempt to open it. */ 146 148 int fd = open(path, O_RDONLY); 147 // TODO: propagate a POSIX compatible errno 148 int rc = fd < 0 ? -1 : 0; 149 close(fd); 150 return rc; 149 if (fd < 0) { 150 /* FIXME: open() returns error code as negative retval. */ 151 errno = -fd; 152 fd = -1; 153 } else { 154 close(fd); 155 } 156 return fd; 151 157 } else if (amode & (X_OK | W_OK | R_OK)) { 152 158 /* HelenOS doesn't support permissions, return success. */
Note:
See TracChangeset
for help on using the changeset viewer.