Explorar o código

The __set_errno macro _must_ match that defined in include/bits/errno.h. We
can't tack in the return -1 since then when people include errno.h, the return
-1 mysteriously vanishes... Setting the __set_errno back and restoring the
'return -1;' calls to each _syscall[0-n] macro makes mips syscalls work again.
-Erik

Eric Andersen %!s(int64=23) %!d(string=hai) anos
pai
achega
a4eb8be71c
Modificáronse 1 ficheiros con 9 adicións e 1 borrados
  1. 9 1
      libc/sysdeps/linux/mips/bits/syscalls.h

+ 9 - 1
libc/sysdeps/linux/mips/bits/syscalls.h

@@ -10,7 +10,7 @@
 #include <bits/syscall.h>
 
 #ifndef __set_errno
-# define __set_errno(val)  { (*__errno_location ()) = (val); return -1; }
+# define __set_errno(val) (*__errno_location ()) = (val)
 #endif
 #ifndef SYS_ify
 # define SYS_ify(syscall_name)  (__NR_##syscall_name)
@@ -34,6 +34,7 @@ __asm__ volatile ("li\t$2,%2\n\t" \
 if (__err == 0) \
 	return (type) __res; \
 __set_errno(__res); \
+return -1; \
 }
 
 /*
@@ -55,6 +56,7 @@ __asm__ volatile ("move\t$4,%3\n\t" \
 if (__err == 0) \
 	return (type) __res; \
 __set_errno(__res); \
+return -1; \
 }
 
 #define _syscall2(type,name,atype,a,btype,b) \
@@ -75,6 +77,7 @@ __asm__ volatile ("move\t$4,%3\n\t" \
 if (__err == 0) \
 	return (type) __res; \
 __set_errno(__res); \
+return -1; \
 }
 
 #define _syscall3(type,name,atype,a,btype,b,ctype,c) \
@@ -97,6 +100,7 @@ __asm__ volatile ("move\t$4,%3\n\t" \
 if (__err == 0) \
 	return (type) __res; \
 __set_errno(__res); \
+return -1; \
 }
 
 #define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
@@ -121,6 +125,7 @@ __asm__ volatile ("move\t$4,%3\n\t" \
 if (__err == 0) \
 	return (type) __res; \
 __set_errno(__res); \
+return -1; \
 }
 
 #define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
@@ -150,6 +155,7 @@ __asm__ volatile ("move\t$4,%3\n\t" \
 if (__err == 0) \
 	return (type) __res; \
 __set_errno(__res); \
+return -1; \
 }
 
 #define _syscall6(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f) \
@@ -182,6 +188,7 @@ __asm__ volatile ("move\t$4,%3\n\t" \
 if (__err == 0) \
 	return (type) __res; \
 __set_errno(__res); \
+return -1; \
 }
 
 #define _syscall7(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f,gtype,g) \
@@ -217,6 +224,7 @@ __asm__ volatile ("move\t$4,%3\n\t" \
 if (__err == 0) \
 	return (type) __res; \
 __set_errno(__res); \
+return -1; \
 }
 
 #endif /* __ASSEMBLER__ */