X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fcommon.h;h=2be2ff504b84f58276bc3304ef5696c5623ec52d;hb=c9596f6cf39a128c10764c3091e6a28186be2303;hp=4dc34b07f0420c5f2e8cf5e68c74efb717a6839e;hpb=601abecb59b6041e84f11877345a98efba7b651b;p=collectd.git diff --git a/src/common.h b/src/common.h index 4dc34b07..2be2ff50 100644 --- a/src/common.h +++ b/src/common.h @@ -37,6 +37,45 @@ void sstrncpy(char *d, const char *s, int len); char *sstrdup(const char *s); void *smalloc(size_t size); +/* + * NAME + * sread + * + * DESCRIPTION + * Reads exactly `n' bytes or failes. Syntax and other behavior is analogous + * to `read(2)'. If EOF is received the file descriptor is closed and an + * error is returned. + * + * PARAMETERS + * `fd' File descriptor to write to. + * `buf' Buffer that is to be written. + * `count' Numver of bytes in the buffer. + * + * RETURN VALUE + * Zero upon success or non-zero if an error occured. `errno' is set in this + * case. + */ +ssize_t sread (int fd, void *buf, size_t count); + +/* + * NAME + * swrite + * + * DESCRIPTION + * Writes exactly `n' bytes or failes. Syntax and other behavior is analogous + * to `write(2)'. + * + * PARAMETERS + * `fd' File descriptor to write to. + * `buf' Buffer that is to be written. + * `count' Numver of bytes in the buffer. + * + * RETURN VALUE + * Zero upon success or non-zero if an error occured. `errno' is set in this + * case. + */ +ssize_t swrite (int fd, const void *buf, size_t count); + /* * NAME * strsplit