xref: /netbsd-src/external/mpl/bind/dist/lib/isc/include/isc/os.h (revision bcda20f65a8566e103791ec395f7f499ef322704)
1 /*	$NetBSD: os.h,v 1.7 2025/01/26 16:25:42 christos Exp $	*/
2 
3 /*
4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5  *
6  * SPDX-License-Identifier: MPL-2.0
7  *
8  * This Source Code Form is subject to the terms of the Mozilla Public
9  * License, v. 2.0. If a copy of the MPL was not distributed with this
10  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
11  *
12  * See the COPYRIGHT file distributed with this work for additional
13  * information regarding copyright ownership.
14  */
15 
16 #pragma once
17 
18 /*! \file isc/os.h */
19 #include <sys/stat.h>
20 
21 #include <isc/lang.h>
22 #include <isc/types.h>
23 
24 ISC_LANG_BEGINDECLS
25 
26 /*%<
27  * Hardcode the L1 cacheline size of the CPU to 64, this is checked in
28  * the os.c library constructor if operating system provide means to
29  * get the L1 cacheline size using sysconf().
30  */
31 #define ISC_OS_CACHELINE_SIZE 64
32 
33 unsigned int
34 isc_os_ncpus(void);
35 /*%<
36  * Return the number of CPUs available on the system, or 1 if this cannot
37  * be determined.
38  */
39 
40 unsigned long
41 isc_os_cacheline(void);
42 /*%<
43  * Return L1 cacheline size of the CPU.
44  * If L1 cache is greater than ISC_OS_CACHELINE_SIZE, ensure it is used
45  * instead of constant. Is common on ppc64le architecture.
46  */
47 
48 mode_t
49 isc_os_umask(void);
50 /*%<
51  * Return umask of the current process as initialized at the program start
52  */
53 
54 ISC_LANG_ENDDECLS
55