File xs-28-remove-talloc-report.patch of Package xen.26348

commit c8b5cae4ad086ab12a06b602fe7bc26a548fbcac
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Feb 24 07:21:45 2017 +0100

    xenstore: remove memory report command line support
    
    As a memory report can now be triggered via XS_CONTROL support via
    command line and signal handler is no longer needed. Remove it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Wei Liu <wei.liu2@citrix.com>

Index: xen-4.7.2-testing/tools/xenstore/xenstored_core.c
===================================================================
--- xen-4.7.2-testing.orig/tools/xenstore/xenstored_core.c
+++ xen-4.7.2-testing/tools/xenstore/xenstored_core.c
@@ -78,12 +78,10 @@ static bool verbose = false;
 LIST_HEAD(connections);
 int tracefd = -1;
 static bool recovery = true;
-static bool remove_local = true;
 static int reopen_log_pipe[2];
 static int reopen_log_pipe0_pollfd_idx = -1;
 char *tracefile = NULL;
 static TDB_CONTEXT *tdb_ctx = NULL;
-static bool trigger_talloc_report = false;
 
 static void corrupt(struct connection *conn, const char *fmt, ...);
 static const char *sockmsg_string(enum xsd_sockmsg_type type);
@@ -1814,10 +1812,6 @@ static void init_sockets(int **psock, in
 	static int minus_one = -1;
 	*psock = *pro_sock = &minus_one;
 }
-
-static void do_talloc_report(int sig)
-{
-}
 #else
 static int destroy_fd(void *_fd)
 {
@@ -1955,11 +1949,6 @@ static void init_sockets(int **psock, in
 
 
 }
-
-static void do_talloc_report(int sig)
-{
-	trigger_talloc_report = true;
-}
 #endif
 
 static void usage(void)
@@ -1984,8 +1973,6 @@ static void usage(void)
 "  -R, --no-recovery       to request that no recovery should be attempted when\n"
 "                          the store is corrupted (debug only),\n"
 "  -I, --internal-db       store database in memory, not on disk\n"
-"  -L, --preserve-local    to request that /local is preserved on start-up,\n"
-"  -M, --memory-debug <file>  support memory debugging to file,\n"
 "  -V, --verbose           to request verbose execution.\n");
 }
 
@@ -2004,11 +1991,9 @@ static struct option options[] = {
 	{ "trace-file", 1, NULL, 'T' },
 	{ "transaction", 1, NULL, 't' },
 	{ "no-recovery", 0, NULL, 'R' },
-	{ "preserve-local", 0, NULL, 'L' },
 	{ "internal-db", 0, NULL, 'I' },
 	{ "verbose", 0, NULL, 'V' },
 	{ "watch-nb", 1, NULL, 'W' },
-	{ "memory-debug", 1, NULL, 'M' },
 	{ NULL, 0, NULL, 0 } };
 
 extern void dump_conn(struct connection *conn); 
@@ -2024,13 +2009,12 @@ int main(int argc, char *argv[])
 	bool outputpid = false;
 	bool no_domain_init = false;
 	const char *pidfile = NULL;
-	const char *memfile = NULL;
 	int timeout;
 #if defined(XEN_SYSTEMD_ENABLED)
 	bool systemd;
 #endif
 
-	while ((opt = getopt_long(argc, argv, "DE:F:HNPS:t:T:RLVW:M:", options,
+	while ((opt = getopt_long(argc, argv, "DE:F:HNPS:t:T:RVW:", options,
 				  NULL)) != -1) {
 		switch (opt) {
 		case 'D':
@@ -2054,9 +2038,6 @@ int main(int argc, char *argv[])
 		case 'R':
 			recovery = false;
 			break;
-		case 'L':
-			remove_local = false;
-			break;
 		case 'S':
 			quota_max_entry_size = strtol(optarg, NULL, 10);
 			break;
@@ -2084,9 +2065,6 @@ int main(int argc, char *argv[])
 		case 'p':
 			priv_domid = strtol(optarg, NULL, 10);
 			break;
-		case 'M':
-			memfile = optarg;
-			break;
 		}
 	}
 	if (optind != argc)
@@ -2123,10 +2101,7 @@ int main(int argc, char *argv[])
 	/* Don't kill us with SIGPIPE. */
 	signal(SIGPIPE, SIG_IGN);
 
-	if (memfile) {
-		talloc_enable_null_tracking();
-		signal(SIGUSR1, do_talloc_report);
-	}
+	talloc_enable_null_tracking();
 
 #if defined(XEN_SYSTEMD_ENABLED)
 	if (!systemd)
@@ -2176,17 +2151,6 @@ int main(int argc, char *argv[])
 	for (;;) {
 		struct connection *conn, *next;
 
-		if (trigger_talloc_report) {
-			FILE *out;
-
-			trigger_talloc_report = false;
-			out = fopen(memfile, "a");
-			if (out) {
-				talloc_report_full(NULL, out);
-				fclose(out);
-			}
-		}
-
 		if (poll(fds, nr_fds, timeout) < 0) {
 			if (errno == EINTR)
 				continue;
openSUSE Build Service is sponsored by