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