liblog: audit declare LIBLOG_ABI_PUBLIC
(cherry pick from commit be1d3c21b57d3e67c6a9682f3b2f0838486a3ee8)
- replace <sys/cdefs.h> with local "log_cdefs.h" which
fortifies and expands definitions, adding LIBLOG_ABI_PUBLIC,
LIBLOG_HIDDEN, LIBLOG_ABI_PRIVATE and LIBLOG_WEAK.
- clearly tag each interface as LIBLOG_ABI_PUBLIC, LIBLOG_HIDDEN,
LIBLOG_ABI_PRIVATE, LIBLOG_WEAK or static depending on scope
- Add -fvisibility=hidden to ensure nothing else leaks
- some code standard adjustments
Bug: 27566046
Change-Id: Ic14033c4e6d833d973beb035ddc1c6134fb35a3f
diff --git a/liblog/uio.c b/liblog/uio.c
index f77cc49..d0184dc 100644
--- a/liblog/uio.c
+++ b/liblog/uio.c
@@ -16,17 +16,20 @@
#if defined(_WIN32)
-#include <log/uio.h>
#include <unistd.h>
-int readv( int fd, struct iovec* vecs, int count )
+#include <log/uio.h>
+
+#include "log_cdefs.h"
+
+LIBLOG_ABI_PUBLIC int readv(int fd, struct iovec *vecs, int count)
{
int total = 0;
for ( ; count > 0; count--, vecs++ ) {
char* buf = vecs->iov_base;
int len = vecs->iov_len;
-
+
while (len > 0) {
int ret = read( fd, buf, len );
if (ret < 0) {
@@ -46,14 +49,14 @@
return total;
}
-int writev( int fd, const struct iovec* vecs, int count )
+LIBLOG_ABI_PUBLIC int writev(int fd, const struct iovec *vecs, int count)
{
int total = 0;
for ( ; count > 0; count--, vecs++ ) {
const char* buf = vecs->iov_base;
int len = vecs->iov_len;
-
+
while (len > 0) {
int ret = write( fd, buf, len );
if (ret < 0) {
@@ -69,7 +72,7 @@
len -= ret;
}
}
-Exit:
+Exit:
return total;
}