xref: /illumos-gate/usr/src/cmd/cron/cron.h (revision 0cd13cbfb4270b840b4bd22ec5f673b2b6a2c02b)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_CRON_H
27 #define	_CRON_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
32 /*	  All Rights Reserved  	*/
33 
34 
35 #include <dirent.h>
36 #include <auth_attr.h>
37 #include <auth_list.h>
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 #define	FALSE		0
44 #define	TRUE		1
45 #define	MINUTE		60L
46 #define	HOUR		60L*60L
47 #define	DAY		24L*60L*60L
48 #define	NQUEUE		26		/* number of queues available */
49 #define	ATEVENT		0
50 #define	BATCHEVENT	1
51 #define	CRONEVENT	2
52 
53 #define	ADD		'a'
54 #define	DELETE		'd'
55 #define	AT		'a'
56 #define	CRON		'c'
57 
58 #define	QUE(x)		('a'+(x))
59 #define	RCODE(x)	(((x)>>8)&0377)
60 #define	TSTAT(x)	((x)&0377)
61 
62 #define	FLEN	15
63 #define	LLEN	9
64 
65 /*
66  * structure used for passing messages from the at and crontab commands to cron
67  */
68 struct	message {
69 	char	etype;
70 	char	action;
71 	char	fname[FLEN];
72 	char	logname[LLEN];
73 } msgbuf;
74 
75 /* anything below here can be changed */
76 
77 #define	CRONDIR		"/var/spool/cron/crontabs"
78 #define	ATDIR		"/var/spool/cron/atjobs"
79 #define	ACCTFILE	"/var/cron/log"
80 #define	CRONALLOW	"/etc/cron.d/cron.allow"
81 #define	CRONDENY	"/etc/cron.d/cron.deny"
82 #define	ATALLOW		"/etc/cron.d/at.allow"
83 #define	ATDENY		"/etc/cron.d/at.deny"
84 #define	PROTO		"/etc/cron.d/.proto"
85 #define	QUEDEFS		"/etc/cron.d/queuedefs"
86 #define	FIFO		"/etc/cron.d/FIFO"
87 #define	DEFFILE		"/etc/default/cron"
88 
89 #define	SHELL		"/usr/bin/sh"	/* shell to execute */
90 
91 #define	CTLINESIZE	1000	/* max chars in a crontab line */
92 #define	UNAMESIZE	20	/* max chars in a user name */
93 
94 int	allowed(char *, char *, char *);
95 int	days_in_mon(int, int);
96 char	*errmsg(int);
97 char	*getuser(uid_t);
98 void	cron_sendmsg(char, char *, char *, char);
99 time_t	 num(char **);
100 void	*xmalloc(size_t);
101 void	*xcalloc(size_t, size_t);
102 int	ascandir(char *, struct dirent *(*[]), int (*)(), int (*)());
103 
104 #ifdef	__cplusplus
105 }
106 #endif
107 
108 #endif	/* _CRON_H */
109