Skip to content

Commit 8d2d556

Browse files
committed
/home/fox/release/dtrace/2008/dtrace-20080530.tar.bz2
1 parent acbd05f commit 8d2d556

7 files changed

Lines changed: 95 additions & 16 deletions

File tree

Packages

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,10 @@ bison-1.35 or byacc
1414
lex or flex
1515
Needed to compile dt_lex.l
1616

17+
librt.so
18+
Needed for the clock_gettime() function so we can implement
19+
gethrtime().
20+
1721
zlib
1822
Need compression header file -- zlib.h and libz.so.1
23+

checksum.lst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
1530b884 size=72 mtime=1209304719 ./.gdbinit
2-
aa612f74 size=3743 mtime=1212098879 ./Changes
2+
3d7a5642 size=3878 mtime=1212099905 ./Changes
33
fed0c352 size=18945 mtime=1106593216 ./LICENSING.NOTICE
44
384c2389 size=32 mtime=1209251274 ./LINUX
5-
aacc10c8 size=519 mtime=1209976212 ./Packages
5+
faf39f64 size=605 mtime=1212185998 ./Packages
66
a2700a1b size=3324 mtime=1209505629 ./README
77
33ab730b size=5236 mtime=1209210953 ./cmd/dtrace/checksum.lst
88
5f413bc7 size=2691 mtime=1207686227 ./cmd/dtrace/demo/Makefile
@@ -88,9 +88,9 @@ c9d1d651 size=1004 mtime=1207686227 ./cmd/dtrace/demo/user/libc.d
8888
41533ab4 size=1677 mtime=1207686227 ./cmd/dtrace/demo/vars/clause.d
8989
c7332e52 size=1276 mtime=1207686227 ./cmd/dtrace/demo/vars/rtime.d
9090
bba528b1 size=1576 mtime=1207686227 ./cmd/dtrace/demo/vminfo/soffice.d
91-
4b0958a5 size=1833518 mtime=1211323734 ./cmd/dtrace/dtrace
91+
a9acdee6 size=1835839 mtime=1212186622 ./cmd/dtrace/dtrace
9292
fc0c9223 size=47923 mtime=1211323732 ./cmd/dtrace/dtrace.c
93-
98da0e74 size=700 mtime=1210796366 ./cmd/dtrace/makefile
93+
39bd6fcc size=705 mtime=1212185965 ./cmd/dtrace/makefile
9494
118f26ce size=801 mtime=1106592642 ./cmd/intrstat/Makefile
9595
0cba365e size=801 mtime=1106592642 ./cmd/intrstat/Makefile.com
9696
e9a8ff89 size=440 mtime=1106592642 ./cmd/intrstat/amd64/Makefile
@@ -237,7 +237,7 @@ f3f1fe0f size=6181 mtime=1210534880 ./libdtrace/common/dt_string.c
237237
7c07da99 size=1471 mtime=1210534880 ./libdtrace/common/dt_string.h
238238
09ebb75d size=5749 mtime=1210534866 ./libdtrace/common/dt_strtab.c
239239
1a438c84 size=2439 mtime=1210534866 ./libdtrace/common/dt_strtab.h
240-
0888a62e size=21950 mtime=1210536822 ./libdtrace/common/dt_subr.c
240+
fc9e545c size=22480 mtime=1212185190 ./libdtrace/common/dt_subr.c
241241
e331dbd8 size=7732 mtime=1210534558 ./libdtrace/common/dt_work.c
242242
4bda6ae5 size=11456 mtime=1210534544 ./libdtrace/common/dt_xlator.c
243243
daef6990 size=3176 mtime=1210534522 ./libdtrace/common/dt_xlator.h
@@ -282,8 +282,9 @@ e89d844b size=629 mtime=1106592653 ./libdtrace/sparcv9/Makefile
282282
861790c6 size=84828 mtime=1207339541 ./liblinux/Psymtab.c
283283
129bd3b4 size=3325 mtime=1207339747 ./liblinux/Putil.c
284284
bdddd1e3 size=93 mtime=1207769009 ./liblinux/gmatch.c
285-
84ab51a4 size=405 mtime=1209235424 ./liblinux/makefile
286-
7fd6e08c size=2670 mtime=1209305172 ./liblinux/proc.c
285+
af98005e size=424 mtime=1212185735 ./liblinux/makefile
286+
4ee51333 size=2830 mtime=1212186324 ./liblinux/proc.c
287+
e8479c50 size=1104 mtime=1212186619 ./liblinux/proc2.c
287288
c6eec312 size=15563 mtime=1207346437 ./liblinux/proc_names.c
288289
d4b66db2 size=1763 mtime=1207602319 ./liblinux/strlcpy.c
289290
49b1ed99 size=1540 mtime=1106592654 ./libproc/Makefile

cmd/dtrace/makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LIBS = \
99

