summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/frv/bits/syscalls.h
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-05-14 10:59:09 +0000
committerEric Andersen <andersen@codepoet.org>2004-05-14 10:59:09 +0000
commit297b6bb585320c9ee650258fb3d3e7e812cdc5a8 (patch)
tree5f2ef14066df9438b6fae31b949a03b5f82cf356 /libc/sysdeps/linux/frv/bits/syscalls.h
parentcd411309b5af27b1a02f324174d1caad98bc0927 (diff)
Alexandre Oliva writes:
Here are a number of minor changes to FR-V-specific bits of the uClibc port: - I've adjusted the definition of _dl_mmap to cope with the fact that there will be a definition for an mmap2-only system. - We don't have COPY relocs, so optimize the copy reloc-related code away. - Change the page size to 16KiB, to match the ABI spec, and not a stale value I'd copied from a linker config file. Oops. - Fix error handling in clone and vfork; parts of the changes by David Howells <dhowells@redhat.com> - Rearrange includes in crtreloc.c. - Change the API of __syscall_error, to reduce code size. - Improve __syscall_return in terms of code size, so as to enable tail-calling of __syscall_error, at least within libc. Ideally, __syscall_error should be hidden within libc.so, but this didn't work because of libdl. I haven't looked into why, and figured I'd leave it visible for now. - Rename enumerators and macros in sys/ucontext.h to reduce namespace pollution.
Diffstat (limited to 'libc/sysdeps/linux/frv/bits/syscalls.h')
-rw-r--r--libc/sysdeps/linux/frv/bits/syscalls.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/libc/sysdeps/linux/frv/bits/syscalls.h b/libc/sysdeps/linux/frv/bits/syscalls.h
index 552f7e7c4..44dba866b 100644
--- a/libc/sysdeps/linux/frv/bits/syscalls.h
+++ b/libc/sysdeps/linux/frv/bits/syscalls.h
@@ -19,15 +19,29 @@
#ifndef __ASSEMBLER__
/* user-visible error numbers are in the range -1 - -4095: see <asm-frv/errno.h> */
-#define __syscall_return(type, res) \
+#ifdef _LIBC
+# define __syscall_return(type, res) \
do { \
unsigned long __sr2 = (res); \
- if ((unsigned long)(__sr2) >= (unsigned long)(-4095)) { \
- __set_errno (-(__sr2)); \
+ if (__builtin_expect ((unsigned long)(__sr2) \
+ >= (unsigned long)(-4095), 0)) { \
+ extern int __syscall_error (int); \
+ return (type) __syscall_error (__sr2); \
+ } \
+ return (type) (__sr2); \
+} while (0)
+#else
+# define __syscall_return(type, res) \
+do { \
+ unsigned long __sr2 = (res); \
+ if (__builtin_expect ((unsigned long)(__sr2) \
+ >= (unsigned long)(-4095), 0)) { \
+ __set_errno (-__sr2); \
__sr2 = -1; \
} \
return (type) (__sr2); \
} while (0)
+#endif
/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */