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