xref: /openbsd/usr.sbin/cron/structs.h (revision 3d8817e4)
1 /*	$OpenBSD: structs.h,v 1.5 2004/06/17 22:11:55 millert 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 typedef	struct _entry {
21 	struct _entry	*next;
22 	struct passwd	*pwd;
23 	char		**envp;
24 	char		*cmd;
25 	bitstr_t	bit_decl(minute, MINUTE_COUNT);
26 	bitstr_t	bit_decl(hour,   HOUR_COUNT);
27 	bitstr_t	bit_decl(dom,    DOM_COUNT);
28 	bitstr_t	bit_decl(month,  MONTH_COUNT);
29 	bitstr_t	bit_decl(dow,    DOW_COUNT);
30 	int		flags;
31 #define	MIN_STAR	0x01
32 #define	HR_STAR		0x02
33 #define	DOM_STAR	0x04
34 #define	DOW_STAR	0x08
35 #define	WHEN_REBOOT	0x10
36 #define	DONT_LOG	0x20
37 } entry;
38 
39 			/* the crontab database will be a list of the
40 			 * following structure, one element per user
41 			 * plus one for the system.
42 			 *
43 			 * These are the crontabs.
44 			 */
45 
46 typedef	struct _user {
47 	struct _user	*next, *prev;	/* links */
48 	char		*name;
49 	time_t		mtime;		/* last modtime of crontab */
50 	entry		*crontab;	/* this person's crontab */
51 } user;
52 
53 typedef	struct _cron_db {
54 	user		*head, *tail;	/* links */
55 	time_t		mtime;		/* last modtime on spooldir */
56 } cron_db;
57 
58 typedef struct _atjob {
59 	struct _atjob	*next, *prev;	/* links */
60 	uid_t		uid;		/* uid of the job */
61 	gid_t		gid;		/* gid of the job */
62 	int		queue;		/* name of the at queue */
63 	time_t		run_time;	/* time to run at job */
64 } atjob;
65 
66 typedef struct _at_db {
67 	atjob		*head, *tail;	/* links */
68 	time_t		mtime;		/* last modtime on spooldir */
69 } at_db;
70 				/* in the C tradition, we only create
71 				 * variables for the main program, just
72 				 * extern them elsewhere.
73 				 */
74