17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 53d63ea05Sas145665 * Common Development and Distribution License (the "License"). 63d63ea05Sas145665 * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*d1419d5aSNobutomo Nakano * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _CRON_H 277c478bd9Sstevel@tonic-gate #define _CRON_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 307c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #define FALSE 0 377c478bd9Sstevel@tonic-gate #define TRUE 1 387c478bd9Sstevel@tonic-gate #define MINUTE 60L 397c478bd9Sstevel@tonic-gate #define HOUR 60L*60L 407c478bd9Sstevel@tonic-gate #define DAY 24L*60L*60L 417c478bd9Sstevel@tonic-gate #define NQUEUE 26 /* number of queues available */ 427c478bd9Sstevel@tonic-gate #define ATEVENT 0 437c478bd9Sstevel@tonic-gate #define BATCHEVENT 1 447c478bd9Sstevel@tonic-gate #define CRONEVENT 2 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate #define ADD 'a' 477c478bd9Sstevel@tonic-gate #define DELETE 'd' 487c478bd9Sstevel@tonic-gate #define AT 'a' 497c478bd9Sstevel@tonic-gate #define CRON 'c' 50*d1419d5aSNobutomo Nakano #define REFRESH 'r' 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate #define QUE(x) ('a'+(x)) 537c478bd9Sstevel@tonic-gate #define RCODE(x) (((x)>>8)&0377) 547c478bd9Sstevel@tonic-gate #define TSTAT(x) ((x)&0377) 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate #define FLEN 15 577c478bd9Sstevel@tonic-gate #define LLEN 9 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate /* 607c478bd9Sstevel@tonic-gate * structure used for passing messages from the at and crontab commands to cron 617c478bd9Sstevel@tonic-gate */ 627c478bd9Sstevel@tonic-gate struct message { 637c478bd9Sstevel@tonic-gate char etype; 647c478bd9Sstevel@tonic-gate char action; 657c478bd9Sstevel@tonic-gate char fname[FLEN]; 667c478bd9Sstevel@tonic-gate char logname[LLEN]; 67*d1419d5aSNobutomo Nakano }; 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate /* anything below here can be changed */ 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate #define CRONDIR "/var/spool/cron/crontabs" 727c478bd9Sstevel@tonic-gate #define ATDIR "/var/spool/cron/atjobs" 737c478bd9Sstevel@tonic-gate #define ACCTFILE "/var/cron/log" 747c478bd9Sstevel@tonic-gate #define CRONALLOW "/etc/cron.d/cron.allow" 757c478bd9Sstevel@tonic-gate #define CRONDENY "/etc/cron.d/cron.deny" 767c478bd9Sstevel@tonic-gate #define ATALLOW "/etc/cron.d/at.allow" 777c478bd9Sstevel@tonic-gate #define ATDENY "/etc/cron.d/at.deny" 787c478bd9Sstevel@tonic-gate #define PROTO "/etc/cron.d/.proto" 797c478bd9Sstevel@tonic-gate #define QUEDEFS "/etc/cron.d/queuedefs" 807c478bd9Sstevel@tonic-gate #define FIFO "/etc/cron.d/FIFO" 817c478bd9Sstevel@tonic-gate #define DEFFILE "/etc/default/cron" 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate #define SHELL "/usr/bin/sh" /* shell to execute */ 847c478bd9Sstevel@tonic-gate 855b08e637SChris Gerhard #define ENV_SHELL "SHELL=" 865b08e637SChris Gerhard #define ENV_TZ "TZ=" 875b08e637SChris Gerhard #define ENV_HOME "HOME=" 885b08e637SChris Gerhard 897c478bd9Sstevel@tonic-gate #define CTLINESIZE 1000 /* max chars in a crontab line */ 907c478bd9Sstevel@tonic-gate #define UNAMESIZE 20 /* max chars in a user name */ 917c478bd9Sstevel@tonic-gate 92*d1419d5aSNobutomo Nakano extern int allowed(char *, char *, char *); 93*d1419d5aSNobutomo Nakano extern int days_in_mon(int, int); 94*d1419d5aSNobutomo Nakano extern char *errmsg(int); 95*d1419d5aSNobutomo Nakano extern char *getuser(uid_t); 96*d1419d5aSNobutomo Nakano extern void cron_sendmsg(char, char *, char *, char); 97*d1419d5aSNobutomo Nakano extern time_t num(char **); 98*d1419d5aSNobutomo Nakano extern void *xmalloc(size_t); 99*d1419d5aSNobutomo Nakano extern void *xcalloc(size_t, size_t); 100*d1419d5aSNobutomo Nakano extern char *xstrdup(const char *); 101*d1419d5aSNobutomo Nakano extern int isvalid_shell(const char *shell); 102*d1419d5aSNobutomo Nakano extern int isvalid_dir(const char *dir); 103*d1419d5aSNobutomo Nakano 104*d1419d5aSNobutomo Nakano extern int cron_admin(const char *); 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1077c478bd9Sstevel@tonic-gate } 1087c478bd9Sstevel@tonic-gate #endif 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate #endif /* _CRON_H */ 111