xref: /titanic_44/usr/src/cmd/cron/cron.h (revision 4eaa471005973e11a6110b69fe990530b3b95a38)
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 2008 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 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
30 /*	  All Rights Reserved  	*/
31 
32 
33 #include <dirent.h>
34 #include <auth_attr.h>
35 #include <auth_list.h>
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 #define	FALSE		0
42 #define	TRUE		1
43 #define	MINUTE		60L
44 #define	HOUR		60L*60L
45 #define	DAY		24L*60L*60L
46 #define	NQUEUE		26		/* number of queues available */
47 #define	ATEVENT		0
48 #define	BATCHEVENT	1
49 #define	CRONEVENT	2
50 
51 #define	ADD		'a'
52 #define	DELETE		'd'
53 #define	AT		'a'
54 #define	CRON		'c'
55 
56 #define	QUE(x)		('a'+(x))
57 #define	RCODE(x)	(((x)>>8)&0377)
58 #define	TSTAT(x)	((x)&0377)
59 
60 #define	FLEN	15
61 #define	LLEN	9
62 
63 /*
64  * structure used for passing messages from the at and crontab commands to cron
65  */
66 struct	message {
67 	char	etype;
68 	char	action;
69 	char	fname[FLEN];
70 	char	logname[LLEN];
71 } msgbuf;
72 
73 /* anything below here can be changed */
74 
75 #define	CRONDIR		"/var/spool/cron/crontabs"
76 #define	ATDIR		"/var/spool/cron/atjobs"
77 #define	ACCTFILE	"/var/cron/log"
78 #define	CRONALLOW	"/etc/cron.d/cron.allow"
79 #define	CRONDENY	"/etc/cron.d/cron.deny"
80 #define	ATALLOW		"/etc/cron.d/at.allow"
81 #define	ATDENY		"/etc/cron.d/at.deny"
82 #define	PROTO		"/etc/cron.d/.proto"
83 #define	QUEDEFS		"/etc/cron.d/queuedefs"
84 #define	FIFO		"/etc/cron.d/FIFO"
85 #define	DEFFILE		"/etc/default/cron"
86 
87 #define	SHELL		"/usr/bin/sh"	/* shell to execute */
88 
89 #define	ENV_SHELL	"SHELL="
90 #define	ENV_TZ		"TZ="
91 #define	ENV_HOME	"HOME="
92 
93 #define	CTLINESIZE	1000	/* max chars in a crontab line */
94 #define	UNAMESIZE	20	/* max chars in a user name */
95 
96 int	allowed(char *, char *, char *);
97 int	days_in_mon(int, int);
98 char	*errmsg(int);
99 char	*getuser(uid_t);
100 void	cron_sendmsg(char, char *, char *, char);
101 time_t	 num(char **);
102 void	*xmalloc(size_t);
103 void	*xcalloc(size_t, size_t);
104 int	isvalid_shell(const char *shell);
105 int	isvalid_dir(const char *dir);
106 
107 #ifdef	__cplusplus
108 }
109 #endif
110 
111 #endif	/* _CRON_H */
112