xref: /freebsd/sys/compat/linux/linux_mib.h (revision 598f6fb49c9ca688029b79de0a44227ab79c608c)
1c6dfea0eSMarcel Moolenaar /*-
2b1ed95fdSEd 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
11b1ed95fdSEd 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  *
16b1ed95fdSEd Maste  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17b1ed95fdSEd Maste  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18b1ed95fdSEd Maste  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19b1ed95fdSEd Maste  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20b1ed95fdSEd Maste  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21b1ed95fdSEd Maste  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22b1ed95fdSEd Maste  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23b1ed95fdSEd Maste  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24b1ed95fdSEd Maste  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25b1ed95fdSEd Maste  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26b1ed95fdSEd 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 
49156da725SEdward Tomasz Napierala #define	LINUX_KVERSION		4
50156da725SEdward Tomasz Napierala #define	LINUX_KPATCHLEVEL	4
511d3a302bSEdward Tomasz Napierala #define	LINUX_KSUBLEVEL		0
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)
629c1045ffSDmitry Chagin #define	LINUX_KERNVER_2006039	LINUX_KERNVER(2,6,39)
63580dd797SDmitry Chagin 
64580dd797SDmitry Chagin #define	linux_use26(t)		(linux_kernver(t) >= LINUX_KERNVER_2006000)
659ce8f9bcSAlexander Leidinger 
66462171d9SEdward Tomasz Napierala extern int linux_debug;
678c5059e9SEdward Tomasz Napierala extern int linux_default_openfiles;
681c34dcb5SEdward Tomasz Napierala extern int linux_default_stacksize;
6954669eb7SEdward Tomasz Napierala extern int linux_dummy_rlimits;
70da6d8ae6SEdward Tomasz Napierala extern int linux_ignore_ip_recverr;
712cf9eb6cSEdward Tomasz Napierala extern int linux_preserve_vstatus;
72b4147bf6STijl Coosemans extern bool linux_map_sched_prio;
732cf9eb6cSEdward Tomasz Napierala 
74*598f6fb4SKonstantin Belousov struct image_params;
75*598f6fb4SKonstantin Belousov bool linux_setid_allowed_query(struct thread *td, struct image_params *imgp);
76*598f6fb4SKonstantin Belousov 
77c6dfea0eSMarcel Moolenaar #endif /* _LINUX_MIB_H_ */
78