1010
COMPILE = $(CC) $(CFLAGS) -o dtrace \
1111
-L../../build \
12-
dtrace.o -ldtrace -lctf -llinux -lz -lpthread $$libelf -ldl
12+
dtrace.o -ldtrace -lctf -llinux -lz -lrt -lpthread $$libelf -ldl
1313

1414
all: dtrace
1515

libdtrace/common/dt_subr.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,33 @@ long
498498
dt_sysconf(dtrace_hdl_t *dtp, int name)
499499
{
500500
const dtrace_vector_t *v = dtp->dt_vector;
501+
FILE *fp;
502+
static int ncpu = -1;
503+
504+
if (v == NULL) {
505+
/***********************************************/
506+
/* On my Linux boxes, eg. Ubuntu/FC8 - */
507+
/* sysconf seems broken. Who cares! */
508+
/***********************************************/
509+
switch (name) {
510+
case _SC_CPUID_MAX: {
511+
char buf[BUFSIZ];
512+
513+
if (ncpu > 0)
514+
return ncpu;
515+
516+
fp = fopen("/proc/cpuinfo", "r");
517+
while (fgets(buf, sizeof buf, fp)) {
518+
if (strncmp(buf, "processor", 9) == 0)
519+
ncpu++;
520+
}
521+
fclose(fp);
522+
return ncpu;
523+
}
524+
}
501525

502-
if (v == NULL)
503526
return (sysconf(name));
527+
}
504528

505529
return (v->dtv_sysconf(dtp->dt_varg, name));
506530
}

liblinux/makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ LIB = ../build/liblinux.a
1313
$(LIB): \
1414
$(LIB)(gmatch.o) \
1515
$(LIB)(proc.o) \
16+
$(LIB)(proc2.o) \
1617
$(LIB)(proc_names.o) \
1718
$(LIB)(strlcpy.o) \
1819

liblinux/proc.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2+
/**********************************************************************/
3+
/* Stubs which we have yet to implement. Just log we got called so */
4+
/* we can make porting progress and know what we forgot to do. */
5+
/**********************************************************************/
6+
17
int _libproc_debug; /* set non-zero to enable debugging printfs */
28
int blockable_sigs; /* signals to block when we need to be safe */
39

@@ -49,18 +55,12 @@ dt_pid_create_glob_offset_probes() { printf("%s\n", __func__); }
4955
dt_pid_create_offset_probe() { printf("%s\n", __func__); }
5056
dt_pid_create_return_probe() { printf("%s\n", __func__); }
5157
fork1() { printf("%s\n", __func__); }
52-
gethrtime() { printf("%s\n", __func__); }
53-
int
54-
getzoneid()
55-
{
56-
return 0;
57-
}
58+
5859
int modctl() { printf("%s\n", __func__); return -1; }
5960
p_online() { printf("%s\n", __func__); }
6061
pr_close() { printf("%s\n", __func__); }
6162
pr_ioctl() { printf("%s\n", __func__); }
6263
pr_open() { printf("%s\n", __func__); }
63-
pthread_cond_reltimedwait_np() { printf("%s\n", __func__); }
6464
rd_errstr() { printf("%s\n", __func__); }
6565
rd_event_addr() { printf("%s\n", __func__); }
6666
rd_event_enable() { printf("%s\n", __func__); }

liblinux/proc2.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**********************************************************************/
2+
/* Missing Linux functions compared to Solaris. We need prototypes */
3+
/* in scope to make sure we behave. Stuff migrated from proc.c as */
4+
/* we fill them in. */
5+
/**********************************************************************/
6+
7+
# include <time.h>
8+
# include <sys/time.h>
9+
# include <pthread.h>
10+
11+
long long
12+
gethrtime()
13+
{
14+
struct timespec sp;
15+
int ret;
16+
long long v;
17+
18+
#ifdef CLOCK_MONOTONIC_HR
19+
ret = clock_gettime(CLOCK_MONOTONIC_HR, &sp);
20+
#else
21+
ret = clock_gettime(CLOCK_MONOTONIC, &sp);
22+
#endif
23+
24+
if (ret)
25+
return 0;
26+
27+
v = 1000000000LL;
28+
v *= sp.tv_sec;
29+
v += sp.tv_nsec;
30+
31+
return v;
32+
}
33+
34+
/**********************************************************************/
35+
/* Linux doesnt support zones (well, it can do, but not quite). */
36+
/**********************************************************************/
37+
int
38+
getzoneid()
39+
{
40+
return 0;
41+
}
42+
43+
int
44+
pthread_cond_reltimedwait_np(pthread_cond_t *cvp, pthread_mutex_t *mp,
45+
struct timespec *reltime)
46+
{
47+
return pthread_cond_timedwait(cvp, mp, reltime);
48+
}

0 commit comments

Comments
 (0)