Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
2e299b38
Commit
2e299b38
authored
Sep 20, 2021
by
vvb2060
Committed by
John Wu
Oct 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an old cgroup v2 path
https://android-review.googlesource.com/c/platform/system/core/+/1324649
parent
43d11d87
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
daemon.cpp
native/jni/core/daemon.cpp
+9
-7
No files found.
native/jni/core/daemon.cpp
View file @
2e299b38
...
...
@@ -257,19 +257,20 @@ done:
close
(
client
);
}
static
int
switch_cgroup
(
const
char
*
cgroup
,
int
pid
)
{
static
void
switch_cgroup
(
const
char
*
cgroup
,
int
pid
)
{
char
buf
[
32
];
snprintf
(
buf
,
sizeof
(
buf
),
"%s/cgroup.procs"
,
cgroup
);
int
fd
=
open
(
buf
,
O_WRONLY
|
O_APPEND
|
O_CLOEXEC
);
if
(
access
(
buf
,
F_OK
)
!=
0
)
return
;
int
fd
=
xopen
(
buf
,
O_WRONLY
|
O_APPEND
|
O_CLOEXEC
);
if
(
fd
==
-
1
)
return
-
1
;
return
;
snprintf
(
buf
,
sizeof
(
buf
),
"%d
\n
"
,
pid
);
if
(
xwrite
(
fd
,
buf
,
strlen
(
buf
))
==
-
1
)
{
close
(
fd
);
return
-
1
;
return
;
}
close
(
fd
);
return
0
;
}
static
void
daemon_entry
()
{
...
...
@@ -302,8 +303,9 @@ static void daemon_entry() {
// Escape from cgroup
int
pid
=
getpid
();
if
(
switch_cgroup
(
"/acct"
,
pid
)
&&
switch_cgroup
(
"/sys/fs/cgroup"
,
pid
))
LOGW
(
"Can't switch cgroup
\n
"
);
switch_cgroup
(
"/acct"
,
pid
);
switch_cgroup
(
"/dev/cg2_bpf"
,
pid
);
switch_cgroup
(
"/sys/fs/cgroup"
,
pid
);
// Get self stat
char
buf
[
64
];
...
...
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