Skip to contentSkip to conversation

tools/xenstore: drop support for running under SunOS

PATCH In review Juergen Gross 3 participants 3 messages Dec 17, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/xenstore: drop support for running under SunOS

Since several years now xenstored is no longer capable to run under SunOS, as the needed libxengnttab interfaces are not available there.

Several attempts to let the SunOS maintainers address this situation didn't change anything in this regard.

For those reasons drop SunOS support in xenstored by removing the SunOS specific code.

---
 tools/xenstore/Makefile            |  15 +--
 tools/xenstore/xenstored_core.c    |   7 --
 tools/xenstore/xenstored_core.h    |   4 -
 tools/xenstore/xenstored_minios.c  |   4 -
 tools/xenstore/xenstored_posix.c   |   6 --
 tools/xenstore/xenstored_probes.d  |  28 -----
 tools/xenstore/xenstored_solaris.c | 168 -----------------------------
 7 files changed, 1 insertion(+), 231 deletions(-)
 delete mode 100644 tools/xenstore/xenstored_probes.d
 delete mode 100644 tools/xenstore/xenstored_solaris.c
tools/xenstore/Makefile +1 -14
index 292b478fa1..c86278fdb1 100644
@@ -27,7 +27,6 @@ XENSTORED_OBJS += xenstored_transaction.o xenstored_control.o
 XENSTORED_OBJS += xs_lib.o talloc.o utils.o tdb.o hashtable.o
 
 XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_posix.o
-XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o xenstored_posix.o xenstored_probes.o
 XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_posix.o
 XENSTORED_OBJS_$(CONFIG_FreeBSD) = xenstored_posix.o
 XENSTORED_OBJS_$(CONFIG_MiniOS) = xenstored_minios.o
@@ -50,18 +49,6 @@ all: $(ALL_TARGETS)
 .PHONY: clients
 clients: xenstore $(CLIENTS) xenstore-control
 
-ifeq ($(CONFIG_SunOS),y)
-xenstored_probes.h: xenstored_probes.d
-	dtrace -C -h -s xenstored_probes.d
-
-xenstored_solaris.o: xenstored_probes.h
-
-xenstored_probes.o: xenstored_solaris.o
-	dtrace -C -G -s xenstored_probes.d xenstored_solaris.o 
-
-CFLAGS += -DHAVE_DTRACE=1
-endif
-
 ifeq ($(CONFIG_SYSTEMD),y)
 $(XENSTORED_OBJS): CFLAGS += $(SYSTEMD_CFLAGS)
 xenstored: LDFLAGS += $(SYSTEMD_LIBS)
@@ -89,7 +76,7 @@ xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
 
 .PHONY: clean
 clean:
-	rm -f *.a *.o xenstored_probes.h
+	rm -f *.a *.o
 	rm -f xenstored
 	rm -f xs_tdb_dump xenstore-control init-xenstore-domain
 	rm -f xenstore $(CLIENTS)
