projects
/
oweals
/
dinit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
922c87b
)
service: add various accessors.
author
Davin McCall
<davmac@davmac.org>
Tue, 19 Jun 2018 18:40:47 +0000
(19:40 +0100)
committer
Davin McCall
<davmac@davmac.org>
Tue, 19 Jun 2018 18:40:47 +0000
(19:40 +0100)
src/includes/baseproc-sys.h
patch
|
blob
|
history
src/includes/proc-service.h
patch
|
blob
|
history
src/includes/service.h
patch
|
blob
|
history
src/tests/test-includes/baseproc-sys.h
patch
|
blob
|
history
diff --git
a/src/includes/baseproc-sys.h
b/src/includes/baseproc-sys.h
index 6bd0de4f906d70ad0a4c782c808078285b6fd7a1..209ad2aeac7a893b8b4478ae6daff9dfc905385c 100644
(file)
--- a/
src/includes/baseproc-sys.h
+++ b/
src/includes/baseproc-sys.h
@@
-29,33
+29,38
@@
class exit_status
int status;
public:
int status;
public:
- exit_status() : status(0) { }
- explicit exit_status(int status_p) : status(status_p) { }
+ exit_status()
noexcept
: status(0) { }
+ explicit exit_status(int status_p)
noexcept
: status(status_p) { }
- bool did_exit()
+ bool did_exit()
noexcept
{
return WIFEXITED(status);
}
{
return WIFEXITED(status);
}
- bool did_exit_clean()
+ bool did_exit_clean()
noexcept
{
return status == 0;
}
{
return status == 0;
}
- bool was_signalled()
+ bool was_signalled()
noexcept
{
return WIFSIGNALED(status);
}
{
return WIFSIGNALED(status);
}
- int get_exit_status()
+ int get_exit_status()
noexcept
{
return WEXITSTATUS(status);
}
{
return WEXITSTATUS(status);
}
- int get_term_sig()
+ int get_term_sig()
noexcept
{
return WTERMSIG(status);
}
{
return WTERMSIG(status);
}
+
+ int as_int() noexcept
+ {
+ return status;
+ }
};
inline pid_t waitpid(pid_t p, exit_status *statusp, int flags)
};
inline pid_t waitpid(pid_t p, exit_status *statusp, int flags)
diff --git
a/src/includes/proc-service.h
b/src/includes/proc-service.h
index 5a0cab3cf9ad05c8689fc549d315b6d4190d5da0..962a558bbd52ed5b540f7356c56375ad35234630 100644
(file)
--- a/
src/includes/proc-service.h
+++ b/
src/includes/proc-service.h
@@
-204,6
+204,16
@@
class base_process_service : public service_record
{
return exec_arg_parts;
}
{
return exec_arg_parts;
}
+
+ pid_t get_pid() override
+ {
+ return pid;
+ }
+
+ int get_exit_status() override
+ {
+ return exit_status.as_int();
+ }
};
// Standard process service.
};
// Standard process service.
diff --git
a/src/includes/service.h
b/src/includes/service.h
index 1c9e9c5d65a3b9960a594665d4d35b556d62e478..3745c062680d30d186b5a1e1c823619b73194e28 100644
(file)
--- a/
src/includes/service.h
+++ b/
src/includes/service.h
@@
-639,6
+639,26
@@
class service_record
{
return stop_reason;
}
{
return stop_reason;
}
+
+ bool is_waiting_for_console()
+ {
+ return waiting_for_console;
+ }
+
+ bool has_console()
+ {
+ return have_console;
+ }
+
+ virtual pid_t get_pid()
+ {
+ return -1;
+ }
+
+ virtual int get_exit_status()
+ {
+ return 0;
+ }
};
inline auto extract_prop_queue(service_record *sr) -> decltype(sr->prop_queue_node) &
};
inline auto extract_prop_queue(service_record *sr) -> decltype(sr->prop_queue_node) &
diff --git
a/src/tests/test-includes/baseproc-sys.h
b/src/tests/test-includes/baseproc-sys.h
index 8a5674a1eac54f7308217f328ec81b2a6cb49f24..af1442c3b7bffec6009fe37bd26ea3d973c57ebb 100644
(file)
--- a/
src/tests/test-includes/baseproc-sys.h
+++ b/
src/tests/test-includes/baseproc-sys.h
@@
-80,6
+80,11
@@
class exit_status
{
return status;
}
{
return status;
}
+
+ int as_int()
+ {
+ return -1;
+ }
};
inline pid_t waitpid(pid_t p, exit_status *statusp, int flags)
};
inline pid_t waitpid(pid_t p, exit_status *statusp, int flags)