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