direct-io.hg

view tools/console/daemon/utils.h @ 10355:7fba181c8531

[TOOLS] Introduce xc_evtchn_*() interface for interacting with /dev/xen/evtchn.
No longer open the device as non-blocking: all reads immediately follow
a select() on the device indicating it's ready to read.

Signed-off-by: John Levon <john.levon@sun.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Jun 15 13:11:31 2006 +0100 (2006-06-15)
parents 06d84bf87159
children
line source
1 /*\
2 * Copyright (C) International Business Machines Corp., 2005
3 * Author(s): Anthony Liguori <aliguori@us.ibm.com>
4 *
5 * Xen Console Daemon
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 as published by
9 * the Free Software Foundation; under version 2 of the License.
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
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 \*/
21 #ifndef CONSOLED_UTILS_H
22 #define CONSOLED_UTILS_H
24 #include <stdbool.h>
25 #include <syslog.h>
26 #include <stdio.h>
28 #include "xs.h"
30 void daemonize(const char *pidfile);
31 bool xen_setup(void);
33 extern struct xs_handle *xs;
34 extern int xc;
36 #if 1
37 #define dolog(val, fmt, ...) do { \
38 if ((val) == LOG_ERR) \
39 fprintf(stderr, fmt "\n", ## __VA_ARGS__); \
40 syslog(val, fmt, ## __VA_ARGS__); \
41 } while (/* CONSTCOND */0)
42 #else
43 #define dolog(val, fmt, ...) fprintf(stderr, fmt "\n", ## __VA_ARGS__)
44 #endif
46 #endif