xref: /freebsd/usr.sbin/cron/cron/structs.h (revision fe590ffe40f49fe09d8275fbf29f0d46c5b99dc7)
1 /*
2  * $Id: structs.h,v 1.1 1998/08/14 00:31:24 vixie Exp $
3  */
4 
5 /*
6  * Copyright (c) 1997 by Internet Software Consortium
7  *
8  * Permission to use, copy, modify, and distribute this software for any
9  * purpose with or without fee is hereby granted, provided that the above
10  * copyright notice and this permission notice appear in all copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
13  * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
14  * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
15  * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
18  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
19  * SOFTWARE.
20  */
21 
22 typedef	struct _entry {
23 	struct _entry	*next;
24 	uid_t		uid;
25 	gid_t		gid;
26 #ifdef LOGIN_CAP
27 	char            *class;
28 #endif
29 	char		**envp;
30 	char		*cmd;
31 	union {
32 		struct {
33 			bitstr_t	bit_decl(second, SECOND_COUNT);
34 			bitstr_t	bit_decl(minute, MINUTE_COUNT);
35 			bitstr_t	bit_decl(hour,   HOUR_COUNT);
36 			bitstr_t	bit_decl(dom,    DOM_COUNT);
37 			bitstr_t	bit_decl(month,  MONTH_COUNT);
38 			bitstr_t	bit_decl(dow,    DOW_COUNT);
39 		};
40 		struct {
41 			time_t	lastexit;
42 			time_t	interval;
43 			pid_t	child;
44 		};
45 	};
46 	int		flags;
47 #define	DOM_STAR	0x01
48 #define	DOW_STAR	0x02
49 #define	WHEN_REBOOT	0x04
50 #define	DONT_LOG	0x08
51 #define	NOT_UNTIL	0x10
52 #define	SEC_RES		0x20
53 #define	INTERVAL	0x40
54 #define	RUN_AT		0x80
55 #define	MAIL_WHEN_ERR	0x100
56 	time_t	lastrun;
57 } entry;
58 
59 			/* the crontab database will be a list of the
60 			 * following structure, one element per user
61 			 * plus one for the system.
62 			 *
63 			 * These are the crontabs.
64 			 */
65 
66 typedef	struct _user {
67 	struct _user	*next, *prev;	/* links */
68 	char		*name;
69 	time_t		mtime;		/* last modtime of crontab */
70 	entry		*crontab;	/* this person's crontab */
71 } user;
72 
73 typedef	struct _cron_db {
74 	user		*head, *tail;	/* links */
75 	time_t		mtime;		/* last modtime on spooldir */
76 } cron_db;
77 				/* in the C tradition, we only create
78 				 * variables for the main program, just
79 				 * extern them elsewhere.
80 				 */
81 
82