X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fcommon.h;h=2be2ff504b84f58276bc3304ef5696c5623ec52d;hb=70a5b80271643b3c0384e03a77fcfb35c11f726a;hp=ae93635f1ab3917618d31fcda174951118af9049;hpb=a9e8ad509f86d0e2cb5f7ac39da5955c53fe3e60;p=collectd.git diff --git a/src/common.h b/src/common.h index ae93635f..2be2ff50 100644 --- a/src/common.h +++ b/src/common.h @@ -1,6 +1,6 @@ /** * collectd - src/common.h - * Copyright (C) 2005 Florian octo Forster + * Copyright (C) 2005,2006 Florian octo Forster * * This program is free software; you can redistribute it and/ * or modify it under the terms of the GNU General Public Li- @@ -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 @@ -103,6 +142,9 @@ int strjoin (char *dst, size_t dst_len, char **fields, size_t fields_num, const */ int escape_slashes (char *buf, int buf_len); +/* FIXME: `timeval_sub_timespec' needs a description */ +int timeval_sub_timespec (struct timeval *tv0, struct timeval *tv1, struct timespec *ret); + int rrd_update_file (char *host, char *file, char *values, char **ds_def, int ds_num);