Annotation of freem/src/jobtab.h, revision 1.3
1.1 snw 1: /*
1.3 ! snw 2: * $Id$
1.1 snw 3: * job table structures
4: *
5: *
1.2 snw 6: * Author: Serena Willis <snw@coherent-logic.com>
1.1 snw 7: * Copyright (C) 1998 MUG Deutschland
1.3 ! snw 8: * Copyright (C) 2021, 2025 Coherent Logic Development LLC
1.1 snw 9: *
10: *
11: * This file is part of FreeM.
12: *
13: * FreeM is free software: you can redistribute it and/or modify
14: * it under the terms of the GNU Affero Public License as published by
15: * the Free Software Foundation, either version 3 of the License, or
16: * (at your option) any later version.
17: *
18: * FreeM is distributed in the hope that it will be useful,
19: * but WITHOUT ANY WARRANTY; without even the implied warranty of
20: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21: * GNU Affero Public License for more details.
22: *
23: * You should have received a copy of the GNU Affero Public License
24: * along with FreeM. If not, see <https://www.gnu.org/licenses/>.
25: *
1.3 ! snw 26: * $Log$
! 27: *
! 28: * SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC
! 29: * SPDX-License-Identifier: AGPL-3.0-or-later
1.1 snw 30: **/
31:
32: #if !defined(_FREEM_JOBTAB_H)
33: # define _FREEM_JOBTAB_H
34:
35: #if defined(__APPLE__)
36: # include <sys/time.h>
37: #endif
38:
39: #define JFLG_DAEMON 1
40: #define JFLG_NEW 2
41: #define JFLG_ALIVE 4
42: #define JFLG_DEFUNCT 8
43: #define JFLG_REPLSENDER 16
44: #define JFLG_REPLRECEIVER 32
45: #define JFLG_FMADM 64
46:
47: #define JSTAT_IDLE 0
48: #define JSTAT_INTERPRETER 1
49: #define JSTAT_HOUSEKEEPING 2
50: #define JSTAT_DIRECTMODE 3
51: #define JSTAT_ERROR 4
52: #define JSTAT_SHUTDOWN 5
53:
54: #define JIPCFLG_PENDING 0
55: #define JIPCFLG_RECEIVED 1
56:
57: typedef struct ipc_slot_t {
58:
59: /* PID of sender */
60: pid_t sender_pid;
61:
62: /* IPC flags */
63: unsigned short flags;
64:
65: void *object;
66:
67: struct ipc_slot_t *next;
68:
69: } ipc_slot_t;
70:
71: typedef struct job_slot_t {
72:
73: /* process ID */
74: pid_t pid;
75:
76: /* job flags */
77: unsigned short flags;
78:
79: /* job status */
80: unsigned short status;
81:
82: /* first IPC slot */
83: ipc_slot_t *ipc_head;
84:
85: /* timestamp at start */
86: time_t start_time;
87:
88: /* stop requested */
89: pid_t stop_requested;
90:
91: /* last error value */
92: char last_ecode[20];
93:
94: /* next slot */
95: struct job_slot_t *next;
96:
97: } job_slot_t;
98:
99: extern short jobtab_get_sem(void);
100: extern void jobtab_release_sem(void);
101: extern void jobtab_init(void);
102: extern job_slot_t *job_init(short is_fmadm);
103: extern void job_remove(const pid_t pid);
104: extern void job_request_stop(const pid_t target_pid);
105: extern void job_set_ecode(const pid_t target_pid, const char *ecode);
106: extern pid_t job_stop_requested (const pid_t target_pid);
107: extern void job_request_all_stop(void);
108: extern void job_signal_all(const int sig);
109: extern int job_count(void);
110: extern job_slot_t *job_set_status(const pid_t target_pid, const unsigned short status);
111: extern void job_gc_mark(void);
112: extern void job_gc_sweep(void);
113: extern ipc_slot_t *job_send_ipc(const pid_t receiver_pid, const void *object);
114: extern job_slot_t *job_get(const pid_t target_pid);
115: extern void job_dump(void);
116:
117: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>