xref: /freebsd/sys/compat/linux/linux_mib.h (revision 0e33efe4e4b5d24e2d416938af8bc6e6e4160ec8)
1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
3  *
4  * Copyright (c) 1999 Marcel Moolenaar
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer
12  *    in this position and unchanged.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. The name of the author may not be used to endorse or promote products
17  *    derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  * $FreeBSD$
31  */
32 
33 #ifndef _LINUX_MIB_H_
34 #define _LINUX_MIB_H_
35 
36 #ifdef SYSCTL_DECL
37 SYSCTL_DECL(_compat_linux);
38 #endif
39 
40 void	linux_osd_jail_register(void);
41 void	linux_osd_jail_deregister(void);
42 
43 void	linux_get_osname(struct thread *td, char *dst);
44 
45 void	linux_get_osrelease(struct thread *td, char *dst);
46 
47 int	linux_get_oss_version(struct thread *td);
48 
49 int	linux_kernver(struct thread *td);
50 
51 #define	LINUX_KVERSION		2
52 #define	LINUX_KPATCHLEVEL	6
53 #define	LINUX_KSUBLEVEL		32
54 
55 #define	LINUX_KERNVER(a,b,c)	(((a) << 16) + ((b) << 8) + (c))
56 #define	LINUX_VERSION_CODE	LINUX_KERNVER(LINUX_KVERSION,		\
57 				    LINUX_KPATCHLEVEL, LINUX_KSUBLEVEL)
58 #define	LINUX_KERNVERSTR(x)	#x
59 #define	LINUX_XKERNVERSTR(x)	LINUX_KERNVERSTR(x)
60 #define	LINUX_VERSION_STR	LINUX_XKERNVERSTR(LINUX_KVERSION.LINUX_KPATCHLEVEL.LINUX_KSUBLEVEL)
61 
62 #define	LINUX_KERNVER_2004000	LINUX_KERNVER(2,4,0)
63 #define	LINUX_KERNVER_2006000	LINUX_KERNVER(2,6,0)
64 
65 #define	linux_use26(t)		(linux_kernver(t) >= LINUX_KERNVER_2006000)
66 
67 #endif /* _LINUX_MIB_H_ */
68