aboutsummaryrefslogtreecommitdiff
blob: c90804fa58dd8372a25773da67e873aa0ca8bfba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
diff -Naur systemtap-2.9.orig/buildrun.cxx systemtap-2.9/buildrun.cxx
--- systemtap-2.9.orig/buildrun.cxx	2017-02-24 10:47:12.478787249 -0800
+++ systemtap-2.9/buildrun.cxx	2017-02-24 10:47:56.414162998 -0800
@@ -788,13 +788,14 @@
   if (s.need_uprobes && !kernel_built_uprobes(s))
     {
       string opt_u = "-u";
+      char *p = strchr(s.uprobes_path.c_str(), '/');
       if (!s.uprobes_path.empty() &&
           strverscmp("1.4", version.c_str()) <= 0)
         {
           if (remotedir.empty())
             opt_u.append(s.uprobes_path);
           else
-            opt_u.append(remotedir + "/" + basename(s.uprobes_path.c_str()));
+            opt_u.append(remotedir + "/" + (p ? p + 1 : s.uprobes_path.c_str()));
         }
       staprun_cmd.push_back(opt_u);
     }
diff -Naur systemtap-2.9.orig/configure.ac systemtap-2.9/configure.ac
--- systemtap-2.9.orig/configure.ac	2017-02-24 10:47:12.480787266 -0800
+++ systemtap-2.9/configure.ac	2017-02-24 10:48:24.679405813 -0800
@@ -443,6 +443,50 @@
   fi
 fi
 
