Page MenuHomeFreeBSD

daemon(8): Add option to write pidfile w/o supervising it
Needs ReviewPublic

Authored by mail_fbsd2.e4m.org on Aug 17 2024, 9:20 AM.
Tags
None
Referenced Files
F106159070: D46313.diff
Thu, Dec 26, 8:58 AM
Unknown Object (File)
Nov 25 2024, 4:44 AM
Unknown Object (File)
Nov 24 2024, 6:53 AM
Unknown Object (File)
Nov 23 2024, 10:18 AM
Unknown Object (File)
Nov 21 2024, 3:37 PM
Unknown Object (File)
Nov 20 2024, 1:02 AM
Unknown Object (File)
Nov 16 2024, 7:27 PM
Unknown Object (File)
Nov 7 2024, 6:36 AM

Details

Reviewers
markj
otis
Summary

I needed to get the pid of a process started by daemon(8) but without using its supervising functionality of --child-pidfile (and therefore without the need of having daemon(8) hang around as another process). This comes handy when you want to switch the user but can't use su(1) (e.g. because the user has a negative listing in /etc/login.access).

This patch adds an option "-x file" to accomplish this (see also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280487)

It also fixes an internal comment regarding which options enable Supervision mode.

(Note: This is my first time using reviews.freebsd.org so please be lenient towards me :-))

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

When I think of it more closely, couldn't it be modified to do something like --no-supervise or --execute-only and use -p to get the command's pid file in child-pidfile? I'm just trying to avoid duplicate functionality.

Hmm, what will happen if one uses --no-supervise (with or even w/o -p) but has given other
options which need supervising? Should we silently ignore --no-supervise? Or spit out a
warning or even an error?
Not thinking about the code which has to honour --no-supervise when finished parsing all
options and then has to decide what to do...

So how shall we proceed with this? While I am not happy with the --no-supervise idea (because of
the confusion it might produce) I could make a patch which

  1. Adds --no-supervise (or whatever we want to call it)
  2. decides what to do with it when option processing has finished

In this case: How shall we call it? Do we want a short option for it?