Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
I3csstatus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jiří Kalvoda
I3csstatus
Commits
c7153d34
Commit
c7153d34
authored
2 years ago
by
Jiří Kalvoda
Browse files
Options
Downloads
Patches
Plain Diff
Create POSIX static class for missing functionality in .NET lib
parent
72543e91
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Program.cs
+11
-3
11 additions, 3 deletions
Program.cs
with
11 additions
and
3 deletions
Program.cs
+
11
−
3
View file @
c7153d34
...
@@ -20,13 +20,21 @@ using Process = System.Diagnostics.Process;
...
@@ -20,13 +20,21 @@ using Process = System.Diagnostics.Process;
using
Config
;
using
Config
;
namespace
i3csstatus
{
namespace
i3csstatus
{
static
class
P
rocesExtended
static
class
P
OSIX
{
{
[
DllImport
(
"libc"
,
SetLastError
=
true
)]
[
DllImport
(
"libc"
,
SetLastError
=
true
)]
public
static
extern
int
mkfifo
(
string
path
,
int
mode
);
[
DllImport
(
"libc"
,
CallingConvention
=
CallingConvention
.
Cdecl
,
SetLastError
=
true
)]
public
static
extern
int
kill
(
int
pid
,
int
sig
);
public
static
extern
int
kill
(
int
pid
,
int
sig
);
public
static
int
SIGUSR1
=
10
;
public
static
int
EEXIST
=
17
;
public
static
int
ERRNO
{
get
=>
Marshal
.
GetLastPInvokeError
();}
}
static
class
ProcesExtended
{
public
static
int
KillBySignal
(
this
Process
p
,
int
sig
)
public
static
int
KillBySignal
(
this
Process
p
,
int
sig
)
{
{
return
kill
(
p
.
Id
,
sig
);
return
POSIX
.
kill
(
p
.
Id
,
sig
);
}
}
}
}
static
class
JsonExtended
static
class
JsonExtended
...
@@ -247,7 +255,7 @@ text = ERR
...
@@ -247,7 +255,7 @@ text = ERR
if
(
lastGet_ms
+
cache_ms
>
t
)
if
(
lastGet_ms
+
cache_ms
>
t
)
return
;
return
;
lastGet_ms
=
t
;
lastGet_ms
=
t
;
process
.
KillBySignal
(
1
0
);
process
.
KillBySignal
(
POSIX
.
SIGUSR
1
);
string
line
=
process
.
StandardOutput
.
ReadLine
();
string
line
=
process
.
StandardOutput
.
ReadLine
();
if
(
line
==
null
)
if
(
line
==
null
)
{
{
...
...
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