• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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 <stdatomic.h>
20 #include <sys/cdefs.h>
21 
22 #include <log/log.h>
23 
24 #include "uio.h"
25 
26 __BEGIN_DECLS
27 
28 struct logger_list {
29   atomic_int fd;
30   int mode;
31   unsigned int tail;
32   log_time start;
33   pid_t pid;
34   uint32_t log_mask;
35 };
36 
37 // Format for a 'logger' entry: uintptr_t where only the bottom 32 bits are used.
38 // bit 31: Set if this 'logger' is for logd.
39 // bit 30: Set if this 'logger' is for pmsg
40 // bits 0-2: the decimal value of the log buffer.
41 // Other bits are unused.
42 
43 #define LOGGER_LOGD (1U << 31)
44 #define LOGGER_PMSG (1U << 30)
45 #define LOGGER_LOG_ID_MASK ((1U << 3) - 1)
46 
android_logger_is_logd(struct logger * logger)47 inline bool android_logger_is_logd(struct logger* logger) {
48   return reinterpret_cast<uintptr_t>(logger) & LOGGER_LOGD;
49 }
50 
51 __END_DECLS
52