Functions | |
dbus_bool_t | _dbus_close (int fd, DBusError *error) |
Closes a file descriptor. | |
int | _dbus_read (int fd, DBusString *buffer, int count) |
Thin wrapper around the read() system call that appends the data it reads to the DBusString buffer. | |
int | _dbus_write (int fd, const DBusString *buffer, int start, int len) |
Thin wrapper around the write() system call that writes a part of a DBusString and handles EINTR for you. | |
int | _dbus_write_two (int fd, const DBusString *buffer1, int start1, int len1, const DBusString *buffer2, int start2, int len2) |
Like _dbus_write() but will use writev() if possible to write both buffers in sequence. | |
dbus_bool_t | _dbus_open_unix_socket (int *fd, DBusError *error) |
Opens a UNIX domain socket (as in the socket() call). | |
int | _dbus_connect_unix_socket (const char *path, dbus_bool_t abstract, DBusError *error) |
Creates a socket and connects it to the UNIX domain socket at the given path. | |
int | _dbus_listen_unix_socket (const char *path, dbus_bool_t abstract, DBusError *error) |
Creates a socket and binds it to the given path, then listens on the socket. |
dbus_bool_t _dbus_close | ( | int | fd, | |
DBusError * | error | |||
) |
Closes a file descriptor.
fd | the file descriptor | |
error | error object |
Definition at line 2146 of file dbus-sysdeps-unix.c.
References _dbus_error_from_errno(), dbus_set_error(), FALSE, and TRUE.
Referenced by _dbus_close_socket(), _dbus_connect_tcp_socket(), _dbus_connect_unix_socket(), _dbus_create_file_exclusively(), _dbus_file_get_contents(), _dbus_full_duplex_pipe(), _dbus_generate_random_bytes(), _dbus_listen_tcp_socket(), _dbus_listen_unix_socket(), _dbus_string_save_to_file(), and _dbus_write_pid_file().
int _dbus_connect_unix_socket | ( | const char * | path, | |
dbus_bool_t | abstract, | |||
DBusError * | error | |||
) |
Creates a socket and connects it to the UNIX domain socket at the given path.
The connection fd is returned, and is set up as nonblocking.
Uses abstract sockets instead of filesystem-linked sockets if requested (it's possible only on Linux; see "man 7 unix" on Linux). On non-Linux abstract socket usage always fails.
path | the path to UNIX domain socket | |
abstract | TRUE to use abstract namespace | |
error | return location for error code |
Definition at line 419 of file dbus-sysdeps-unix.c.
References _dbus_close(), _dbus_error_from_errno(), _dbus_open_unix_socket(), _DBUS_ZERO, DBUS_ERROR_BAD_ADDRESS, DBUS_ERROR_NOT_SUPPORTED, dbus_set_error(), and NULL.
Referenced by _dbus_transport_new_for_domain_socket().
int _dbus_listen_unix_socket | ( | const char * | path, | |
dbus_bool_t | abstract, | |||
DBusError * | error | |||
) |
Creates a socket and binds it to the given path, then listens on the socket.
The socket is set to be nonblocking.
Uses abstract sockets instead of filesystem-linked sockets if requested (it's possible only on Linux; see "man 7 unix" on Linux). On non-Linux abstract socket usage always fails.
path | the socket name | |
abstract | TRUE to use abstract namespace | |
error | return location for errors |
Definition at line 555 of file dbus-sysdeps-unix.c.
References _dbus_close(), _dbus_error_from_errno(), _dbus_open_unix_socket(), _dbus_warn(), _DBUS_ZERO, DBUS_ERROR_BAD_ADDRESS, DBUS_ERROR_NOT_SUPPORTED, dbus_set_error(), NULL, and TRUE.
Referenced by _dbus_server_new_for_domain_socket().
dbus_bool_t _dbus_open_unix_socket | ( | int * | fd, | |
DBusError * | error | |||
) |
Opens a UNIX domain socket (as in the socket() call).
Does not bind the socket.
fd | return location for socket descriptor | |
error | return location for an error |
Definition at line 115 of file dbus-sysdeps-unix.c.
Referenced by _dbus_connect_unix_socket(), and _dbus_listen_unix_socket().
int _dbus_read | ( | int | fd, | |
DBusString * | buffer, | |||
int | count | |||
) |
Thin wrapper around the read() system call that appends the data it reads to the DBusString buffer.
It appends up to the given count, and returns the same value and same errno as read(). The only exception is that _dbus_read() handles EINTR for you. Also, _dbus_read() can return ENOMEM, even though regular UNIX read doesn't.
Unlike _dbus_read_socket(), _dbus_read() is not available on Windows.
fd | the file descriptor to read from | |
buffer | the buffer to append data to | |
count | the amount of data to read |
Definition at line 216 of file dbus-sysdeps-unix.c.
References _dbus_assert, _dbus_string_get_data_len(), _dbus_string_lengthen(), _dbus_string_set_length(), and _dbus_verbose_bytes_of_string().
Referenced by _dbus_file_get_contents(), _dbus_generate_random_bytes(), _dbus_get_autolaunch_address(), and _dbus_read_socket().
int _dbus_write | ( | int | fd, | |
const DBusString * | buffer, | |||
int | start, | |||
int | len | |||
) |
Thin wrapper around the write() system call that writes a part of a DBusString and handles EINTR for you.
fd | the file descriptor to write | |
buffer | the buffer to write data from | |
start | the first byte in the buffer to write | |
len | the number of bytes to try to write |
Definition at line 276 of file dbus-sysdeps-unix.c.
References _dbus_verbose_bytes_of_string().
Referenced by _dbus_string_save_to_file(), _dbus_write_socket(), and _dbus_write_two().
int _dbus_write_two | ( | int | fd, | |
const DBusString * | buffer1, | |||
int | start1, | |||
int | len1, | |||
const DBusString * | buffer2, | |||
int | start2, | |||
int | len2 | |||
) |
Like _dbus_write() but will use writev() if possible to write both buffers in sequence.
The return value is the number of bytes written in the first buffer, plus the number written in the second. If the first buffer is written successfully and an error occurs writing the second, the number of bytes in the first is returned (i.e. the error is ignored), on systems that don't have writev. Handles EINTR for you. The second buffer may be NULL.
fd | the file descriptor | |
buffer1 | first buffer | |
start1 | first byte to write in first buffer | |
len1 | number of bytes to write from first buffer | |
buffer2 | second buffer, or NULL | |
start2 | first byte to write in second buffer | |
len2 | number of bytes to write in second buffer |
Definition at line 322 of file dbus-sysdeps-unix.c.
References _dbus_assert, _dbus_write(), and NULL.
Referenced by _dbus_write_socket_two().