From 446d01c2c71c1b3cd1ab5000a61ff3abe2676cf6 Mon Sep 17 00:00:00 2001 From: Pavel Grafov Date: Thu, 8 Feb 2018 19:20:56 +0000 Subject: [PATCH] Make log_event_list.h available to vendor code. This is required in order to be able to log audit events from wpa_supplicant. Only log writing functions from log_event_list.h are made available. Test: manually Bug: 70886042 Change-Id: I097d4ad1de573662658678e6a9f1fc8f17820542 --- liblog/include_vndk/log/log_event_list.h | 73 ++++++++++++++++++++++++ liblog/liblog.map.txt | 11 ++++ 2 files changed, 84 insertions(+) create mode 100644 liblog/include_vndk/log/log_event_list.h diff --git a/liblog/include_vndk/log/log_event_list.h b/liblog/include_vndk/log/log_event_list.h new file mode 100644 index 000000000..cbd309174 --- /dev/null +++ b/liblog/include_vndk/log/log_event_list.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2005-2016 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. + */ + +/* Special log_event_list.h file for VNDK linking modules */ + +#ifndef _LIBS_LOG_EVENT_LIST_H +#define _LIBS_LOG_EVENT_LIST_H + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define __ANDROID_USE_LIBLOG_EVENT_INTERFACE 1 + +/* + * The opaque context used to manipulate lists of events. + */ +#ifndef __android_log_context_defined +#define __android_log_context_defined +typedef struct android_log_context_internal* android_log_context; +#endif + +/* + * Creates a context associated with an event tag to write elements to + * the list of events. + */ +android_log_context create_android_logger(uint32_t tag); + +/* All lists must be braced by a begin and end call */ +/* + * NB: If the first level braces are missing when specifying multiple + * elements, we will manufacturer a list to embrace it for your API + * convenience. For a single element, it will remain solitary. + */ +int android_log_write_list_begin(android_log_context ctx); +int android_log_write_list_end(android_log_context ctx); + +int android_log_write_int32(android_log_context ctx, int32_t value); +int android_log_write_int64(android_log_context ctx, int64_t value); +int android_log_write_string8(android_log_context ctx, const char* value); +int android_log_write_string8_len(android_log_context ctx, const char* value, + size_t maxlen); +int android_log_write_float32(android_log_context ctx, float value); + +/* Submit the composed list context to the specified logger id */ +/* NB: LOG_ID_EVENTS and LOG_ID_SECURITY only valid binary buffers */ +int android_log_write_list(android_log_context ctx, log_id_t id); + +/* Finished with reader or writer context */ +int android_log_destroy(android_log_context* ctx); + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBS_LOG_EVENT_LIST_H */ diff --git a/liblog/liblog.map.txt b/liblog/liblog.map.txt index 3c4c1f10a..9d21e56eb 100644 --- a/liblog/liblog.map.txt +++ b/liblog/liblog.map.txt @@ -35,6 +35,17 @@ LIBLOG_M { android_logger_get_statistics; # vndk __android_log_error_write; # vndk __android_log_is_loggable; + create_android_logger; #vndk + android_log_destroy; #vndk + android_log_write_list_begin; #vndk + android_log_write_list_end; #vndk + android_log_write_int32; #vndk + android_log_write_int64; #vndk + android_log_write_string8; #vndk + android_log_write_string8_len; #vndk + android_log_write_float32; #vndk + android_log_write_list; #vndk + }; LIBLOG_O {