Merge "Remove liblog/uio.c and <log/uio.h>"
This commit is contained in:
commit
e181bf5116
13 changed files with 14 additions and 107 deletions
|
@ -85,7 +85,6 @@ cc_library {
|
|||
ldflags: ["-Wl,--hash-style=both"],
|
||||
},
|
||||
windows: {
|
||||
srcs: ["uio.cpp"],
|
||||
enabled: true,
|
||||
},
|
||||
not_windows: {
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <time.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <log/uio.h>
|
||||
|
||||
#include "log_portability.h"
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <sys/types.h>
|
||||
|
||||
#include "log_portability.h"
|
||||
#include "uio.h"
|
||||
|
||||
struct iovec;
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include <log/log_safetynet.h>
|
||||
#include <log/log_system.h>
|
||||
#include <log/log_time.h>
|
||||
#include <log/uio.h> /* helper to define iovec for portability */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "config_write.h"
|
||||
#include "log_portability.h"
|
||||
#include "logger.h"
|
||||
#include "uio.h"
|
||||
|
||||
/* branchless on many architectures. */
|
||||
#define min(x, y) ((y) ^ (((x) ^ (y)) & -((x) < (y))))
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
|
||||
#include <cutils/list.h>
|
||||
#include <log/log.h>
|
||||
#include <log/uio.h>
|
||||
|
||||
#include "log_portability.h"
|
||||
#include "uio.h"
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "config_write.h"
|
||||
#include "log_portability.h"
|
||||
#include "logger.h"
|
||||
#include "uio.h"
|
||||
|
||||
#define LOG_BUF_SIZE 1024
|
||||
|
||||
|
@ -524,11 +525,8 @@ LIBLOG_ABI_PUBLIC void __android_log_assert(const char* cond, const char* tag, c
|
|||
|
||||
// Log assertion failures to stderr for the benefit of "adb shell" users
|
||||
// and gtests (http://b/23675822).
|
||||
struct iovec iov[2] = {
|
||||
{buf, strlen(buf)},
|
||||
{(char*)"\n", 1},
|
||||
};
|
||||
TEMP_FAILURE_RETRY(writev(2, iov, 2));
|
||||
TEMP_FAILURE_RETRY(write(2, buf, strlen(buf)));
|
||||
TEMP_FAILURE_RETRY(write(2, "\n", 1));
|
||||
|
||||
__android_log_write(ANDROID_LOG_FATAL, tag, buf);
|
||||
abort(); /* abort so we have a chance to debug the situation */
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "config_write.h"
|
||||
#include "log_portability.h"
|
||||
#include "logger.h"
|
||||
#include "uio.h"
|
||||
|
||||
static int pmsgOpen();
|
||||
static void pmsgClose();
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
#include <log/event_tag_map.h>
|
||||
#include <log/log.h>
|
||||
#include <log/logprint.h>
|
||||
#include <log/uio.h>
|
||||
|
||||
#include "log_portability.h"
|
||||
#include "logger.h"
|
||||
#include "uio.h"
|
||||
|
||||
static int stderrOpen();
|
||||
static void stderrClose();
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <sys/socket.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <unordered_set>
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <log/uio.h>
|
||||
|
||||
#include "log_portability.h"
|
||||
|
||||
LIBLOG_ABI_PUBLIC int readv(int fd, struct iovec* vecs, int count) {
|
||||
int total = 0;
|
||||
|
||||
for (; count > 0; count--, vecs++) {
|
||||
char* buf = static_cast<char*>(vecs->iov_base);
|
||||
int len = vecs->iov_len;
|
||||
|
||||
while (len > 0) {
|
||||
int ret = read(fd, buf, len);
|
||||
if (ret < 0) {
|
||||
if (total == 0) total = -1;
|
||||
goto Exit;
|
||||
}
|
||||
if (ret == 0) goto Exit;
|
||||
|
||||
total += ret;
|
||||
buf += ret;
|
||||
len -= ret;
|
||||
}
|
||||
}
|
||||
Exit:
|
||||
return total;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int writev(int fd, const struct iovec* vecs, int count) {
|
||||
int total = 0;
|
||||
|
||||
for (; count > 0; count--, vecs++) {
|
||||
const char* buf = static_cast<const char*>(vecs->iov_base);
|
||||
int len = vecs->iov_len;
|
||||
|
||||
while (len > 0) {
|
||||
int ret = write(fd, buf, len);
|
||||
if (ret < 0) {
|
||||
if (total == 0) total = -1;
|
||||
goto Exit;
|
||||
}
|
||||
if (ret == 0) goto Exit;
|
||||
|
||||
total += ret;
|
||||
buf += ret;
|
||||
len -= ret;
|
||||
}
|
||||
}
|
||||
Exit:
|
||||
return total;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2014 The Android Open Source Project
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -16,32 +16,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if !defined(_WIN32)
|
||||
|
||||
#include <sys/uio.h>
|
||||
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//
|
||||
// Implementation of sys/uio.h for Win32.
|
||||
//
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <stddef.h>
|
||||
|
||||
struct iovec {
|
||||
void* iov_base;
|
||||
size_t iov_len;
|
||||
};
|
||||
|
||||
extern int readv(int fd, struct iovec* vecs, int count);
|
||||
extern int writev(int fd, const struct iovec* vecs, int count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
#include <sys/uio.h>
|
||||
#endif
|
|
@ -31,6 +31,7 @@
|
|||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/un.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
|
Loading…
Reference in a new issue