Skip to contentSkip to conversation

perf_counter tools: Remove dead code

tip:perfcounters/urgent tip-bot for Ingo Molnar 1 participant 1 message Jun 27, 2009 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  fde953c1c67986e1c381fa50d8207b1578b5cefa
Gitweb:     http://git.kernel.org/tip/fde953c1c67986e1c381fa50d8207b1578b5cefa
Author:     Ingo Molnar <[email protected]>
AuthorDate: Sat, 27 Jun 2009 06:06:39 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sat, 27 Jun 2009 06:06:39 +0200

perf_counter tools: Remove dead code

Vince Weaver reported that there's a handful of #ifdef __MINGW32__ sections in the code.

Remove them as they are in essence dead code - as unlike upstream Git, the perf tool is unlikely to be ported to Windows.

Cc Peter Zijlstra <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>

LKML-Reference: <new-submission>

---
 tools/perf/util/help.c        |   15 ------
 tools/perf/util/pager.c       |    5 +--
 tools/perf/util/run-command.c |   95 +----------------------------------------
 tools/perf/util/run-command.h |    5 --
 tools/perf/util/util.h        |   15 ------
 5 files changed, 3 insertions(+), 132 deletions(-)
tools/perf/util/help.c +0 -15
index 6653f7d..17a00e0 100644
@@ -126,21 +126,6 @@ static int is_executable(const char *name)
 	    !S_ISREG(st.st_mode))
 		return 0;
 
-#ifdef __MINGW32__
-	/* cannot trust the executable bit, peek into the file instead */
-	char buf[3] = { 0 };
-	int n;
-	int fd = open(name, O_RDONLY);
-	st.st_mode &= ~S_IXUSR;
-	if (fd >= 0) {
-		n = read(fd, buf, 2);
-		if (n == 2)
-			/* DOS executables start with "MZ" */
-			if (!strcmp(buf, "#!") || !strcmp(buf, "MZ"))
-				st.st_mode |= S_IXUSR;
-		close(fd);
-	}
-#endif
 	return st.st_mode & S_IXUSR;
 }
 
tools/perf/util/pager.c +1 -4
index a28bcca..1915de2 100644
@@ -9,7 +9,6 @@
 
 static int spawned_pager;
 
-#ifndef __MINGW32__
 static void pager_preexec(void)
 {
 	/*
@@ -24,7 +23,6 @@ static void pager_preexec(void)
 
 	setenv("LESS", "FRSX", 0);
 }
-#endif
 
 static const char *pager_argv[] = { "sh", "-c", NULL, NULL };
 static struct child_process pager_process;
@@ -70,9 +68,8 @@ void setup_pager(void)
 	pager_argv[2] = pager;
 	pager_process.argv = pager_argv;
 	pager_process.in = -1;
-#ifndef __MINGW32__
 	pager_process.preexec_cb = pager_preexec;
-#endif
+
 	if (start_command(&pager_process))
 		return;
 
tools/perf/util/run-command.c +2 -93

134 lines not on this page · raw message

tools/perf/util/run-command.h +0 -5
index 328289f..cc1837d 100644
@@ -79,12 +79,7 @@ struct async {
 	int (*proc)(int fd, void *data);
 	void *data;
 	int out;	/* caller reads from here and closes it */
-#ifndef __MINGW32__
 	pid_t pid;
-#else
-	HANDLE tid;
-	int fd_for_proc;
-#endif
 };
 
 int start_async(struct async *async);
tools/perf/util/util.h +0 -15
index b8cfed7..b4be607 100644
@@ -67,7 +67,6 @@
 #include <assert.h>
 #include <regex.h>
 #include <utime.h>
-#ifndef __MINGW32__
 #include <sys/wait.h>
 #include <sys/poll.h>
 #include <sys/socket.h>
@@ -81,20 +80,6 @@
 #include <netdb.h>
 #include <pwd.h>
 #include <inttypes.h>
-#if defined(__CYGWIN__)
-#undef _XOPEN_SOURCE
-#include <grp.h>
-#define _XOPEN_SOURCE 600
-#include "compat/cygwin.h"
-#else
-#undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */
-#include <grp.h>
-#define _ALL_SOURCE 1
-#endif
-#else 	/* __MINGW32__ */
-/* pull in Windows compatibility stuff */
-#include "compat/mingw.h"
-#endif	/* __MINGW32__ */
 
 #ifndef NO_ICONV
 #include <iconv.h>