dpid.h(3)

πŸ“¦
version 0.14 Β· 4 versions
, in ubuntu noble, ubuntu questing

πŸ’– dpid.h πŸ’–

okay bestie, gather round, because this is dpid.h, page 3 of the Library Functions Manual section, and it's literally the whole API for messing with PID files. that's it, that's the vibe. it's giving "small header, big responsibility". πŸŽ€


🌸 NAME 🌸

dpid.h β€” Contains an API for manipulating PID files. πŸ’…


✨ SYNOPSIS ✨

#include <sys/types.h>

πŸ“ Macros πŸ“

  • #define DAEMON_PID_FILE_KILL_WAIT_AVAILABLE 1 β€” this variable is defined to 1 iff daemon_pid_file_kill_wait() is supported. so like, if you see this macro, the wait-y function exists. no cap.

πŸ¦‹ Typedefs πŸ¦‹

  • typedef const char *(* daemon_pid_file_proc_t) (void) β€” the prototype of a function for generating the name of a PID file. it's a function pointer type, and it returns a const char * and takes void, periodt.

πŸ’œ Functions πŸ’œ

  • const char * daemon_pid_file_proc_default (void) β€” a function for creating a pid file name from daemon_pid_file_ident.
  • int daemon_pid_file_create (void) β€” creates PID pid file for the current process.
  • int daemon_pid_file_remove (void) β€” removes the PID file of the current process.
  • pid_t daemon_pid_file_is_running (void) β€” returns the PID file of a running daemon, if available.
  • int daemon_pid_file_kill (int s) β€” kills a running daemon, if available.
  • int daemon_pid_file_kill_wait (int s, int m) β€” similar to daemon_pid_file_kill() but waits until the process died.

πŸŽ€ Variables πŸŽ€

  • const char * daemon_pid_file_ident β€” identification string for the PID file name, only used when daemon_pid_file_proc is set to daemon_pid_file_proc_default().
  • daemon_pid_file_proc_t daemon_pid_file_proc β€” a function pointer which is used to generate the name of the PID file to manipulate.

🌈 Detailed Description 🌈

Contains an API for manipulating PID files.

Definition in file dpid.h.

πŸ’€ Macro Definition Documentation πŸ’€

#define DAEMON_PID_FILE_KILL_WAIT_AVAILABLE 1

This variable is defined to 1 iff daemon_pid_file_kill_wait() is supported.

Since

0.3

See also

daemon_pid_file_kill_wait()

Definition at line 82 of file dpid.h.

🧚 Typedef Documentation 🧚

typedef const char *(* daemon_pid_file_proc_t) (void)

Prototype of a function for generating the name of a PID file.

Definition at line 37 of file dpid.h.

πŸ‘‘ Function Documentation πŸ‘‘

int daemon_pid_file_create (void)

Creates PID pid file for the current process. your fave is doing the whole "hi world, here's my PID" thing. πŸ’–

Returns

zero on success, nonzero on failure

Examples

testd.c.


pid_t daemon_pid_file_is_running (void)

Returns the PID file of a running daemon, if available. lowkey the vibe check of this whole header. 🫢

Returns

The PID or negative on failure

Examples

testd.c.


int daemon_pid_file_kill (int s)

Kills a running daemon, if available. not me being the one to deliver the bad news 😭

Parameters

  • s β€” The signal to send

Returns

zero on success, nonzero on failure


int daemon_pid_file_kill_wait (int s, int m)

Similar to daemon_pid_file_kill() but waits until the process died. This functions is new in libdaemon 0.3. The macro DAEMON_PID_FILE_KILL_WAIT_AVAILABLE is defined iff libdaemon supports this function.

Parameters

  • s β€” The signal to send
  • m β€” Seconds to wait at maximum

Returns

zero on success, nonzero on failure (timeout condition is considered a failure)

Since

0.3

See also

DAEMON_PID_FILE_KILL_WAIT_AVAILABLE

Examples

testd.c.


const char * daemon_pid_file_proc_default (void)

A function for creating a pid file name from daemon_pid_file_ident. the default girlie of the function-pointer world πŸ’…

Returns

The PID file path


int daemon_pid_file_remove (void)

Removes the PID file of the current process. clean up after yourself, bestie, it's the bare minimum. ✨

Returns

zero on success, nonzero on failure

Examples

testd.c.


🌟 Variable Documentation 🌟

const char* daemon_pid_file_ident [extern]

Identification string for the PID file name, only used when daemon_pid_file_proc is set to daemon_pid_file_proc_default(). Use daemon_ident_from_argv0() to generate an identification string from argv[0]

Examples

testd.c.


daemon_pid_file_proc_t daemon_pid_file_proc [extern]

A function pointer which is used to generate the name of the PID file to manipulate. Points to daemon_pid_file_proc_default() by default.


πŸŽ€ Author πŸŽ€

Generated automatically by Doxygen for libdaemon from the source code.


okay that's the whole page, you ate that, go write some PID files πŸ¦‹πŸ’–

and for the little sign-off tea: this whole thing is libdaemon, Version 0.14, page dpid.h(3). mwah, ily, bye 🫢✨

πŸ“¦ where this page comes from