diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-04-06 20:28:45 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-04-06 20:28:45 +0000 |
commit | 6278781655261a5011376b2fa2600996e32ca889 (patch) | |
tree | 11783e71b36c8c546c4dc02dff355b0f2478978b /libc/unistd | |
parent | a704ccaa5232184844cd67315951b39f85a6ba04 (diff) |
Fix include/errno.h to not use kernel header, and instead use bits/errno.h.
This required we use _LIBC instead of __LIBC__ to be consistent with glibc.
This had some sideffects in sys/syscalls.h. While fixing things, I made
everything use __set_errno() for (eventual) thread support.
-Erik
Diffstat (limited to 'libc/unistd')
-rw-r--r-- | libc/unistd/getcwd.c | 10 | ||||
-rw-r--r-- | libc/unistd/sysconf.c | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/libc/unistd/getcwd.c b/libc/unistd/getcwd.c index c0be5c39e..ad68ed4a7 100644 --- a/libc/unistd/getcwd.c +++ b/libc/unistd/getcwd.c @@ -21,7 +21,7 @@ char *getcwd( char *buf, int size) path_size = size; if (size < 3) { - errno = ERANGE; + __set_errno(ERANGE); return NULL; } @@ -59,7 +59,7 @@ static char *recurser() return path_buf; } if (strlen(path_buf) + 4 > path_size) { - errno = ERANGE; + __set_errno(ERANGE); return 0; } strcat(path_buf, "/.."); @@ -90,7 +90,7 @@ ino_t this_ino; ptr = path_buf + slen - 1; if (*ptr != '/') { if (slen + 2 > path_size) { - errno = ERANGE; + __set_errno(ERANGE); return 0; } strcpy(++ptr, "/"); @@ -105,7 +105,7 @@ ino_t this_ino; while ((d = readdir(dp)) != 0) { if (slow_search || this_ino == d->d_ino) { if (slen + strlen(d->d_name) > path_size) { - errno = ERANGE; + __set_errno(ERANGE); return 0; } strcpy(ptr + 1, d->d_name); @@ -119,6 +119,6 @@ ino_t this_ino; } closedir(dp); - errno = ENOENT; + __set_errno(ENOENT); return 0; } diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c index 50d8e4bb5..702046874 100644 --- a/libc/unistd/sysconf.c +++ b/libc/unistd/sysconf.c @@ -52,8 +52,8 @@ * a constant. The pagesize on the target arch should not vary, * so it should be safe to set this as 0. */ -#define RETURN_NEG_1 errno = ENOSYS; return -1 -#define RETURN_FUNCTION(f) errno = EISNAM ; return (long int) #f +#define RETURN_NEG_1 __set_errno(ENOSYS); return -1 +#define RETURN_FUNCTION(f) __set_errno(EISNAM); return (long int) #f #define GETPAGESIZE_IS_DYNAMIC 0 #else #define RETURN_NEG_1 return -1 @@ -66,7 +66,7 @@ long int sysconf(int name) switch (name) { default: - errno=EINVAL; + __set_errno(EINVAL); return -1; case _SC_ARG_MAX: @@ -935,7 +935,7 @@ int main(void) } for (i=0; i<_UCLIBC_SYSCONF_NUM_VALID_ARGS ; i++) { - errno = 0; + __set_errno(0); r = ret_vals[i] = sysconf(i); switch(errno) { case EINVAL: /* we're missing a case! */ |