summaryrefslogtreecommitdiff
path: root/libc/misc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-04-06 20:28:45 +0000
committerEric Andersen <andersen@codepoet.org>2001-04-06 20:28:45 +0000
commit6278781655261a5011376b2fa2600996e32ca889 (patch)
tree11783e71b36c8c546c4dc02dff355b0f2478978b /libc/misc
parenta704ccaa5232184844cd67315951b39f85a6ba04 (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/misc')
-rw-r--r--libc/misc/dirent/closedir.c4
-rw-r--r--libc/misc/dirent/dirfd.c2
-rw-r--r--libc/misc/dirent/opendir.c6
-rw-r--r--libc/misc/dirent/readdir.c6
-rw-r--r--libc/misc/dirent/rewinddir.c2
-rw-r--r--libc/misc/dirent/seekdir.c2
-rw-r--r--libc/misc/dirent/telldir.c4
-rw-r--r--libc/misc/internals/__uClibc_main.c2
-rw-r--r--libc/misc/lock/flock.c2
-rw-r--r--libc/misc/regex/regex.c3
-rw-r--r--libc/misc/syslog/syslog.c2
-rw-r--r--libc/misc/time/adjtime.c2
12 files changed, 20 insertions, 17 deletions
diff --git a/libc/misc/dirent/closedir.c b/libc/misc/dirent/closedir.c
index f2ead00f2..a2ac83b17 100644
--- a/libc/misc/dirent/closedir.c
+++ b/libc/misc/dirent/closedir.c
@@ -9,13 +9,13 @@ int closedir(DIR * dir)
int fd;
if (!dir) {
- errno = EBADF;
+ __set_errno(EBADF);
return -1;
}
/* We need to check dd_fd. */
if (dir->dd_fd == -1) {
- errno = EBADF;
+ __set_errno(EBADF);
return -1;
}
fd = dir->dd_fd;
diff --git a/libc/misc/dirent/dirfd.c b/libc/misc/dirent/dirfd.c
index d401dccd2..d6c1e6647 100644
--- a/libc/misc/dirent/dirfd.c
+++ b/libc/misc/dirent/dirfd.c
@@ -4,7 +4,7 @@
int dirfd(DIR * dir)
{
if (!dir || dir->dd_fd == -1) {
- errno = EBADF;
+ __set_errno(EBADF);
return -1;
}
diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c
index 329515447..0ac1637b3 100644
--- a/libc/misc/dirent/opendir.c
+++ b/libc/misc/dirent/opendir.c
@@ -21,7 +21,7 @@ DIR *opendir(const char *name)
if (stat(name, &statbuf))
return NULL;
if (!S_ISDIR(statbuf.st_mode)) {
- errno = ENOTDIR;
+ __set_errno(ENOTDIR);
return NULL;
}
if ((fd = open(name, O_RDONLY)) < 0)
@@ -33,7 +33,7 @@ DIR *opendir(const char *name)
return NULL;
if (!(ptr = malloc(sizeof(*ptr)))) {
close(fd);
- errno = ENOMEM;
+ __set_errno(ENOMEM);
return NULL;
}
@@ -44,7 +44,7 @@ DIR *opendir(const char *name)
if (!(buf = malloc(ptr->dd_max))) {
close(fd);
free(ptr);
- errno = ENOMEM;
+ __set_errno(ENOMEM);
return NULL;
}
ptr->dd_fd = fd;
diff --git a/libc/misc/dirent/readdir.c b/libc/misc/dirent/readdir.c
index a755ed24d..0bb03f4c2 100644
--- a/libc/misc/dirent/readdir.c
+++ b/libc/misc/dirent/readdir.c
@@ -14,7 +14,7 @@ struct dirent *readdir(DIR * dir)
struct dirent *de;
if (!dir) {
- errno = EBADF;
+ __set_errno(EBADF);
return NULL;
}
@@ -37,7 +37,7 @@ struct dirent *readdir(DIR * dir)
dir->dd_getdents = no_getdents;
abort();
}
- errno = result;
+ __set_errno(result);
}
return NULL;
@@ -63,7 +63,7 @@ struct dirent *readdir(DIR * dir)
if (strlen((char *) &de->d_type) > 10)
de->d_name[10] = 0;
strcpy(dir->dd_buf->d_name, (char *) &de->d_name);
- errno = 0;
+ __set_errno(0);
return dir->dd_buf;
}
diff --git a/libc/misc/dirent/rewinddir.c b/libc/misc/dirent/rewinddir.c
index 9d147fca2..2fff9101c 100644
--- a/libc/misc/dirent/rewinddir.c
+++ b/libc/misc/dirent/rewinddir.c
@@ -7,7 +7,7 @@
void rewinddir(DIR * dir)
{
if (!dir) {
- errno = EBADF;
+ __set_errno(EBADF);
return;
}
lseek(dir->dd_fd, 0, SEEK_SET);
diff --git a/libc/misc/dirent/seekdir.c b/libc/misc/dirent/seekdir.c
index 7e4f24f72..3ff9f5da9 100644
--- a/libc/misc/dirent/seekdir.c
+++ b/libc/misc/dirent/seekdir.c
@@ -6,7 +6,7 @@
void seekdir(DIR * dir, off_t offset)
{
if (!dir) {
- errno = EBADF;
+ __set_errno(EBADF);
return;
}
dir->dd_nextoff = lseek(dir->dd_fd, offset, SEEK_SET);
diff --git a/libc/misc/dirent/telldir.c b/libc/misc/dirent/telldir.c
index 33e163aba..872cddbf1 100644
--- a/libc/misc/dirent/telldir.c
+++ b/libc/misc/dirent/telldir.c
@@ -8,7 +8,7 @@ off_t telldir(DIR * dir)
off_t offset;
if (!dir) {
- errno = EBADF;
+ __set_errno(EBADF);
return -1;
}
@@ -27,7 +27,7 @@ off_t telldir(DIR * dir)
break;
default:
- errno = EBADF;
+ __set_errno(EBADF);
offset = -1;
}
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index 23ca473ee..26c028015 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -64,7 +64,7 @@ void __uClibc_main(int argc, char **argv, char **envp)
* have resulted in errno being set nonzero, so set it to 0 before
* we call main.
*/
- errno = 0;
+ __set_errno(0);
/*
* Finally, invoke application's main and then exit.
diff --git a/libc/misc/lock/flock.c b/libc/misc/lock/flock.c
index 3c1264655..80d15dfd4 100644
--- a/libc/misc/lock/flock.c
+++ b/libc/misc/lock/flock.c
@@ -42,7 +42,7 @@ int flock( int fd, int operation)
lbuf.l_type = F_UNLCK;
break;
default:
- errno = EINVAL;
+ __set_errno(EINVAL);
return -1;
}
diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c
index 64e754ee0..19e3e0cbb 100644
--- a/libc/misc/regex/regex.c
+++ b/libc/misc/regex/regex.c
@@ -19,6 +19,9 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+/* To exclude some unwanted junk.... */
+#undef _LIBC
+
/* AIX requires this to be the first thing in the file. */
#if defined _AIX && !defined REGEX_MALLOC
#pragma alloca
diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c
index 53a00f86d..b3c53ff7d 100644
--- a/libc/misc/syslog/syslog.c
+++ b/libc/misc/syslog/syslog.c
@@ -224,7 +224,7 @@ vsyslog( int pri, const char *fmt, va_list ap )
*/
end = tbuf + sizeof(tbuf) - 1;
- errno = saved_errno;
+ __set_errno(saved_errno);
p += vsnprintf(p, end - p, fmt, ap);
if (p >= end || p < head_end) { /* Returned -1 in case of error... */
static char truncate_msg[12] = "[truncated] ";
diff --git a/libc/misc/time/adjtime.c b/libc/misc/time/adjtime.c
index 12c1a2a40..2a9190e9b 100644
--- a/libc/misc/time/adjtime.c
+++ b/libc/misc/time/adjtime.c
@@ -24,7 +24,7 @@ adjtime(const struct timeval * itv, struct timeval * otv)
tmp.tv_usec = itv->tv_usec % 1000000L;
if (tmp.tv_sec > MAX_SEC || tmp.tv_sec < MIN_SEC)
{
- errno = EINVAL;
+ __set_errno(EINVAL);
return -1;
}
tntx.offset = tmp.tv_usec + tmp.tv_sec * 1000000L;