From 527c082c88390fde29f555fe3720e0d55d9edc34 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 25 Aug 2015 09:00:06 +0200 Subject: attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-registry/slave.h | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'src/mds-registry/slave.h') diff --git a/src/mds-registry/slave.h b/src/mds-registry/slave.h index 59183ea..1213aaa 100644 --- a/src/mds-registry/slave.h +++ b/src/mds-registry/slave.h @@ -86,6 +86,15 @@ typedef struct slave +/** + * Start a slave thread with an already created slave + * + * @param slave The slave + * @return Non-zero on error, `errno` will be set accordingly + */ +__attribute__((nonnull)) +int start_created_slave(slave_t* restrict slave); + /** * Start a slave thread * @@ -94,15 +103,9 @@ typedef struct slave * @param recv_message_id The ID of the message that triggered the waiting * @return Non-zero on error */ -int start_slave(hash_table_t* restrict wait_set, const char* restrict recv_client_id, const char* restrict recv_message_id); - -/** - * Start a slave thread with an already created slave - * - * @param slave The slave - * @return Non-zero on error, `errno` will be set accordingly - */ -int start_created_slave(slave_t* restrict slave); +__attribute__((nonnull)) +int start_slave(hash_table_t* restrict wait_set, const char* restrict recv_client_id, + const char* restrict recv_message_id); /** * Close all slaves associated with a client @@ -117,14 +120,20 @@ void close_slaves(uint64_t client); * @param command The protocol * @return Non-zero on error, `ernno`will be set accordingly */ +__attribute__((nonnull)) int advance_slaves(char* command); /** * Create a slave * - * @return The slave + * @param wait_set Set of protocols for which to wait that they become available + * @param recv_client_id The ID of the waiting client + * @param recv_message_id The ID of the message that triggered the waiting + * @return The slave, `NULL` on error, `errno` will be set accordingly */ -slave_t* slave_create(hash_table_t* restrict wait_set, const char* restrict recv_client_id, const char* restrict recv_message_id); +__attribute__((nonnull)) +slave_t* slave_create(hash_table_t* restrict wait_set, const char* restrict recv_client_id, + const char* restrict recv_message_id); /** @@ -132,6 +141,7 @@ slave_t* slave_create(hash_table_t* restrict wait_set, const char* restrict recv * * @param this Memory slot in which to store the new slave information */ +__attribute__((nonnull)) void slave_initialise(slave_t* restrict this); /** @@ -147,7 +157,8 @@ void slave_destroy(slave_t* restrict this); * @param this The slave information * @return The number of bytes to allocate to the output buffer */ -size_t slave_marshal_size(const slave_t* restrict this) __attribute__((pure)); +__attribute__((pure, nonnull)) +size_t slave_marshal_size(const slave_t* restrict this); /** * Marshals slave information @@ -156,6 +167,7 @@ size_t slave_marshal_size(const slave_t* restrict this) __attribute__((pure)); * @param data Output buffer for the marshalled data * @return The number of bytes that have been written (everything will be written) */ +__attribute__((nonnull)) size_t slave_marshal(const slave_t* restrict this, char* restrict data); /** @@ -166,6 +178,7 @@ size_t slave_marshal(const slave_t* restrict this, char* restrict data); * @return Zero on error, `errno` will be set accordingly, otherwise the * number of read bytes. Destroy the slave information on error. */ +__attribute__((nonnull)) size_t slave_unmarshal(slave_t* restrict this, char* restrict data); /** @@ -174,7 +187,8 @@ size_t slave_unmarshal(slave_t* restrict this, char* restrict data); * @param data In buffer with the marshalled data * @return The number of read bytes */ -size_t slave_unmarshal_skip(char* restrict data) __attribute__((pure)); +__attribute__((pure, nonnull)) +size_t slave_unmarshal_skip(char* restrict data); #endif -- cgit v1.2.3-70-g09d2