Data Structures | |
struct | DBusAtomic |
An atomic integer safe to increment or decrement from multiple threads. More... | |
struct | DBusPollFD |
A portable struct pollfd wrapper. More... | |
struct | DBusPipe |
struct | DBusStat |
Portable struct with stat() results. More... | |
Defines | |
#define | _DBUS_GNUC_PRINTF(format_idx, arg_idx) |
used to tell gcc about printf format strings | |
#define | _DBUS_GNUC_NORETURN |
used to tell gcc about functions that never return, such as _dbus_abort() | |
#define | DBUS_PID_UNSET ((dbus_pid_t) -1) |
an invalid PID used to represent an uninitialized dbus_pid_t field | |
#define | DBUS_UID_UNSET ((dbus_uid_t) -1) |
an invalid UID used to represent an uninitialized dbus_uid_t field | |
#define | DBUS_GID_UNSET ((dbus_gid_t) -1) |
an invalid GID used to represent an uninitialized dbus_gid_t field | |
#define | DBUS_PID_FORMAT "%lu" |
an appropriate printf format for dbus_pid_t | |
#define | DBUS_UID_FORMAT "%lu" |
an appropriate printf format for dbus_uid_t | |
#define | DBUS_GID_FORMAT "%lu" |
an appropriate printf format for dbus_gid_t | |
#define | _DBUS_POLLIN 0x0001 |
There is data to read. | |
#define | _DBUS_POLLPRI 0x0002 |
There is urgent data to read. | |
#define | _DBUS_POLLOUT 0x0004 |
Writing now will not block. | |
#define | _DBUS_POLLERR 0x0008 |
Error condition. | |
#define | _DBUS_POLLHUP 0x0010 |
Hung up. | |
#define | _DBUS_POLLNVAL 0x0020 |
Invalid request: fd not open. | |
#define | _DBUS_BYTE_OF_PRIMITIVE(p, i) (((const char*)&(p))[(i)]) |
Casts a primitive C type to a byte array and then indexes a particular byte of the array. | |
#define | _DBUS_DOUBLES_BITWISE_EQUAL(a, b) |
On x86 there is an 80-bit FPU, and if you do "a == b" it may have a or b in an 80-bit register, thus failing to compare the two 64-bit doubles for bitwise equality. | |
Typedefs | |
typedef unsigned long | dbus_pid_t |
A process ID. | |
typedef unsigned long | dbus_uid_t |
A user ID. | |
typedef unsigned long | dbus_gid_t |
A group ID. | |
typedef DBusAtomic | DBusAtomic |
Opaque type representing an atomically-modifiable integer that can be used from multiple threads. | |
typedef DBusDirIter | DBusDirIter |
Opaque type for reading a directory listing. | |
typedef void(* | DBusSignalHandler )(int sig) |
A UNIX signal handler. | |
typedef DBusGUID | DBusGUID |
Type representing a universally unique ID. | |
Functions | |
void | _dbus_abort (void) |
Aborts the program with SIGABRT (dumping core). | |
dbus_bool_t | _dbus_setenv (const char *varname, const char *value) |
Wrapper for setenv(). | |
const char * | _dbus_getenv (const char *varname) |
Wrapper for getenv(). | |
dbus_bool_t | _dbus_clearenv (void) |
Wrapper for clearenv(). | |
void | _dbus_pipe_init (DBusPipe *pipe, int fd) |
void | _dbus_pipe_init_stdout (DBusPipe *pipe) |
init a pipe with stdout | |
dbus_bool_t | _dbus_pipe_is_valid (DBusPipe *pipe) |
check if a pipe is valid; pipes can be set invalid, similar to a -1 file descriptor. | |
dbus_bool_t | _dbus_pipe_is_stdout_or_stderr (DBusPipe *pipe) |
Check if a pipe is stdout or stderr. | |
void | _dbus_pipe_invalidate (DBusPipe *pipe) |
Initializes a pipe to an invalid value. | |
dbus_bool_t | _dbus_split_paths_and_append (DBusString *dirs, const char *suffix, DBusList **dir_list) |
Split paths into a list of char strings. | |
dbus_bool_t | _dbus_open_tcp_socket (int *fd, DBusError *error) |
Socket interface. | |
dbus_bool_t | _dbus_close_socket (int fd, DBusError *error) |
Closes a socket. | |
int | _dbus_read_socket (int fd, DBusString *buffer, int count) |
Like _dbus_read(), but only works on sockets so is available on Windows. | |
int | _dbus_write_socket (int fd, const DBusString *buffer, int start, int len) |
Like _dbus_write(), but only supports sockets and is thus available on Windows. | |
int | _dbus_write_socket_two (int fd, const DBusString *buffer1, int start1, int len1, const DBusString *buffer2, int start2, int len2) |
Like _dbus_write_two() but only works on sockets and is thus available on Windows. | |
int | _dbus_connect_tcp_socket (const char *host, const char *port, const char *family, DBusError *error) |
Creates a socket and connects to a socket at the given host and port. | |
int | _dbus_listen_tcp_socket (const char *host, const char *port, const char *family, DBusString *retport, int **fds_p, DBusError *error) |
Creates a socket and binds it to the given path, then listens on the socket. | |
int | _dbus_accept (int listen_fd) |
Accepts a connection on a listening socket. | |
dbus_bool_t | _dbus_read_credentials_socket (int client_fd, DBusCredentials *credentials, DBusError *error) |
Reads a single byte which must be nul (an error occurs otherwise), and reads unix credentials if available. | |
dbus_bool_t | _dbus_send_credentials_socket (int server_fd, DBusError *error) |
Sends a single nul byte with our UNIX credentials as ancillary data. | |
dbus_bool_t | _dbus_credentials_add_from_user (DBusCredentials *credentials, const DBusString *username) |
Adds the credentials corresponding to the given username. | |
dbus_bool_t | _dbus_credentials_add_from_current_process (DBusCredentials *credentials) |
Adds the credentials of the current process to the passed-in credentials object. | |
dbus_bool_t | _dbus_append_user_from_current_process (DBusString *str) |
Append to the string the identity we would like to have when we authenticate, on UNIX this is the current process UID and on Windows something else, probably a Windows SID string. | |
dbus_bool_t | _dbus_parse_unix_user_from_config (const DBusString *username, dbus_uid_t *uid_p) |
Parse a UNIX user from the bus config file. | |
dbus_bool_t | _dbus_parse_unix_group_from_config (const DBusString *groupname, dbus_gid_t *gid_p) |
Parse a UNIX group from the bus config file. | |
dbus_bool_t | _dbus_unix_groups_from_uid (dbus_uid_t uid, dbus_gid_t **group_ids, int *n_group_ids) |
Gets all groups corresponding to the given UNIX user ID. | |
dbus_bool_t | _dbus_unix_user_is_at_console (dbus_uid_t uid, DBusError *error) |
Checks to see if the UNIX user ID is at the console. | |
dbus_bool_t | _dbus_unix_user_is_process_owner (dbus_uid_t uid) |
Checks to see if the UNIX user ID matches the UID of the process. | |
dbus_bool_t | _dbus_windows_user_is_process_owner (const char *windows_sid) |
Checks to see if the Windows user SID matches the owner of the process. | |
dbus_bool_t | _dbus_append_keyring_directory_for_credentials (DBusString *directory, DBusCredentials *credentials) |
Appends the directory in which a keyring for the given credentials should be stored. | |
dbus_int32_t | _dbus_atomic_inc (DBusAtomic *atomic) |
Atomically increments an integer. | |
dbus_int32_t | _dbus_atomic_dec (DBusAtomic *atomic) |
Atomically decrement an integer. | |
int | _dbus_poll (DBusPollFD *fds, int n_fds, int timeout_milliseconds) |
Wrapper for poll(). | |
void | _dbus_sleep_milliseconds (int milliseconds) |
Sleeps the given number of milliseconds. | |
void | _dbus_get_current_time (long *tv_sec, long *tv_usec) |
Get current time, as in gettimeofday(). | |
dbus_bool_t | _dbus_file_exists (const char *file) |
File/directory interface. | |
dbus_bool_t | _dbus_file_get_contents (DBusString *str, const DBusString *filename, DBusError *error) |
Appends the contents of the given file to the string, returning error code. | |
dbus_bool_t | _dbus_string_save_to_file (const DBusString *str, const DBusString *filename, DBusError *error) |
Writes a string out to a file. | |
dbus_bool_t | _dbus_make_file_world_readable (const DBusString *filename, DBusError *error) |
Makes the file readable by every user in the system. | |
dbus_bool_t | _dbus_create_file_exclusively (const DBusString *filename, DBusError *error) |
Creates the given file, failing if the file already exists. | |
dbus_bool_t | _dbus_delete_file (const DBusString *filename, DBusError *error) |
Deletes the given file. | |
dbus_bool_t | _dbus_create_directory (const DBusString *filename, DBusError *error) |
Creates a directory; succeeds if the directory is created or already existed. | |
dbus_bool_t | _dbus_delete_directory (const DBusString *filename, DBusError *error) |
Removes a directory; Directory must be empty. | |
dbus_bool_t | _dbus_concat_dir_and_file (DBusString *dir, const DBusString *next_component) |
Appends the given filename to the given directory. | |
dbus_bool_t | _dbus_string_get_dirname (const DBusString *filename, DBusString *dirname) |
Get the directory name from a complete filename. | |
dbus_bool_t | _dbus_path_is_absolute (const DBusString *filename) |
Checks whether the filename is an absolute path. | |
dbus_bool_t | _dbus_get_standard_session_servicedirs (DBusList **dirs) |
Returns the standard directories for a session bus to look for service activation files. | |
dbus_bool_t | _dbus_get_standard_system_servicedirs (DBusList **dirs) |
Returns the standard directories for a system bus to look for service activation files. | |
dbus_bool_t | _dbus_append_system_config_file (DBusString *str) |
Append the absolute path of the system.conf file (there is no system bus on Windows so this can just return FALSE and print a warning or something). | |
dbus_bool_t | _dbus_append_session_config_file (DBusString *str) |
Append the absolute path of the session.conf file. | |
int | _dbus_pipe_write (DBusPipe *pipe, const DBusString *buffer, int start, int len, DBusError *error) |
write data to a pipe. | |
int | _dbus_pipe_close (DBusPipe *pipe, DBusError *error) |
close a pipe. | |
DBusDirIter * | _dbus_directory_open (const DBusString *filename, DBusError *error) |
Open a directory to iterate over. | |
dbus_bool_t | _dbus_directory_get_next_file (DBusDirIter *iter, DBusString *filename, DBusError *error) |
Get next file in the directory. | |
void | _dbus_directory_close (DBusDirIter *iter) |
Closes a directory iteration. | |
dbus_bool_t | _dbus_check_dir_is_private_to_user (DBusString *dir, DBusError *error) |
Checks to make sure the given directory is private to the user. | |
void | _dbus_fd_set_close_on_exec (int fd) |
Sets the file descriptor to be close on exec. | |
const char * | _dbus_get_tmpdir (void) |
Gets the temporary files directory by inspecting the environment variables TMPDIR, TMP, and TEMP in that order. | |
void | _dbus_generate_pseudorandom_bytes_buffer (char *buffer, int n_bytes) |
Random numbers. | |
void | _dbus_generate_random_bytes_buffer (char *buffer, int n_bytes) |
Fills n_bytes of the given buffer with random bytes. | |
dbus_bool_t | _dbus_generate_random_bytes (DBusString *str, int n_bytes) |
Generates the given number of random bytes, using the best mechanism we can come up with. | |
dbus_bool_t | _dbus_generate_random_ascii (DBusString *str, int n_bytes) |
Generates the given number of random bytes, where the bytes are chosen from the alphanumeric ASCII subset. | |
const char * | _dbus_error_from_errno (int error_number) |
Converts a UNIX or Windows errno into a DBusError name. | |
void | _dbus_set_errno_to_zero (void) |
Assign 0 to the global errno variable. | |
dbus_bool_t | _dbus_get_is_errno_nonzero (void) |
See if errno is set. | |
dbus_bool_t | _dbus_get_is_errno_eagain_or_ewouldblock (void) |
See if errno is EAGAIN or EWOULDBLOCK (this has to be done differently for Winsock so is abstracted). | |
dbus_bool_t | _dbus_get_is_errno_enomem (void) |
See if errno is ENOMEM. | |
dbus_bool_t | _dbus_get_is_errno_eintr (void) |
See if errno is EINTR. | |
const char * | _dbus_strerror_from_errno (void) |
Get error message from errno. | |
void | _dbus_disable_sigpipe (void) |
signal (SIGPIPE, SIG_IGN); | |
void | _dbus_exit (int code) _DBUS_GNUC_NORETURN |
Exit the process, returning the given value. | |
int | _dbus_printf_string_upper_bound (const char *format, va_list args) |
Measure the length of the given format string and arguments, not including the terminating nul. | |
dbus_bool_t | _dbus_stat (const DBusString *filename, DBusStat *statbuf, DBusError *error) |
stat() wrapper. | |
dbus_bool_t | _dbus_full_duplex_pipe (int *fd1, int *fd2, dbus_bool_t blocking, DBusError *error) |
Creates a full-duplex pipe (as in socketpair()). | |
void | _dbus_print_backtrace (void) |
On GNU libc systems, print a crude backtrace to stderr. | |
dbus_bool_t | _dbus_become_daemon (const DBusString *pidfile, DBusPipe *print_pid_pipe, DBusError *error) |
Does the chdir, fork, setsid, etc. | |
dbus_bool_t | _dbus_verify_daemon_user (const char *user) |
Verify that after the fork we can successfully change to this user. | |
dbus_bool_t | _dbus_change_to_daemon_user (const char *user, DBusError *error) |
Changes the user and group the bus is running as. | |
dbus_bool_t | _dbus_write_pid_to_file_and_pipe (const DBusString *pidfile, DBusPipe *print_pid_pipe, dbus_pid_t pid_to_write, DBusError *error) |
Writes the given pid_to_write to a pidfile (if non-NULL) and/or to a pipe (if non-NULL). | |
void | _dbus_set_signal_handler (int sig, DBusSignalHandler handler) |
Installs a UNIX signal handler. | |
dbus_bool_t | _dbus_user_at_console (const char *username, DBusError *error) |
Checks if user is at the console. | |
dbus_bool_t | _dbus_get_autolaunch_address (DBusString *address, DBusError *error) |
Determines the address of the session bus by querying a platform-specific method. | |
dbus_bool_t | _dbus_read_local_machine_uuid (DBusGUID *machine_id, dbus_bool_t create_if_not_found, DBusError *error) |
Reads the uuid of the machine we're running on from the dbus configuration. | |
dbus_bool_t | _dbus_threads_init_platform_specific (void) |
Initialize threads as in dbus_threads_init_default(), appropriately for the platform. | |
unsigned long | _dbus_pid_for_log (void) |
The only reason this is separate from _dbus_getpid() is to allow it on Windows for logging but not for other purposes. | |
dbus_pid_t | _dbus_getpid (void) |
Gets our process ID. | |
void | _dbus_flush_caches (void) |
Called when the bus daemon is signaled to reload its configuration; any caches should be nuked. |
The system-dependent API has a dual purpose. First, it encapsulates all usage of operating system APIs for ease of auditing and to avoid cluttering the rest of the code with bizarre OS quirks and headers. Second, it abstracts different operating system APIs for portability.
|
Value: (_DBUS_BYTE_OF_PRIMITIVE (a, 0) == _DBUS_BYTE_OF_PRIMITIVE (b, 0) && \ _DBUS_BYTE_OF_PRIMITIVE (a, 1) == _DBUS_BYTE_OF_PRIMITIVE (b, 1) && \ _DBUS_BYTE_OF_PRIMITIVE (a, 2) == _DBUS_BYTE_OF_PRIMITIVE (b, 2) && \ _DBUS_BYTE_OF_PRIMITIVE (a, 3) == _DBUS_BYTE_OF_PRIMITIVE (b, 3) && \ _DBUS_BYTE_OF_PRIMITIVE (a, 4) == _DBUS_BYTE_OF_PRIMITIVE (b, 4) && \ _DBUS_BYTE_OF_PRIMITIVE (a, 5) == _DBUS_BYTE_OF_PRIMITIVE (b, 5) && \ _DBUS_BYTE_OF_PRIMITIVE (a, 6) == _DBUS_BYTE_OF_PRIMITIVE (b, 6) && \ _DBUS_BYTE_OF_PRIMITIVE (a, 7) == _DBUS_BYTE_OF_PRIMITIVE (b, 7)) So this macro compares the two doubles bitwise. Definition at line 447 of file dbus-sysdeps.h. |
|
Type representing a universally unique ID.
Definition at line 463 of file dbus-sysdeps.h. |
|
Accepts a connection on a listening socket. Handles EINTR for you.
Definition at line 1336 of file dbus-sysdeps-unix.c. |
|
Appends the directory in which a keyring for the given credentials should be stored. The credentials should have either a Windows or UNIX user in them. The directory should be an absolute path. On UNIX the directory is ~/.dbus-keyrings while on Windows it should probably be something else, since the dotfile convention is not normal on Windows.
Definition at line 3186 of file dbus-sysdeps-unix.c. References _dbus_assert, _dbus_concat_dir_and_file(), _dbus_credentials_are_anonymous(), _dbus_credentials_get_unix_uid(), _dbus_getenv(), _dbus_homedir_from_uid(), _dbus_string_append(), _dbus_string_copy(), _dbus_string_free(), _dbus_string_init(), _dbus_string_init_const(), _dbus_string_set_length(), _dbus_warn(), DBUS_UID_UNSET, FALSE, NULL, and TRUE. Referenced by _dbus_keyring_new_for_credentials(). |
|
Append the absolute path of the session.conf file.
Definition at line 3154 of file dbus-sysdeps-unix.c. References _dbus_string_append(). |
|
Append the absolute path of the system.conf file (there is no system bus on Windows so this can just return FALSE and print a warning or something).
Definition at line 3142 of file dbus-sysdeps-unix.c. References _dbus_string_append(). |
|
Append to the string the identity we would like to have when we authenticate, on UNIX this is the current process UID and on Windows something else, probably a Windows SID string. No escaping is required, that is done in dbus-auth.c. The username here need not be anything human-readable, it can be the machine-readable form i.e. a user id.
Definition at line 1666 of file dbus-sysdeps-unix.c. References _dbus_geteuid(), and _dbus_string_append_uint(). |
|
Atomically decrement an integer.
Definition at line 1803 of file dbus-sysdeps-unix.c. References _DBUS_LOCK, _DBUS_UNLOCK, and DBusAtomic::value. Referenced by _dbus_connection_unref_unlocked(), _dbus_server_unref_unlocked(), dbus_connection_unref(), dbus_free(), dbus_message_unref(), dbus_pending_call_unref(), and dbus_server_unref(). |
|
Atomically increments an integer.
Definition at line 1780 of file dbus-sysdeps-unix.c. References _DBUS_LOCK, _DBUS_UNLOCK, and DBusAtomic::value. Referenced by _dbus_connection_ref_unlocked(), _dbus_server_ref_unlocked(), dbus_connection_ref(), dbus_malloc(), dbus_malloc0(), dbus_message_ref(), dbus_pending_call_ref(), dbus_realloc(), and dbus_server_ref(). |
|
Does the chdir, fork, setsid, etc. to become a daemon process.
Definition at line 75 of file dbus-sysdeps-util-unix.c. References _dbus_assert_not_reached, _dbus_error_from_errno(), _dbus_getenv(), _dbus_write_pid_to_file_and_pipe(), DBUS_ERROR_FAILED, dbus_set_error(), FALSE, DBusError::message, NULL, and TRUE. |
|
Changes the user and group the bus is running as.
Definition at line 313 of file dbus-sysdeps-util-unix.c. References _dbus_error_from_errno(), _dbus_get_user_id_and_primary_group(), _dbus_geteuid(), _dbus_string_init_const(), _dbus_warn(), DBUS_ERROR_FAILED, dbus_set_error(), FALSE, NULL, and TRUE. |
|
Checks to make sure the given directory is private to the user.
Definition at line 1367 of file dbus-sysdeps-unix.c. References _dbus_error_from_errno(), DBUS_ERROR_FAILED, dbus_set_error(), FALSE, and TRUE. |
|
Wrapper for clearenv().
Definition at line 186 of file dbus-sysdeps.c. |
|
Closes a socket. Should not be used on non-socket file descriptors or handles.
Definition at line 135 of file dbus-sysdeps-unix.c. References _dbus_close(). Referenced by _dbus_babysitter_unref(), _dbus_server_new_for_domain_socket(), _dbus_server_new_for_tcp_socket(), _dbus_transport_new_for_domain_socket(), and _dbus_transport_new_for_tcp_socket(). |
|
Appends the given filename to the given directory.
Definition at line 2342 of file dbus-sysdeps-unix.c. References _dbus_string_append_byte(), _dbus_string_copy(), _dbus_string_shorten(), FALSE, and TRUE. Referenced by _dbus_append_keyring_directory_for_credentials(), _dbus_get_standard_session_servicedirs(), _dbus_keyring_new_for_credentials(), _dbus_server_listen_platform_specific(), and _dbus_split_paths_and_append(). |
|
Creates a socket and connects to a socket at the given host and port. The connection fd is returned, and is set up as nonblocking.
Definition at line 748 of file dbus-sysdeps-unix.c. References _dbus_close(), _dbus_error_from_errno(), _dbus_open_tcp_socket(), _DBUS_ZERO, dbus_set_error(), and NULL. Referenced by _dbus_transport_new_for_tcp_socket(). |
|
Creates a directory; succeeds if the directory is created or already existed.
Definition at line 2308 of file dbus-sysdeps-unix.c. References DBUS_ERROR_FAILED, dbus_set_error(), FALSE, and TRUE. Referenced by _dbus_keyring_new_for_credentials(). |
|
Creates the given file, failing if the file already exists.
Definition at line 2233 of file dbus-sysdeps-unix.c. References _dbus_close(), DBUS_ERROR_FAILED, dbus_set_error(), FALSE, NULL, and TRUE. |
|
Adds the credentials of the current process to the passed-in credentials object.
Definition at line 1636 of file dbus-sysdeps-unix.c. References _dbus_assert, _dbus_credentials_add_unix_pid(), _dbus_credentials_add_unix_uid(), _dbus_geteuid(), _dbus_getpid(), FALSE, and TRUE. Referenced by _dbus_credentials_new_from_current_process(), and _dbus_keyring_new_for_credentials(). |
|
Adds the credentials corresponding to the given username. Used among other purposes to parses a desired identity provided from a client in the auth protocol. On UNIX this means parsing a UID, on Windows probably parsing an SID string.
Definition at line 490 of file dbus-userdb.c. References _dbus_credentials_add_unix_uid(), _dbus_user_database_get_system(), _dbus_user_database_get_username(), _dbus_user_database_lock_system(), _dbus_user_database_unlock_system(), DBusTransport::credentials, FALSE, NULL, TRUE, and DBusUserInfo::uid. |
|
Removes a directory; Directory must be empty.
Definition at line 482 of file dbus-sysdeps-util-unix.c. References DBUS_ERROR_FAILED, dbus_set_error(), FALSE, and TRUE. |
|
Deletes the given file.
Definition at line 2279 of file dbus-sysdeps-unix.c. References DBUS_ERROR_FAILED, dbus_set_error(), FALSE, and TRUE. |
|
Get next file in the directory. Will not return "." or ".." on UNIX. If an error occurs, the contents of "filename" are undefined. The error is never set if the function succeeds.
Definition at line 716 of file dbus-sysdeps-util-unix.c. References _dbus_error_from_errno(), _dbus_string_append(), _dbus_string_set_length(), DBusDirIter::d, DBUS_ERROR_FAILED, DBUS_ERROR_NO_MEMORY, dbus_free(), dbus_malloc(), dbus_set_error(), FALSE, and TRUE. |
|
Open a directory to iterate over.
Definition at line 628 of file dbus-sysdeps-util-unix.c. References _dbus_error_from_errno(), DBusDirIter::d, DBUS_ERROR_NO_MEMORY, dbus_new0, dbus_set_error(), and NULL. |
|
Converts a UNIX or Windows errno into a DBusError name.
Definition at line 911 of file dbus-sysdeps.c. References DBUS_ERROR_ACCESS_DENIED, DBUS_ERROR_ADDRESS_IN_USE, DBUS_ERROR_FAILED, DBUS_ERROR_FILE_EXISTS, DBUS_ERROR_FILE_NOT_FOUND, DBUS_ERROR_LIMITS_EXCEEDED, DBUS_ERROR_NO_MEMORY, DBUS_ERROR_NO_NETWORK, DBUS_ERROR_NO_SERVER, DBUS_ERROR_NOT_SUPPORTED, and DBUS_ERROR_TIMEOUT. Referenced by _dbus_become_daemon(), _dbus_change_to_daemon_user(), _dbus_check_dir_is_private_to_user(), _dbus_close(), _dbus_connect_tcp_socket(), _dbus_connect_unix_socket(), _dbus_directory_get_next_file(), _dbus_directory_open(), _dbus_file_get_contents(), _dbus_full_duplex_pipe(), _dbus_get_autolaunch_address(), _dbus_listen_tcp_socket(), _dbus_listen_unix_socket(), _dbus_read_credentials_socket(), _dbus_stat(), and _dbus_string_save_to_file(). |
|
Exit the process, returning the given value.
Definition at line 2478 of file dbus-sysdeps-unix.c. Referenced by _dbus_abort(). |
|
Sets the file descriptor to be close on exec. Should be called for all file descriptors in D-Bus code.
Definition at line 2520 of file dbus-sysdeps-unix.c. Referenced by _dbus_server_new_for_domain_socket(), _dbus_server_new_for_tcp_socket(), _dbus_spawn_async_with_babysitter(), _dbus_transport_new_for_domain_socket(), and _dbus_transport_new_for_tcp_socket(). |
|
File/directory interface.
Definition at line 508 of file dbus-sysdeps-util-unix.c. Referenced by _dbus_user_at_console(). |
|
Appends the contents of the given file to the string, returning error code. At the moment, won't open a file more than a megabyte in size.
Definition at line 1960 of file dbus-sysdeps-unix.c. References _dbus_close(), _dbus_error_from_errno(), _dbus_read(), _dbus_string_set_length(), DBUS_ERROR_FAILED, dbus_set_error(), FALSE, NULL, and TRUE. |
|
Called when the bus daemon is signaled to reload its configuration; any caches should be nuked. Of course any caches that need explicit reload are probably broken, but c'est la vie. Definition at line 3167 of file dbus-sysdeps-unix.c. References _dbus_user_database_flush_system(). |
|
Creates a full-duplex pipe (as in socketpair()). Sets both ends of the pipe nonblocking.
Definition at line 2652 of file dbus-sysdeps-unix.c. References _dbus_close(), _dbus_error_from_errno(), _dbus_warn(), DBUS_ERROR_FAILED, dbus_set_error(), FALSE, NULL, and TRUE. Referenced by _dbus_spawn_async_with_babysitter(). |
|
Generates the given number of random bytes, where the bytes are chosen from the alphanumeric ASCII subset.
Definition at line 872 of file dbus-sysdeps.c. References _dbus_assert, _dbus_generate_random_bytes(), _dbus_string_validate_ascii(), FALSE, and TRUE. Referenced by _dbus_server_listen_platform_specific(), and _dbus_string_save_to_file(). |
|
Generates the given number of random bytes, using the best mechanism we can come up with.
Definition at line 2435 of file dbus-sysdeps-unix.c. References _dbus_close(), _dbus_read(), _dbus_string_set_length(), NULL, and TRUE. Referenced by _dbus_generate_random_ascii(), and _dbus_generate_random_bytes_buffer(). |
|
Fills n_bytes of the given buffer with random bytes.
Definition at line 840 of file dbus-sysdeps.c. References _dbus_generate_pseudorandom_bytes_buffer(), _dbus_generate_random_bytes(), _dbus_string_copy_to_buffer(), _dbus_string_free(), and _dbus_string_init(). Referenced by _dbus_generate_uuid(). |
|
Determines the address of the session bus by querying a platform-specific method.
If successful, returns TRUE and appends the address to
Definition at line 2765 of file dbus-sysdeps-unix.c. References _dbus_assert, _dbus_error_from_errno(), _dbus_get_local_machine_uuid_encoded(), _DBUS_N_ELEMENTS, _dbus_read(), _dbus_string_free(), _dbus_string_init(), _dbus_string_set_length(), DBUS_ERROR_SPAWN_EXEC_FAILED, dbus_set_error(), FALSE, NULL, READ_END, TRUE, and WRITE_END. |
|
Get current time, as in gettimeofday().
Definition at line 1936 of file dbus-sysdeps-unix.c. References NULL. Referenced by _dbus_connection_block_pending_call(), _dbus_generate_pseudorandom_bytes_buffer(), and _dbus_generate_uuid(). |
|
See if errno is EAGAIN or EWOULDBLOCK (this has to be done differently for Winsock so is abstracted).
Definition at line 3257 of file dbus-sysdeps-unix.c. |
|
See if errno is EINTR.
Definition at line 1033 of file dbus-sysdeps.c. |
|
See if errno is ENOMEM.
Definition at line 1023 of file dbus-sysdeps.c. |
|
See if errno is set.
Definition at line 1013 of file dbus-sysdeps.c. |
|
Returns the standard directories for a session bus to look for service activation files. On UNIX this should be the standard xdg freedesktop.org data directories: XDG_DATA_HOME=${XDG_DATA_HOME-$HOME/.local/share} XDG_DATA_DIRS=${XDG_DATA_DIRS-/usr/local/share:/usr/share} and DBUS_DATADIR
Definition at line 2998 of file dbus-sysdeps-unix.c. References _dbus_concat_dir_and_file(), _dbus_getenv(), _dbus_homedir_from_current_process(), _dbus_split_paths_and_append(), _dbus_string_append(), _dbus_string_free(), _dbus_string_init(), _dbus_string_init_const(), FALSE, NULL, and TRUE. |
|
Returns the standard directories for a system bus to look for service activation files. On UNIX this should be the standard xdg freedesktop.org data directories: XDG_DATA_DIRS=${XDG_DATA_DIRS-/usr/local/share:/usr/share} and DBUS_DATADIR On Windows there is no system bus and this function can return nothing.
Definition at line 3087 of file dbus-sysdeps-unix.c. References _dbus_getenv(), _dbus_split_paths_and_append(), _dbus_string_append(), _dbus_string_free(), _dbus_string_init(), FALSE, NULL, and TRUE. |
|
Gets the temporary files directory by inspecting the environment variables TMPDIR, TMP, and TEMP in that order. If none of those are set "/tmp" is returned
Definition at line 2721 of file dbus-sysdeps-unix.c. References _dbus_assert, and NULL. |
|
Wrapper for getenv().
Definition at line 175 of file dbus-sysdeps.c. Referenced by _dbus_abort(), _dbus_append_keyring_directory_for_credentials(), _dbus_become_daemon(), _dbus_get_standard_session_servicedirs(), and _dbus_get_standard_system_servicedirs(). |
|
Gets our process ID.
Definition at line 1677 of file dbus-sysdeps-unix.c. Referenced by _dbus_credentials_add_from_current_process(). |
|
Creates a socket and binds it to the given path, then listens on the socket. The socket is set to be nonblocking. In case of port=0 a random free port is used and returned in the port parameter. If inaddr_any is specified, the hostname is ignored.
Definition at line 856 of file dbus-sysdeps-unix.c. References _dbus_close(), _dbus_error_from_errno(), _dbus_string_append(), _DBUS_ZERO, DBUS_ERROR_NO_MEMORY, dbus_realloc(), dbus_set_error(), and NULL. Referenced by _dbus_server_new_for_tcp_socket(). |
|
Makes the file readable by every user in the system.
Definition at line 2206 of file dbus-sysdeps-unix.c. References DBUS_ERROR_FAILED, dbus_set_error(), FALSE, and TRUE. |
|
Socket interface.
Definition at line 106 of file dbus-sysdeps-unix.c. Referenced by _dbus_connect_tcp_socket(). |
|
Parse a UNIX group from the bus config file. On Windows, this should simply always fail (just return FALSE).
Definition at line 942 of file dbus-sysdeps-util-unix.c. References _dbus_get_group_id(). |
|
Parse a UNIX user from the bus config file. On Windows, this should simply always fail (just return FALSE).
Definition at line 926 of file dbus-sysdeps-util-unix.c. References _dbus_get_user_id(). |
|
Checks whether the filename is an absolute path.
Definition at line 563 of file dbus-sysdeps-util-unix.c. References FALSE. |
|
The only reason this is separate from _dbus_getpid() is to allow it on Windows for logging but not for other purposes.
Definition at line 1707 of file dbus-sysdeps-unix.c. Referenced by _dbus_abort(), and _dbus_warn_check_failed(). |
|
close a pipe.
Definition at line 214 of file dbus-sysdeps-unix.c. References _dbus_close(), _dbus_pipe_invalidate(), and DBusPipe::fd_or_handle. |
|
init a pipe with stdout
Definition at line 222 of file dbus-sysdeps.c. References _dbus_pipe_init(). |
|
Initializes a pipe to an invalid value.
Definition at line 257 of file dbus-sysdeps.c. References DBusPipe::fd_or_handle. Referenced by _dbus_pipe_close(). |
|
Check if a pipe is stdout or stderr.
Definition at line 247 of file dbus-sysdeps.c. References DBusPipe::fd_or_handle. |
|
check if a pipe is valid; pipes can be set invalid, similar to a -1 file descriptor.
Definition at line 235 of file dbus-sysdeps.c. References DBusPipe::fd_or_handle. Referenced by _dbus_write_pid_to_file_and_pipe(). |
|
write data to a pipe.
Definition at line 188 of file dbus-sysdeps-unix.c. References _dbus_write(), DBUS_ERROR_FAILED, dbus_set_error(), and DBusPipe::fd_or_handle. Referenced by _dbus_write_pid_to_file_and_pipe(). |
|
Wrapper for poll().
Definition at line 1838 of file dbus-sysdeps-unix.c. References _DBUS_POLLERR, _DBUS_POLLHUP, _DBUS_POLLIN, _DBUS_POLLNVAL, _DBUS_POLLOUT, _DBUS_POLLPRI, and _dbus_warn(). |
|
On GNU libc systems, print a crude backtrace to stderr. On other systems, print "no backtrace support" and block for possible gdb attachment if an appropriate environment variable is set. Definition at line 2607 of file dbus-sysdeps-unix.c. Referenced by _dbus_abort(). |
|
Measure the length of the given format string and arguments, not including the terminating nul.
Definition at line 2707 of file dbus-sysdeps-unix.c. Referenced by _dbus_string_append_printf_valist(). |
|
Reads a single byte which must be nul (an error occurs otherwise), and reads unix credentials if available. Clears the credentials object, then adds pid/uid if available, so any previous credentials stored in the object are lost. Return value indicates whether a byte was read, not whether we got valid credentials. On some systems, such as Linux, reading/writing the byte isn't actually required, but we do it anyway just to avoid multiple codepaths. Fails if no byte is available, so you must select() first. The point of the byte is that on some systems we have to use sendmsg()/recvmsg() to transmit credentials.
Definition at line 1114 of file dbus-sysdeps-unix.c. References _dbus_assert, _dbus_credentials_add_unix_pid(), _dbus_credentials_add_unix_uid(), _dbus_credentials_clear(), _dbus_error_from_errno(), DBUS_ERROR_FAILED, DBUS_PID_FORMAT, DBUS_PID_UNSET, dbus_set_error(), DBUS_UID_FORMAT, DBUS_UID_UNSET, FALSE, NULL, and TRUE. |
|
Reads the uuid of the machine we're running on from the dbus configuration. Optionally try to create it (only root can do this usually). On UNIX, reads a file that gets created by dbus-uuidgen in a post-install script. On Windows, if there's a standard machine uuid we could just use that, but I can't find one with the right properties (the hardware profile guid can change without rebooting I believe). If there's no standard one we might want to use the registry instead of a file for this, and I'm not sure how we'd ensure the uuid gets created.
Definition at line 2967 of file dbus-sysdeps-unix.c. References _dbus_read_uuid_file(), and _dbus_string_init_const(). Referenced by _dbus_get_local_machine_uuid_encoded(), and dbus_internal_do_not_use_get_uuid(). |
|
Like _dbus_read(), but only works on sockets so is available on Windows.
Definition at line 151 of file dbus-sysdeps-unix.c. References _dbus_read(). |
|
Sends a single nul byte with our UNIX credentials as ancillary data. Returns TRUE if the data was successfully written. On systems that don't support sending credentials, just writes a byte, doesn't send any credentials. On some systems, such as Linux, reading/writing the byte isn't actually required, but we do it anyway just to avoid multiple codepaths. Fails if no byte can be written, so you must select() first. The point of the byte is that on some systems we have to use sendmsg()/recvmsg() to transmit credentials.
Definition at line 1317 of file dbus-sysdeps-unix.c. |
|
Installs a UNIX signal handler.
Definition at line 460 of file dbus-sysdeps-util-unix.c. References NULL. |
|
Wrapper for setenv(). If the value is NULL, unsets the environment variable. There is an unfixable memleak in that it is unsafe to free memory malloced for use with setenv. This is because we can not rely on internal implementation details of the underlying libc library.
Definition at line 104 of file dbus-sysdeps.c. References _dbus_assert, FALSE, NULL, and TRUE. |
|
Sleeps the given number of milliseconds.
Definition at line 2387 of file dbus-sysdeps-unix.c. Referenced by _dbus_abort(). |
|
Split paths into a list of char strings.
Definition at line 271 of file dbus-sysdeps.c. References _dbus_concat_dir_and_file(), _dbus_list_append(), _dbus_list_clear(), _dbus_list_foreach(), _dbus_string_chop_white(), _dbus_string_copy_data(), _dbus_string_copy_len(), _dbus_string_find(), _dbus_string_free(), _dbus_string_init(), _dbus_string_init_const(), dbus_free(), FALSE, NULL, and TRUE. Referenced by _dbus_get_standard_session_servicedirs(), and _dbus_get_standard_system_servicedirs(). |
|
stat() wrapper.
Definition at line 580 of file dbus-sysdeps-util-unix.c. References _dbus_error_from_errno(), DBusStat::atime, DBusStat::ctime, dbus_set_error(), FALSE, DBusStat::gid, DBusStat::mode, DBusStat::mtime, DBusStat::nlink, DBusStat::size, TRUE, and DBusStat::uid. Referenced by _dbus_is_console_user(). |
|
Get error message from errno.
Definition at line 1043 of file dbus-sysdeps.c. |
|
Get the directory name from a complete filename.
Definition at line 1023 of file dbus-sysdeps-util-unix.c. References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL. |
|
Writes a string out to a file. If the file exists, it will be atomically overwritten by the new data.
Definition at line 2068 of file dbus-sysdeps-unix.c. References _dbus_close(), _dbus_error_from_errno(), _dbus_generate_random_ascii(), _dbus_string_append(), _dbus_string_copy(), _dbus_string_free(), _dbus_string_init(), _dbus_write(), DBUS_ERROR_NO_MEMORY, dbus_set_error(), FALSE, NULL, and TRUE. |
|
Initialize threads as in dbus_threads_init_default(), appropriately for the platform.
Definition at line 321 of file dbus-sysdeps-pthread.c. References dbus_threads_init(). Referenced by dbus_threads_init_default(). |
|
Gets all groups corresponding to the given UNIX user ID. On UNIX, just calls _dbus_groups_from_uid(). On Windows, should always fail since we don't know any UNIX groups.
Definition at line 959 of file dbus-sysdeps-util-unix.c. References _dbus_groups_from_uid(). |
|
Checks to see if the UNIX user ID is at the console. Should always fail on Windows (set the error to DBUS_ERROR_NOT_SUPPORTED).
Definition at line 976 of file dbus-sysdeps-util-unix.c. References _dbus_is_console_user(). |
|
Checks to see if the UNIX user ID matches the UID of the process. Should always return FALSE on Windows.
Definition at line 991 of file dbus-sysdeps-util-unix.c. References _dbus_geteuid(). |
|
Checks if user is at the console.
Definition at line 520 of file dbus-sysdeps-util-unix.c. References _dbus_file_exists(), _dbus_string_append(), _dbus_string_free(), _dbus_string_init(), and FALSE. Referenced by _dbus_is_console_user(). |
|
Verify that after the fork we can successfully change to this user.
Definition at line 296 of file dbus-sysdeps-util-unix.c. References _dbus_get_user_id_and_primary_group(), _dbus_string_init_const(), and NULL. |
|
Checks to see if the Windows user SID matches the owner of the process. Should always return FALSE on UNIX.
Definition at line 1004 of file dbus-sysdeps-util-unix.c. References FALSE. |
|
Writes the given pid_to_write to a pidfile (if non-NULL) and/or to a pipe (if non-NULL). Does nothing if pidfile and print_pid_pipe are both NULL.
Definition at line 223 of file dbus-sysdeps-util-unix.c. References _dbus_pipe_is_valid(), _dbus_pipe_write(), _dbus_string_append(), _dbus_string_append_int(), _dbus_string_free(), _dbus_string_init(), DBUS_ERROR_FAILED, dbus_error_is_set(), dbus_set_error(), FALSE, NULL, and TRUE. Referenced by _dbus_become_daemon(). |
|
Like _dbus_write(), but only supports sockets and is thus available on Windows.
Definition at line 169 of file dbus-sysdeps-unix.c. References _dbus_write(). |
|
Like _dbus_write_two() but only works on sockets and is thus available on Windows.
Definition at line 242 of file dbus-sysdeps-unix.c. References _dbus_write_two(). |