D-Bus
1.10.12
|
00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ 00002 /* dbus-sysdeps-unix.h UNIX-specific wrappers around system/libc features (internal to D-Bus implementation) 00003 * 00004 * Copyright (C) 2002, 2003, 2006 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_UNIX_H 00026 #define DBUS_SYSDEPS_UNIX_H 00027 00028 #include <dbus/dbus-sysdeps.h> 00029 00030 #ifdef DBUS_WIN 00031 #error "Don't include this on Windows" 00032 #endif 00033 00034 DBUS_BEGIN_DECLS 00035 00043 DBUS_PRIVATE_EXPORT 00044 dbus_bool_t 00045 _dbus_close (int fd, 00046 DBusError *error); 00047 DBUS_PRIVATE_EXPORT 00048 int _dbus_dup (int fd, 00049 DBusError *error); 00050 DBUS_PRIVATE_EXPORT 00051 int 00052 _dbus_read (int fd, 00053 DBusString *buffer, 00054 int count); 00055 int 00056 _dbus_write (int fd, 00057 const DBusString *buffer, 00058 int start, 00059 int len); 00060 int 00061 _dbus_write_two (int fd, 00062 const DBusString *buffer1, 00063 int start1, 00064 int len1, 00065 const DBusString *buffer2, 00066 int start2, 00067 int len2); 00068 00069 int _dbus_connect_unix_socket (const char *path, 00070 dbus_bool_t abstract, 00071 DBusError *error); 00072 int _dbus_listen_unix_socket (const char *path, 00073 dbus_bool_t abstract, 00074 DBusError *error); 00075 00076 int _dbus_connect_exec (const char *path, 00077 char *const argv[], 00078 DBusError *error); 00079 00080 int _dbus_listen_systemd_sockets (DBusSocket **fd, 00081 DBusError *error); 00082 00083 dbus_bool_t _dbus_read_credentials (int client_fd, 00084 DBusCredentials *credentials, 00085 DBusError *error); 00086 dbus_bool_t _dbus_send_credentials (int server_fd, 00087 DBusError *error); 00088 00089 dbus_bool_t _dbus_lookup_launchd_socket (DBusString *socket_path, 00090 const char *launchd_env_var, 00091 DBusError *error); 00092 00093 DBUS_PRIVATE_EXPORT 00094 dbus_bool_t _dbus_lookup_user_bus (dbus_bool_t *supported, 00095 DBusString *address, 00096 DBusError *error); 00097 00099 typedef struct DBusUserInfo DBusUserInfo; 00101 typedef struct DBusGroupInfo DBusGroupInfo; 00102 00106 struct DBusUserInfo 00107 { 00108 dbus_uid_t uid; 00109 dbus_gid_t primary_gid; 00110 dbus_gid_t *group_ids; 00111 int n_group_ids; 00112 char *username; 00113 char *homedir; 00114 }; 00115 00119 struct DBusGroupInfo 00120 { 00121 dbus_gid_t gid; 00122 char *groupname; 00123 }; 00124 00125 dbus_bool_t _dbus_user_info_fill (DBusUserInfo *info, 00126 const DBusString *username, 00127 DBusError *error); 00128 dbus_bool_t _dbus_user_info_fill_uid (DBusUserInfo *info, 00129 dbus_uid_t uid, 00130 DBusError *error); 00131 void _dbus_user_info_free (DBusUserInfo *info); 00132 00133 dbus_bool_t _dbus_group_info_fill (DBusGroupInfo *info, 00134 const DBusString *groupname, 00135 DBusError *error); 00136 dbus_bool_t _dbus_group_info_fill_gid (DBusGroupInfo *info, 00137 dbus_gid_t gid, 00138 DBusError *error); 00139 void _dbus_group_info_free (DBusGroupInfo *info); 00140 00141 DBUS_PRIVATE_EXPORT 00142 dbus_uid_t _dbus_geteuid (void); 00143 00144 dbus_bool_t _dbus_parse_uid (const DBusString *uid_str, 00145 dbus_uid_t *uid); 00146 00147 DBUS_PRIVATE_EXPORT 00148 void _dbus_close_all (void); 00149 00150 dbus_bool_t _dbus_append_address_from_socket (DBusSocket fd, 00151 DBusString *address, 00152 DBusError *error); 00153 00154 DBUS_PRIVATE_EXPORT 00155 void _dbus_fd_set_close_on_exec (int fd); 00156 00157 typedef enum 00158 { 00159 DBUS_FORCE_STDIN_NULL = (1 << 0), 00160 DBUS_FORCE_STDOUT_NULL = (1 << 1), 00161 DBUS_FORCE_STDERR_NULL = (1 << 2) 00162 } DBusEnsureStandardFdsFlags; 00163 00164 DBUS_PRIVATE_EXPORT 00165 dbus_bool_t _dbus_ensure_standard_fds (DBusEnsureStandardFdsFlags flags, 00166 const char **error_str_p); 00167 00170 DBUS_END_DECLS 00171 00172 #endif /* DBUS_SYSDEPS_UNIX_H */