xref: /onnv-gate/usr/src/cmd/cron/cron.h (revision 11115:bcfb2bb98fca)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
54774Sas145665  * Common Development and Distribution License (the "License").
64774Sas145665  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*11115SNobutomo.Nakano@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_CRON_H
270Sstevel@tonic-gate #define	_CRON_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
300Sstevel@tonic-gate /*	  All Rights Reserved  	*/
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #ifdef	__cplusplus
330Sstevel@tonic-gate extern "C" {
340Sstevel@tonic-gate #endif
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #define	FALSE		0
370Sstevel@tonic-gate #define	TRUE		1
380Sstevel@tonic-gate #define	MINUTE		60L
390Sstevel@tonic-gate #define	HOUR		60L*60L
400Sstevel@tonic-gate #define	DAY		24L*60L*60L
410Sstevel@tonic-gate #define	NQUEUE		26		/* number of queues available */
420Sstevel@tonic-gate #define	ATEVENT		0
430Sstevel@tonic-gate #define	BATCHEVENT	1
440Sstevel@tonic-gate #define	CRONEVENT	2
450Sstevel@tonic-gate 
460Sstevel@tonic-gate #define	ADD		'a'
470Sstevel@tonic-gate #define	DELETE		'd'
480Sstevel@tonic-gate #define	AT		'a'
490Sstevel@tonic-gate #define	CRON		'c'
50*11115SNobutomo.Nakano@Sun.COM #define	REFRESH		'r'
510Sstevel@tonic-gate 
520Sstevel@tonic-gate #define	QUE(x)		('a'+(x))
530Sstevel@tonic-gate #define	RCODE(x)	(((x)>>8)&0377)
540Sstevel@tonic-gate #define	TSTAT(x)	((x)&0377)
550Sstevel@tonic-gate 
560Sstevel@tonic-gate #define	FLEN	15
570Sstevel@tonic-gate #define	LLEN	9
580Sstevel@tonic-gate 
590Sstevel@tonic-gate /*
600Sstevel@tonic-gate  * structure used for passing messages from the at and crontab commands to cron
610Sstevel@tonic-gate  */
620Sstevel@tonic-gate struct	message {
630Sstevel@tonic-gate 	char	etype;
640Sstevel@tonic-gate 	char	action;
650Sstevel@tonic-gate 	char	fname[FLEN];
660Sstevel@tonic-gate 	char	logname[LLEN];
67*11115SNobutomo.Nakano@Sun.COM };
680Sstevel@tonic-gate 
690Sstevel@tonic-gate /* anything below here can be changed */
700Sstevel@tonic-gate 
710Sstevel@tonic-gate #define	CRONDIR		"/var/spool/cron/crontabs"
720Sstevel@tonic-gate #define	ATDIR		"/var/spool/cron/atjobs"
730Sstevel@tonic-gate #define	ACCTFILE	"/var/cron/log"
740Sstevel@tonic-gate #define	CRONALLOW	"/etc/cron.d/cron.allow"
750Sstevel@tonic-gate #define	CRONDENY	"/etc/cron.d/cron.deny"
760Sstevel@tonic-gate #define	ATALLOW		"/etc/cron.d/at.allow"
770Sstevel@tonic-gate #define	ATDENY		"/etc/cron.d/at.deny"
780Sstevel@tonic-gate #define	PROTO		"/etc/cron.d/.proto"
790Sstevel@tonic-gate #define	QUEDEFS		"/etc/cron.d/queuedefs"
800Sstevel@tonic-gate #define	FIFO		"/etc/cron.d/FIFO"
810Sstevel@tonic-gate #define	DEFFILE		"/etc/default/cron"
820Sstevel@tonic-gate 
830Sstevel@tonic-gate #define	SHELL		"/usr/bin/sh"	/* shell to execute */
840Sstevel@tonic-gate 
858439SChris.Gerhard@sun.com #define	ENV_SHELL	"SHELL="
868439SChris.Gerhard@sun.com #define	ENV_TZ		"TZ="
878439SChris.Gerhard@sun.com #define	ENV_HOME	"HOME="
888439SChris.Gerhard@sun.com 
890Sstevel@tonic-gate #define	CTLINESIZE	1000	/* max chars in a crontab line */
900Sstevel@tonic-gate #define	UNAMESIZE	20	/* max chars in a user name */
910Sstevel@tonic-gate 
92*11115SNobutomo.Nakano@Sun.COM extern int	allowed(char *, char *, char *);
93*11115SNobutomo.Nakano@Sun.COM extern int	days_in_mon(int, int);
94*11115SNobutomo.Nakano@Sun.COM extern char	*errmsg(int);
95*11115SNobutomo.Nakano@Sun.COM extern char	*getuser(uid_t);
96*11115SNobutomo.Nakano@Sun.COM extern void	cron_sendmsg(char, char *, char *, char);
97*11115SNobutomo.Nakano@Sun.COM extern time_t	 num(char **);
98*11115SNobutomo.Nakano@Sun.COM extern void	*xmalloc(size_t);
99*11115SNobutomo.Nakano@Sun.COM extern void	*xcalloc(size_t, size_t);
100*11115SNobutomo.Nakano@Sun.COM extern char	*xstrdup(const char *);
101*11115SNobutomo.Nakano@Sun.COM extern int	isvalid_shell(const char *shell);
102*11115SNobutomo.Nakano@Sun.COM extern int	isvalid_dir(const char *dir);
103*11115SNobutomo.Nakano@Sun.COM 
104*11115SNobutomo.Nakano@Sun.COM extern int	cron_admin(const char *);
1050Sstevel@tonic-gate 
1060Sstevel@tonic-gate #ifdef	__cplusplus
1070Sstevel@tonic-gate }
1080Sstevel@tonic-gate #endif
1090Sstevel@tonic-gate 
1100Sstevel@tonic-gate #endif	/* _CRON_H */
111