blob: 117bc59e50fa5c821e5c805b9ab69032acf88fbf [file] [log] [blame]
Mark Salyzyn5ac5c6b2015-08-28 08:02:59 -07001/*
2 * Copyright (C) 2012-2015 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 _LOGD_LOG_UTILS_H__
18#define _LOGD_LOG_UTILS_H__
19
20#include <sys/types.h>
21
22#include <log/log.h>
23
24// Hijack this header as a common include file used by most all sources
25// to report some utilities defined here and there.
26
27namespace android {
28
29// Furnished in main.cpp. Caller must own and free returned value
30char *uidToName(uid_t uid);
31
32// Furnished in LogStatistics.cpp. Caller must own and free returned value
33char *pidToName(pid_t pid);
34char *tidToName(pid_t tid);
35
36// Furnished in main.cpp. Thread safe.
37const char *tagToName(uint32_t tag);
38
39}
40
41static inline bool worstUidEnabledForLogid(log_id_t id) {
42 return (id != LOG_ID_CRASH) && (id != LOG_ID_KERNEL) && (id != LOG_ID_EVENTS);
43}
44
45#endif // _LOGD_LOG_UTILS_H__