aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-server
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-08-25 09:00:06 +0200
committerMattias Andrée <maandree@operamail.com>2015-08-25 09:00:06 +0200
commit527c082c88390fde29f555fe3720e0d55d9edc34 (patch)
tree141242290d3cfc1fc6fe280ebd4e77477943a4f7 /src/mds-server
parentm + attributes (diff)
downloadmds-527c082c88390fde29f555fe3720e0d55d9edc34.tar.gz
mds-527c082c88390fde29f555fe3720e0d55d9edc34.tar.bz2
mds-527c082c88390fde29f555fe3720e0d55d9edc34.tar.xz
attributes
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mds-server')
-rw-r--r--src/mds-server/client.h11
-rw-r--r--src/mds-server/interception-condition.h8
-rw-r--r--src/mds-server/interceptors.c1
-rw-r--r--src/mds-server/interceptors.h6
-rw-r--r--src/mds-server/mds-server.c1
-rw-r--r--src/mds-server/mds-server.h4
-rw-r--r--src/mds-server/multicast.h10
-rw-r--r--src/mds-server/queued-interception.h8
-rw-r--r--src/mds-server/receiving.c4
-rw-r--r--src/mds-server/receiving.h1
-rw-r--r--src/mds-server/sending.c2
-rw-r--r--src/mds-server/sending.h3
-rw-r--r--src/mds-server/slavery.h2
13 files changed, 51 insertions, 10 deletions
diff --git a/src/mds-server/client.h b/src/mds-server/client.h
index 24152f6..e60a0ed 100644
--- a/src/mds-server/client.h
+++ b/src/mds-server/client.h
@@ -154,6 +154,7 @@ typedef struct client
*
* @param this Memory slot in which to store the new client information
*/
+__attribute__((nonnull))
void client_initialise(client_t* restrict this);
/**
@@ -168,6 +169,7 @@ void client_initialise(client_t* restrict this);
* @param this The client information
* @return Zero on success, -1 on error
*/
+__attribute__((nonnull))
int client_initialise_threading(client_t* restrict this);
/**
@@ -175,6 +177,7 @@ int client_initialise_threading(client_t* restrict this);
*
* @param this The client information
*/
+__attribute__((nonnull))
void client_destroy(client_t* restrict this);
/**
@@ -183,7 +186,8 @@ void client_destroy(client_t* restrict this);
* @param this The client information
* @return The number of bytes to allocate to the output buffer
*/
-size_t client_marshal_size(const client_t* restrict this) __attribute__((pure));
+__attribute__((pure, nonnull))
+size_t client_marshal_size(const client_t* restrict this);
/**
* Marshals client information
@@ -192,6 +196,7 @@ size_t client_marshal_size(const client_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 client_marshal(const client_t* restrict this, char* restrict data);
/**
@@ -202,6 +207,7 @@ size_t client_marshal(const client_t* restrict this, char* restrict data);
* @return Zero on error, `errno` will be set accordingly, otherwise the
* number of read bytes. Destroy the client information on error.
*/
+__attribute__((nonnull))
size_t client_unmarshal(client_t* restrict this, char* restrict data);
/**
@@ -210,7 +216,8 @@ size_t client_unmarshal(client_t* restrict this, char* restrict data);
* @param data In buffer with the marshalled data
* @return The number of read bytes
*/
-size_t client_unmarshal_skip(char* restrict data) __attribute__((pure));
+__attribute__((pure, nonnull))
+size_t client_unmarshal_skip(char* restrict data);
#endif
diff --git a/src/mds-server/interception-condition.h b/src/mds-server/interception-condition.h
index 006ae18..3e7c7e1 100644
--- a/src/mds-server/interception-condition.h
+++ b/src/mds-server/interception-condition.h
@@ -62,7 +62,8 @@ typedef struct interception_condition
* @param this The interception condition
* @return The number of bytes to allocate to the output buffer
*/
-size_t interception_condition_marshal_size(const interception_condition_t* restrict this) __attribute__((pure));
+__attribute__((pure, nonnull))
+size_t interception_condition_marshal_size(const interception_condition_t* restrict this);
/**
* Marshals an interception condition
@@ -71,6 +72,7 @@ size_t interception_condition_marshal_size(const interception_condition_t* restr
* @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 interception_condition_marshal(const interception_condition_t* restrict this, char* restrict data);
/**
@@ -81,6 +83,7 @@ size_t interception_condition_marshal(const interception_condition_t* restrict t
* @return Zero on error, `errno` will be set accordingly, otherwise the
* number of read bytes. Destroy the interception condition on error.
*/
+__attribute__((nonnull))
size_t interception_condition_unmarshal(interception_condition_t* restrict this, char* restrict data);
/**
@@ -89,7 +92,8 @@ size_t interception_condition_unmarshal(interception_condition_t* restrict this,
* @param data In buffer with the marshalled data
* @return The number of read bytes
*/
-size_t interception_condition_unmarshal_skip(char* restrict data) __attribute__((pure));
+__attribute__((pure, nonnull))
+size_t interception_condition_unmarshal_skip(char* restrict data);
#endif
diff --git a/src/mds-server/interceptors.c b/src/mds-server/interceptors.c
index 9e66ce6..559a191 100644
--- a/src/mds-server/interceptors.c
+++ b/src/mds-server/interceptors.c
@@ -38,6 +38,7 @@
* @param client The intercepting client
* @param index The index of the condition
*/
+__attribute__((nonnull))
static void remove_intercept_condition(client_t* client, size_t index)
{
interception_condition_t* conds = client->interception_conditions;
diff --git a/src/mds-server/interceptors.h b/src/mds-server/interceptors.h
index 66aad42..5b8d50a 100644
--- a/src/mds-server/interceptors.h
+++ b/src/mds-server/interceptors.h
@@ -36,6 +36,7 @@
* @param modifying Whether the client may modify the messages
* @param stop Whether the condition should be removed rather than added
*/
+__attribute__((nonnull))
void add_intercept_condition(client_t* client, char* condition, int64_t priority, int modifying, int stop);
@@ -49,8 +50,9 @@ void add_intercept_condition(client_t* client, char* condition, int64_t priority
* @param count The number of accepted patterns
* @return Evaluates to true if and only if a matching pattern was found
*/
+__attribute__((pure, nonnull(1)))
int is_condition_matching(interception_condition_t* cond, size_t* hashes,
- char** keys, char** headers, size_t count) __attribute__((pure));
+ char** keys, char** headers, size_t count);
/**
@@ -64,6 +66,7 @@ int is_condition_matching(interception_condition_t* cond, size_t* hashes,
* @param interception_out Storage slot for found interception
* @return -1 on error, otherwise: evalutes to true iff a matching condition was found
*/
+__attribute__((pure, nonnull(1, 6)))
int find_matching_condition(client_t* client, size_t* hashes, char** keys, char** headers,
size_t count, queued_interception_t* interception_out);
@@ -79,6 +82,7 @@ int find_matching_condition(client_t* client, size_t* hashes, char** keys, char*
* @param interceptions_count_out Slot at where to store the number of found interceptors
* @return The found interceptors, `NULL` on error
*/
+__attribute__((pure, nonnull(1, 6)))
queued_interception_t* get_interceptors(client_t* sender, size_t* hashes, char** keys, char** headers,
size_t count, size_t* interceptions_count_out);
diff --git a/src/mds-server/mds-server.c b/src/mds-server/mds-server.c
index 801e47c..c249236 100644
--- a/src/mds-server/mds-server.c
+++ b/src/mds-server/mds-server.c
@@ -371,6 +371,7 @@ void* slave_loop(void* data)
* @param b:const queued_interception_t* The other of the two interceptors
* @return Negative if a before b, positive if a after b, otherwise zero
*/
+__attribute__((nonnull))
static int cmp_queued_interception(const void* a, const void* b)
{
const queued_interception_t* p = b; /* Highest first, so swap them. */
diff --git a/src/mds-server/mds-server.h b/src/mds-server/mds-server.h
index 471eb34..42b610a 100644
--- a/src/mds-server/mds-server.h
+++ b/src/mds-server/mds-server.h
@@ -46,6 +46,7 @@ void* slave_loop(void* data);
* @param length The length of the message
* @param sender The original sender of the message
*/
+__attribute__((nonnull))
void queue_message_multicast(char* message, size_t length, client_t* sender);
/**
@@ -53,7 +54,8 @@ void queue_message_multicast(char* message, size_t length, client_t* sender);
*
* @param args The arguments to the child process
*/
-void run_initrc(char** args) __attribute__((noreturn));
+__attribute__((noreturn, nonnull))
+void run_initrc(char** args);
#endif
diff --git a/src/mds-server/multicast.h b/src/mds-server/multicast.h
index a0add4d..bb83687 100644
--- a/src/mds-server/multicast.h
+++ b/src/mds-server/multicast.h
@@ -72,6 +72,7 @@ typedef struct multicast
*
* @param this The message multicast state
*/
+__attribute__((nonnull))
void multicast_initialise(multicast_t* restrict this);
/**
@@ -79,6 +80,7 @@ void multicast_initialise(multicast_t* restrict this);
*
* @param this The message multicast state
*/
+__attribute__((nonnull))
void multicast_destroy(multicast_t* restrict this);
/**
@@ -87,7 +89,8 @@ void multicast_destroy(multicast_t* restrict this);
* @param this The client information
* @return The number of bytes to allocate to the output buffer
*/
-size_t multicast_marshal_size(const multicast_t* restrict this) __attribute__((pure));
+__attribute__((pure, nonnull))
+size_t multicast_marshal_size(const multicast_t* restrict this);
/**
* Marshals a message multicast state
@@ -96,6 +99,7 @@ size_t multicast_marshal_size(const multicast_t* restrict this) __attribute__((p
* @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 multicast_marshal(const multicast_t* restrict this, char* restrict data);
/**
@@ -106,6 +110,7 @@ size_t multicast_marshal(const multicast_t* restrict this, char* restrict data);
* @return Zero on error, `errno` will be set accordingly, otherwise the
* number of read bytes. Destroy the message multicast state on error.
*/
+__attribute__((nonnull))
size_t multicast_unmarshal(multicast_t* restrict this, char* restrict data);
/**
@@ -114,7 +119,8 @@ size_t multicast_unmarshal(multicast_t* restrict this, char* restrict data);
* @param data In buffer with the marshalled data
* @return The number of read bytes
*/
-size_t multicast_unmarshal_skip(char* restrict data) __attribute__((pure));
+__attribute__((pure, nonnull))
+size_t multicast_unmarshal_skip(char* restrict data);
diff --git a/src/mds-server/queued-interception.h b/src/mds-server/queued-interception.h
index 8162479..d03720a 100644
--- a/src/mds-server/queued-interception.h
+++ b/src/mds-server/queued-interception.h
@@ -60,7 +60,8 @@ typedef struct queued_interception
* @param this The client information
* @return The number of bytes to allocate to the output buffer
*/
-size_t queued_interception_marshal_size(void) __attribute__((const));
+__attribute__((const, nonnull))
+size_t queued_interception_marshal_size(void);
/**
* Marshals a queued interception
@@ -69,6 +70,7 @@ size_t queued_interception_marshal_size(void) __attribute__((const));
* @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 queued_interception_marshal(const queued_interception_t* restrict this, char* restrict data);
/**
@@ -78,6 +80,7 @@ size_t queued_interception_marshal(const queued_interception_t* restrict this, c
* @param data In buffer with the marshalled data
* @return Zero on error, `errno` will be set accordingly, otherwise the number of read bytes.
*/
+__attribute__((nonnull))
size_t queued_interception_unmarshal(queued_interception_t* restrict this, char* restrict data);
/**
@@ -86,7 +89,8 @@ size_t queued_interception_unmarshal(queued_interception_t* restrict this, char*
* @param data In buffer with the marshalled data
* @return The number of read bytes
*/
-size_t queued_interception_unmarshal_skip(void) __attribute__((const));
+__attribute__((const, nonnull))
+size_t queued_interception_unmarshal_skip(void);
#endif
diff --git a/src/mds-server/receiving.c b/src/mds-server/receiving.c
index 28823f7..458aae4 100644
--- a/src/mds-server/receiving.c
+++ b/src/mds-server/receiving.c
@@ -39,6 +39,7 @@
* @param length The length of the message
* @param sender The original sender of the message
*/
+__attribute__((nonnull))
void queue_message_multicast(char* message, size_t length, client_t* sender);
@@ -50,6 +51,7 @@ void queue_message_multicast(char* message, size_t length, client_t* sender);
* @param modify_id The modify ID of the message
* @return Normally zero, but 1 if exited because of re-exec or termination
*/
+__attribute__((nonnull))
static int modifying_notify(client_t* client, mds_message_t message, uint64_t modify_id)
{
/* pthread_cond_timedwait is required to handle re-exec and termination because
@@ -110,6 +112,7 @@ static int modifying_notify(client_t* client, mds_message_t message, uint64_t mo
* @param stop Whether to stop listening rather than start or reconfigure
* @return Zero on success, -1 on error
*/
+__attribute__((nonnull))
static int add_intercept_conditions_from_message(client_t* client, int modifying, int64_t priority, int stop)
{
int saved_errno;
@@ -174,6 +177,7 @@ static int add_intercept_conditions_from_message(client_t* client, int modifying
* @param message_id The message ID of the ID request
* @return Zero on success, -1 on error
*/
+__attribute__((nonnull(1)))
static int assign_and_send_id(client_t* client, const char* message_id)
{
char* msgbuf = NULL;
diff --git a/src/mds-server/receiving.h b/src/mds-server/receiving.h
index 7d704de..a38f611 100644
--- a/src/mds-server/receiving.h
+++ b/src/mds-server/receiving.h
@@ -29,6 +29,7 @@
* @param client The client whom sent the message
* @return Normally zero, but 1 if exited because of re-exec or termination
*/
+__attribute__((nonnull))
int message_received(client_t* client);
diff --git a/src/mds-server/sending.c b/src/mds-server/sending.c
index 1106d05..a02fb0e 100644
--- a/src/mds-server/sending.c
+++ b/src/mds-server/sending.c
@@ -57,6 +57,7 @@ static client_t* client_by_socket(int client_fd)
* @param modifying Whether the recipient may modify the message
* @return Evaluates to true if and only if the entire message was sent
*/
+__attribute__((nonnull))
static int send_multicast_to_recipient(multicast_t* multicast, client_t* recipient, int modifying)
{
char* msg = multicast->message + multicast->message_ptr;
@@ -93,6 +94,7 @@ static int send_multicast_to_recipient(multicast_t* multicast, client_t* recipie
* @param recipient The recipient
* @param modify_id The modify ID of the multicast
*/
+__attribute__((nonnull))
static void wait_for_reply(client_t* recipient, uint64_t modify_id)
{
/* pthread_cond_timedwait is required to handle re-exec and termination because
diff --git a/src/mds-server/sending.h b/src/mds-server/sending.h
index c31f31a..534c172 100644
--- a/src/mds-server/sending.h
+++ b/src/mds-server/sending.h
@@ -28,6 +28,7 @@
*
* @param multicast The multicast message
*/
+__attribute__((nonnull))
void multicast_message(multicast_t* multicast);
/**
@@ -35,6 +36,7 @@ void multicast_message(multicast_t* multicast);
*
* @param client The client
*/
+__attribute__((nonnull))
void send_multicast_queue(client_t* client);
/**
@@ -42,6 +44,7 @@ void send_multicast_queue(client_t* client);
*
* @param client The client
*/
+__attribute__((nonnull))
void send_reply_queue(client_t* client);
diff --git a/src/mds-server/slavery.h b/src/mds-server/slavery.h
index b613110..b65d978 100644
--- a/src/mds-server/slavery.h
+++ b/src/mds-server/slavery.h
@@ -30,6 +30,7 @@
* @param client The client
* @return Zero on success, -2 on failure, otherwise -1
*/
+__attribute__((nonnull))
int fetch_message(client_t* client);
/**
@@ -39,6 +40,7 @@ int fetch_message(client_t* client);
* @param slave_fd The file descriptor of the slave's socket
* @return Zero on success, -1 on error, error message will have been printed
*/
+__attribute__((nonnull))
int create_slave(pthread_t* thread_slot, int slave_fd);
/**