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 /* 22d1419d5aSNobutomo 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 29*951bafeaSRichard Lowe #include <unistd.h> 30*951bafeaSRichard Lowe 317c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 327c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 357c478bd9Sstevel@tonic-gate extern "C" { 367c478bd9Sstevel@tonic-gate #endif 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #define FALSE 0 397c478bd9Sstevel@tonic-gate #define TRUE 1 407c478bd9Sstevel@tonic-gate #define MINUTE 60L 417c478bd9Sstevel@tonic-gate #define HOUR 60L*60L 427c478bd9Sstevel@tonic-gate #define DAY 24L*60L*60L 437c478bd9Sstevel@tonic-gate #define NQUEUE 26 /* number of queues available */ 447c478bd9Sstevel@tonic-gate #define ATEVENT 0 457c478bd9Sstevel@tonic-gate #define BATCHEVENT 1 467c478bd9Sstevel@tonic-gate #define CRONEVENT 2 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #define ADD 'a' 497c478bd9Sstevel@tonic-gate #define DELETE 'd' 507c478bd9Sstevel@tonic-gate #define AT 'a' 517c478bd9Sstevel@tonic-gate #define CRON 'c' 52d1419d5aSNobutomo Nakano #define REFRESH 'r' 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate #define QUE(x) ('a'+(x)) 557c478bd9Sstevel@tonic-gate #define RCODE(x) (((x)>>8)&0377) 567c478bd9Sstevel@tonic-gate #define TSTAT(x) ((x)&0377) 577c478bd9Sstevel@tonic-gate 58*951bafeaSRichard Lowe /* This constant must be at least sysconf(_SC_LOGIN_NAME_MAX) in size */ 59*951bafeaSRichard Lowe #define UNAMESIZE 32 /* max chars in a user name */ 60*951bafeaSRichard Lowe 61*951bafeaSRichard Lowe #define FLEN UNAMESIZE 62*951bafeaSRichard Lowe #define LLEN UNAMESIZE 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate /* 657c478bd9Sstevel@tonic-gate * structure used for passing messages from the at and crontab commands to cron 667c478bd9Sstevel@tonic-gate */ 677c478bd9Sstevel@tonic-gate struct message { 687c478bd9Sstevel@tonic-gate char etype; 697c478bd9Sstevel@tonic-gate char action; 707c478bd9Sstevel@tonic-gate char fname[FLEN]; 717c478bd9Sstevel@tonic-gate char logname[LLEN]; 72d1419d5aSNobutomo Nakano }; 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate #define CRONDIR "/var/spool/cron/crontabs" 757c478bd9Sstevel@tonic-gate #define ATDIR "/var/spool/cron/atjobs" 767c478bd9Sstevel@tonic-gate #define ACCTFILE "/var/cron/log" 777c478bd9Sstevel@tonic-gate #define CRONALLOW "/etc/cron.d/cron.allow" 787c478bd9Sstevel@tonic-gate #define CRONDENY "/etc/cron.d/cron.deny" 797c478bd9Sstevel@tonic-gate #define ATALLOW "/etc/cron.d/at.allow" 807c478bd9Sstevel@tonic-gate #define ATDENY "/etc/cron.d/at.deny" 817c478bd9Sstevel@tonic-gate #define PROTO "/etc/cron.d/.proto" 827c478bd9Sstevel@tonic-gate #define QUEDEFS "/etc/cron.d/queuedefs" 837c478bd9Sstevel@tonic-gate #define FIFO "/etc/cron.d/FIFO" 847c478bd9Sstevel@tonic-gate #define DEFFILE "/etc/default/cron" 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate #define SHELL "/usr/bin/sh" /* shell to execute */ 877c478bd9Sstevel@tonic-gate 885b08e637SChris Gerhard #define ENV_SHELL "SHELL=" 895b08e637SChris Gerhard #define ENV_TZ "TZ=" 905b08e637SChris Gerhard #define ENV_HOME "HOME=" 915b08e637SChris Gerhard 927c478bd9Sstevel@tonic-gate #define CTLINESIZE 1000 /* max chars in a crontab line */ 937c478bd9Sstevel@tonic-gate 94d1419d5aSNobutomo Nakano extern int allowed(char *, char *, char *); 95d1419d5aSNobutomo Nakano extern int days_in_mon(int, int); 96d1419d5aSNobutomo Nakano extern char *errmsg(int); 97d1419d5aSNobutomo Nakano extern char *getuser(uid_t); 98d1419d5aSNobutomo Nakano extern void cron_sendmsg(char, char *, char *, char); 99d1419d5aSNobutomo Nakano extern time_t num(char **); 100d1419d5aSNobutomo Nakano extern void *xmalloc(size_t); 101d1419d5aSNobutomo Nakano extern void *xcalloc(size_t, size_t); 102d1419d5aSNobutomo Nakano extern char *xstrdup(const char *); 103d1419d5aSNobutomo Nakano extern int isvalid_shell(const char *shell); 104d1419d5aSNobutomo Nakano extern int isvalid_dir(const char *dir); 105d1419d5aSNobutomo Nakano 106d1419d5aSNobutomo Nakano extern int cron_admin(const char *); 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1097c478bd9Sstevel@tonic-gate } 1107c478bd9Sstevel@tonic-gate #endif 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate #endif /* _CRON_H */ 113