|
From: <sv...@va...> - 2006-10-17 01:38:54
|
Author: sewardj
Date: 2006-10-17 02:38:48 +0100 (Tue, 17 Oct 2006)
New Revision: 6268
Log:
Merge r6131:
Change the SysRes type so as to represent both the error value and the
non-error result at the same time.
Modified:
trunk/include/pub_tool_basics.h
Modified: trunk/include/pub_tool_basics.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/pub_tool_basics.h 2006-10-17 01:38:13 UTC (rev 6267)
+++ trunk/include/pub_tool_basics.h 2006-10-17 01:38:48 UTC (rev 6268)
@@ -80,6 +80,7 @@
# define NULL ((void*)0)
#endif
=20
+
/* ---------------------------------------------------------------------
non-builtin types
------------------------------------------------------------------ */
@@ -91,15 +92,35 @@
typedef UInt ThreadId;
=20
/* An abstraction of syscall return values.
- When .isError =3D=3D False, val holds the return value.
- When .isError =3D=3D True, val holds the error code.
+ Linux:
+ When .isError =3D=3D False,=20
+ res holds the return value, and err is zero.
+ When .isError =3D=3D True, =20
+ err holds the error code, and res is zero.
+
+ AIX:
+ res is the POSIX result of the syscall.
+ err is the corresponding errno value.
+ isError =3D=3D=3D err=3D=3D0
+
+ Unlike on Linux, it is possible for 'err' to be nonzero (thus an
+ error has occurred), nevertheless 'res' is also nonzero. AIX
+ userspace does not appear to consistently inspect 'err' to
+ determine whether or not an error has occurred. For example,
+ sys_open() will return -1 for 'val' if a file cannot be opened,
+ as well as the relevant errno value in 'err', but AIX userspace
+ then consults 'val' to figure out if the syscall failed, rather
+ than looking at 'err'. Hence we need to represent them both.
*/
-typedef struct {=20
- UWord val;
- Bool isError;
-}
-SysRes;
+typedef
+ struct {
+ UWord res;
+ UWord err;
+ Bool isError;
+ }
+ SysRes;
=20
+
/* ---------------------------------------------------------------------
Miscellaneous (word size, endianness, regparmness, stringification)
------------------------------------------------------------------ */
|