aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsclient/comm.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-08-25 07:16:48 +0200
committerMattias Andrée <maandree@operamail.com>2015-08-25 07:16:48 +0200
commita355ea128a6d2fbdbf3c01dade25ce0be4f364ac (patch)
treea89ce9c47445df5625d2009af0334047b2328d53 /src/libmdsclient/comm.c
parentsed is a buil dep (diff)
downloadmds-a355ea128a6d2fbdbf3c01dade25ce0be4f364ac.tar.gz
mds-a355ea128a6d2fbdbf3c01dade25ce0be4f364ac.tar.bz2
mds-a355ea128a6d2fbdbf3c01dade25ce0be4f364ac.tar.xz
libmds_connection: locking
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libmdsclient/comm.c')
-rw-r--r--src/libmdsclient/comm.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/libmdsclient/comm.c b/src/libmdsclient/comm.c
index c9cdcde..1084e8b 100644
--- a/src/libmdsclient/comm.c
+++ b/src/libmdsclient/comm.c
@@ -37,7 +37,8 @@ void libmds_connection_initialise(libmds_connection_t* restrict this)
/**
* Allocate and initialise a connection descriptor
*
- * @return The connection descriptor, `NULL` on error
+ * @return The connection descriptor, `NULL` on error,
+ * `errno` will have been set accordingly on error
*
* @throws ENOMEM Out of memory, Possibly, the process hit the RLIMIT_AS or
* RLIMIT_DATA limit described in getrlimit(2).
@@ -78,3 +79,24 @@ void libmds_connection_free(libmds_connection_t* restrict this)
free(this);
}
+
+int libmds_connection_send(libmds_connection_t* restrict this, const char* message, size_t length)
+{
+ int r, saved_errno;
+
+ if (libmds_connection_lock(this))
+ return -1;
+
+ r = libmds_connection_send_unlocked(this, message, length);
+
+ saved_errno = errno;
+ libmds_connection_unlock(this);
+ return errno = saved_errno, r;
+}
+
+
+int libmds_connection_send_unlocked(libmds_connection_t* restrict this, const char* message, size_t length)
+{
+ /* TODO */
+}
+