|
From: <sv...@va...> - 2006-10-01 18:16:58
|
Author: sewardj
Date: 2006-10-01 19:16:56 +0100 (Sun, 01 Oct 2006)
New Revision: 6131
Log:
Change the SysRes type so as to represent both the error value and the
non-error result at the same time.
Modified:
branches/AIX5/include/pub_tool_basics.h
Modified: branches/AIX5/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
--- branches/AIX5/include/pub_tool_basics.h 2006-10-01 18:13:14 UTC (rev =
6130)
+++ branches/AIX5/include/pub_tool_basics.h 2006-10-01 18:16:56 UTC (rev =
6131)
@@ -52,13 +52,6 @@
// For varargs types
#include <stdarg.h>
=20
-// Kernel types. Might as well have them here, they're used so broadly
-// (eg. in pub_core_threadstate.h).
-#if defined(VGO_linux)
-# include "vki-linux.h"
-#else
-# error Unknown OS
-#endif
=20
/* ---------------------------------------------------------------------
builtin types
@@ -87,6 +80,7 @@
# define NULL ((void*)0)
#endif
=20
+
/* ---------------------------------------------------------------------
non-builtin types
------------------------------------------------------------------ */
@@ -98,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)
------------------------------------------------------------------ */
|