summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiyong Park2017-09-03 20:55:09 -0500
committerJayant Chowdhary2017-10-03 12:45:17 -0500
commit0d047642ebde013ed44ec6386a20debd87e54eb9 (patch)
treeabbf0ae6cc0aff160b767a6be631c8dddbf352f9 /liblog/include_vndk
parent9c568d0fc0e290529180e3fc0452f0ac489e5053 (diff)
downloadplatform-system-core-0d047642ebde013ed44ec6386a20debd87e54eb9.tar.gz
platform-system-core-0d047642ebde013ed44ec6386a20debd87e54eb9.tar.xz
platform-system-core-0d047642ebde013ed44ec6386a20debd87e54eb9.zip
Hide implementation details of log_time struct
In the future, the sizes of tv_sec and tv_nsec (or even the size of log_time struct itself) can change due to the 32-bit overflow expected to happen in the year 2138. In order to hide such implementation details to the clients of liblog, the two macros LOG_TIME_SEC and LOG_TIME_NSEC are introduced. Furthermore, vendors are provided with a simplified version of log_time.h without C++ APIs. In doing so, log_time.h no longer includes time.h. This breaks several modules that implicitly relied on the hidden dependency, which should be fixed. Bug: 37629934 Test: build with BOARD_VNDK_VERSION=current Merged-In: If213fc291395554fd8de5f5d1fb005ceaaa5ca57 Change-Id: I01b36078c1d8f3f44824be20ae769ba1465b6feb (cherry picked from commit 98c0d030c9a1ca7a94ebfe1d8db167973be504d3)
Diffstat (limited to 'liblog/include_vndk')
-rw-r--r--[l---------]liblog/include_vndk/log/log_time.h48
1 files changed, 47 insertions, 1 deletions
diff --git a/liblog/include_vndk/log/log_time.h b/liblog/include_vndk/log/log_time.h
index abfe439ae..5a09959a7 120000..100644
--- a/liblog/include_vndk/log/log_time.h
+++ b/liblog/include_vndk/log/log_time.h
@@ -1 +1,47 @@
1../../include/log/log_time.h \ No newline at end of file 1/*
2 * Copyright (C) 2005-2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _LIBS_LOG_LOG_TIME_H
18#define _LIBS_LOG_LOG_TIME_H
19
20#include <stdint.h>
21
22/* struct log_time is a wire-format variant of struct timespec */
23#ifndef NS_PER_SEC
24#define NS_PER_SEC 1000000000ULL
25#endif
26#ifndef US_PER_SEC
27#define US_PER_SEC 1000000ULL
28#endif
29#ifndef MS_PER_SEC
30#define MS_PER_SEC 1000ULL
31#endif
32
33#ifndef __struct_log_time_defined
34#define __struct_log_time_defined
35
36#define LOG_TIME_SEC(t) ((t)->tv_sec)
37/* next power of two after NS_PER_SEC */
38#define LOG_TIME_NSEC(t) ((t)->tv_nsec & (UINT32_MAX >> 2))
39
40typedef struct log_time {
41 uint32_t tv_sec;
42 uint32_t tv_nsec;
43} __attribute__((__packed__)) log_time;
44
45#endif
46
47#endif /* _LIBS_LOG_LOG_TIME_H */