1 /*
2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
7  *
8  * See the COPYRIGHT file distributed with this work for additional
9  * information regarding copyright ownership.
10  */
11 
12 #ifndef NAMED_OS_H
13 #define NAMED_OS_H 1
14 
15 /*! \file */
16 
17 #include <pwd.h>
18 #include <stdbool.h>
19 
20 #include <isc/types.h>
21 
22 void
23 named_os_init(const char *progname);
24 
25 void
26 named_os_daemonize(void);
27 
28 void
29 named_os_opendevnull(void);
30 
31 void
32 named_os_closedevnull(void);
33 
34 void
35 named_os_chroot(const char *root);
36 
37 void
38 named_os_inituserinfo(const char *username);
39 
40 void
41 named_os_changeuser(void);
42 
43 uid_t
44 ns_os_uid(void);
45 
46 void
47 named_os_adjustnofile(void);
48 
49 void
50 named_os_minprivs(void);
51 
52 FILE *
53 named_os_openfile(const char *filename, mode_t mode, bool switch_user);
54 
55 void
56 named_os_writepidfile(const char *filename, bool first_time);
57 
58 bool
59 named_os_issingleton(const char *filename);
60 
61 void
62 named_os_shutdown(void);
63 
64 isc_result_t
65 named_os_gethostname(char *buf, size_t len);
66 
67 void
68 named_os_shutdownmsg(char *command, isc_buffer_t *text);
69 
70 void
71 named_os_tzset(void);
72 
73 void
74 named_os_started(void);
75 
76 const char *
77 named_os_uname(void);
78 
79 #endif /* NAMED_OS_H */
80