projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Auto-Merge pull request #2519 from octo/ff/strerror
[collectd.git]
/
src
/
daemon
/
common.h
diff --git
a/src/daemon/common.h
b/src/daemon/common.h
index
a1a2528
..
cf4c5a7
100644
(file)
--- a/
src/daemon/common.h
+++ b/
src/daemon/common.h
@@
-66,9
+66,6
@@
typedef struct value_to_rate_state_s value_to_rate_state_t;
char *sstrncpy(char *dest, const char *src, size_t n);
char *sstrncpy(char *dest, const char *src, size_t n);
-__attribute__((format(printf, 3, 4))) int ssnprintf(char *dest, size_t n,
- const char *format, ...);
-
__attribute__((format(printf, 1, 2))) char *ssnprintf_alloc(char const *format,
...);
__attribute__((format(printf, 1, 2))) char *ssnprintf_alloc(char const *format,
...);
@@
-76,14
+73,20
@@
char *sstrdup(const char *s);
void *smalloc(size_t size);
char *sstrerror(int errnum, char *buf, size_t buflen);
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
*
* DESCRIPTION
* Reads exactly `n' bytes or fails. Syntax and other behavior is analogous
/*
* NAME
* sread
*
* DESCRIPTION
* Reads exactly `n' bytes or fails. Syntax and other behavior is analogous
- * to `read(2)'. If EOF is received the file descriptor is closed and an
- * error is returned.
+ * to `read(2)'.
*
* PARAMETERS
* `fd' File descriptor to write to.
*
* PARAMETERS
* `fd' File descriptor to write to.
@@
-94,7
+97,7
@@
char *sstrerror(int errnum, char *buf, size_t buflen);
* Zero upon success or non-zero if an error occurred. `errno' is set in this
* case.
*/
* Zero upon success or non-zero if an error occurred. `errno' is set in this
* case.
*/
-
ssize_
t sread(int fd, void *buf, size_t count);
+
in
t sread(int fd, void *buf, size_t count);
/*
* NAME
/*
* NAME
@@
-113,7
+116,7
@@
ssize_t sread(int fd, void *buf, size_t count);
* Zero upon success or non-zero if an error occurred. `errno' is set in this
* case.
*/
* Zero upon success or non-zero if an error occurred. `errno' is set in this
* case.
*/
-
ssize_
t swrite(int fd, const void *buf, size_t count);
+
in
t swrite(int fd, const void *buf, size_t count);
/*
* NAME
/*
* NAME
@@
-385,7
+388,7
@@
void strarray_free(char **array, size_t array_len);
* 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.
* */
* 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
capability
);
+int check_capability(int
arg
);
#endif /* HAVE_SYS_CAPABILITY_H */
#endif /* COMMON_H */
#endif /* HAVE_SYS_CAPABILITY_H */
#endif /* COMMON_H */