Code

Moved sdb_proto_send/sdb_proto_select to sdb_write/sdb_select.
[sysdb.git] / src / include / utils / os.h
index 07328dd11a2b0d9aaf96c82c0f920e1d88082070..38d53b2a8bb1281aa13987403ea60f96b3375a6d 100644 (file)
@@ -69,6 +69,37 @@ sdb_remove_all(const char *pathname);
 char *
 sdb_get_current_user(void);
 
+enum {
+       SDB_SELECTIN = 0,
+       SDB_SELECTOUT,
+       SDB_SELECTERR,
+};
+
+/*
+ * sdb_select:
+ * Wait for a file-descriptor to become ready for I/O operations of the
+ * specified type. This is a simple wrapper around the select() system call.
+ * The type argument may be any of the SDB_SELECT* constants.
+ *
+ * Returns:
+ *  - the number of file descriptors ready for I/O
+ *  - a negative value on error
+ */
+int
+sdb_select(int fd, int type);
+
+/*
+ * sdb_write:
+ * Write a message to a file-descriptor. This is a simple wrapper around the
+ * write() system call ensuring that all data is written on success.
+ *
+ * Returns:
+ *  - the number of bytes written
+ *  - a negative value on error
+ */
+ssize_t
+sdb_write(int fd, size_t msg_len, const void *msg);
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif