From 516d12dae36538257fe57e8f7cf7e867068c33d1 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Thu, 25 Feb 2021 10:23:54 -0500 Subject: [PATCH] Hide private share.h symbols The major SONAME bump to '1' gives us the opportunity to hide private symbols that should never have been visible. While we're at it, namespace the symbols that were previously part of the ABI. Change-Id: I75c4a65969982f2097365441f92de0d3082c8172 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- include/Makefile.am | 2 +- include/ust-share.h | 10 +++++----- include/usterr-signal-safe.h | 2 +- liblttng-ust-dl/Makefile.am | 1 + liblttng-ust/event-notifier-notification.c | 2 +- snprintf/patient_write.c | 6 +++--- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/Makefile.am b/include/Makefile.am index cafcb7c7..9e03290c 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -49,7 +49,7 @@ nobase_nodist_include_HEADERS = \ ### Global private headers ### ### ### -# note: usterr-signal-safe.h, core.h and share.h need namespace cleanup. +# note: usterr-signal-safe.h need namespace cleanup. noinst_HEADERS = \ usterr-signal-safe.h \ diff --git a/include/ust-share.h b/include/ust-share.h index cabb2640..b9490e4d 100644 --- a/include/ust-share.h +++ b/include/ust-share.h @@ -12,11 +12,11 @@ #include "ust-helper.h" -/* Should be hidden but would break the ABI */ -ssize_t patient_write(int fd, const void *buf, size_t count); LTTNG_HIDDEN -ssize_t patient_writev(int fd, struct iovec *iov, int iovcnt); -/* Should be hidden but would break the ABI */ -ssize_t patient_send(int fd, const void *buf, size_t count, int flags); +ssize_t ust_patient_write(int fd, const void *buf, size_t count); +LTTNG_HIDDEN +ssize_t ust_patient_writev(int fd, struct iovec *iov, int iovcnt); +LTTNG_HIDDEN +ssize_t ust_patient_send(int fd, const void *buf, size_t count, int flags); #endif /* _LTTNG_SHARE_H */ diff --git a/include/usterr-signal-safe.h b/include/usterr-signal-safe.h index c3050a42..9ce6ad83 100644 --- a/include/usterr-signal-safe.h +++ b/include/usterr-signal-safe.h @@ -66,7 +66,7 @@ do { \ ____saved_errno = errno; /* signal-safety */ \ ust_safe_snprintf(____buf, sizeof(____buf), fmt, ## args); \ ____buf[sizeof(____buf) - 1] = 0; \ - patient_write(STDERR_FILENO, ____buf, strlen(____buf)); \ + ust_patient_write(STDERR_FILENO, ____buf, strlen(____buf)); \ errno = ____saved_errno; /* signal-safety */ \ fflush(stderr); \ } \ diff --git a/liblttng-ust-dl/Makefile.am b/liblttng-ust-dl/Makefile.am index b92c5092..ef670220 100644 --- a/liblttng-ust-dl/Makefile.am +++ b/liblttng-ust-dl/Makefile.am @@ -10,6 +10,7 @@ liblttng_ust_dl_la_SOURCES = \ liblttng_ust_dl_la_LIBADD = \ $(top_builddir)/liblttng-ust/liblttng-ust.la \ + $(top_builddir)/snprintf/libustsnprintf.la \ $(DL_LIBS) liblttng_ust_dl_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-dl $(AM_CFLAGS) diff --git a/liblttng-ust/event-notifier-notification.c b/liblttng-ust/event-notifier-notification.c index 942f6136..96b91a9a 100644 --- a/liblttng-ust/event-notifier-notification.c +++ b/liblttng-ust/event-notifier-notification.c @@ -341,7 +341,7 @@ void notification_send(struct lttng_event_notifier_notification *notif, ust_notif.capture_buf_size = content_len; /* Send all the buffers. */ - ret = patient_writev(notif->notification_fd, iov, iovec_count); + ret = ust_patient_writev(notif->notification_fd, iov, iovec_count); if (ret == -1) { if (errno == EAGAIN) { record_error(event_notifier); diff --git a/snprintf/patient_write.c b/snprintf/patient_write.c index 2ec00cd9..5a7fed43 100644 --- a/snprintf/patient_write.c +++ b/snprintf/patient_write.c @@ -25,7 +25,7 @@ * This write is patient because it restarts if it was incomplete. */ -ssize_t patient_write(int fd, const void *buf, size_t count) +ssize_t ust_patient_write(int fd, const void *buf, size_t count) { const char *bufc = (const char *) buf; int result; @@ -53,7 +53,7 @@ ssize_t patient_write(int fd, const void *buf, size_t count) * The `struct iovec *iov` is not `const` because we modify it to support * partial writes. */ -ssize_t patient_writev(int fd, struct iovec *iov, int iovcnt) +ssize_t ust_patient_writev(int fd, struct iovec *iov, int iovcnt) { ssize_t written, total_written = 0; int curr_element_idx = 0; @@ -95,7 +95,7 @@ ssize_t patient_writev(int fd, struct iovec *iov, int iovcnt) return total_written; } -ssize_t patient_send(int fd, const void *buf, size_t count, int flags) +ssize_t ust_patient_send(int fd, const void *buf, size_t count, int flags) { const char *bufc = (const char *) buf; int result; -- 2.34.1