diff options
-rw-r--r-- | tools/hotplug/Linux/vif-setup | 2 | ||||
-rw-r--r-- | tools/libxc/xc_private.c | 14 | ||||
-rw-r--r-- | tools/libxl/libxl.c | 12 | ||||
-rw-r--r-- | tools/libxl/libxl.h | 2 | ||||
-rw-r--r-- | tools/libxl/xl_cmdimpl.c | 4 | ||||
-rw-r--r-- | tools/xenpaging/xenpaging.c | 1 |
6 files changed, 29 insertions, 6 deletions
diff --git a/tools/hotplug/Linux/vif-setup b/tools/hotplug/Linux/vif-setup index 677e29ca3f..bcc462eaf5 100644 --- a/tools/hotplug/Linux/vif-setup +++ b/tools/hotplug/Linux/vif-setup @@ -2,7 +2,7 @@ if test "$script" then - exec "$script" $* + exec $script $* else exec /etc/xen/scripts/vif-bridge $* fi diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c index befc3f965a..429e7b148d 100644 --- a/tools/libxc/xc_private.c +++ b/tools/libxc/xc_private.c @@ -57,6 +57,8 @@ xc_interface *xc_interface_open(xentoollog_logger *logger, return 0; } +static void xc_clean_hcall_buf(void); + int xc_interface_close(xc_interface *xch) { int rc = 0; @@ -68,6 +70,9 @@ int xc_interface_close(xc_interface *xch) rc = xc_interface_close_core(xch, xch->fd); if (rc) PERROR("Could not close hypervisor interface"); } + + xc_clean_hcall_buf(); + free(xch); return rc; } @@ -180,6 +185,8 @@ void unlock_pages(void *addr, size_t len) { } int hcall_buf_prep(void **addr, size_t len) { return 0; } void hcall_buf_release(void **addr, size_t len) { } +static void xc_clean_hcall_buf(void) { } + #else /* !__sun__ */ int lock_pages(void *addr, size_t len) @@ -230,6 +237,13 @@ static void _xc_init_hcall_buf(void) pthread_key_create(&hcall_buf_pkey, _xc_clean_hcall_buf); } +static void xc_clean_hcall_buf(void) +{ + pthread_once(&hcall_buf_pkey_once, _xc_init_hcall_buf); + + _xc_clean_hcall_buf(pthread_getspecific(hcall_buf_pkey)); +} + int hcall_buf_prep(void **addr, size_t len) { struct hcall_buf *hcall_buf; diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index c95272d432..c31c659d09 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -959,12 +959,20 @@ int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_conso char *cons_num_s = libxl_sprintf(&gc, "%d", cons_num); char *cons_type_s; - if (type == LIBXL_CONSTYPE_PV) + switch (type) { + case LIBXL_CONSTYPE_PV: cons_type_s = "pv"; - else + break; + case LIBXL_CONSTYPE_SERIAL: cons_type_s = "serial"; + break; + default: + goto out; + } execl(p, p, domid_s, "--num", cons_num_s, "--type", cons_type_s, (void *)NULL); + +out: libxl_free_all(&gc); return ERROR_FAIL; } diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index c757a9f09d..d9de4f67a8 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -155,7 +155,7 @@ typedef enum { } libxl_qemu_machine_type; typedef enum { - LIBXL_CONSTYPE_SERIAL, + LIBXL_CONSTYPE_SERIAL = 1, LIBXL_CONSTYPE_PV, } libxl_console_constype; diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 323dd04803..b5a1cddb47 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -1851,7 +1851,7 @@ int main_cd_insert(int argc, char **argv) int main_console(int argc, char **argv) { int opt = 0, num = 0; - libxl_console_constype type = -1; + libxl_console_constype type = 0; while ((opt = getopt(argc, argv, "hn:t:")) != -1) { switch (opt) { @@ -1882,7 +1882,7 @@ int main_console(int argc, char **argv) } find_domain(argv[optind]); - if (type <= 0 && num == 0) + if (!type) libxl_primary_console_exec(&ctx, domid); else libxl_console_exec(&ctx, domid, num, type); diff --git a/tools/xenpaging/xenpaging.c b/tools/xenpaging/xenpaging.c index 72d131161b..e6ed4a6f9f 100644 --- a/tools/xenpaging/xenpaging.c +++ b/tools/xenpaging/xenpaging.c @@ -19,6 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#define _XOPEN_SOURCE 600 #include <inttypes.h> #include <stdlib.h> |