xref: /freebsd/sys/compat/linux/linux_mib.h (revision 7f2d13d60721803155950276e0282fcd1e6bacc3)
1c6dfea0eSMarcel Moolenaar /*-
2*7f2d13d6SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
3*7f2d13d6SPedro 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
11c6dfea0eSMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer
12c6dfea0eSMarcel Moolenaar  *    in this position and unchanged.
13c6dfea0eSMarcel Moolenaar  * 2. Redistributions in binary form must reproduce the above copyright
14c6dfea0eSMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer in the
15c6dfea0eSMarcel Moolenaar  *    documentation and/or other materials provided with the distribution.
16c6dfea0eSMarcel Moolenaar  * 3. The name of the author may not be used to endorse or promote products
17bc34729cSMarcel Moolenaar  *    derived from this software without specific prior written permission.
18c6dfea0eSMarcel Moolenaar  *
19c6dfea0eSMarcel Moolenaar  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20c6dfea0eSMarcel Moolenaar  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21c6dfea0eSMarcel Moolenaar  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22c6dfea0eSMarcel Moolenaar  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23c6dfea0eSMarcel Moolenaar  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24c6dfea0eSMarcel Moolenaar  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25c6dfea0eSMarcel Moolenaar  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26c6dfea0eSMarcel Moolenaar  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27c6dfea0eSMarcel Moolenaar  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28c6dfea0eSMarcel Moolenaar  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29c6dfea0eSMarcel Moolenaar  *
3028065282SPeter Wemm  * $FreeBSD$
31c6dfea0eSMarcel Moolenaar  */
32c6dfea0eSMarcel Moolenaar 
33c6dfea0eSMarcel Moolenaar #ifndef _LINUX_MIB_H_
34c6dfea0eSMarcel Moolenaar #define _LINUX_MIB_H_
35c6dfea0eSMarcel Moolenaar 
3667d39748SDmitry Chagin #ifdef SYSCTL_DECL
3767d39748SDmitry Chagin SYSCTL_DECL(_compat_linux);
3867d39748SDmitry Chagin #endif
3967d39748SDmitry Chagin 
407ae27ff4SJamie Gritton void	linux_osd_jail_register(void);
417ae27ff4SJamie Gritton void	linux_osd_jail_deregister(void);
427ae27ff4SJamie Gritton 
43b62f75cfSJohn Baldwin void	linux_get_osname(struct thread *td, char *dst);
44c6dfea0eSMarcel Moolenaar 
45b62f75cfSJohn Baldwin void	linux_get_osrelease(struct thread *td, char *dst);
46c6dfea0eSMarcel Moolenaar 
47b62f75cfSJohn Baldwin int	linux_get_oss_version(struct thread *td);
48c6dfea0eSMarcel Moolenaar 
49580dd797SDmitry Chagin int	linux_kernver(struct thread *td);
50580dd797SDmitry Chagin 
51a6326909SDmitry Chagin #define	LINUX_KVERSION		2
52a6326909SDmitry Chagin #define	LINUX_KPATCHLEVEL	6
532c4f134bSDmitry Chagin #define	LINUX_KSUBLEVEL		32
54a6326909SDmitry Chagin 
55a6326909SDmitry Chagin #define	LINUX_KERNVER(a,b,c)	(((a) << 16) + ((b) << 8) + (c))
56a6326909SDmitry Chagin #define	LINUX_VERSION_CODE	LINUX_KERNVER(LINUX_KVERSION,		\
57a6326909SDmitry Chagin 				    LINUX_KPATCHLEVEL, LINUX_KSUBLEVEL)
58a6326909SDmitry Chagin #define	LINUX_KERNVERSTR(x)	#x
59a6326909SDmitry Chagin #define	LINUX_XKERNVERSTR(x)	LINUX_KERNVERSTR(x)
60a6326909SDmitry Chagin #define	LINUX_VERSION_STR	LINUX_XKERNVERSTR(LINUX_KVERSION.LINUX_KPATCHLEVEL.LINUX_KSUBLEVEL)
61a6326909SDmitry Chagin 
62a6326909SDmitry Chagin #define	LINUX_KERNVER_2004000	LINUX_KERNVER(2,4,0)
63a6326909SDmitry Chagin #define	LINUX_KERNVER_2006000	LINUX_KERNVER(2,6,0)
64580dd797SDmitry Chagin 
65580dd797SDmitry Chagin #define	linux_use26(t)		(linux_kernver(t) >= LINUX_KERNVER_2006000)
669ce8f9bcSAlexander Leidinger 
67c6dfea0eSMarcel Moolenaar #endif /* _LINUX_MIB_H_ */
68