summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/arm/bits/errno.h60
-rw-r--r--libc/sysdeps/linux/common/create_module.c2
-rw-r--r--libc/sysdeps/linux/common/errno.c1
-rw-r--r--libc/sysdeps/linux/common/getdnnm.c4
-rw-r--r--libc/sysdeps/linux/common/gethstnm.c4
-rw-r--r--libc/sysdeps/linux/common/seteuid.c2
-rw-r--r--libc/sysdeps/linux/common/syscalls.c2
-rw-r--r--libc/sysdeps/linux/i386/__init_brk.c6
-rw-r--r--libc/sysdeps/linux/i386/brk.c6
-rw-r--r--libc/sysdeps/linux/i386/sbrk.c6
-rw-r--r--libc/sysdeps/linux/m68k/ptrace.c4
11 files changed, 79 insertions, 18 deletions
diff --git a/libc/sysdeps/linux/arm/bits/errno.h b/libc/sysdeps/linux/arm/bits/errno.h
new file mode 100644
index 000000000..6bfd44e0c
--- /dev/null
+++ b/libc/sysdeps/linux/arm/bits/errno.h
@@ -0,0 +1,60 @@
+/* Error constants. Linux specific version.
+ Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifdef _ERRNO_H
+
+# undef EDOM
+# undef EILSEQ
+# undef ERANGE
+# include <linux/errno.h>
+
+/* Linux has no ENOTSUP error code. */
+# define ENOTSUP EOPNOTSUPP
+
+/* Linux also has no ECANCELED error code. Since it is not used here
+ we define it to an invalid value. */
+# define ECANCELED 125
+
+# ifndef __ASSEMBLER__
+/* We now need a declaration of the `errno' variable. */
+extern int errno;
+
+/* Function to get address of global `errno' variable. */
+extern int *__errno_location (void) __THROW __attribute__ ((__const__));
+
+# if defined _LIBC
+/* We wouldn't need a special macro anymore but it is history. */
+# define __set_errno(val) (*__errno_location ()) = (val)
+# endif /* _LIBC */
+
+# if !defined _LIBC || defined _LIBC_REENTRANT
+/* When using threads, errno is a per-thread value. */
+# define errno (*__errno_location ())
+# endif
+# endif /* !__ASSEMBLER__ */
+#endif /* _ERRNO_H */
+
+#if !defined _ERRNO_H && defined __need_Emath
+/* This is ugly but the kernel header is not clean enough. We must
+ define only the values EDOM, EILSEQ and ERANGE in case __need_Emath is
+ defined. */
+# define EDOM 33 /* Math argument out of domain of function. */
+# define EILSEQ 84 /* Illegal byte sequence. */
+# define ERANGE 34 /* Math result not representable. */
+#endif /* !_ERRNO_H && __need_Emath */
diff --git a/libc/sysdeps/linux/common/create_module.c b/libc/sysdeps/linux/common/create_module.c
index 1cacaefaf..223b909f5 100644
--- a/libc/sysdeps/linux/common/create_module.c
+++ b/libc/sysdeps/linux/common/create_module.c
@@ -42,7 +42,7 @@ unsigned long create_module(const char *name, size_t size)
/* Jump through hoops to fixup error return codes */
if (ret == -1 && errno > 125) {
ret = -errno;
- errno = 0;
+ __set_errno(0);
}
return ret;
}
diff --git a/libc/sysdeps/linux/common/errno.c b/libc/sysdeps/linux/common/errno.c
index 418fc933b..e6a8ae875 100644
--- a/libc/sysdeps/linux/common/errno.c
+++ b/libc/sysdeps/linux/common/errno.c
@@ -6,3 +6,4 @@ int * __errno_location ( void )
{
return &errno;
}
+
diff --git a/libc/sysdeps/linux/common/getdnnm.c b/libc/sysdeps/linux/common/getdnnm.c
index fdcbb0f3a..46751b1e7 100644
--- a/libc/sysdeps/linux/common/getdnnm.c
+++ b/libc/sysdeps/linux/common/getdnnm.c
@@ -9,14 +9,14 @@ getdomainname(char *name, size_t len)
struct utsname uts;
if (name == NULL) {
- errno = EINVAL;
+ __set_errno(EINVAL);
return -1;
}
if (uname(&uts) == -1) return -1;
if (strlen(uts.domainname)+1 > len) {
- errno = EINVAL;
+ __set_errno(EINVAL);
return -1;
}
strcpy(name, uts.domainname);
diff --git a/libc/sysdeps/linux/common/gethstnm.c b/libc/sysdeps/linux/common/gethstnm.c
index 0728f65a4..0f7a04681 100644
--- a/libc/sysdeps/linux/common/gethstnm.c
+++ b/libc/sysdeps/linux/common/gethstnm.c
@@ -9,14 +9,14 @@ gethostname(char *name, size_t len)
struct utsname uts;
if (name == NULL) {
- errno = EINVAL;
+ __set_errno(EINVAL);
return -1;
}
if (uname(&uts) == -1) return -1;
if (strlen(uts.nodename)+1 > len) {
- errno = EINVAL;
+ __set_errno(EINVAL);
return -1;
}
strcpy(name, uts.nodename);
diff --git a/libc/sysdeps/linux/common/seteuid.c b/libc/sysdeps/linux/common/seteuid.c
index 179477a14..a0a63610d 100644
--- a/libc/sysdeps/linux/common/seteuid.c
+++ b/libc/sysdeps/linux/common/seteuid.c
@@ -9,7 +9,7 @@ int seteuid(uid_t uid)
case 2:
if (uid == 65535)
{
- errno = EINVAL;
+ __set_errno(EINVAL);
return -1;
}
break;
diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c
index ca0b3a317..8d51f1f4f 100644
--- a/libc/sysdeps/linux/common/syscalls.c
+++ b/libc/sysdeps/linux/common/syscalls.c
@@ -139,7 +139,7 @@ int _xmknod (int version, const char * path, mode_t mode, dev_t *dev)
case 1:
return mknod (path, mode, *dev);
default:
- errno = EINVAL;
+ __set_errno(EINVAL);
return -1;
}
}
diff --git a/libc/sysdeps/linux/i386/__init_brk.c b/libc/sysdeps/linux/i386/__init_brk.c
index c2ae482dd..4d9746342 100644
--- a/libc/sysdeps/linux/i386/__init_brk.c
+++ b/libc/sysdeps/linux/i386/__init_brk.c
@@ -17,15 +17,15 @@ __init_brk ()
"int $0x80\n\t"
"popl %%ebx"
:"=a" (___brk_addr)
- :"0" (SYS_brk));
+ :"0" (__NR_brk));
#else
__asm__ volatile ("int $0x80"
:"=a" (___brk_addr)
- :"0" (SYS_brk),"b" (0));
+ :"0" (__NR_brk),"b" (0));
#endif
if (___brk_addr == 0)
{
- errno = ENOMEM;
+ __set_errno(ENOMEM);
return -1;
}
}
diff --git a/libc/sysdeps/linux/i386/brk.c b/libc/sysdeps/linux/i386/brk.c
index 2a776bac1..9e06d0acc 100644
--- a/libc/sysdeps/linux/i386/brk.c
+++ b/libc/sysdeps/linux/i386/brk.c
@@ -18,15 +18,15 @@ int brk(void * end_data_seg)
"int $0x80\n\t"
"popl %%ebx"
:"=a" (___brk_addr)
- :"0" (SYS_brk),"c" (end_data_seg));
+ :"0" (__NR_brk),"c" (end_data_seg));
#else
__asm__ volatile ("int $0x80"
:"=a" (___brk_addr)
- :"0" (SYS_brk),"b" (end_data_seg));
+ :"0" (__NR_brk),"b" (end_data_seg));
#endif
if (___brk_addr == end_data_seg)
return 0;
- errno = ENOMEM;
+ __set_errno(ENOMEM);
}
return -1;
}
diff --git a/libc/sysdeps/linux/i386/sbrk.c b/libc/sysdeps/linux/i386/sbrk.c
index f5099d7e8..ca987aa8c 100644
--- a/libc/sysdeps/linux/i386/sbrk.c
+++ b/libc/sysdeps/linux/i386/sbrk.c
@@ -20,15 +20,15 @@ sbrk(ptrdiff_t increment)
"int $0x80\n\t"
"popl %%ebx"
:"=a" (___brk_addr)
- :"0" (SYS_brk),"c" (tmp));
+ :"0" (__NR_brk),"c" (tmp));
#else
__asm__ volatile ("int $0x80"
:"=a" (___brk_addr)
- :"0" (SYS_brk),"b" (tmp));
+ :"0" (__NR_brk),"b" (tmp));
#endif
if (___brk_addr == tmp)
return tmp-increment;
- errno = ENOMEM;
+ __set_errno(ENOMEM);
return ((void *) -1);
}
return ((void *) -1);
diff --git a/libc/sysdeps/linux/m68k/ptrace.c b/libc/sysdeps/linux/m68k/ptrace.c
index 383f72615..a82adc765 100644
--- a/libc/sysdeps/linux/m68k/ptrace.c
+++ b/libc/sysdeps/linux/m68k/ptrace.c
@@ -23,11 +23,11 @@ ptrace(int request, int pid, int addr, int data)
if (res >= 0) {
if (request > 0 && request < 4) {
- errno = 0;
+ __set_errno(0);
return (ret);
}
return (int) res;
}
- errno = -res;
+ __set_errno(-res);
return -1;
}