Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
system_core
Commits
f894b96a
Commit
f894b96a
authored
8 years ago
by
Tim Murray
Browse files
Options
Download
Email Patches
Plain Diff
Restrict pmsg use to eng builds.
bug 30375418 Change-Id: I50c6c74a2373593495cf6a3b94b31f9a865c950c
parent
0c28557e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
liblog/pmsg_writer.c
liblog/pmsg_writer.c
+21
-2
No files found.
liblog/pmsg_writer.c
View file @
f894b96a
...
...
@@ -31,6 +31,8 @@
#include <private/android_filesystem_config.h>
#include <private/android_logger.h>
#include <sys/system_properties.h>
#include "config_write.h"
#include "log_portability.h"
#include "logger.h"
...
...
@@ -51,8 +53,25 @@ LIBLOG_HIDDEN struct android_log_transport_write pmsgLoggerWrite = {
.
write
=
pmsgWrite
,
};
static
bool
pmsgShouldUse
=
false
;
// Only use pmsg on eng builds
static
bool
pmsgIsEng
()
{
char
buf
[
PROP_VALUE_MAX
];
if
(
__system_property_get
(
"ro.build.type"
,
buf
)
==
0
)
{
return
false
;
}
if
(
!
strncmp
(
buf
,
"eng"
,
sizeof
(
"eng"
)))
{
return
true
;
}
return
false
;
}
static
int
pmsgOpen
()
{
pmsgShouldUse
=
pmsgIsEng
();
if
(
pmsgLoggerWrite
.
context
.
fd
<
0
)
{
pmsgLoggerWrite
.
context
.
fd
=
TEMP_FAILURE_RETRY
(
open
(
"/dev/pmsg0"
,
O_WRONLY
|
O_CLOEXEC
));
}
...
...
@@ -75,7 +94,7 @@ static int pmsgAvailable(log_id_t logId)
}
if
((
logId
!=
LOG_ID_SECURITY
)
&&
(
logId
!=
LOG_ID_EVENTS
)
&&
!
__android_log_is_debuggable
())
{
(
!
pmsgShouldUse
||
!
__android_log_is_debuggable
())
)
{
return
-
EINVAL
;
}
if
(
pmsgLoggerWrite
.
context
.
fd
<
0
)
{
...
...
@@ -105,7 +124,7 @@ static int pmsgWrite(log_id_t logId, struct timespec *ts,
size_t
i
,
payloadSize
;
ssize_t
ret
;
if
((
logId
==
LOG_ID_EVENTS
)
&&
!
__android_log_is_debuggable
())
{
if
((
logId
==
LOG_ID_EVENTS
)
&&
(
!
pmsgShouldUse
||
!
__android_log_is_debuggable
())
)
{
if
(
vec
[
0
].
iov_len
<
4
)
{
return
-
EINVAL
;
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment