Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AndroidSystemCore
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Werner Sembach
AndroidSystemCore
Commits
4aa84212
Commit
4aa84212
authored
Jun 13, 2018
by
Treehugger Robot
Committed by
Gerrit Code Review
Jun 13, 2018
Browse files
Options
Downloads
Plain Diff
Merge "init: Add warning in init first stage mount"
parents
b7761b26
fdafb3d0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
init/uevent_listener.cpp
+14
-0
14 additions, 0 deletions
init/uevent_listener.cpp
with
14 additions
and
0 deletions
init/uevent_listener.cpp
+
14
−
0
View file @
4aa84212
...
@@ -23,7 +23,11 @@
...
@@ -23,7 +23,11 @@
#include
<memory>
#include
<memory>
#include
<android-base/chrono_utils.h>
#include
<android-base/file.h>
#include
<android-base/logging.h>
#include
<android-base/logging.h>
#include
<android-base/scopeguard.h>
#include
<android-base/stringprintf.h>
#include
<cutils/uevent.h>
#include
<cutils/uevent.h>
namespace
android
{
namespace
android
{
...
@@ -130,9 +134,19 @@ ListenerAction UeventListener::RegenerateUeventsForDir(DIR* d,
...
@@ -130,9 +134,19 @@ ListenerAction UeventListener::RegenerateUeventsForDir(DIR* d,
int
fd
=
openat
(
dfd
,
"uevent"
,
O_WRONLY
);
int
fd
=
openat
(
dfd
,
"uevent"
,
O_WRONLY
);
if
(
fd
>=
0
)
{
if
(
fd
>=
0
)
{
android
::
base
::
Timer
t
;
write
(
fd
,
"add
\n
"
,
4
);
write
(
fd
,
"add
\n
"
,
4
);
const
std
::
string
fd_path
=
android
::
base
::
StringPrintf
(
"/proc/self/fd/%d"
,
fd
);
std
::
string
uevent_file_path
;
android
::
base
::
Readlink
(
fd_path
,
&
uevent_file_path
);
close
(
fd
);
close
(
fd
);
auto
guard
=
android
::
base
::
make_scope_guard
([
&
t
,
&
uevent_file_path
]()
{
if
(
t
.
duration
()
>
50ms
)
{
LOG
(
WARNING
)
<<
"ReadUevent took "
<<
t
<<
" on '"
<<
uevent_file_path
<<
"'"
;
}
});
Uevent
uevent
;
Uevent
uevent
;
while
(
ReadUevent
(
&
uevent
))
{
while
(
ReadUevent
(
&
uevent
))
{
if
(
callback
(
uevent
)
==
ListenerAction
::
kStop
)
return
ListenerAction
::
kStop
;
if
(
callback
(
uevent
)
==
ListenerAction
::
kStop
)
return
ListenerAction
::
kStop
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment