Print this page
4474 DTrace Userland CTF Support
4475 DTrace userland Keyword
4476 DTrace tests should be better citizens
4479 pid provider types
4480 dof emulation missing checks
Reviewed by: Bryan Cantrill <bryan@joyent.com>


  53 #include <sys/wait.h>
  54 #include <unistd.h>
  55 #include "prov.h"
  56 
  57 int
  58 main(int argc, char **argv)
  59 {
  60         TEST_PROV_GO();
  61         if (fork() == 0) {
  62                 TEST_PROV_GO();
  63                 return (0);
  64         }
  65 
  66         (void) wait(NULL);
  67         TEST_PROV_GO();
  68 
  69         return (0);
  70 }
  71 EOF
  72 
  73 gcc -c test.c
  74 if [ $? -ne 0 ]; then
  75         print -u2 "failed to compile test.c"
  76         exit 1
  77 fi
  78 $dtrace -G -32 -s prov.d test.o
  79 if [ $? -ne 0 ]; then
  80         print -u2 "failed to create DOF"
  81         exit 1
  82 fi
  83 gcc -o test test.o prov.o
  84 if [ $? -ne 0 ]; then
  85         print -u2 "failed to link final executable"
  86         exit 1
  87 fi
  88 
  89 script() {
  90         $dtrace -c ./test -Zqs /dev/stdin <<EOF
  91         test_prov*:::
  92         {
  93                 printf("%s:%s:%s\n", probemod, probefunc, probename);
  94         }
  95 EOF
  96 }
  97 
  98 script
  99 status=$?
 100 
 101 cd /
 102 /usr/bin/rm -rf $DIR
 103 


  53 #include <sys/wait.h>
  54 #include <unistd.h>
  55 #include "prov.h"
  56 
  57 int
  58 main(int argc, char **argv)
  59 {
  60         TEST_PROV_GO();
  61         if (fork() == 0) {
  62                 TEST_PROV_GO();
  63                 return (0);
  64         }
  65 
  66         (void) wait(NULL);
  67         TEST_PROV_GO();
  68 
  69         return (0);
  70 }
  71 EOF
  72 
  73 gcc -m32 -c test.c
  74 if [ $? -ne 0 ]; then
  75         print -u2 "failed to compile test.c"
  76         exit 1
  77 fi
  78 $dtrace -G -32 -s prov.d test.o
  79 if [ $? -ne 0 ]; then
  80         print -u2 "failed to create DOF"
  81         exit 1
  82 fi
  83 gcc -m32 -o test test.o prov.o
  84 if [ $? -ne 0 ]; then
  85         print -u2 "failed to link final executable"
  86         exit 1
  87 fi
  88 
  89 script() {
  90         $dtrace -c ./test -Zqs /dev/stdin <<EOF
  91         test_prov*:::
  92         {
  93                 printf("%s:%s:%s\n", probemod, probefunc, probename);
  94         }
  95 EOF
  96 }
  97 
  98 script
  99 status=$?
 100 
 101 cd /
 102 /usr/bin/rm -rf $DIR
 103