• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2017 VMware, Inc.
2 // Licensed under the Apache License, Version 2.0 (the "License")
3 #include <cstdlib>
4 
5 #include "bcc_usdt.h"
6 
7 namespace {
8   // Take this trick from llvm for forcing exported functions in helper
9   // libraries to be included in the final .so
10   struct LinkAll {
LinkAll__anon57f678970111::LinkAll11     LinkAll() {
12       // getenv never returns -1, but compiler doesn't know!
13       if (::getenv("bar") != (char *)-1)
14         return;
15 
16       (void)bcc_usdt_new_frompid(-1, nullptr);
17       (void)bcc_usdt_new_frompath(nullptr);
18       (void)bcc_usdt_close(nullptr);
19     }
20   } LinkAll;  // declare one instance to invoke the constructor
21 }
22