X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fcommon.h;h=71aede0b7097e384dea11535e5e064628745d1a2;hb=a6f084608f38fa0ad66247f8e4b8ce7520292276;hp=da21cad9a6f3a81f1120b466740a669ec009c231;hpb=3e5744ada388c94024cf65aa77aa940a45f88e5e;p=collectd.git diff --git a/src/daemon/common.h b/src/daemon/common.h index da21cad9..71aede0b 100644 --- a/src/daemon/common.h +++ b/src/daemon/common.h @@ -1,6 +1,6 @@ /** * collectd - src/common.h - * Copyright (C) 2005-2014 Florian octo Forster + * Copyright (C) 2005-2015 Florian octo Forster * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -99,6 +99,13 @@ char *sstrerror (int errnum, char *buf, size_t buflen); */ ssize_t sread (int fd, void *buf, size_t count); +/* read_file reads the contents of "file" into memory and stores a pointer in + * "ret_data", which must be freed by the caller. The number of bytes read is + * stored in "ret_data_size". On success, 0 is returned. On failure, an error + * code is stored in "errno" and -1 is returned; "ret_data" and "ret_data_size" + * are left unmodified. */ +int read_file (char const *file, void **ret_data, size_t *ret_data_size); + /* * NAME * swrite