X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fcommon.h;h=addf06d336baddd3036e2c4933f42e258774ecdc;hb=711f5b6c86f51061c21bedcaa46214a01de0125c;hp=aae190916227a398d7ca338fce3ca3a5d569f873;hpb=cd59bf058d535d4eb77bac3d422b24810a52d8c0;p=collectd.git diff --git a/src/daemon/common.h b/src/daemon/common.h index aae19091..addf06d3 100644 --- a/src/daemon/common.h +++ b/src/daemon/common.h @@ -73,6 +73,13 @@ char *sstrdup(const char *s); void *smalloc(size_t size); char *sstrerror(int errnum, char *buf, size_t buflen); +#ifndef ERRBUF_SIZE +#define ERRBUF_SIZE 256 +#endif + +#define STRERROR(e) sstrerror((e), (char[ERRBUF_SIZE]){0}, ERRBUF_SIZE) +#define STRERRNO STRERROR(errno) + /* * NAME * sread @@ -312,7 +319,7 @@ int format_name(char *ret, int ret_len, const char *hostname, format_name(ret, ret_len, (vl)->host, (vl)->plugin, (vl)->plugin_instance, \ (vl)->type, (vl)->type_instance) int format_values(char *ret, size_t ret_len, const data_set_t *ds, - const value_list_t *vl, _Bool store_rates); + const value_list_t *vl, bool store_rates); int parse_identifier(char *str, char **ret_host, char **ret_plugin, char **ret_plugin_instance, char **ret_type, @@ -328,6 +335,7 @@ int parse_values(char *buffer, value_list_t *vl, const data_set_t *ds); int parse_value_file(char const *path, value_t *ret_value, int ds_type); #if !HAVE_GETPWNAM_R +struct passwd; int getpwnam_r(const char *name, struct passwd *pwbuf, char *buf, size_t buflen, struct passwd **pwbufp); #endif @@ -350,7 +358,7 @@ ssize_t read_file_contents(char const *filename, char *buf, size_t bufsize); counter_t counter_diff(counter_t old_value, counter_t new_value); /* Convert a rate back to a value_t. When converting to a derive_t, counter_t - * or absoltue_t, take fractional residuals into account. This is important + * or absolute_t, take fractional residuals into account. This is important * when scaling counters, for example. * Returns zero on success. Returns EAGAIN when called for the first time; in * this case the value_t is invalid and the next call should succeed. Other @@ -379,12 +387,10 @@ int strtogauge(const char *string, gauge_t *ret_value); int strarray_add(char ***ret_array, size_t *ret_array_len, char const *str); void strarray_free(char **array, size_t array_len); -#ifdef HAVE_SYS_CAPABILITY_H /** Check if the current process benefits from the capability passed in * argument. Returns zero if it does, less than zero if it doesn't or on error. * See capabilities(7) for the list of possible capabilities. * */ int check_capability(int arg); -#endif /* HAVE_SYS_CAPABILITY_H */ #endif /* COMMON_H */