From b8361e2e12f612cf302bc03c2c9e7a648c37a84e Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 12 May 2004 22:54:59 +0000 Subject: Add a local '_dl_errno' to be used by syscalls in ldso, allowing useful syscall failure diagnostics. --- ldso/ldso/m68k/dl-syscalls.h | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'ldso/ldso/m68k') diff --git a/ldso/ldso/m68k/dl-syscalls.h b/ldso/ldso/m68k/dl-syscalls.h index 1fb2cccd2..ada694b97 100644 --- a/ldso/ldso/m68k/dl-syscalls.h +++ b/ldso/ldso/m68k/dl-syscalls.h @@ -18,6 +18,9 @@ #define __NR_stat 106 #define __NR_mprotect 125 +/* We can't use the real errno in ldso, since it has not yet + * been dynamicly linked in yet. */ +extern int _dl_errno; /* Here are the macros which define how this platform makes * system calls. This particular variant does _not_ set @@ -31,8 +34,8 @@ do { \ if ((unsigned long)(res) >= (unsigned long)(-125)) { \ /* avoid using res which is declared to be in register d0; \ errno might expand to a function call and clobber it. */ \ - /* int __err = -(res); \ - errno = __err; */ \ + int __err = -(res); \ + _dl_errno = __err; \ res = -1; \ } \ return (type) (res); \ @@ -48,8 +51,8 @@ type name(void) \ : "=g" (__res) \ : "i" (__NR_##name) \ : "cc", "%d0"); \ - if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ - /* errno = -__res; */ \ + if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ + _dl_errno = -__res; \ __res = -1; \ } \ return (type)__res; \ @@ -67,8 +70,8 @@ type name(atype a) \ : "i" (__NR_##name), \ "g" ((long)a) \ : "cc", "%d0", "%d1"); \ - if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ - /* errno = -__res; */ \ + if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ + _dl_errno = -__res; \ __res = -1; \ } \ return (type)__res; \ @@ -88,8 +91,8 @@ type name(atype a, btype b) \ "a" ((long)a), \ "g" ((long)b) \ : "cc", "%d0", "%d1", "%d2"); \ - if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ - /* errno = -__res; */ \ + if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ + _dl_errno = -__res; \ __res = -1; \ } \ return (type)__res; \ @@ -111,8 +114,8 @@ type name(atype a, btype b, ctype c) \ "a" ((long)b), \ "g" ((long)c) \ : "cc", "%d0", "%d1", "%d2", "%d3"); \ - if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ - /* errno = -__res; */ \ + if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ + _dl_errno = -__res; \ __res = -1; \ } \ return (type)__res; \ @@ -137,8 +140,8 @@ type name(atype a, btype b, ctype c, dtype d) \ "g" ((long)d) \ : "cc", "%d0", "%d1", "%d2", "%d3", \ "%d4"); \ - if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ - /* errno = -__res; */ \ + if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ + _dl_errno = -__res; \ __res = -1; \ } \ return (type)__res; \ @@ -165,8 +168,8 @@ type name(atype a, btype b, ctype c, dtype d, etype e) \ "g" ((long)e) \ : "cc", "%d0", "%d1", "%d2", "%d3", \ "%d4", "%d5"); \ - if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ - /* errno = -__res; */ \ + if ((unsigned long)(__res) >= (unsigned long)(-125)) { \ + _dl_errno = -__res; \ __res = -1; \ } \ return (type)__res; \ -- cgit v1.2.3