X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fincludes%2Fproc-service.h;h=2705811b69b2812f103d74f19123e8c8a9ee1094;hb=f8693a9e47be002588d31a29a47cfecc57ec56ad;hp=6a5831c20c979a2bdc3d801d61bc98b3bf6e3ddb;hpb=2747a6f366b9a9f5f1b0255ea3df32d36d88f8ab;p=oweals%2Fdinit.git diff --git a/src/includes/proc-service.h b/src/includes/proc-service.h index 6a5831c..2705811 100644 --- a/src/includes/proc-service.h +++ b/src/includes/proc-service.h @@ -60,6 +60,13 @@ class base_process_service : public service_record // ). 0 to disable. time_val start_timeout = {60, 0}; // default of 1 minute + pid_t pid = -1; // PID of the process. If state is STARTING or STOPPING, + // this is PID of the service script; otherwise it is the + // PID of the process itself (process service). + int exit_status = 0; // Exit status, if the process has exited (pid == -1). + int socket_fd = -1; // For socket-activation services, this is the file + // descriptor for the socket. + bool waiting_restart_timer : 1; bool stop_timer_armed : 1; bool reserved_child_watch : 1; @@ -103,12 +110,20 @@ class base_process_service : public service_record virtual bool interrupt_start() noexcept override; + void becoming_inactive() noexcept override; + // Kill with SIGKILL void kill_with_fire() noexcept; // Signal the process group of the service process void kill_pg(int signo) noexcept; + // stop immediately + void emergency_stop() noexcept; + + // Open the activation socket, return false on failure + bool open_socket() noexcept; + public: // Constructor for a base_process_service. Note that the various parameters not specified here must in // general be set separately (using the appropriate set_xxx function for each). @@ -153,6 +168,12 @@ class base_process_service : public service_record start_is_interruptible = value; } + // Set an additional signal (other than SIGTERM) to be used to terminate the process + void set_extra_termination_signal(int signo) noexcept + { + this->term_signal = signo; + } + // The restart/stop timer expired. void timer_expired() noexcept; };