1 /* $OpenBSD: structs.h,v 1.9 2018/06/13 11:27:30 job Exp $ */ 2 3 /* 4 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") 5 * Copyright (c) 1997,2000 by Internet Software Consortium, Inc. 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 17 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 #include <sys/queue.h> 21 22 struct passwd; 23 24 typedef struct _entry { 25 SLIST_ENTRY(_entry) entries; 26 struct passwd *pwd; 27 char **envp; 28 char *cmd; 29 bitstr_t bit_decl(minute, MINUTE_COUNT); 30 bitstr_t bit_decl(hour, HOUR_COUNT); 31 bitstr_t bit_decl(dom, DOM_COUNT); 32 bitstr_t bit_decl(month, MONTH_COUNT); 33 bitstr_t bit_decl(dow, DOW_COUNT); 34 int flags; 35 #define MIN_STAR 0x01 36 #define HR_STAR 0x02 37 #define DOM_STAR 0x04 38 #define DOW_STAR 0x08 39 #define WHEN_REBOOT 0x10 40 #define DONT_LOG 0x20 41 #define MAIL_WHEN_ERR 0x40 42 } entry; 43 44 /* the crontab database will be a list of the 45 * following structure, one element per user 46 * plus one for the system. 47 * 48 * These are the crontabs. 49 */ 50 51 typedef struct _user { 52 TAILQ_ENTRY(_user) entries; /* links */ 53 char *name; 54 struct timespec mtime; /* last modtime of crontab */ 55 SLIST_HEAD(crontab_list, _entry) crontab; /* this person's crontab */ 56 } user; 57 58 typedef struct _cron_db { 59 TAILQ_HEAD(user_list, _user) users; 60 struct timespec mtime; /* last modtime on spooldir */ 61 } cron_db; 62 63 typedef struct _atjob { 64 TAILQ_ENTRY(_atjob) entries; /* links */ 65 uid_t uid; /* uid of the job */ 66 gid_t gid; /* gid of the job */ 67 int queue; /* name of the at queue */ 68 time_t run_time; /* time to run at job */ 69 } atjob; 70 71 typedef struct _at_db { 72 TAILQ_HEAD(atjob_list, _atjob) jobs; 73 struct timespec mtime; /* last modtime on spooldir */ 74 } at_db; 75