tools/xenstore/xenstored_core.c +0 -7
index 91d093a12e..c386ae6129 100644
@@ -146,10 +146,6 @@ static void trace_io(const struct connection *conn,
 	time_t now;
 	struct tm *tm;
 
-#ifdef HAVE_DTRACE
-	dtrace_io(conn, data, out);
-#endif
-
 	if (tracefd < 0)
 		return;
 
@@ -2337,9 +2333,6 @@ int main(int argc, char *argv[])
 	/* Get ready to listen to the tools. */
 	initialize_fds(&sock_pollfd_idx, &timeout);
 
-	/* Tell the kernel we're up and running. */
-	xenbus_notify_running();
-
 #if defined(XEN_SYSTEMD_ENABLED)
 	if (!live_update) {
 		sd_notify(1, "READY=1");
tools/xenstore/xenstored_core.h +0 -4
index 07d861d924..190d2447cd 100644
@@ -225,7 +225,6 @@ int delay_request(struct connection *conn, struct buffered_data *in,
 void trace_create(const void *data, const char *type);
 void trace_destroy(const void *data, const char *type);
 void trace(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
-void dtrace_io(const struct connection *conn, const struct buffered_data *data, int out);
 void reopen_log(void);
 void close_log(void);
 
@@ -250,9 +249,6 @@ static inline int xenbus_master_domid(void) { return dom0_domid; }
 /* Return the event channel used by xenbus. */
 evtchn_port_t xenbus_evtchn(void);
 
-/* Tell the kernel xenstored is running. */
-void xenbus_notify_running(void);
-
 /* Write out the pidfile */
 void write_pidfile(const char *pidfile);
 
tools/xenstore/xenstored_minios.c +0 -4
index c94493e52a..aa384e50c8 100644
@@ -38,10 +38,6 @@ void init_pipe(int reopen_log_pipe[2])
 	reopen_log_pipe[1] = -1;
 }
 
-void xenbus_notify_running(void)
-{
-}
-
 evtchn_port_t xenbus_evtchn(void)
 {
 	return dom0_event;
tools/xenstore/xenstored_posix.c +0 -6
index 48c37ffe3e..b20504d1b6 100644
@@ -111,7 +111,6 @@ void unmap_xenbus(void *interface)
 	munmap(interface, getpagesize());
 }
 
-#ifndef __sun__
 evtchn_port_t xenbus_evtchn(void)
 {
 	int fd;
@@ -158,8 +157,3 @@ void *xenbus_map(void)
 
 	return addr;
 }
-
-void xenbus_notify_running(void)
-{
-}
-#endif /* !__sun__ */
tools/xenstore/xenstored_probes.d deleted +0 -28
deleted file mode 100644
index f72d38f935..0000000000
@@ -1,28 +0,0 @@
-/*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 2 of the License.
- */
-
-#include <sys/types.h>
-
-provider xenstore {
-	/* tx id, dom id, pid, type, msg */
-	probe msg(uint32_t, unsigned int, pid_t, int, const char *);
-	/* tx id, dom id, pid, type, reply */
-	probe reply(uint32_t, unsigned int, pid_t, int, const char *);
-	/* tx id, dom id, pid, reply */
-	probe error(uint32_t, unsigned int, pid_t, const char *);
-	/* dom id, pid, watch details */
-	probe watch_event(unsigned int, pid_t, const char *);
-};
-
-#pragma D attributes Evolving/Evolving/Common provider xenstore provider
-#pragma D attributes Private/Private/Unknown provider xenstore module
-#pragma D attributes Private/Private/Unknown provider xenstore function
-#pragma D attributes Evolving/Evolving/Common provider xenstore name
-#pragma D attributes Evolving/Evolving/Common provider xenstore args
-
tools/xenstore/xenstored_solaris.c deleted +0 -168

168 lines not on this page · raw message

Signature · 1 line
2.26.2
#1 lore raw
Quoted 10 lines · Juergen Gross

Since several years now xenstored is no longer capable to run under SunOS, as the needed libxengnttab interfaces are not available there.

Several attempts to let the SunOS maintainers address this situation didn't change anything in this regard.

For those reasons drop SunOS support in xenstored by removing the SunOS specific code.

FWIW, Acked-by: Andrew Cooper <[email protected]>

tools/xenstore/xenstored_solaris.c line 168

Quoted 6 lines
tools/xenstore/xenstored_solaris.c deleted +0 -6
-out:
-	/*
-	 * 6589130 dtrace -G fails for certain tail-calls on x86
-	 */
-	asm("nop");
-}

Code like this makes me extra sad... It only works for the same reasons as why asm ("") would be fine as well.

~Andrew

Reviewed-by on v1 1/1
#2 lore raw
In reply to Juergen Gross

Hi Juergen,

Quoted 10 lines · Juergen Gross

Since several years now xenstored is no longer capable to run under SunOS, as the needed libxengnttab interfaces are not available there.

Several attempts to let the SunOS maintainers address this situation didn't change anything in this regard.

For those reasons drop SunOS support in xenstored by removing the SunOS specific code.

Cheers,

Quoted 343 lines
---
  tools/xenstore/Makefile            |  15 +--
  tools/xenstore/xenstored_core.c    |   7 --
  tools/xenstore/xenstored_core.h    |   4 -
  tools/xenstore/xenstored_minios.c  |   4 -
  tools/xenstore/xenstored_posix.c   |   6 --
  tools/xenstore/xenstored_probes.d  |  28 -----
  tools/xenstore/xenstored_solaris.c | 168 -----------------------------
  7 files changed, 1 insertion(+), 231 deletions(-)

delete mode 100644 tools/xenstore/xenstored_probes.d delete mode 100644 tools/xenstore/xenstored_solaris.c

tools/xenstore/Makefile +1 -14
index 292b478fa1..c86278fdb1 100644
@@ -27,7 +27,6 @@ XENSTORED_OBJS += xenstored_transaction.o xenstored_control.o
  XENSTORED_OBJS += xs_lib.o talloc.o utils.o tdb.o hashtable.o
 
  XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_posix.o
-XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o xenstored_posix.o xenstored_probes.o
  XENSTORED_OBJS_$(CONFIG_NetBSD) = xenstored_posix.o
  XENSTORED_OBJS_$(CONFIG_FreeBSD) = xenstored_posix.o
  XENSTORED_OBJS_$(CONFIG_MiniOS) = xenstored_minios.o
@@ -50,18 +49,6 @@ all: $(ALL_TARGETS)
  .PHONY: clients
  clients: xenstore $(CLIENTS) xenstore-control
 
-ifeq ($(CONFIG_SunOS),y)
-xenstored_probes.h: xenstored_probes.d
-	dtrace -C -h -s xenstored_probes.d
-
-xenstored_solaris.o: xenstored_probes.h
-
-xenstored_probes.o: xenstored_solaris.o
-	dtrace -C -G -s xenstored_probes.d xenstored_solaris.o
-
-CFLAGS += -DHAVE_DTRACE=1
-endif
-
  ifeq ($(CONFIG_SYSTEMD),y)
  $(XENSTORED_OBJS): CFLAGS += $(SYSTEMD_CFLAGS)
  xenstored: LDFLAGS += $(SYSTEMD_LIBS)
@@ -89,7 +76,7 @@ xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
 
  .PHONY: clean
  clean:
-	rm -f *.a *.o xenstored_probes.h
+	rm -f *.a *.o
  	rm -f xenstored
  	rm -f xs_tdb_dump xenstore-control init-xenstore-domain
  	rm -f xenstore $(CLIENTS)
tools/xenstore/xenstored_core.c +0 -7
index 91d093a12e..c386ae6129 100644
@@ -146,10 +146,6 @@ static void trace_io(const struct connection *conn,
  	time_t now;
  	struct tm *tm;
 
-#ifdef HAVE_DTRACE
-	dtrace_io(conn, data, out);
-#endif
-
  	if (tracefd < 0)
  		return;
 
@@ -2337,9 +2333,6 @@ int main(int argc, char *argv[])
  	/* Get ready to listen to the tools. */
  	initialize_fds(&sock_pollfd_idx, &timeout);
 
-	/* Tell the kernel we're up and running. */
-	xenbus_notify_running();
-
  #if defined(XEN_SYSTEMD_ENABLED)
  	if (!live_update) {
  		sd_notify(1, "READY=1");
tools/xenstore/xenstored_core.h +0 -4
index 07d861d924..190d2447cd 100644
@@ -225,7 +225,6 @@ int delay_request(struct connection *conn, struct buffered_data *in,
  void trace_create(const void *data, const char *type);
  void trace_destroy(const void *data, const char *type);
  void trace(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
-void dtrace_io(const struct connection *conn, const struct buffered_data *data, int out);
  void reopen_log(void);
  void close_log(void);
 
@@ -250,9 +249,6 @@ static inline int xenbus_master_domid(void) { return dom0_domid; }
  /* Return the event channel used by xenbus. */
  evtchn_port_t xenbus_evtchn(void);
 
-/* Tell the kernel xenstored is running. */
-void xenbus_notify_running(void);
-
  /* Write out the pidfile */
  void write_pidfile(const char *pidfile);
 
tools/xenstore/xenstored_minios.c +0 -4
index c94493e52a..aa384e50c8 100644
@@ -38,10 +38,6 @@ void init_pipe(int reopen_log_pipe[2])
  	reopen_log_pipe[1] = -1;
  }
 
-void xenbus_notify_running(void)
-{
-}
-
  evtchn_port_t xenbus_evtchn(void)
  {
  	return dom0_event;
tools/xenstore/xenstored_posix.c +0 -6
index 48c37ffe3e..b20504d1b6 100644
@@ -111,7 +111,6 @@ void unmap_xenbus(void *interface)
  	munmap(interface, getpagesize());
  }
 
-#ifndef __sun__
  evtchn_port_t xenbus_evtchn(void)
  {
  	int fd;
@@ -158,8 +157,3 @@ void *xenbus_map(void)
 
  	return addr;
  }
-
-void xenbus_notify_running(void)
-{
-}
-#endif /* !__sun__ */
tools/xenstore/xenstored_probes.d deleted +0 -28
deleted file mode 100644
index f72d38f935..0000000000
@@ -1,28 +0,0 @@
-/*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 2 of the License.
- */
-
-#include <sys/types.h>
-
-provider xenstore {
-	/* tx id, dom id, pid, type, msg */
-	probe msg(uint32_t, unsigned int, pid_t, int, const char *);
-	/* tx id, dom id, pid, type, reply */
-	probe reply(uint32_t, unsigned int, pid_t, int, const char *);
-	/* tx id, dom id, pid, reply */
-	probe error(uint32_t, unsigned int, pid_t, const char *);
-	/* dom id, pid, watch details */
-	probe watch_event(unsigned int, pid_t, const char *);
-};
-
-#pragma D attributes Evolving/Evolving/Common provider xenstore provider
-#pragma D attributes Private/Private/Unknown provider xenstore module
-#pragma D attributes Private/Private/Unknown provider xenstore function
-#pragma D attributes Evolving/Evolving/Common provider xenstore name
-#pragma D attributes Evolving/Evolving/Common provider xenstore args
-
tools/xenstore/xenstored_solaris.c deleted +0 -168
deleted file mode 100644
index 06052d124a..0000000000
@@ -1,168 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (C) 2005 Rusty Russell IBM Corporation
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, version 2 of the
- * License.
- */
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <sys/mman.h>
-#include <strings.h>
-#include <ucred.h>
-#include <stdio.h>
-
-#include <xen/sys/xenbus.h>
-
-#include "talloc.h"
-#include "xenstored_core.h"
-#include "xenstored_probes.h"
-
-evtchn_port_t xenbus_evtchn(void)
-{
-	int fd;
-	evtchn_port_t port;
-
-	fd = open("/dev/xen/xenbus", O_RDONLY);
-	if (fd == -1)
-		return -1;
-
-	port = ioctl(fd, IOCTL_XENBUS_XENSTORE_EVTCHN);
-
-	close(fd);
-	return port;
-}
-
-void *xenbus_map(void)
-{
-	int fd;
-	void *addr;
-
-	fd = open("/dev/xen/xenbus", O_RDWR);
-	if (fd == -1)
-		return NULL;
-
-	addr = mmap(NULL, getpagesize(), PROT_READ|PROT_WRITE,
-		MAP_SHARED, fd, 0);
-
-	if (addr == MAP_FAILED)
-		addr = NULL;
-
-	close(fd);
-
-	return addr;
-}
-
-void xenbus_notify_running(void)
-{
-	int fd;
-
-	fd = open("/dev/xen/xenbus", O_RDONLY);
-
-	(void) ioctl(fd, IOCTL_XENBUS_NOTIFY_UP);
-
-	close(fd);
-}
-
-static pid_t cred(const struct connection *conn)
-{
-	ucred_t *ucred = NULL;
-	pid_t pid;
-
-	if (conn->domain)
-		return (0);
-
-	if (getpeerucred(conn->fd, &ucred) == -1)
-		return (0);
-
-	pid = ucred_getpid(ucred);
-
-	ucred_free(ucred);
-	return (pid);
-}
-
-/*
- * The strings are often a number of nil-separated strings. We'll just
- * replace the separators with spaces - not quite right, but good
- * enough.
- */
-static char *
-mangle(const struct connection *conn, const struct buffered_data *in)
-{
-	char *str;
-	int i;
-
-	if (in->hdr.msg.len == 0)
-		return (talloc_strdup(conn, ""));
-
-	if ((str = talloc_zero_size(conn, in->hdr.msg.len + 1)) == NULL)
-		return (NULL);
-
-	memcpy(str, in->buffer, in->hdr.msg.len);
-	
-	/*
-	 * The protocol is absurdly inconsistent in whether the length
-	 * includes the terminating nil or not; replace all nils that
-	 * aren't the last one.
-	 */
-	for (i = 0; i < (in->hdr.msg.len - 1); i++) {
-		if (str[i] == '\0')
-			str[i] = ' ';
-	}
-
-	return (str);
-}
-
-void
-dtrace_io(const struct connection *conn, const struct buffered_data *in,
-    int io_out)
-{
-	if (!io_out) {
-		if (XENSTORE_MSG_ENABLED()) {
-			char *mangled = mangle(conn, in);
-			XENSTORE_MSG(in->hdr.msg.tx_id, conn->id, cred(conn),
-			    in->hdr.msg.type, mangled);
-		}
-
-		goto out;
-	}
-
-	switch (in->hdr.msg.type) {
-	case XS_ERROR:
-		if (XENSTORE_ERROR_ENABLED()) {
-			char *mangled = mangle(conn, in);
-			XENSTORE_ERROR(in->hdr.msg.tx_id, conn->id,
-			    cred(conn), mangled);
-		}
-		break;
-
-	case XS_WATCH_EVENT:
-		if (XENSTORE_WATCH_EVENT_ENABLED()) {
-			char *mangled = mangle(conn, in);
-			XENSTORE_WATCH_EVENT(conn->id, cred(conn), mangled);
-		}
-		break;
-
-	default:
-		if (XENSTORE_REPLY_ENABLED()) {
-			char *mangled = mangle(conn, in);
-			XENSTORE_REPLY(in->hdr.msg.tx_id, conn->id, cred(conn),
-			    in->hdr.msg.type, mangled);
-		}
-		break;
-	}
-
-out:
-	/*
-	 * 6589130 dtrace -G fails for certain tail-calls on x86
-	 */
-	asm("nop");
-}
Signature · 1 line
Julien Grall