]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
process-util: prefix FORK_PID_ONLY with _ to signify it is internal
authorMike Yuan <me@yhndnzj.com>
Mon, 10 Nov 2025 01:44:13 +0000 (02:44 +0100)
committerMike Yuan <me@yhndnzj.com>
Mon, 10 Nov 2025 01:44:57 +0000 (02:44 +0100)
src/basic/process-util.c
src/basic/process-util.h

index de9784381668521ef8028723e8d80bf553f71776..35d3f8bfd9e1d5c771475aeceee58033e5b43c13 100644 (file)
@@ -1662,7 +1662,7 @@ int pidref_safe_fork_full(
                 }
 
                 if (ret_pid) {
-                        if (FLAGS_SET(flags, FORK_PID_ONLY))
+                        if (FLAGS_SET(flags, _FORK_PID_ONLY))
                                 *ret_pid = PIDREF_MAKE_FROM_PID(pid);
                         else {
                                 r = pidref_set_pid(ret_pid, pid);
@@ -1840,7 +1840,7 @@ int pidref_safe_fork_full(
                 freeze();
 
         if (ret_pid) {
-                if (FLAGS_SET(flags, FORK_PID_ONLY))
+                if (FLAGS_SET(flags, _FORK_PID_ONLY))
                         *ret_pid = PIDREF_MAKE_FROM_PID(getpid_cached());
                 else {
                         r = pidref_set_self(ret_pid);
@@ -1869,7 +1869,7 @@ int safe_fork_full(
          * a pidref to the caller. */
         assert(!FLAGS_SET(flags, FORK_DETACH) || !ret_pid);
 
-        r = pidref_safe_fork_full(name, stdio_fds, except_fds, n_except_fds, flags|FORK_PID_ONLY, ret_pid ? &pidref : NULL);
+        r = pidref_safe_fork_full(name, stdio_fds, except_fds, n_except_fds, flags|_FORK_PID_ONLY, ret_pid ? &pidref : NULL);
         if (r < 0 || !ret_pid)
                 return r;
 
index b3ccb2dc35d4118c51f88dc17f03207fe55f2a13..66ec4fa031c7f2d3a391c8b1f1d04fc8f4e49263 100644 (file)
@@ -187,7 +187,8 @@ typedef enum ForkFlags {
         FORK_NEW_NETNS          = 1 << 20, /* Run child in its own network namespace                             ðŸ’£ DO NOT USE IN THREADED PROGRAMS! ðŸ’£ */
         FORK_NEW_PIDNS          = 1 << 21, /* Run child in its own PID namespace                                 ðŸ’£ DO NOT USE IN THREADED PROGRAMS! ðŸ’£ */
         FORK_FREEZE             = 1 << 22, /* Don't return in child, just call freeze() instead */
-        FORK_PID_ONLY           = 1 << 23, /* Don't open a pidfd referencing the child process */
+
+        _FORK_PID_ONLY          = 1 << 23, /* Don't open a pidfd referencing the child process */
 } ForkFlags;
 
 int pidref_safe_fork_full(