X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=blobdiff_plain;f=src%2Finclude%2Futils%2Fos.h;h=38d53b2a8bb1281aa13987403ea60f96b3375a6d;hp=07328dd11a2b0d9aaf96c82c0f920e1d88082070;hb=e2258e6ee3c933351f81490bac576438ff973ae4;hpb=13fe0f9ec3d161fab7a015054649910541d75f5e diff --git a/src/include/utils/os.h b/src/include/utils/os.h index 07328dd..38d53b2 100644 --- a/src/include/utils/os.h +++ b/src/include/utils/os.h @@ -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