Make timespec const for new timestamp function. am: 85724ad817
Original change: https://android-review.googlesource.com/c/platform/system/logging/+/3540340
Change-Id: I1d5abb19dc0813afbf235743c6c10fbbee3c3bb9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/liblog/include/android/log.h b/liblog/include/android/log.h
index 0fdc677..938786c 100644
--- a/liblog/include/android/log.h
+++ b/liblog/include/android/log.h
@@ -285,7 +285,7 @@
* Available since API level 37.
*/
void __android_log_logd_logger_with_timestamp(const struct __android_log_message* log_message,
- struct timespec* timestamp) __INTRODUCED_IN(37);
+ const struct timespec* timestamp) __INTRODUCED_IN(37);
/**
* Writes the log message to stderr. This is an {@link __android_logger_function} and can be provided to
diff --git a/liblog/logd_writer.cpp b/liblog/logd_writer.cpp
index 3d5cee6..e320413 100644
--- a/liblog/logd_writer.cpp
+++ b/liblog/logd_writer.cpp
@@ -116,7 +116,7 @@
LogdSocket::NonBlockingSocket().Close();
}
-int LogdWrite(log_id_t logId, struct timespec* ts, struct iovec* vec, size_t nr) {
+int LogdWrite(log_id_t logId, const struct timespec* ts, const struct iovec* vec, size_t nr) {
ssize_t ret;
static const unsigned headerLength = 1;
struct iovec newVec[nr + headerLength];
diff --git a/liblog/logd_writer.h b/liblog/logd_writer.h
index 41197b5..966f523 100644
--- a/liblog/logd_writer.h
+++ b/liblog/logd_writer.h
@@ -20,5 +20,5 @@
#include <android/log.h>
-int LogdWrite(log_id_t logId, struct timespec* ts, struct iovec* vec, size_t nr);
+int LogdWrite(log_id_t logId, const struct timespec* ts, const struct iovec* vec, size_t nr);
void LogdClose();
diff --git a/liblog/logger_write.cpp b/liblog/logger_write.cpp
index 010a069..99c455a 100644
--- a/liblog/logger_write.cpp
+++ b/liblog/logger_write.cpp
@@ -197,7 +197,7 @@
#ifdef __ANDROID__
static int write_to_log(log_id_t log_id, struct iovec* vec, size_t nr,
- struct timespec* timestamp = nullptr) {
+ const struct timespec* timestamp = nullptr) {
if (log_id == LOG_ID_KERNEL) {
return -EINVAL;
}
@@ -233,7 +233,7 @@
return ret;
}
#else
-static int write_to_log(log_id_t, struct iovec*, size_t, struct timespec* = nullptr) {
+static int write_to_log(log_id_t, struct iovec*, size_t, const struct timespec* = nullptr) {
// Non-Android text logs should go to __android_log_stderr_logger, not here.
// Non-Android binary logs are always dropped.
return 1;
@@ -339,7 +339,7 @@
}
void __android_log_logd_logger_with_timestamp(const struct __android_log_message* log_message,
- struct timespec* timestamp) {
+ const struct timespec* timestamp) {
if (log_to_file_if_overridden(log_message)) return;
int buffer_id = log_message->buffer_id == LOG_ID_DEFAULT ? LOG_ID_MAIN : log_message->buffer_id;
diff --git a/liblog/pmsg_writer.cpp b/liblog/pmsg_writer.cpp
index 1cf8f96..b075a58 100644
--- a/liblog/pmsg_writer.cpp
+++ b/liblog/pmsg_writer.cpp
@@ -67,7 +67,7 @@
pmsg_fd = 0;
}
-int PmsgWrite(log_id_t logId, struct timespec* ts, struct iovec* vec, size_t nr) {
+int PmsgWrite(log_id_t logId, const struct timespec* ts, const struct iovec* vec, size_t nr) {
static const unsigned headerLength = 2;
struct iovec newVec[nr + headerLength];
android_log_header_t header;
diff --git a/liblog/pmsg_writer.h b/liblog/pmsg_writer.h
index d5e1a1c..59443c3 100644
--- a/liblog/pmsg_writer.h
+++ b/liblog/pmsg_writer.h
@@ -20,5 +20,5 @@
#include <android/log.h>
-int PmsgWrite(log_id_t logId, struct timespec* ts, struct iovec* vec, size_t nr);
+int PmsgWrite(log_id_t logId, const struct timespec* ts, const struct iovec* vec, size_t nr);
void PmsgClose();