2 * FCRON - periodic command scheduler
4 * Copyright 2000-2012 Thibault Godouet <fcron@free.fr>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * The GNU General Public License can also be found in the file
21 * `LICENSE' that comes with the fcron source distribution.
27 WARNING : this file should not be modified.
28 Compilation's options are in config.h
34 /* config.h must be included before every other includes
35 * (contains the compilation options) */
47 #include <get_context_list.h>
48 #include <selinux/flask.h>
49 #include <selinux/av_permissions.h>
82 #ifdef HAVE_SYS_FILE_H
87 #include <sys/types.h>
89 #ifdef HAVE_SYS_WAIT_H
97 #ifdef TIME_WITH_SYS_TIME
100 #include <sys/time.h>
103 #ifdef HAVE_TERMIOS_H
113 #elif HAVE_SYS_FCNTL_H
114 #include <sys/fcntl.h>
123 #ifdef HAVE_SYS_CRED_H
124 #include <sys/cred.h>
126 #ifdef HAVE_SYS_UCRED_H
127 #include <sys/ucred.h>
131 #include <libaudit.h>
138 #include "bitstring.h" /* bit arrays */
139 #include "option.h" /* manage fcrontab's options */
140 #include "env_list.h" /* manage fcrontab's environment variable lists */
141 #include "cl.h" /* Cron Line cl_t type and associated functions */
143 /* you should not change this (nor need to do it) */
147 /* options for local functions */
152 #define seteuid(arg) setresuid(-1,(arg),-1)
156 #define setegid(arg) setresgid(-1,(arg),-1)
159 #define Skip_blanks(PTR) \
160 while((*(PTR) == ' ') || (*(PTR) == '\t')) \
163 #define Overwrite(x) \
165 register char *__xx__; \
171 #define debug if(debug_opt) Debug
173 typedef struct cf_t {
174 struct cf_t *cf_next;
175 struct cl_t *cf_line_base;
176 char *cf_user; /* user-name */
177 env_list_t *cf_env_list; /* list of all parsed env var */
178 int cf_running; /* number of jobs running */
179 signed char cf_tzdiff; /* time diff between system and local hour */
181 security_context_t cf_user_context;
182 security_context_t cf_file_context;
187 typedef struct job_t {
189 struct job_t *j_next;
193 #if SIZEOF_TIME_T == SIZEOF_SHORT_INT
194 #define ATTR_SIZE_TIMET "h"
195 #define CAST_TIMET_PTR (short int *)
196 #elif SIZEOF_TIME_T == SIZEOF_INT
197 #define ATTR_SIZE_TIMET ""
198 #define CAST_TIMET_PTR (int *)
199 #elif SIZEOF_TIME_T == SIZEOF_LONG_INT
200 #define ATTR_SIZE_TIMET "l"
201 #define CAST_TIMET_PTR (long int *)
202 #elif SIZEOF_TIME_T == SIZEOF_LONG_LONG_INT
203 #define ATTR_SIZE_TIMET "ll"
204 #define CAST_TIMET_PTR (long long int *)
206 #error "SIZEOF_TIME_T does not correspond with a known format."
209 #if SIZEOF_PID_T == SIZEOF_SHORT_INT
210 #define ATTR_SIZE_PIDT "h"
211 #define CAST_PIDT_PTR (short int *)
212 #elif SIZEOF_PID_T == SIZEOF_INT
213 #define ATTR_SIZE_PIDT ""
214 #define CAST_PIDT_PTR (int *)
215 #elif SIZEOF_PID_T == SIZEOF_LONG_INT
216 #define ATTR_SIZE_PIDT "l"
217 #define CAST_PIDT_PTR (long int *)
218 #elif SIZEOF_PID_T == SIZEOF_LONG_LONG_INT
219 #define ATTR_SIZE_PIDT "ll"
220 #define CAST_PIDT_PTR (long long int *)
222 #error "SIZEOF_PID_T does not correspond with a known format."
226 /* local header files : we include here the headers which may use some types defined
229 /* constants for fcrontabs needed to load and save the fcrontabs to disk */
233 /* functions used by fcrontab, fcrondyn, and fcron */
237 #endif /* __GLOBAL_H__ */