+dnl Check if we have argp available from our libc
+AC_LINK_IFELSE(
+	[AC_LANG_PROGRAM(
+		[#include <argp.h>],
+		[int argc=1; char *argv[]={"test"}, argp_parse(0,argc,argv,0,0,0); return 0;]
+		)],
+	[libc_has_argp="true"],
+	[libc_has_argp="false"]
+)
+
+dnl If our libc doesn't provide argp, then test for libargp
+if test "$libc_has_argp" = "false" ; then
+	AC_MSG_WARN("libc does not have argp")
+	AC_CHECK_LIB([argp], [argp_parse], [have_obstack="true"], [have_obstack="false"])
+
+	if test "$have_argp" = "false"; then
+		AC_MSG_ERROR("no libargp found")
+	else
+                stap_LIBS="$stap_LIBS -largp"
+	fi
+fi
+
+dnl Check if we have obstack available from our libc
+AC_LINK_IFELSE(
+	[AC_LANG_PROGRAM(
+		[#include <obstack.h>],
+		[_obstack_begin(0, 0, 0, 0, 0); return 0;]
+		)],
+	[libc_has_obstack="true", AC_DEFINE(HAVE_OBSTACK, 1)],
+	[libc_has_obstack="false"]
+)
+
+dnl If our libc doesn't provide obstack, then test for libobstack
+if test "$libc_has_obstack" = "false" ; then
+	AC_MSG_WARN("libc does not have obstack")
+	AC_CHECK_LIB([obstack], [_obstack_begin], [have_obstack="true"], [have_obstack="false"])
+
+	if test "$have_obstack" = "false"; then
+		AC_MSG_ERROR("no libobstack found")
+	else
+                stap_LIBS="$stap_LIBS -lobstack"
+	fi
+fi
+
 AC_SUBST(stap_LIBS)
 AC_MSG_NOTICE([stap will link $stap_LIBS])
 
diff -Naur systemtap-2.9.orig/csclient.cxx systemtap-2.9/csclient.cxx
--- systemtap-2.9.orig/csclient.cxx	2017-02-24 10:47:12.481787274 -0800
+++ systemtap-2.9/csclient.cxx	2017-02-24 10:48:59.261702894 -0800
@@ -75,6 +75,10 @@
 
 #define MOK_PUBLIC_CERT_NAME "signing_key.x509"
 
+#ifndef NI_IDN
+#define NI_IDN 32
+#endif
+
 static PRIPv6Addr &copyAddress (PRIPv6Addr &PRin6, const in6_addr &in6);
 static PRNetAddr &copyNetAddr (PRNetAddr &x, const PRNetAddr &y);
 bool operator!= (const PRNetAddr &x, const PRNetAddr &y);
@@ -1038,7 +1042,7 @@
 
   // Canonicalize the given path and remove the leading /.
   string rpath;
-  char *cpath = canonicalize_file_name (path.c_str ());
+  char *cpath = realpath (path.c_str (), NULL);
   if (! cpath)
     {
       // It can not be canonicalized. Use the name relative to
diff -Naur systemtap-2.9.orig/error.h systemtap-2.9/error.h
--- systemtap-2.9.orig/error.h	1969-12-31 16:00:00.000000000 -0800
+++ systemtap-2.9/error.h	2017-02-24 10:49:03.823742085 -0800
@@ -0,0 +1,27 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+	va_list ap;
+	fprintf(stderr, "%s: ", program_invocation_name);
+	va_start(ap, format);
+	vfprintf(stderr, format, ap);
+	va_end(ap);
+	if (errnum)
+		fprintf(stderr, ": %s", strerror(errnum));
+	fprintf(stderr, "\n");
+	error_message_count++;
+	if (status)
+		exit(status);
+}
+
+#endif	/* _ERROR_H_ */
diff -Naur systemtap-2.9.orig/remote.cxx systemtap-2.9/remote.cxx
--- systemtap-2.9.orig/remote.cxx	2017-02-24 10:47:12.532787709 -0800
+++ systemtap-2.9/remote.cxx	2017-02-24 10:49:25.245926113 -0800
@@ -459,7 +459,8 @@
 
         if (!s->uprobes_path.empty())
           {
-            string remoteuprobes = basename(s->uprobes_path.c_str());
+            char *p = strchr(s->uprobes_path.c_str(), '/');
+            string remoteuprobes = p ? p + 1 : s->uprobes_path.c_str();
             if ((rc = send_file(s->uprobes_path, remoteuprobes)))
               return rc;
 
diff -Naur systemtap-2.9.orig/sdt_types.h systemtap-2.9/sdt_types.h
--- systemtap-2.9.orig/sdt_types.h	2017-02-24 10:47:12.572788050 -0800
+++ systemtap-2.9/sdt_types.h	2017-02-24 10:49:42.865077472 -0800
@@ -10,6 +10,13 @@
 #define UPROBE2_TYPE 0x32425055 /* "UPB2" */
 #define UPROBE3_TYPE 0x33425055 /* "UPB3" */
 
+#ifndef __uint32_t
+#define __uint32_t uint32_t
+#endif
+#ifndef __uint64_t
+#define __uint64_t uint64_t
+#endif
+
 typedef enum
   {
     uprobe1_type = UPROBE1_TYPE,
diff -Naur systemtap-2.9.orig/session.cxx systemtap-2.9/session.cxx
--- systemtap-2.9.orig/session.cxx	2017-02-24 10:47:12.572788050 -0800
+++ systemtap-2.9/session.cxx	2017-02-24 10:49:56.716196203 -0800
@@ -1329,7 +1329,7 @@
 	      cerr << "ERROR: multiple --sysroot options not supported" << endl;
 	      return 1;
 	  } else {
-	      char *spath = canonicalize_file_name (optarg);
+	      char *spath = realpath (optarg, NULL);
 	      if (spath == NULL) {
 		  cerr << _F("ERROR: %s is an invalid directory for --sysroot", optarg) << endl;
 		  return 1;
diff -Naur systemtap-2.9.orig/staprun/staprun.h systemtap-2.9/staprun/staprun.h
--- systemtap-2.9.orig/staprun/staprun.h	2017-02-24 10:47:12.581788127 -0800
+++ systemtap-2.9/staprun/staprun.h	2017-02-24 10:50:18.951386526 -0800
@@ -47,6 +47,9 @@
 #include <locale.h>
 #endif
 
+#ifndef __off_t
+#define __off_t off_t
+#endif
 
 /* define gettext options if NLS is set */
 #if ENABLE_NLS