~ubuntu-branches/ubuntu/oneiric/collectd/oneiric

« back to all changes in this revision

Viewing changes to src/utils_tail.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Harl
  • Date: 2008-06-17 10:35:51 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080617103551-9d0ym3zejc7agtt3
Tags: 4.4.1-1
* New upstream release.
  - Fixed another issue of the sensors plugin affecting some chip types
    (Closes: #468143).
  - Fixed creation of "vserver" graphs in collection.cgi (Closes: #475120).
  - Fixed a segfault when using libperl 5.10.
  - collectd now ships libiptc itself.
  New plugins:
  - Ascent server statistics: ascent
  - IPMI sensors information: ipmi
  - PowerDNS name server statistics: powerdns
  - incremental parsing of logfiles: tail
  - TeamSpeak2 server statistics: teamspeak2
  - detailed virtual memory statistics: vmem
* Disable "tcpconns" plugin by default (Closes: #478759).
* Reenabled iptables plugin on all architectures (Closes: #473435).
  - Added the plugin to collectd.conf.
  - Added /usr/share/doc/collectd/examples/iptables/.
  - Added build dependency on linux-libc-dev (>= 2.6.25-4) - that version is
    required because of #479899.
* New debconf template translations:
  - gl.po, thanks to Jacobo Tarrio (Closes: #482667).
* Added a work around for #474087 (broken openipmi .pc files) by forcing the
  inclusion of the ipmi plugin and manually specifying the dependencies.
* Updated standards-version to 3.8.0 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * collectd - src/utils_tail.h
 
3
 * Copyright (C) 2007-2008  C-Ware, Inc.
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify it
 
6
 * under the terms of the GNU General Public License as published by the
 
7
 * Free Software Foundation; only version 2 of the License is applicable.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful, but
 
10
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License along
 
15
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
16
 * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
17
 *
 
18
 * Author:
 
19
 *   Luke Heberling <lukeh at c-ware.com>
 
20
 *
 
21
 * DESCRIPTION
 
22
 *   Facilitates reading information that is appended to a file, taking into
 
23
 *   account that the file may be rotated and a new file created under the
 
24
 *   same name.
 
25
 **/
 
26
 
 
27
#ifndef UTILS_TAIL_H
 
28
#define UTILS_TAIL_H 1
 
29
 
 
30
struct cu_tail_s;
 
31
typedef struct cu_tail_s cu_tail_t;
 
32
 
 
33
typedef int tailfunc_t(void *data, char *buf, int buflen);
 
34
 
 
35
/*
 
36
 * NAME
 
37
 *   cu_tail_create
 
38
 *
 
39
 * DESCRIPTION
 
40
 *   Allocates a new tail object..
 
41
 *
 
42
 * PARAMETERS
 
43
 *   `file'       The name of the file to be tailed.
 
44
 */
 
45
cu_tail_t *cu_tail_create (const char *file);
 
46
 
 
47
/*
 
48
 * cu_tail_destroy
 
49
 *
 
50
 * Takes a tail object returned by `cu_tail_create' and destroys it, freeing
 
51
 * all internal memory.
 
52
 *
 
53
 * Returns 0 when successful and non-zero otherwise.
 
54
 */
 
55
int cu_tail_destroy (cu_tail_t *obj);
 
56
 
 
57
/*
 
58
 * cu_tail_readline
 
59
 *
 
60
 * Reads from the file until `buflen' characters are read, a newline
 
61
 * character is read, or an eof condition is encountered. `buf' is
 
62
 * always null-terminated on successful return and isn't touched when non-zero
 
63
 * is returned.
 
64
 *
 
65
 * You can check if the EOF condition is reached by looking at the buffer: If
 
66
 * the length of the string stored in the buffer is zero, EOF occurred.
 
67
 * Otherwise at least the newline character will be in the buffer.
 
68
 *
 
69
 * Returns 0 when successful and non-zero otherwise.
 
70
 */
 
71
int cu_tail_readline (cu_tail_t *obj, char *buf, int buflen);
 
72
 
 
73
/*
 
74
 * cu_tail_readline
 
75
 *
 
76
 * Reads from the file until eof condition or an error is encountered.
 
77
 *
 
78
 * Returns 0 when successful and non-zero otherwise.
 
79
 */
 
80
int cu_tail_read (cu_tail_t *obj, char *buf, int buflen, tailfunc_t *callback,
 
81
                void *data);
 
82
 
 
83
#endif /* UTILS_TAIL_H */