Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
4de8d667
Commit
4de8d667
authored
Dec 29, 2018
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine code style using OsConstants
parent
f2297f92
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
core/src/main/java/com/github/shadowsocks/bg/Executable.kt
core/src/main/java/com/github/shadowsocks/bg/Executable.kt
+3
-2
core/src/main/java/com/github/shadowsocks/bg/GuardedProcessPool.kt
...main/java/com/github/shadowsocks/bg/GuardedProcessPool.kt
+3
-2
No files found.
core/src/main/java/com/github/shadowsocks/bg/Executable.kt
View file @
4de8d667
...
...
@@ -22,6 +22,7 @@ package com.github.shadowsocks.bg
import
android.system.ErrnoException
import
android.system.Os
import
android.system.OsConstants
import
android.text.TextUtils
import
android.util.Log
import
com.crashlytics.android.Crashlytics
...
...
@@ -46,9 +47,9 @@ object Executable {
continue
}.
split
(
Character
.
MIN_VALUE
,
limit
=
2
).
first
())
if
(
exe
.
parent
==
app
.
applicationInfo
.
nativeLibraryDir
&&
EXECUTABLES
.
contains
(
exe
.
name
))
try
{
Os
.
kill
(
process
.
name
.
toInt
(),
9
)
// SIGKILL
Os
.
kill
(
process
.
name
.
toInt
(),
OsConstants
.
SIGKILL
)
}
catch
(
e
:
ErrnoException
)
{
if
(
e
.
errno
!=
3
)
{
// ESRCH
if
(
e
.
errno
!=
OsConstants
.
ESRCH
)
{
e
.
printStackTrace
()
Crashlytics
.
log
(
Log
.
WARN
,
"kill"
,
"SIGKILL ${exe.absolutePath} (${process.name}) failed"
)
Crashlytics
.
logException
(
e
)
...
...
core/src/main/java/com/github/shadowsocks/bg/GuardedProcessPool.kt
View file @
4de8d667
...
...
@@ -24,6 +24,7 @@ import android.os.Build
import
android.os.SystemClock
import
android.system.ErrnoException
import
android.system.Os
import
android.system.OsConstants
import
android.util.Log
import
com.crashlytics.android.Crashlytics
import
com.github.shadowsocks.Core
...
...
@@ -98,9 +99,9 @@ class GuardedProcessPool {
if
(
Build
.
VERSION
.
SDK_INT
<
24
)
{
val
pid
=
pid
.
get
(
process
)
as
Int
try
{
Os
.
kill
(
pid
,
15
)
// SIGTERM
Os
.
kill
(
pid
,
OsConstants
.
SIGTERM
)
}
catch
(
e
:
ErrnoException
)
{
if
(
e
.
errno
!=
3
)
throw
e
// ESRCH
if
(
e
.
errno
!=
OsConstants
.
ESRCH
)
throw
e
}
val
mutex
=
exitValueMutex
.
get
(
process
)
as
Object
synchronized
(
mutex
)
{
...
...
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