Merge commit 'b1e7e97d3b60469b243b3b2e22c7d8cbd11c7c90'
[unleashed.git] / usr / src / cmd / cron / cron.h
bloba76016299cc8d4537b66ea19504d8aa5715ca7da
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _CRON_H
27 #define _CRON_H
29 #include <unistd.h>
31 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
32 /* All Rights Reserved */
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 #define FALSE 0
39 #define TRUE 1
40 #define MINUTE 60L
41 #define HOUR 60L*60L
42 #define DAY 24L*60L*60L
43 #define NQUEUE 26 /* number of queues available */
44 #define ATEVENT 0
45 #define BATCHEVENT 1
46 #define CRONEVENT 2
48 #define ADD 'a'
49 #define DELETE 'd'
50 #define AT 'a'
51 #define CRON 'c'
52 #define REFRESH 'r'
54 #define QUE(x) ('a'+(x))
55 #define RCODE(x) (((x)>>8)&0377)
56 #define TSTAT(x) ((x)&0377)
58 /* This constant must be at least sysconf(_SC_LOGIN_NAME_MAX) in size */
59 #define UNAMESIZE 32 /* max chars in a user name */
61 #define FLEN UNAMESIZE
62 #define LLEN UNAMESIZE
65 * structure used for passing messages from the at and crontab commands to cron
67 struct message {
68 char etype;
69 char action;
70 char fname[FLEN];
71 char logname[LLEN];
74 #define CRONDIR "/var/spool/cron/crontabs"
75 #define ATDIR "/var/spool/cron/atjobs"
76 #define ACCTFILE "/var/cron/log"
77 #define CRONALLOW "/etc/cron.d/cron.allow"
78 #define CRONDENY "/etc/cron.d/cron.deny"
79 #define ATALLOW "/etc/cron.d/at.allow"
80 #define ATDENY "/etc/cron.d/at.deny"
81 #define PROTO "/etc/cron.d/.proto"
82 #define QUEDEFS "/etc/cron.d/queuedefs"
83 #define FIFO "/etc/cron.d/FIFO"
84 #define DEFFILE "/etc/default/cron"
86 #define SHELL "/usr/bin/sh" /* shell to execute */
88 #define ENV_SHELL "SHELL="
89 #define ENV_TZ "TZ="
90 #define ENV_HOME "HOME="
92 #define CTLINESIZE 1000 /* max chars in a crontab line */
94 extern int allowed(char *, char *, char *);
95 extern int days_in_mon(int, int);
96 extern char *errmsg(int);
97 extern char *getuser(uid_t);
98 extern void cron_sendmsg(char, char *, char *, char);
99 extern time_t num(char **);
100 extern void *xmalloc(size_t);
101 extern void *xcalloc(size_t, size_t);
102 extern char *xstrdup(const char *);
103 extern int isvalid_shell(const char *shell);
104 extern int isvalid_dir(const char *dir);
106 extern int cron_admin(const char *);
108 #ifdef __cplusplus
110 #endif
112 #endif /* _CRON_H */