summaryrefslogtreecommitdiffstats
path: root/lib/isc/include/isc/os.h
blob: fd7e5cf2bdb39ca2a959e825cc8c9c2f88f505a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
 *
 * SPDX-License-Identifier: MPL-2.0
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, you can obtain one at https://mozilla.org/MPL/2.0/.
 *
 * See the COPYRIGHT file distributed with this work for additional
 * information regarding copyright ownership.
 */

#pragma once

/*! \file isc/os.h */
#include <isc/lang.h>
#include <isc/types.h>

#include <sys/stat.h>

ISC_LANG_BEGINDECLS

/*%<
 * Hardcode the L1 cacheline size of the CPU to 64, this is checked in
 * the os.c library constructor if operating system provide means to
 * get the L1 cacheline size using sysconf().
 */
#define ISC_OS_CACHELINE_SIZE 64

unsigned int
isc_os_ncpus(void);
/*%<
 * Return the number of CPUs available on the system, or 1 if this cannot
 * be determined.
 */

unsigned long
isc_os_cacheline(void);
/*%<
 * Return L1 cacheline size of the CPU.
 * If L1 cache is greater than ISC_OS_CACHELINE_SIZE, ensure it is used
 * instead of constant. Is common on ppc64le architecture.
 */

mode_t
isc_os_umask(void);
/*%<
 * Return umask of the current process as initialized at the program start
 */

ISC_LANG_ENDDECLS