X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=doc%2Flibrrd.pod;h=dfe6f29c48ba5d9be69065cd47ddbdcbe717c138;hb=6ee658a8cf9f249fcf4305393ed9028c3e3de35a;hp=52cf18e4d50d9be425635d5a0ce90b133b8699a7;hpb=4445ea8dfeb4f30fd181c922141303fa49e01c5a;p=rrdtool.git diff --git a/doc/librrd.pod b/doc/librrd.pod index 52cf18e..dfe6f29 100644 --- a/doc/librrd.pod +++ b/doc/librrd.pod @@ -16,9 +16,52 @@ B This document is a work in progress, and should be considered incomplete as long as this warning persists. For more information about the B functions, always consult the source code. +=head1 CORE FUNCTIONS + +=over 4 + +=item B + +In some situations it is necessary to get the output of C without +writing it to a file or the standard output. In such cases an application +can ask B to call an user-defined function each time there +is output to be stored somewhere. This can be used, to e.g. directly feed +an XML parser with the dumped output or transfer the resulting string +in memory. + +The arguments for B are the same as for B +except that the output filename parameter is replaced by the user-defined +callback function and an additional parameter for the callback function +that is passed untouched, i.e. to store information about the callback state +needed for the user-defined callback to function properly. + +Recent versions of B internally use this callback mechanism +to write their output to the file provided by the user. + + size_t rrd_dump_opt_cb_fileout( + const void *data, + size_t len, + void *user) + { + return fwrite(data, 1, len, (FILE *)user); + } + +The associated call for B looks like + + res = rrd_dump_cb_r(filename, opt_header, + rrd_dump_opt_cb_fileout, (void *)out_file); + +where the last parameter specifies the file handle B +should write to. There's no specific condition for the callback to detect +when it is called for the first time, nor for the last time. If you require +this for initialization and cleanup you should do those tasks before and +after calling B respectively. + +=back + =head1 UTILITY FUNCTIONS -=over +=over 4 =item B @@ -58,4 +101,36 @@ source pointer will be NULL and the count will be zero. rrd_free_ptrs(&arr, &arr_size); /* here, arr == NULL && arr_size == 0 */ +=item B + +Create the directory named C including all of its parent +directories (similar to C on the command line - see L for +more information). The argument C specifies the permissions to use. It +is modified by the process's C. See L for more details. + +The function returns 0 on success, a negative value else. In case of an error, +C is set accordingly. Aside from the errors documented in L, +the function may fail with the following errors: + +=over 4 + +=item B + +C is C or the empty string. + +=item B + +Insufficient memory was available. + +=item B> + +=back + +In contrast to L, the function does B fail if C +already exists and is a directory. + =back + +=head1 AUTHOR + +RRD Contributors