debuggers.hg

view tools/console/daemon/utils.h @ 6675:275e28658c66

Update consoled to use xs_get_domain_path and cleanup domain tracking code.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Sep 06 13:43:28 2005 +0000 (2005-09-06)
parents dd668f7527cb
children d4d69c509371
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);
32 #define read_sync(fd, buffer, size) _read_write_sync(fd, buffer, size, true)
33 #define write_sync(fd, buffer, size) _read_write_sync(fd, buffer, size, false)
34 bool _read_write_sync(int fd, void *data, size_t size, bool do_read);
36 extern int xcs_ctrl_fd;
37 extern int xcs_data_fd;
38 extern struct xs_handle *xs;
39 extern int xc;
41 #if 1
42 #define dolog(val, fmt, ...) do { \
43 if ((val) == LOG_ERR) \
44 fprintf(stderr, fmt "\n", ## __VA_ARGS__); \
45 syslog(val, fmt, ## __VA_ARGS__); \
46 } while (/* CONSTCOND */0)
47 #else
48 #define dolog(val, fmt, ...) fprintf(stderr, fmt "\n", ## __VA_ARGS__)
49 #endif
51 #endif