diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-04-29 22:30:47 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-04-29 22:30:47 +0200 |
commit | 7754e3c18a7bfed1fea34d286c6f8f8e2f119a0d (patch) | |
tree | 9c3a8639d49871d7ce6160a25bb19e3ff373e87c /src/bus.h | |
parent | ... (diff) | |
download | bus-7754e3c18a7bfed1fea34d286c6f8f8e2f119a0d.tar.gz bus-7754e3c18a7bfed1fea34d286c6f8f8e2f119a0d.tar.bz2 bus-7754e3c18a7bfed1fea34d286c6f8f8e2f119a0d.tar.xz |
doc
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/bus.h | 52 |
1 files changed, 49 insertions, 3 deletions
@@ -45,17 +45,17 @@ /** * Open the bus for both reading and writing only */ -#define BUS_RDWR 0 +#define BUS_RDWR 0 /** * Fail to create bus if its file already exists */ -#define BUS_EXCL 2 +#define BUS_EXCL 2 /** * Fail if interrupted */ -#define BUS_INTR 4 +#define BUS_INTR 4 /** * Function shall fail with errno set to `EAGAIN` @@ -189,11 +189,57 @@ int bus_write(const bus_t *bus, const char *message, int flags); int bus_read(const bus_t *bus, int (*callback)(const char *message, void *user_data), void *user_data); +/** + * Announce that the thread is listening on the bus. + * This is required so the will does not miss any + * messages due to race conditions. Additionally, + * not calling this function will cause the bus the + * misbehave, is `bus_poll` is written to expect + * this function to have been called. + * + * @param bus Bus information + * @return 0 on success, -1 on error + */ int bus_poll_start(bus_t *bus); + +/** + * Announce that the thread has stopped listening on the bus. + * This is required so that the thread does not cause others + * to wait indefinitely. + * + * @param bus Bus information + * @return 0 on success, -1 on error + */ int bus_poll_stop(const bus_t *bus); const char *bus_poll(bus_t *bus, int flags); +/** + * Change the ownership of a bus + * + * `stat(2)` can be used of the bus's associated file to get the bus's ownership + * + * @param file The pathname of the bus + * @param owner The user ID of the bus's new owner + * @param group The group ID of the bus's new group + * @return 0 on success, -1 on error + */ +int bus_chown(const char *file, uid_t owner, gid_t group); + +/** + * Change the permissions for a bus + * + * `stat(2)` can be used of the bus's associated file to get the bus's permissions + * + * @param file The pathname of the bus + * @param mode The permissions of the bus, any permission for a user implies + * full permissions for that user, except only the owner may + * edit the bus's associated file + * @return 0 on success, -1 on error + */ +int bus_chmod(const char *file, mode_t mode); + + #endif |