ia64/xen-unstable

view tools/xenstore/xenstored.h @ 7238:971e7c7411b3

Raise an exception if an error appears on the pipes to our children, and make
sure that the child's pipes are closed even under that exception. Move the
handling of POLLHUP to the end of the loop, so that we guarantee to read any
remaining data from the child if POLLHUP and POLLIN appear at the same time.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Thu Oct 06 10:13:11 2005 +0100 (2005-10-06)
parents ef9591d03fdd
children 93e27f7ca8a8 61b3b357d827 402b5eb85905
line source
1 /*
2 * Simple prototyle Xen Store Daemon providing simple tree-like database.
3 * Copyright (C) 2005 Rusty Russell IBM Corporation
4 *
5 * This file may be distributed separately from the Linux kernel, or
6 * incorporated into other software packages, subject to the following license:
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this source file (the "Software"), to deal in the Software without
10 * restriction, including without limitation the rights to use, copy, modify,
11 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
12 * and to permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 * IN THE SOFTWARE.
25 */
27 #ifndef _XENSTORED_H
28 #define _XENSTORED_H
30 enum xsd_sockmsg_type
31 {
32 XS_DEBUG,
33 XS_SHUTDOWN,
34 XS_DIRECTORY,
35 XS_READ,
36 XS_GET_PERMS,
37 XS_WATCH,
38 XS_WATCH_ACK,
39 XS_UNWATCH,
40 XS_TRANSACTION_START,
41 XS_TRANSACTION_END,
42 XS_OP_READ_ONLY = XS_TRANSACTION_END,
43 XS_INTRODUCE,
44 XS_RELEASE,
45 XS_GET_DOMAIN_PATH,
46 XS_WRITE,
47 XS_MKDIR,
48 XS_RM,
49 XS_SET_PERMS,
50 XS_WATCH_EVENT,
51 XS_ERROR,
52 };
54 #define XS_WRITE_NONE "NONE"
55 #define XS_WRITE_CREATE "CREATE"
56 #define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
58 /* We hand errors as strings, for portability. */
59 struct xsd_errors
60 {
61 int errnum;
62 const char *errstring;
63 };
64 #define XSD_ERROR(x) { x, #x }
65 static struct xsd_errors xsd_errors[] __attribute__((unused)) = {
66 XSD_ERROR(EINVAL),
67 XSD_ERROR(EACCES),
68 XSD_ERROR(EEXIST),
69 XSD_ERROR(EISDIR),
70 XSD_ERROR(ENOENT),
71 XSD_ERROR(ENOMEM),
72 XSD_ERROR(ENOSPC),
73 XSD_ERROR(EIO),
74 XSD_ERROR(ENOTEMPTY),
75 XSD_ERROR(ENOSYS),
76 XSD_ERROR(EROFS),
77 XSD_ERROR(EBUSY),
78 XSD_ERROR(EAGAIN),
79 XSD_ERROR(EISCONN),
80 };
81 struct xsd_sockmsg
82 {
83 u32 type;
84 u32 len; /* Length of data following this. */
86 /* Generally followed by nul-terminated string(s). */
87 };
89 #endif /* _XENSTORED_H */