libcutils: klog inherit android_get_control_file("/dev/kmsg")
If the file descriptor is in the environment, use it. Test: compile Bug: 32450474 Change-Id: Id208b11b727a44dc861a141130a644d7d8009c5f
This commit is contained in:
parent
77fdb22cf6
commit
c377843258
1 changed files with 6 additions and 1 deletions
|
@ -24,6 +24,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cutils/files.h>
|
||||
#include <cutils/klog.h>
|
||||
|
||||
static int klog_level = KLOG_DEFAULT_LEVEL;
|
||||
|
@ -37,7 +38,11 @@ void klog_set_level(int level) {
|
|||
}
|
||||
|
||||
static int __open_klog(void) {
|
||||
return TEMP_FAILURE_RETRY(open("/dev/kmsg", O_WRONLY | O_CLOEXEC));
|
||||
static const char kmsg_device[] = "/dev/kmsg";
|
||||
|
||||
int ret = android_get_control_file(kmsg_device);
|
||||
if (ret >= 0) return ret;
|
||||
return TEMP_FAILURE_RETRY(open(kmsg_device, O_WRONLY | O_CLOEXEC));
|
||||
}
|
||||
|
||||
#define LOG_BUF_MAX 512
|
||||
|
|
Loading…
Reference in a new issue