3
* Copyright © 2011 Canonical Ltd.
4
* Authors: Scott James Remnant <keybuk@google.com>,
5
* James Hunt <james.hunt@canonical.com>.
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License version 2, as
9
* published by the Free Software Foundation.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License along
17
* with this program; if not, write to the Free Software Foundation, Inc.,
18
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
#include <nih/alloc.h>
28
#include <nih/string.h>
29
#include <nih/logging.h>
30
#include <nih/error.h>
34
/** LOG_DEFAULT_UMASK:
36
* The default file creation mask for log files.
38
#define LOG_DEFAULT_UMASK (S_IXUSR | S_IXGRP | S_IRWXO)
42
* File creation mode for log files.
44
#define LOG_DEFAULT_MODE (S_IRWXU | S_IRGRP)
48
* Minimum buffer size for reading log data.
50
#define LOG_READ_SIZE 1024
55
* @fd: Write file descriptor associated with @path,
56
* @path: Full path to log file,
57
* @io: NihIo associated with jobs stdout and stderr,
58
* @uid: User ID of caller,
59
* @unflushed: Unflushed data,
60
* @detached: TRUE if log is no longer associated with a parent (job),
61
* @remote_closed: TRUE if remote end of pty has been closed,
62
* @open_errno: value of errno immediately after last attempt to open @path.
69
NihIoBuffer *unflushed;
77
extern NihList *log_unflushed_files;
79
Log *log_new (const void *parent, const char *path,
81
__attribute__ ((warn_unused_result));
82
void log_io_reader (Log *log, NihIo *io, const char *buf, size_t len);
83
void log_io_error_handler (Log *log, NihIo *io);
84
int log_destroy (Log *log)
85
__attribute__ ((warn_unused_result));
86
int log_handle_unflushed (void *parent, Log *log)
87
__attribute__ ((warn_unused_result));
88
int log_clear_unflushed (void)
89
__attribute__ ((warn_unused_result));
90
void log_unflushed_init (void);
91
json_object * log_serialise (Log *log)
92
__attribute__ ((warn_unused_result));
93
Log * log_deserialise (const void *parent, json_object *json)
94
__attribute__ ((warn_unused_result));
98
#endif /* INIT_LOG_H */