~jamesodhunt/upstart/test-quiesce-cleanup

« back to all changes in this revision

Viewing changes to init/log.h

  • Committer: Scott James Remnant
  • Date: 2009-07-08 19:43:16 UTC
  • Revision ID: scott@netsplit.com-20090708194316-t6rw4e8auuza6qju
* conf/control-alt-delete.conf: Default job for Control-Alt-Delete
* conf/rc-sysinit.conf: Default job for system initialisation
* conf/rc.conf: A fully wacky instance job that runs the rc script
for runlevel changes
* conf/rcS.conf: And a job for single-user-mode, which calls back
to rc-sysinit
* conf/Makefile.am (dist_init_DATA): Install the default files
into the /etc/init directory
* configure.ac (AC_CONFIG_FILES): Create conf/Makefile
* Makefile.am (SUBDIRS): Recurse into the conf directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* upstart
2
 
 *
3
 
 * Copyright © 2011 Canonical Ltd.
4
 
 * Authors: Scott James Remnant <keybuk@google.com>,
5
 
 *          James Hunt <james.hunt@canonical.com>.
6
 
 *
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.
10
 
 *
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.
15
 
 *
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.
19
 
 */
20
 
 
21
 
#ifndef INIT_LOG_H
22
 
#define INIT_LOG_H
23
 
 
24
 
#include <nih/alloc.h>
25
 
#include <nih/list.h>
26
 
#include <nih/io.h>
27
 
#include <nih/file.h>
28
 
#include <nih/string.h>
29
 
#include <nih/logging.h>
30
 
#include <nih/error.h>
31
 
 
32
 
#include "state.h"
33
 
 
34
 
/** LOG_DEFAULT_UMASK:
35
 
 *
36
 
 * The default file creation mask for log files.
37
 
 **/
38
 
#define LOG_DEFAULT_UMASK        (S_IXUSR | S_IXGRP | S_IRWXO)
39
 
 
40
 
/** LOG_DEFAULT_MODE:
41
 
 *
42
 
 * File creation mode for log files.
43
 
 **/
44
 
#define LOG_DEFAULT_MODE         (S_IRWXU | S_IRGRP)
45
 
 
46
 
/** LOG_READ_SIZE:
47
 
 *
48
 
 * Minimum buffer size for reading log data.
49
 
 **/
50
 
#define LOG_READ_SIZE            1024
51
 
 
52
 
/**
53
 
 * Log:
54
 
 *
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.
63
 
 **/
64
 
typedef struct log {
65
 
        int          fd;
66
 
        char        *path;
67
 
        NihIo       *io;
68
 
        uid_t        uid;
69
 
        NihIoBuffer *unflushed;
70
 
        int          detached;
71
 
        int          remote_closed;
72
 
        int          open_errno;
73
 
} Log;
74
 
 
75
 
NIH_BEGIN_EXTERN
76
 
 
77
 
extern NihList *log_unflushed_files;
78
 
 
79
 
Log  *log_new                (const void *parent, const char *path,
80
 
                              int fd, uid_t uid)
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));
95
 
 
96
 
NIH_END_EXTERN
97
 
 
98
 
#endif /* INIT_LOG_H */