#ifndef DBUS_SYSDEPS_H
#define DBUS_SYSDEPS_H
-#include <config.h>
+#include "config.h"
-/**
- * @addtogroup DBusSysdeps
- *
- * @{
- */
-
-/* The idea of this file is to encapsulate everywhere that we're
- * relying on external libc features, for ease of security
- * auditing. The idea is from vsftpd. This also gives us a chance to
- * make things more convenient to use, e.g. by reading into a
- * DBusString. Operating system headers aren't intended to be used
- * outside of this file and a limited number of others (such as
- * dbus-memory.c)
- */
-
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
-#define _DBUS_GNUC_PRINTF( format_idx, arg_idx ) \
- __attribute__((__format__ (__printf__, format_idx, arg_idx)))
-#define _DBUS_GNUC_NORETURN \
- __attribute__((__noreturn__))
-#else /* !__GNUC__ */
-#define _DBUS_GNUC_PRINTF( format_idx, arg_idx )
-#define _DBUS_GNUC_NORETURN
-#endif /* !__GNUC__ */
-
-/** @def _DBUS_GNUC_PRINTF
- * used to tell gcc about printf format strings
- */
-/** @def _DBUS_GNUC_NORETURN
- * used to tell gcc about functions that never return, such as _dbus_abort()
- */
-
-/** @} */
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
#include <dbus/dbus-errors.h>
+#include <dbus/dbus-file.h>
#include <dbus/dbus-string.h>
-#include <dbus/dbus-pipe.h>
/* this is perhaps bogus, but strcmp() etc. are faster if we use the
* stuff straight out of string.h, so have this here for now.
#include <string.h>
#include <stdarg.h>
-
/* AIX sys/poll.h does #define events reqevents, and other
* wonderousness, so must include sys/poll before declaring
* DBusPollFD
#include <sys/poll.h>
#endif
+#ifdef DBUS_WINCE
+/* Windows CE lacks some system functions (such as errno and clock).
+ We bring them in here. */
+#include "dbus-sysdeps-wince-glue.h"
+#endif
+
DBUS_BEGIN_DECLS
#ifdef DBUS_WIN
/** Object that contains a list of credentials such as UNIX or Windows user ID */
typedef struct DBusCredentials DBusCredentials;
+/** A wrapper around a pipe descriptor or handle */
+typedef struct DBusPipe DBusPipe;
+
/**
* @addtogroup DBusSysdeps
*
dbus_bool_t _dbus_append_keyring_directory_for_credentials (DBusString *directory,
DBusCredentials *credentials);
-void _dbus_daemon_publish_session_bus_address (const char* address);
+dbus_bool_t _dbus_daemon_is_session_bus_address_published (const char *scope);
+
+dbus_bool_t _dbus_daemon_publish_session_bus_address (const char* address, const char* shm_name);
void _dbus_daemon_unpublish_session_bus_address (void);
long *tv_usec);
/**
- * File/directory interface
+ * directory interface
*/
-dbus_bool_t _dbus_file_exists (const char *file);
-dbus_bool_t _dbus_file_get_contents (DBusString *str,
- const DBusString *filename,
- DBusError *error);
-dbus_bool_t _dbus_string_save_to_file (const DBusString *str,
- const DBusString *filename,
- DBusError *error);
-
-dbus_bool_t _dbus_make_file_world_readable (const DBusString *filename,
- DBusError *error);
-
-dbus_bool_t _dbus_create_file_exclusively (const DBusString *filename,
- DBusError *error);
-dbus_bool_t _dbus_delete_file (const DBusString *filename,
- DBusError *error);
dbus_bool_t _dbus_create_directory (const DBusString *filename,
DBusError *error);
dbus_bool_t _dbus_delete_directory (const DBusString *filename,
dbus_bool_t _dbus_check_dir_is_private_to_user (DBusString *dir,
DBusError *error);
-void _dbus_fd_set_close_on_exec (int fd);
+void _dbus_fd_set_close_on_exec (intptr_t fd);
const char* _dbus_get_tmpdir (void);
int n_bytes);
const char* _dbus_error_from_errno (int error_number);
+const char* _dbus_error_from_system_errno (void);
void _dbus_set_errno_to_zero (void);
dbus_bool_t _dbus_get_is_errno_nonzero (void);
DBusError *error);
void _dbus_init_system_log (void);
-void _dbus_log_info (const char *msg, va_list args);
-void _dbus_log_security (const char *msg, va_list args);
-/* Define DBUS_VA_COPY() to do the right thing for copying va_list variables.
- * config.h may have already defined DBUS_VA_COPY as va_copy or __va_copy.
+typedef enum {
+ DBUS_SYSTEM_LOG_INFO,
+ DBUS_SYSTEM_LOG_SECURITY,
+ DBUS_SYSTEM_LOG_FATAL
+} DBusSystemLogSeverity;
+
+void _dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...) _DBUS_GNUC_PRINTF (2, 3);
+void _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args);
+
+/* Define DBUS_VA_COPY() to do the right thing for copying va_list variables.
+ * config.h may have already defined DBUS_VA_COPY as va_copy or __va_copy.
*/
#if !defined (DBUS_VA_COPY)
# if defined (__GNUC__) && defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
_DBUS_BYTE_OF_PRIMITIVE (a, 6) == _DBUS_BYTE_OF_PRIMITIVE (b, 6) && \
_DBUS_BYTE_OF_PRIMITIVE (a, 7) == _DBUS_BYTE_OF_PRIMITIVE (b, 7))
-dbus_bool_t _dbus_get_autolaunch_address (DBusString *address,
- DBusError *error);
+dbus_bool_t _dbus_get_autolaunch_address (const char *scope,
+ DBusString *address,
+ DBusError *error);
dbus_bool_t _dbus_lookup_session_address (dbus_bool_t *supported,
DBusString *address,
*/
dbus_pid_t _dbus_getpid (void);
+dbus_bool_t _dbus_change_to_daemon_user (const char *user,
+ DBusError *error);
+
void _dbus_flush_caches (void);
+void _dbus_request_file_descriptor_limit (unsigned int limit);
+
+/*
+ * replaces the term DBUS_PREFIX in configure_time_path by the
+ * current dbus installation directory. On unix this function is a noop
+ *
+ * @param configure_time_path
+ * @return real path
+ */
+const char *
+_dbus_replace_install_prefix (const char *configure_time_path);
+
/** @} */
DBUS_END_DECLS
+
+#ifdef DBUS_WIN
+#include "dbus-sysdeps-win.h"
+#endif
+
#endif /* DBUS_SYSDEPS_H */