Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2880501
pid.rs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
644 B
Referenced Files
None
Subscribers
None
pid.rs
View Options
use
crate
::
helpers
;
use
global_placeholders
::
global
;
use
macros_rs
::
crashln
;
use
std
::
fs
;
pub
fn
exists
()
->
bool
{
fs
::
metadata
(
global
!
(
"pmc.pid"
)).
is_ok
()
}
pub
fn
running
(
pid
:
i32
)
->
bool
{
unsafe
{
libc
::
kill
(
pid
,
0
)
==
0
}
}
pub
fn
write
(
pid
:
u32
)
{
if
let
Err
(
err
)
=
fs
::
write
(
global
!
(
"pmc.pid"
),
pid
.
to_string
())
{
crashln
!
(
"{} Failed to write PID to file: {}"
,
*
helpers
::
FAIL
,
err
);
}
}
pub
fn
remove
()
{
log
::
debug
!
(
"Stale PID file detected. Removing the PID file."
);
if
let
Err
(
err
)
=
fs
::
remove_file
(
global
!
(
"pmc.pid"
))
{
crashln
!
(
"{} Failed to remove PID file: {}"
,
*
helpers
::
FAIL
,
err
);
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 19, 12:04 PM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
506520
Default Alt Text
pid.rs (644 B)
Attached To
Mode
rPMC Process Management Controller
Attached
Detach File
Event Timeline
Log In to Comment