xref: /netbsd/external/bsd/cron/dist/funcs.h (revision bd4a2c22)
1 /*	$NetBSD: funcs.h,v 1.7 2020/04/18 19:32:19 christos Exp $	*/
2 
3 /*
4  * Id: funcs.h,v 1.9 2004/01/23 18:56:42 vixie Exp
5  */
6 
7 /*
8  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
9  * Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
10  *
11  * Permission to use, copy, modify, and distribute this software for any
12  * purpose with or without fee is hereby granted, provided that the above
13  * copyright notice and this permission notice appear in all copies.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
16  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
17  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
18  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22  */
23 
24 /* Notes:
25  *	This file has to be included by cron.h after data structure defs.
26  *	We should reorg this into sections by module.
27  */
28 
29 void		set_cron_uid(void),
30 		set_cron_cwd(void),
31 		load_database(cron_db *),
32 		open_logfile(void),
33 		sigpipe_func(void),
34 		job_add(entry *, user *, time_t),
35 		job_remove(entry *, user *),
36 		job_exit(pid_t),
37 		link_user(cron_db *, user *),
38 		unlink_user(cron_db *, user *),
39 		free_user(user *),
40 		env_free(char **),
41 		unget_char(int, FILE *),
42 		free_entry(entry *),
43 		acquire_daemonlock(int),
44 		skip_comments(FILE *),
45 		log_it(const char *, int, const char *, const char *),
46 		log_close(void);
47 
48 
49 void
50 		log_itx(const char *, int, const char *, const char *, ...)
51 		    __printflike(4, 5);
52 
53 pid_t		do_command(entry *, user *);
54 
55 int		job_runqueue(void),
56 		set_debug_flags(const char *),
57 		get_char(FILE *),
58 		get_string(char *, int, FILE *, const char *),
59 		load_env(char *, FILE *),
60 		cron_pclose(FILE *),
61 		cron_pabort(FILE *),
62 		glue_strings(char *, size_t, const char *, const char *, char),
63 		strcmp_until(const char *, const char *, char),
64 		strdtb(char *);
65 
66 size_t		strlens(const char *, ...);
67 
68 char		*env_get(const char *, char **),
69 		*arpadate(time_t *),
70 		*mkprints(char *, size_t),
71 		**env_init(void),
72 		**env_copy(char **),
73 		**env_set(char **, char *);
74 
75 user		*load_user(int, struct passwd *, const char *),
76 		*find_user(cron_db *, const char *);
77 
78 entry		*load_entry(FILE *, void (*)(const char *), struct passwd *, char **);
79 
80 FILE		*cron_popen(char *, const char *, struct passwd *);
81 
82 struct passwd	*pw_dup(const struct passwd *);
83 
84 #ifndef HAVE_TM_GMTOFF
85 long		get_gmtoff(time_t *, struct tm *);
86 #endif
87 
88 extern int close_all(int);
89 #ifdef USE_PAM
90 extern int cron_pam_start (const char *user);
91 extern int cron_pam_setcred (void);
92 extern void cron_pam_finish (void);
93 extern void cron_pam_child_close (void);
94 extern char **cron_pam_getenvlist (char **envp);
95 #endif
96