summaryrefslogtreecommitdiff
path: root/vapi/libdaemon.vapi
blob: 7f80fb5dcde5916e8033ba1902b7b39f13836985 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/* daemon.vapi
 *
 * Copyright (C) 2009 Jukka-Pekka Iivonen
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Jukka-Pekka Iivonen <jp0409@jippii.fi>
 */

[CCode (lower_case_cprefix = "daemon_", cheader_filename = "signal.h,libdaemon/daemon.h")]
namespace Daemon {
	[CCode (cname = "int", cprefix = "DAEMON_LOG_", has_type_id = false)]
 	public enum LogFlags {
		SYSLOG,
		STDERR,
		STDOUT,
		AUTO
	}

	[CCode (cname = "int", cprefix = "LOG_", has_type_id = false)]
	public enum LogPriority {
		EMERG,
		ALERT,
		CRIT,
		ERR,
		WARNING,
		NOTICE,
		INFO,
		DEBUG
	}

	[CCode (cname = "int", cprefix = "SIG", has_type_id = false)]
	public enum Sig {
		HUP,
		INT,
		QUIT,
		ILL,
		TRAP,
		ABRT,
		IOT,
		BUS,
		FPE,
		KILL,
		USR1,
		SEGV,
		USR2,
		PIPE,
		ALRM,
		TERM,
		STKFLT,
		CLD,
		CHLD,
		CONT,
		STOP,
		TSTP,
		TTIN,
		TTOU,
		URG,
		XCPU,
		XFSZ,
		VTALRM,
		PROF,
		WINCH,
		POLL,
		IO,
		PWR,
		SYS,
		UNUSED
	}

	public int exec (string dir, out int ret, string prog, ...);

	public GLib.Pid fork ();
	public int retval_init ();
	public void retval_done ();
	public int retval_wait (int timeout);
	public int retval_send (int s);
	public int close_all (int except_fd, ...);
	public int close_allv ([CCode (array_length = false)] int[] except_fds);
	public int unblock_sigs (int except, ...);
	public int unblock_sigsv ([CCode (array_length = false)] int[] except);
	public int reset_sigs (int except, ...);
	public int reset_sigsv ([CCode (array_length = false)] int[] except);

	public static LogFlags log_use;
	public static string log_ident;

	public void log (int prio, string t, ...);
	public unowned string ident_from_argv0 (string argv0);

	public int nonblock (int fd, int b);

	public delegate string PidFileProc ();

	public static string pid_file_ident;
	public static PidFileProc pid_file_proc;

	public unowned string pid_file_proc_default ();
	public int pid_file_create ();
	public int pid_file_remove ();
	public GLib.Pid pid_file_is_running ();
	public int pid_file_kill (Sig s);
	public int pid_file_kill_wait (Sig s, int m);

	public int signal_init (Sig s, ...);
	public int signal_install (Sig s);
	public void signal_done ();
	public int signal_next ();
	public int signal_fd ();
}