~bkerensa/ubuntu/raring/valgrind/merge-from-deb

« back to all changes in this revision

Viewing changes to include/pub_tool_basics.h

  • Committer: Bazaar Package Importer
  • Author(s): Andrés Roldán
  • Date: 2008-06-13 02:31:40 UTC
  • mto: (1.4.1 upstream) (2.2.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: james.westby@ubuntu.com-20080613023140-iwk33rz9rhvfkr96
Import upstream version 3.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
   This file is part of Valgrind, a dynamic binary instrumentation
8
8
   framework.
9
9
 
10
 
   Copyright (C) 2000-2006 Julian Seward 
 
10
   Copyright (C) 2000-2007 Julian Seward 
11
11
      jseward@acm.org
12
12
 
13
13
   This program is free software; you can redistribute it and/or
52
52
// For varargs types
53
53
#include <stdarg.h>
54
54
 
55
 
// Kernel types.  Might as well have them here, they're used so broadly
56
 
// (eg. in pub_core_threadstate.h).
57
 
#if defined(VGO_linux)
58
 
#  include "vki-linux.h"
59
 
#else
60
 
#  error Unknown OS
61
 
#endif
62
55
 
63
56
/* ---------------------------------------------------------------------
64
57
   builtin types
87
80
#  define NULL ((void*)0)
88
81
#endif
89
82
 
 
83
 
90
84
/* ---------------------------------------------------------------------
91
85
   non-builtin types
92
86
   ------------------------------------------------------------------ */
98
92
typedef UInt ThreadId;
99
93
 
100
94
/* An abstraction of syscall return values.
101
 
   When .isError == False, val holds the return value.
102
 
   When .isError == True,  val holds the error code.
 
95
   Linux:
 
96
      When .isError == False, 
 
97
         res holds the return value, and err is zero.
 
98
      When .isError == True,  
 
99
         err holds the error code, and res is zero.
 
100
 
 
101
   AIX:
 
102
      res is the POSIX result of the syscall.
 
103
      err is the corresponding errno value.
 
104
      isError === err==0
 
105
 
 
106
      Unlike on Linux, it is possible for 'err' to be nonzero (thus an
 
107
      error has occurred), nevertheless 'res' is also nonzero.  AIX
 
108
      userspace does not appear to consistently inspect 'err' to
 
109
      determine whether or not an error has occurred.  For example,
 
110
      sys_open() will return -1 for 'val' if a file cannot be opened,
 
111
      as well as the relevant errno value in 'err', but AIX userspace
 
112
      then consults 'val' to figure out if the syscall failed, rather
 
113
      than looking at 'err'.  Hence we need to represent them both.
103
114
*/
104
 
typedef struct { 
105
 
   UWord val;
106
 
   Bool  isError;
107
 
}
108
 
SysRes;
 
115
typedef
 
116
   struct {
 
117
      UWord res;
 
118
      UWord err;
 
119
      Bool  isError;
 
120
   }
 
121
   SysRes;
 
122
 
109
123
 
110
124
/* ---------------------------------------------------------------------
111
125
   Miscellaneous (word size, endianness, regparmness, stringification)
138
152
#define VG_STRINGIFZ(__str)  #__str
139
153
#define VG_STRINGIFY(__str)  VG_STRINGIFZ(__str)
140
154
 
 
155
// Where to send bug reports to.
 
156
#define VG_BUGS_TO "www.valgrind.org"
 
157
 
141
158
#endif /* __PUB_TOOL_BASICS_H */
142
159
 
143
160
/*--------------------------------------------------------------------*/