xref: /freebsd/sys/compat/linux/linux_mib.h (revision b1ed95fd9d1ddda7ebd00c737e2b49b0216c194e)
1c6dfea0eSMarcel Moolenaar /*-
2*b1ed95fdSEd Maste  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
37f2d13d6SPedro F. Giffuni  *
4c6dfea0eSMarcel Moolenaar  * Copyright (c) 1999 Marcel Moolenaar
5c6dfea0eSMarcel Moolenaar  * All rights reserved.
6c6dfea0eSMarcel Moolenaar  *
7c6dfea0eSMarcel Moolenaar  * Redistribution and use in source and binary forms, with or without
8c6dfea0eSMarcel Moolenaar  * modification, are permitted provided that the following conditions
9c6dfea0eSMarcel Moolenaar  * are met:
10c6dfea0eSMarcel Moolenaar  * 1. Redistributions of source code must retain the above copyright
11*b1ed95fdSEd Maste  *    notice, this list of conditions and the following disclaimer.
12c6dfea0eSMarcel Moolenaar  * 2. Redistributions in binary form must reproduce the above copyright
13c6dfea0eSMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer in the
14c6dfea0eSMarcel Moolenaar  *    documentation and/or other materials provided with the distribution.
15c6dfea0eSMarcel Moolenaar  *
16*b1ed95fdSEd Maste  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17*b1ed95fdSEd Maste  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*b1ed95fdSEd Maste  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*b1ed95fdSEd Maste  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20*b1ed95fdSEd Maste  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*b1ed95fdSEd Maste  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*b1ed95fdSEd Maste  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*b1ed95fdSEd Maste  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*b1ed95fdSEd Maste  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*b1ed95fdSEd Maste  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*b1ed95fdSEd Maste  * SUCH DAMAGE.
27c6dfea0eSMarcel Moolenaar  *
2828065282SPeter Wemm  * $FreeBSD$
29c6dfea0eSMarcel Moolenaar  */
30c6dfea0eSMarcel Moolenaar 
31c6dfea0eSMarcel Moolenaar #ifndef _LINUX_MIB_H_
32c6dfea0eSMarcel Moolenaar #define _LINUX_MIB_H_
33c6dfea0eSMarcel Moolenaar 
3467d39748SDmitry Chagin #ifdef SYSCTL_DECL
3567d39748SDmitry Chagin SYSCTL_DECL(_compat_linux);
3667d39748SDmitry Chagin #endif
3767d39748SDmitry Chagin 
387ae27ff4SJamie Gritton void	linux_osd_jail_register(void);
397ae27ff4SJamie Gritton void	linux_osd_jail_deregister(void);
407ae27ff4SJamie Gritton 
41b62f75cfSJohn Baldwin void	linux_get_osname(struct thread *td, char *dst);
42c6dfea0eSMarcel Moolenaar 
43b62f75cfSJohn Baldwin void	linux_get_osrelease(struct thread *td, char *dst);
44c6dfea0eSMarcel Moolenaar 
45b62f75cfSJohn Baldwin int	linux_get_oss_version(struct thread *td);
46c6dfea0eSMarcel Moolenaar 
47580dd797SDmitry Chagin int	linux_kernver(struct thread *td);
48580dd797SDmitry Chagin 
49a6326909SDmitry Chagin #define	LINUX_KVERSION		2
50a6326909SDmitry Chagin #define	LINUX_KPATCHLEVEL	6
512c4f134bSDmitry Chagin #define	LINUX_KSUBLEVEL		32
52a6326909SDmitry Chagin 
53a6326909SDmitry Chagin #define	LINUX_KERNVER(a,b,c)	(((a) << 16) + ((b) << 8) + (c))
54a6326909SDmitry Chagin #define	LINUX_VERSION_CODE	LINUX_KERNVER(LINUX_KVERSION,		\
55a6326909SDmitry Chagin 				    LINUX_KPATCHLEVEL, LINUX_KSUBLEVEL)
56a6326909SDmitry Chagin #define	LINUX_KERNVERSTR(x)	#x
57a6326909SDmitry Chagin #define	LINUX_XKERNVERSTR(x)	LINUX_KERNVERSTR(x)
58a6326909SDmitry Chagin #define	LINUX_VERSION_STR	LINUX_XKERNVERSTR(LINUX_KVERSION.LINUX_KPATCHLEVEL.LINUX_KSUBLEVEL)
59a6326909SDmitry Chagin 
60a6326909SDmitry Chagin #define	LINUX_KERNVER_2004000	LINUX_KERNVER(2,4,0)
61a6326909SDmitry Chagin #define	LINUX_KERNVER_2006000	LINUX_KERNVER(2,6,0)
62580dd797SDmitry Chagin 
63580dd797SDmitry Chagin #define	linux_use26(t)		(linux_kernver(t) >= LINUX_KERNVER_2006000)
649ce8f9bcSAlexander Leidinger 
65c6dfea0eSMarcel Moolenaar #endif /* _LINUX_MIB_H_ */
66