~ubuntu-branches/ubuntu/maverick/dbus/maverick-security

« back to all changes in this revision

Viewing changes to dbus/dbus-internals.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-27 13:06:32 UTC
  • mfrom: (1.1.23 upstream)
  • Revision ID: james.westby@ubuntu.com-20100927130632-bqs145trvchd2lmf
Tags: 1.4.0-0ubuntu1
* New upstream release
 - Fixes https://bugs.freedesktop.org/show_bug.cgi?id=17754 Race condition in protected_change_timeout
 - Requested by various upstream KDE developers http://lists.kde.org/?t=128514970000004&r=1&w=2

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#ifndef DBUS_INTERNALS_H
28
28
#define DBUS_INTERNALS_H
29
29
 
30
 
#include <config.h>
31
 
 
32
30
#include <dbus/dbus-memory.h>
33
31
#include <dbus/dbus-types.h>
34
32
#include <dbus/dbus-errors.h>
37
35
 
38
36
DBUS_BEGIN_DECLS
39
37
 
 
38
#ifndef DBUS_SESSION_BUS_DEFAULT_ADDRESS
40
39
#define DBUS_SESSION_BUS_DEFAULT_ADDRESS        "autolaunch:"
 
40
#endif
41
41
 
42
42
void _dbus_warn               (const char *format,
43
43
                               ...) _DBUS_GNUC_PRINTF (1, 2);
83
83
 
84
84
#ifdef DBUS_ENABLE_VERBOSE_MODE
85
85
 
 
86
/*
 
87
 at least gnu cc and msvc compiler are known to 
 
88
 have support for variable macro argument lists
 
89
 add other compilers is required
 
90
*/
 
91
#if defined(__GNUC__) || defined(_MSC_VER) 
 
92
#define DBUS_CPP_SUPPORTS_VARIABLE_MACRO_ARGUMENTS
 
93
#endif
 
94
 
 
95
#ifdef DBUS_CPP_SUPPORTS_VARIABLE_MACRO_ARGUMENTS
 
96
void _dbus_verbose_real       (const char *file, const int line, const char *function, 
 
97
                               const char *format,...) _DBUS_GNUC_PRINTF (4, 5);
 
98
#  define _dbus_verbose(fmt,...) _dbus_verbose_real( __FILE__,__LINE__,__FUNCTION__,fmt, ## __VA_ARGS__)
 
99
#else
86
100
void _dbus_verbose_real       (const char *format,
87
101
                               ...) _DBUS_GNUC_PRINTF (1, 2);
 
102
#  define _dbus_verbose _dbus_verbose_real
 
103
#endif
88
104
void _dbus_verbose_reset_real (void);
89
105
dbus_bool_t _dbus_is_verbose_real (void);
90
106
 
91
 
#  define _dbus_verbose _dbus_verbose_real
92
107
#  define _dbus_verbose_reset _dbus_verbose_reset_real
93
108
#  define _dbus_is_verbose _dbus_is_verbose_real
94
109
#else
131
146
#define _dbus_return_if_fail(condition)
132
147
#define _dbus_return_val_if_fail(condition, val)
133
148
#else
134
 
extern const char _dbus_return_if_fail_warning_format[];
 
149
 
 
150
extern const char *_dbus_return_if_fail_warning_format;
135
151
 
136
152
#define _dbus_return_if_fail(condition) do {                                       \
137
153
   _dbus_assert ((*(const char*)_DBUS_FUNCTION_NAME) != '_');                      \
153
169
 
154
170
#define _DBUS_N_ELEMENTS(array) ((int) (sizeof ((array)) / sizeof ((array)[0])))
155
171
 
156
 
#define _DBUS_POINTER_TO_INT(pointer) ((long)(pointer))
157
 
#define _DBUS_INT_TO_POINTER(integer) ((void*)((long)(integer)))
 
172
#define _DBUS_POINTER_TO_INT(pointer) ((intptr_t)(pointer))
 
173
#define _DBUS_INT_TO_POINTER(integer) ((void*)((intptr_t)(integer)))
158
174
 
159
175
#define _DBUS_ZERO(object) (memset (&(object), '\0', sizeof ((object))))
160
176
 
161
177
#define _DBUS_STRUCT_OFFSET(struct_type, member)        \
162
 
    ((long) ((unsigned char*) &((struct_type*) 0)->member))
 
178
    ((intptr_t) ((unsigned char*) &((struct_type*) 0)->member))
163
179
 
164
180
#ifdef DBUS_DISABLE_CHECKS
165
181
/* this is an assert and not an error, but in the typical --disable-checks case (you're trying
187
203
 */
188
204
 
189
205
#define _DBUS_ALIGN_VALUE(this, boundary) \
190
 
  (( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))
 
206
  (( ((uintptr_t)(this)) + (((uintptr_t)(boundary)) -1)) & (~(((uintptr_t)(boundary))-1)))
191
207
 
192
208
#define _DBUS_ALIGN_ADDRESS(this, boundary) \
193
209
  ((void*)_DBUS_ALIGN_VALUE(this, boundary))
245
261
 
246
262
const char* _dbus_header_field_to_string (int header_field);
247
263
 
248
 
extern const char _dbus_no_memory_message[];
 
264
extern const char *_dbus_no_memory_message;
249
265
#define _DBUS_SET_OOM(error) dbus_set_error_const ((error), DBUS_ERROR_NO_MEMORY, _dbus_no_memory_message)
250
266
 
251
267
#ifdef DBUS_BUILD_TESTS
294
310
_DBUS_DECLARE_GLOBAL_LOCK (server_slots);
295
311
_DBUS_DECLARE_GLOBAL_LOCK (message_slots);
296
312
/* 5-10 */
297
 
_DBUS_DECLARE_GLOBAL_LOCK (atomic);
298
313
_DBUS_DECLARE_GLOBAL_LOCK (bus);
299
314
_DBUS_DECLARE_GLOBAL_LOCK (bus_datas);
300
315
_DBUS_DECLARE_GLOBAL_LOCK (shutdown_funcs);
301
316
_DBUS_DECLARE_GLOBAL_LOCK (system_users);
302
 
/* 10-15 */
303
317
_DBUS_DECLARE_GLOBAL_LOCK (message_cache);
 
318
/* 10-14 */
304
319
_DBUS_DECLARE_GLOBAL_LOCK (shared_connections);
305
320
_DBUS_DECLARE_GLOBAL_LOCK (win_fds);
306
321
_DBUS_DECLARE_GLOBAL_LOCK (sid_atom_cache);
307
322
_DBUS_DECLARE_GLOBAL_LOCK (machine_uuid);
 
323
 
 
324
#if !DBUS_USE_SYNC
 
325
_DBUS_DECLARE_GLOBAL_LOCK (atomic);
308
326
#define _DBUS_N_GLOBAL_LOCKS (15)
 
327
#else
 
328
#define _DBUS_N_GLOBAL_LOCKS (14)
 
329
#endif
309
330
 
310
331
dbus_bool_t _dbus_threads_init_debug (void);
311
332