@@ -11,6 +11,9 @@
#include "traceevent/event-parse.h"
#include "trace-cmd/trace-cmd.h"
+#define __packed __attribute__((packed))
+#define __hidden __attribute__((visibility ("hidden")))
+
#define TRACECMD_MAGIC { 23, 8, 68 }
#define ARRAY_SIZE(_a) (sizeof(_a) / sizeof((_a)[0]))
@@ -12,8 +12,6 @@
/* Can be overridden */
void warning(const char *fmt, ...);
-#define __packed __attribute__((packed))
-
/* trace.dat file format version */
#define FILE_VERSION 6
@@ -9,9 +9,10 @@
#include <stdarg.h>
#include <errno.h>
+#include "trace-cmd-private.h"
#include "trace-hash.h"
-int trace_hash_init(struct trace_hash *hash, int buckets)
+int __hidden trace_hash_init(struct trace_hash *hash, int buckets)
{
memset(hash, 0, sizeof(*hash));
@@ -27,12 +28,12 @@ int trace_hash_init(struct trace_hash *hash, int buckets)
return 0;
}
-void trace_hash_free(struct trace_hash *hash)
+void __hidden trace_hash_free(struct trace_hash *hash)
{
free(hash->buckets);
}
-int trace_hash_empty(struct trace_hash *hash)
+int __hidden trace_hash_empty(struct trace_hash *hash)
{
struct trace_hash_item **bucket;
@@ -42,7 +43,7 @@ int trace_hash_empty(struct trace_hash *hash)
return 1;
}
-int trace_hash_add(struct trace_hash *hash, struct trace_hash_item *item)
+int __hidden trace_hash_add(struct trace_hash *hash, struct trace_hash_item *item)
{
struct trace_hash_item *next;
int bucket = hash->power ? item->key & hash->power :
@@ -62,7 +63,7 @@ int trace_hash_add(struct trace_hash *hash, struct trace_hash_item *item)
return 1;
}
-struct trace_hash_item *
+ __hidden struct trace_hash_item *
trace_hash_find(struct trace_hash *hash, unsigned long long key,
trace_hash_func match, void *data)
{
@@ -44,7 +44,7 @@ static void default_perf_init_pe(struct perf_event_attr *pe)
* Returns 0 on success, or -1 in case of an error.
*
*/
-int trace_perf_init(struct trace_perf *perf, int pages, int cpu, int pid)
+int __hidden trace_perf_init(struct trace_perf *perf, int pages, int cpu, int pid)
{
if (!perf)
return -1;
@@ -66,7 +66,7 @@ int trace_perf_init(struct trace_perf *perf, int pages, int cpu, int pid)
* with trace_perf_open()
*
*/
-void trace_perf_close(struct trace_perf *perf)
+void __hidden trace_perf_close(struct trace_perf *perf)
{
if (perf->fd >= 0)
close(perf->fd);
@@ -85,7 +85,7 @@ void trace_perf_close(struct trace_perf *perf)
* Returns 0 on success, or -1 in case of an error. In case of success, the
* session must be closed with trace_perf_close()
*/
-int trace_perf_open(struct trace_perf *perf)
+int __hidden trace_perf_open(struct trace_perf *perf)
{
perf->fd = syscall(__NR_perf_event_open, &perf->pe, perf->pid, perf->cpu, -1, 0);
if (perf->fd < 0)
@@ -103,7 +103,7 @@ int tracecmd_tsync_proto_unregister(char *proto_name)
return -1;
}
-bool tsync_proto_is_supported(const char *proto_name)
+bool __hidden tsync_proto_is_supported(const char *proto_name)
{
if (tsync_proto_find(proto_name))
return true;
@@ -364,7 +364,7 @@ static int vsock_make(void)
return sd;
}
-int vsock_get_port(int sd, unsigned int *port)
+int __hidden vsock_get_port(int sd, unsigned int *port)
{
struct sockaddr_vm addr;
socklen_t addr_len = sizeof(addr);
@@ -277,7 +277,7 @@ static void add_plugin_file(struct tep_handle *pevent, const char *path,
*
* Use trace_util_free_plugin_files() to free the result.
*/
-char **trace_util_find_plugin_files(const char *suffix)
+__hidden char **trace_util_find_plugin_files(const char *suffix)
{
struct add_plugin_data pdata;
@@ -297,7 +297,7 @@ char **trace_util_find_plugin_files(const char *suffix)
*
* Frees the contents that were allocated by trace_util_find_plugin_files().
*/
-void trace_util_free_plugin_files(char **files)
+void __hidden trace_util_free_plugin_files(char **files)
{
int i;
@@ -332,7 +332,7 @@ static char *get_source_plugins_dir(void)
return strdup(path);
}
-struct tep_plugin_list*
+__hidden struct tep_plugin_list *
trace_load_plugins(struct tep_handle *tep, int flags)
{
struct tep_plugin_list *list;