summaryrefslogtreecommitdiffstats
path: root/src/basic
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/process-util.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/basic/process-util.h b/src/basic/process-util.h
index 59732a8676..2efe89e135 100644
--- a/src/basic/process-util.h
+++ b/src/basic/process-util.h
@@ -148,10 +148,21 @@ static inline bool sched_priority_is_valid(int i) {
return i >= 0 && i <= sched_get_priority_max(SCHED_RR);
}
+#define PID_AUTOMATIC ((pid_t) INT_MIN) /* special value indicating "acquire pid from connection peer */
+#define PID_INVALID ((pid_t) 0) /* default value for "invalid pid" */
+
static inline bool pid_is_valid(pid_t p) {
return p > 0;
}
+static inline bool pid_is_automatic(pid_t p) {
+ return p == PID_AUTOMATIC;
+}
+
+static inline bool pid_is_valid_or_automatic(pid_t p) {
+ return pid_is_valid(p) || pid_is_automatic(p);
+}
+
pid_t getpid_cached(void);
void reset_cached_pid(void);