D-Bus
1.10.12
|
00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ 00002 /* dbus-sysdeps.h Wrappers around system/libc features (internal to D-Bus implementation) 00003 * 00004 * Copyright (C) 2002, 2003 Red Hat, Inc. 00005 * Copyright (C) 2003 CodeFactory AB 00006 * 00007 * Licensed under the Academic Free License version 2.1 00008 * 00009 * This program is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00022 * 00023 */ 00024 00025 #ifndef DBUS_SYSDEPS_H 00026 #define DBUS_SYSDEPS_H 00027 00028 #ifndef VERSION 00029 #warning Please include config.h before dbus-sysdeps.h 00030 #include "config.h" 00031 #endif 00032 00033 #ifdef HAVE_STDINT_H 00034 #include <stdint.h> 00035 #endif 00036 00037 #ifdef HAVE_INTTYPES_H 00038 #include <inttypes.h> 00039 #endif 00040 00041 #include <dbus/dbus-errors.h> 00042 #include <dbus/dbus-file.h> 00043 #include <dbus/dbus-string.h> 00044 00045 /* this is perhaps bogus, but strcmp() etc. are faster if we use the 00046 * stuff straight out of string.h, so have this here for now. 00047 */ 00048 #include <string.h> 00049 #include <stdarg.h> 00050 00051 /* AIX sys/poll.h does #define events reqevents, and other 00052 * wonderousness, so must include sys/poll before declaring 00053 * DBusPollFD 00054 */ 00055 #ifdef HAVE_POLL 00056 #include <sys/poll.h> 00057 #endif 00058 00059 #ifdef DBUS_WINCE 00060 /* Windows CE lacks some system functions (such as errno and clock). 00061 We bring them in here. */ 00062 #include "dbus-sysdeps-wince-glue.h" 00063 #endif 00064 00065 #ifdef DBUS_WIN 00066 #include <ws2tcpip.h> 00067 #endif 00068 00069 DBUS_BEGIN_DECLS 00070 00071 #ifdef DBUS_WIN 00072 #define _DBUS_PATH_SEPARATOR ";" 00073 #else 00074 #define _DBUS_PATH_SEPARATOR ":" 00075 #endif 00076 00077 /* Forward declarations */ 00078 00079 00081 typedef struct DBusList DBusList; 00082 00084 typedef struct DBusCredentials DBusCredentials; 00085 00087 typedef struct DBusPipe DBusPipe; 00088 00095 void _dbus_abort (void) _DBUS_GNUC_NORETURN; 00096 00097 dbus_bool_t _dbus_check_setuid (void); 00098 DBUS_PRIVATE_EXPORT 00099 const char* _dbus_getenv (const char *varname); 00100 DBUS_PRIVATE_EXPORT 00101 dbus_bool_t _dbus_clearenv (void); 00102 char ** _dbus_get_environment (void); 00103 00105 typedef unsigned long dbus_pid_t; 00107 typedef unsigned long dbus_uid_t; 00109 typedef unsigned long dbus_gid_t; 00110 00112 #define DBUS_PID_UNSET ((dbus_pid_t) -1) 00113 00114 #define DBUS_UID_UNSET ((dbus_uid_t) -1) 00115 00116 #define DBUS_GID_UNSET ((dbus_gid_t) -1) 00117 00119 #define DBUS_PID_FORMAT "%lu" 00120 00121 #define DBUS_UID_FORMAT "%lu" 00122 00123 #define DBUS_GID_FORMAT "%lu" 00124 00128 #ifdef DBUS_WIN 00129 00130 typedef struct { SOCKET sock; } DBusSocket; 00131 # define DBUS_SOCKET_FORMAT "Iu" 00132 # define DBUS_SOCKET_INIT { INVALID_SOCKET } 00133 00134 static inline SOCKET 00135 _dbus_socket_printable (DBusSocket s) { return s.sock; } 00136 00137 static inline dbus_bool_t 00138 _dbus_socket_is_valid (DBusSocket s) { return s.sock != INVALID_SOCKET; } 00139 00140 static inline void 00141 _dbus_socket_invalidate (DBusSocket *s) { s->sock = INVALID_SOCKET; } 00142 00143 static inline int 00144 _dbus_socket_get_int (DBusSocket s) { return (int)s.sock; } 00145 00146 #else /* not DBUS_WIN */ 00147 00148 typedef struct { int fd; } DBusSocket; 00149 # define DBUS_SOCKET_FORMAT "d" 00150 # define DBUS_SOCKET_INIT { -1 } 00151 00152 static inline int 00153 _dbus_socket_printable (DBusSocket s) { return s.fd; } 00154 00155 static inline dbus_bool_t 00156 _dbus_socket_is_valid (DBusSocket s) { return s.fd >= 0; } 00157 00158 static inline void 00159 _dbus_socket_invalidate (DBusSocket *s) { s->fd = -1; } 00160 00161 static inline int 00162 _dbus_socket_get_int (DBusSocket s) { return s.fd; } 00163 00164 #endif /* not DBUS_WIN */ 00165 00166 static inline DBusSocket 00167 _dbus_socket_get_invalid (void) 00168 { 00169 DBusSocket s = DBUS_SOCKET_INIT; 00170 00171 return s; 00172 } 00173 00174 dbus_bool_t _dbus_set_socket_nonblocking (DBusSocket fd, 00175 DBusError *error); 00176 00177 DBUS_PRIVATE_EXPORT 00178 dbus_bool_t _dbus_close_socket (DBusSocket fd, 00179 DBusError *error); 00180 DBUS_PRIVATE_EXPORT 00181 int _dbus_read_socket (DBusSocket fd, 00182 DBusString *buffer, 00183 int count); 00184 DBUS_PRIVATE_EXPORT 00185 int _dbus_write_socket (DBusSocket fd, 00186 const DBusString *buffer, 00187 int start, 00188 int len); 00189 int _dbus_write_socket_two (DBusSocket fd, 00190 const DBusString *buffer1, 00191 int start1, 00192 int len1, 00193 const DBusString *buffer2, 00194 int start2, 00195 int len2); 00196 00197 int _dbus_read_socket_with_unix_fds (DBusSocket fd, 00198 DBusString *buffer, 00199 int count, 00200 int *fds, 00201 int *n_fds); 00202 DBUS_PRIVATE_EXPORT 00203 int _dbus_write_socket_with_unix_fds (DBusSocket fd, 00204 const DBusString *buffer, 00205 int start, 00206 int len, 00207 const int *fds, 00208 int n_fds); 00209 int _dbus_write_socket_with_unix_fds_two (DBusSocket fd, 00210 const DBusString *buffer1, 00211 int start1, 00212 int len1, 00213 const DBusString *buffer2, 00214 int start2, 00215 int len2, 00216 const int *fds, 00217 int n_fds); 00218 00219 DBusSocket _dbus_connect_tcp_socket (const char *host, 00220 const char *port, 00221 const char *family, 00222 DBusError *error); 00223 DBusSocket _dbus_connect_tcp_socket_with_nonce (const char *host, 00224 const char *port, 00225 const char *family, 00226 const char *noncefile, 00227 DBusError *error); 00228 int _dbus_listen_tcp_socket (const char *host, 00229 const char *port, 00230 const char *family, 00231 DBusString *retport, 00232 DBusSocket **fds_p, 00233 DBusError *error); 00234 DBusSocket _dbus_accept (DBusSocket listen_fd); 00235 00236 dbus_bool_t _dbus_read_credentials_socket (DBusSocket client_fd, 00237 DBusCredentials *credentials, 00238 DBusError *error); 00239 dbus_bool_t _dbus_send_credentials_socket (DBusSocket server_fd, 00240 DBusError *error); 00241 00242 dbus_bool_t _dbus_credentials_add_from_user (DBusCredentials *credentials, 00243 const DBusString *username); 00244 dbus_bool_t _dbus_credentials_add_from_current_process (DBusCredentials *credentials); 00245 DBUS_PRIVATE_EXPORT 00246 dbus_bool_t _dbus_append_user_from_current_process (DBusString *str); 00247 00248 dbus_bool_t _dbus_parse_unix_user_from_config (const DBusString *username, 00249 dbus_uid_t *uid_p); 00250 dbus_bool_t _dbus_parse_unix_group_from_config (const DBusString *groupname, 00251 dbus_gid_t *gid_p); 00252 dbus_bool_t _dbus_unix_groups_from_uid (dbus_uid_t uid, 00253 dbus_gid_t **group_ids, 00254 int *n_group_ids); 00255 dbus_bool_t _dbus_unix_user_is_at_console (dbus_uid_t uid, 00256 DBusError *error); 00257 dbus_bool_t _dbus_unix_user_is_process_owner (dbus_uid_t uid); 00258 dbus_bool_t _dbus_windows_user_is_process_owner (const char *windows_sid); 00259 00260 dbus_bool_t _dbus_append_keyring_directory_for_credentials (DBusString *directory, 00261 DBusCredentials *credentials); 00262 00263 dbus_bool_t _dbus_daemon_is_session_bus_address_published (const char *scope); 00264 00265 dbus_bool_t _dbus_daemon_publish_session_bus_address (const char* address, const char* shm_name); 00266 00267 void _dbus_daemon_unpublish_session_bus_address (void); 00268 00269 dbus_bool_t _dbus_socket_can_pass_unix_fd(DBusSocket fd); 00270 00274 typedef struct DBusAtomic DBusAtomic; 00275 00279 struct DBusAtomic 00280 { 00281 #ifdef DBUS_WIN 00282 volatile long value; 00283 #else 00284 volatile dbus_int32_t value; 00285 #endif 00286 }; 00287 00288 /* The value we get from autofoo is in the form of a cpp expression; 00289 * convert that to a conventional defined/undef switch. (We can't get 00290 * the conventional defined/undef because of multiarch builds only running 00291 * ./configure once, on Darwin.) */ 00292 #if DBUS_HAVE_ATOMIC_INT_COND 00293 # define DBUS_HAVE_ATOMIC_INT 1 00294 #else 00295 # undef DBUS_HAVE_ATOMIC_INT 00296 #endif 00297 00298 DBUS_PRIVATE_EXPORT 00299 dbus_int32_t _dbus_atomic_inc (DBusAtomic *atomic); 00300 DBUS_PRIVATE_EXPORT 00301 dbus_int32_t _dbus_atomic_dec (DBusAtomic *atomic); 00302 DBUS_PRIVATE_EXPORT 00303 dbus_int32_t _dbus_atomic_get (DBusAtomic *atomic); 00304 00305 #ifdef DBUS_WIN 00306 00307 /* On Windows, you can only poll sockets. We emulate Unix poll() using 00308 * select(), so it doesn't matter what precise type we put in DBusPollFD; 00309 * use DBusSocket so that the compiler can check we are doing it right. 00310 */ 00311 typedef DBusSocket DBusPollable; 00312 # define DBUS_POLLABLE_FORMAT "Iu" 00313 00314 static inline DBusPollable 00315 _dbus_socket_get_pollable (DBusSocket s) { return s; } 00316 00317 static inline SOCKET 00318 _dbus_pollable_printable (DBusPollable p) { return p.sock; } 00319 00320 static inline dbus_bool_t 00321 _dbus_pollable_is_valid (DBusPollable p) { return _dbus_socket_is_valid (p); } 00322 00323 static inline void 00324 _dbus_pollable_invalidate (DBusPollable *p) { _dbus_socket_invalidate (p); } 00325 00326 static inline dbus_bool_t 00327 _dbus_pollable_equals (DBusPollable a, DBusPollable b) { return a.sock == b.sock; } 00328 00329 #else /* !DBUS_WIN */ 00330 00331 /* On Unix, you can poll sockets, pipes, etc., and we must put exactly 00332 * "int" in DBusPollFD because we're relying on its layout exactly matching 00333 * struct pollfd. (This is silly, and one day we should use a better 00334 * abstraction.) 00335 */ 00336 typedef int DBusPollable; 00337 # define DBUS_POLLABLE_FORMAT "d" 00338 00339 static inline DBusPollable 00340 _dbus_socket_get_pollable (DBusSocket s) { return s.fd; } 00341 00342 static inline int 00343 _dbus_pollable_printable (DBusPollable p) { return p; } 00344 00345 static inline dbus_bool_t 00346 _dbus_pollable_is_valid (DBusPollable p) { return p >= 0; } 00347 00348 static inline void 00349 _dbus_pollable_invalidate (DBusPollable *p) { *p = -1; } 00350 00351 static inline dbus_bool_t 00352 _dbus_pollable_equals (DBusPollable a, DBusPollable b) { return a == b; } 00353 00354 #endif /* !DBUS_WIN */ 00355 00356 #if defined(HAVE_POLL) && !defined(BROKEN_POLL) 00357 00361 typedef struct pollfd DBusPollFD; 00362 00364 #define _DBUS_POLLIN POLLIN 00365 00366 #define _DBUS_POLLPRI POLLPRI 00367 00368 #define _DBUS_POLLOUT POLLOUT 00369 00370 #define _DBUS_POLLERR POLLERR 00371 00372 #define _DBUS_POLLHUP POLLHUP 00373 00374 #define _DBUS_POLLNVAL POLLNVAL 00375 #else 00376 /* Emulate poll() via select(). Because we aren't really going to call 00377 * poll(), any similarly-shaped struct is acceptable, and any power of 2 00378 * will do for the events/revents; these values happen to match Linux 00379 * and *BSD. */ 00380 typedef struct 00381 { 00382 DBusPollable fd; 00383 short events; 00384 short revents; 00385 } DBusPollFD; 00386 00388 #define _DBUS_POLLIN 0x0001 00389 00390 #define _DBUS_POLLPRI 0x0002 00391 00392 #define _DBUS_POLLOUT 0x0004 00393 00394 #define _DBUS_POLLERR 0x0008 00395 00396 #define _DBUS_POLLHUP 0x0010 00397 00398 #define _DBUS_POLLNVAL 0x0020 00399 #endif 00400 00401 DBUS_PRIVATE_EXPORT 00402 int _dbus_poll (DBusPollFD *fds, 00403 int n_fds, 00404 int timeout_milliseconds); 00405 00406 DBUS_PRIVATE_EXPORT 00407 void _dbus_sleep_milliseconds (int milliseconds); 00408 00409 DBUS_PRIVATE_EXPORT 00410 void _dbus_get_monotonic_time (long *tv_sec, 00411 long *tv_usec); 00412 00413 DBUS_PRIVATE_EXPORT 00414 void _dbus_get_real_time (long *tv_sec, 00415 long *tv_usec); 00416 00420 DBUS_PRIVATE_EXPORT 00421 dbus_bool_t _dbus_create_directory (const DBusString *filename, 00422 DBusError *error); 00423 DBUS_PRIVATE_EXPORT 00424 dbus_bool_t _dbus_delete_directory (const DBusString *filename, 00425 DBusError *error); 00426 00427 DBUS_PRIVATE_EXPORT 00428 dbus_bool_t _dbus_concat_dir_and_file (DBusString *dir, 00429 const DBusString *next_component); 00430 dbus_bool_t _dbus_string_get_dirname (const DBusString *filename, 00431 DBusString *dirname); 00432 DBUS_PRIVATE_EXPORT 00433 dbus_bool_t _dbus_path_is_absolute (const DBusString *filename); 00434 00435 dbus_bool_t _dbus_get_standard_session_servicedirs (DBusList **dirs); 00436 dbus_bool_t _dbus_get_standard_system_servicedirs (DBusList **dirs); 00437 00438 dbus_bool_t _dbus_append_system_config_file (DBusString *str); 00439 dbus_bool_t _dbus_append_session_config_file (DBusString *str); 00440 00442 typedef struct DBusDirIter DBusDirIter; 00443 00444 DBusDirIter* _dbus_directory_open (const DBusString *filename, 00445 DBusError *error); 00446 dbus_bool_t _dbus_directory_get_next_file (DBusDirIter *iter, 00447 DBusString *filename, 00448 DBusError *error); 00449 void _dbus_directory_close (DBusDirIter *iter); 00450 00451 dbus_bool_t _dbus_check_dir_is_private_to_user (DBusString *dir, 00452 DBusError *error); 00453 00454 DBUS_PRIVATE_EXPORT 00455 const char* _dbus_get_tmpdir (void); 00456 00460 _DBUS_GNUC_WARN_UNUSED_RESULT 00461 dbus_bool_t _dbus_generate_random_bytes_buffer (char *buffer, 00462 int n_bytes, 00463 DBusError *error); 00464 dbus_bool_t _dbus_generate_random_bytes (DBusString *str, 00465 int n_bytes, 00466 DBusError *error); 00467 DBUS_PRIVATE_EXPORT 00468 dbus_bool_t _dbus_generate_random_ascii (DBusString *str, 00469 int n_bytes, 00470 DBusError *error); 00471 00472 DBUS_PRIVATE_EXPORT 00473 const char* _dbus_error_from_errno (int error_number); 00474 DBUS_PRIVATE_EXPORT 00475 const char* _dbus_error_from_system_errno (void); 00476 00477 int _dbus_save_socket_errno (void); 00478 void _dbus_restore_socket_errno (int saved_errno); 00479 void _dbus_set_errno_to_zero (void); 00480 dbus_bool_t _dbus_get_is_errno_eagain_or_ewouldblock (int e); 00481 dbus_bool_t _dbus_get_is_errno_enomem (int e); 00482 dbus_bool_t _dbus_get_is_errno_eintr (int e); 00483 dbus_bool_t _dbus_get_is_errno_epipe (int e); 00484 dbus_bool_t _dbus_get_is_errno_etoomanyrefs (int e); 00485 DBUS_PRIVATE_EXPORT 00486 const char* _dbus_strerror_from_errno (void); 00487 00488 void _dbus_disable_sigpipe (void); 00489 00490 DBUS_PRIVATE_EXPORT 00491 void _dbus_exit (int code) _DBUS_GNUC_NORETURN; 00492 00493 DBUS_PRIVATE_EXPORT 00494 int _dbus_printf_string_upper_bound (const char *format, 00495 va_list args); 00496 00497 00501 typedef struct 00502 { 00503 unsigned long mode; 00504 unsigned long nlink; 00505 dbus_uid_t uid; 00506 dbus_gid_t gid; 00507 unsigned long size; 00508 unsigned long atime; 00509 unsigned long mtime; 00510 unsigned long ctime; 00511 } DBusStat; 00512 00513 dbus_bool_t _dbus_stat (const DBusString *filename, 00514 DBusStat *statbuf, 00515 DBusError *error); 00516 DBUS_PRIVATE_EXPORT 00517 dbus_bool_t _dbus_socketpair (DBusSocket *fd1, 00518 DBusSocket *fd2, 00519 dbus_bool_t blocking, 00520 DBusError *error); 00521 00522 void _dbus_print_backtrace (void); 00523 00524 dbus_bool_t _dbus_become_daemon (const DBusString *pidfile, 00525 DBusPipe *print_pid_pipe, 00526 DBusError *error, 00527 dbus_bool_t keep_umask); 00528 00529 dbus_bool_t _dbus_verify_daemon_user (const char *user); 00530 dbus_bool_t _dbus_change_to_daemon_user (const char *user, 00531 DBusError *error); 00532 00533 dbus_bool_t _dbus_write_pid_to_file_and_pipe (const DBusString *pidfile, 00534 DBusPipe *print_pid_pipe, 00535 dbus_pid_t pid_to_write, 00536 DBusError *error); 00537 00538 dbus_bool_t _dbus_command_for_pid (unsigned long pid, 00539 DBusString *str, 00540 int max_len, 00541 DBusError *error); 00542 00544 typedef void (* DBusSignalHandler) (int sig); 00545 00546 void _dbus_set_signal_handler (int sig, 00547 DBusSignalHandler handler); 00548 00549 dbus_bool_t _dbus_user_at_console (const char *username, 00550 DBusError *error); 00551 00552 void _dbus_init_system_log (dbus_bool_t is_daemon); 00553 00554 typedef enum { 00555 DBUS_SYSTEM_LOG_INFO, 00556 DBUS_SYSTEM_LOG_WARNING, 00557 DBUS_SYSTEM_LOG_SECURITY, 00558 DBUS_SYSTEM_LOG_FATAL 00559 } DBusSystemLogSeverity; 00560 00561 void _dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...) _DBUS_GNUC_PRINTF (2, 3); 00562 void _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args); 00563 00564 /* Define DBUS_VA_COPY() to do the right thing for copying va_list variables. 00565 * config.h may have already defined DBUS_VA_COPY as va_copy or __va_copy. 00566 */ 00567 #if !defined (DBUS_VA_COPY) 00568 # if defined (__GNUC__) && defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32)) 00569 # define DBUS_VA_COPY(ap1, ap2) (*(ap1) = *(ap2)) 00570 # elif defined (DBUS_VA_COPY_AS_ARRAY) 00571 # define DBUS_VA_COPY(ap1, ap2) memcpy ((ap1), (ap2), sizeof (va_list)) 00572 # else /* va_list is a pointer */ 00573 # define DBUS_VA_COPY(ap1, ap2) ((ap1) = (ap2)) 00574 # endif /* va_list is a pointer */ 00575 #endif /* !DBUS_VA_COPY */ 00576 00577 00582 #define _DBUS_BYTE_OF_PRIMITIVE(p, i) \ 00583 (((const char*)&(p))[(i)]) 00584 00589 #define _DBUS_DOUBLES_BITWISE_EQUAL(a, b) \ 00590 (_DBUS_BYTE_OF_PRIMITIVE (a, 0) == _DBUS_BYTE_OF_PRIMITIVE (b, 0) && \ 00591 _DBUS_BYTE_OF_PRIMITIVE (a, 1) == _DBUS_BYTE_OF_PRIMITIVE (b, 1) && \ 00592 _DBUS_BYTE_OF_PRIMITIVE (a, 2) == _DBUS_BYTE_OF_PRIMITIVE (b, 2) && \ 00593 _DBUS_BYTE_OF_PRIMITIVE (a, 3) == _DBUS_BYTE_OF_PRIMITIVE (b, 3) && \ 00594 _DBUS_BYTE_OF_PRIMITIVE (a, 4) == _DBUS_BYTE_OF_PRIMITIVE (b, 4) && \ 00595 _DBUS_BYTE_OF_PRIMITIVE (a, 5) == _DBUS_BYTE_OF_PRIMITIVE (b, 5) && \ 00596 _DBUS_BYTE_OF_PRIMITIVE (a, 6) == _DBUS_BYTE_OF_PRIMITIVE (b, 6) && \ 00597 _DBUS_BYTE_OF_PRIMITIVE (a, 7) == _DBUS_BYTE_OF_PRIMITIVE (b, 7)) 00598 00599 dbus_bool_t _dbus_get_autolaunch_address (const char *scope, 00600 DBusString *address, 00601 DBusError *error); 00602 00603 dbus_bool_t _dbus_lookup_session_address (dbus_bool_t *supported, 00604 DBusString *address, 00605 DBusError *error); 00606 00610 typedef union DBusGUID DBusGUID; 00611 00612 dbus_bool_t _dbus_read_local_machine_uuid (DBusGUID *machine_id, 00613 dbus_bool_t create_if_not_found, 00614 DBusError *error); 00615 00621 dbus_bool_t _dbus_threads_init_platform_specific (void); 00622 00626 void _dbus_threads_lock_platform_specific (void); 00627 00631 void _dbus_threads_unlock_platform_specific (void); 00632 00633 DBUS_PRIVATE_EXPORT 00634 dbus_bool_t _dbus_split_paths_and_append (DBusString *dirs, 00635 const char *suffix, 00636 DBusList **dir_list); 00637 00638 unsigned long _dbus_pid_for_log (void); 00639 00640 /* FIXME move back to dbus-sysdeps-unix.h probably - 00641 * the PID file handling just needs a little more abstraction 00642 * in the bus daemon first. 00643 */ 00644 DBUS_PRIVATE_EXPORT 00645 dbus_pid_t _dbus_getpid (void); 00646 00647 DBUS_PRIVATE_EXPORT 00648 dbus_uid_t _dbus_getuid (void); 00649 00650 dbus_bool_t _dbus_change_to_daemon_user (const char *user, 00651 DBusError *error); 00652 00653 DBUS_PRIVATE_EXPORT 00654 void _dbus_flush_caches (void); 00655 00656 /* 00657 * replaces the term DBUS_PREFIX in configure_time_path by the 00658 * current dbus installation directory. On unix this function is a noop 00659 * 00660 * @param configure_time_path 00661 * @return real path 00662 */ 00663 const char * 00664 _dbus_replace_install_prefix (const char *configure_time_path); 00665 00666 /* Do not set this too high: it is a denial-of-service risk. 00667 * See <https://bugs.freedesktop.org/show_bug.cgi?id=82820> 00668 * 00669 * (This needs to be in the non-Unix-specific header so that 00670 * the config-parser can use it.) 00671 */ 00672 #define DBUS_DEFAULT_MESSAGE_UNIX_FDS 16 00673 00674 typedef struct DBusRLimit DBusRLimit; 00675 00676 DBusRLimit *_dbus_rlimit_save_fd_limit (DBusError *error); 00677 dbus_bool_t _dbus_rlimit_raise_fd_limit_if_privileged (unsigned int desired, 00678 DBusError *error); 00679 dbus_bool_t _dbus_rlimit_restore_fd_limit (DBusRLimit *saved, 00680 DBusError *error); 00681 void _dbus_rlimit_free (DBusRLimit *lim); 00682 00685 DBUS_END_DECLS 00686 00687 00688 #ifdef DBUS_WIN 00689 #include "dbus-sysdeps-win.h" 00690 #endif 00691 00692 #endif /* DBUS_SYSDEPS_H */