blob: c9960ecae4bad12e4e1d8d7fd12cff30bd005928 [file] [log] [blame]
Marco Nelissena8d42982021-12-02 10:49:52 -08001/*
2 * Copyright (C) 2021 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#pragma once
18
19#include <private/android_logger.h>
20#include <sysutils/SocketListener.h>
21
22#include "LogBuffer.h"
23#include "LogStatistics.h"
24
25/* Use SocketListener because it provides reader thread management and
26 * works well with the Trusty log device due to using poll() and not
27 * relying on blocking reads, which the Trusty log device does not support.
28 */
29class TrustyLog : public SocketListener {
30 LogBuffer* logbuf;
Marco Nelissencaa341e2022-03-03 19:22:16 -080031 void LogMsg(const char* msg, size_t len);
Marco Nelissena8d42982021-12-02 10:49:52 -080032
33 public:
34 static void create(LogBuffer* buf);
35
36 protected:
37 virtual bool onDataAvailable(SocketClient* cli);
38 TrustyLog(LogBuffer* buf, int fdRead);
39};