linux_emul.h revision 302962
155714Skris/*- 255714Skris * Copyright (c) 2006 Roman Divacky 355714Skris * Copyright (c) 2013 Dmitry Chagin 455714Skris * All rights reserved. 555714Skris * 655714Skris * Redistribution and use in source and binary forms, with or without 755714Skris * modification, are permitted provided that the following conditions 8280297Sjkim * are met: 955714Skris * 1. Redistributions of source code must retain the above copyright 1055714Skris * notice, this list of conditions and the following disclaimer 1155714Skris * in this position and unchanged. 1255714Skris * 2. Redistributions in binary form must reproduce the above copyright 1355714Skris * notice, this list of conditions and the following disclaimer in the 1455714Skris * documentation and/or other materials provided with the distribution. 15280297Sjkim * 3. The name of the author may not be used to endorse or promote products 1655714Skris * derived from this software without specific prior written permission 1755714Skris * 1855714Skris * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1955714Skris * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2055714Skris * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2155714Skris * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22280297Sjkim * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2355714Skris * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2455714Skris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2555714Skris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2655714Skris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2755714Skris * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2855714Skris * 2955714Skris * $FreeBSD: stable/10/sys/compat/linux/linux_emul.h 302962 2016-07-17 15:07:33Z dchagin $ 3055714Skris */ 3155714Skris 3255714Skris#ifndef _LINUX_EMUL_H_ 3355714Skris#define _LINUX_EMUL_H_ 3455714Skris 3555714Skris/* 3655714Skris * modeled after similar structure in NetBSD 37280297Sjkim * this will be extended as we need more functionality 3855714Skris */ 3955714Skrisstruct linux_emuldata { 40280297Sjkim int *child_set_tid; /* in clone(): Child's TID to set on clone */ 4155714Skris int *child_clear_tid;/* in clone(): Child's TID to clear on exit */ 4255714Skris 4355714Skris int pdeath_signal; /* parent death signal */ 4455714Skris int flags; /* thread emuldata flags */ 4555714Skris int em_tid; /* thread id */ 4655714Skris 4755714Skris struct linux_robust_list_head *robust_futexes; 4855714Skris}; 4955714Skris 5055714Skrisstruct linux_emuldata *em_find(struct thread *); 5155714Skris 52280297Sjkimvoid linux_proc_init(struct thread *, struct thread *, int); 5355714Skrisvoid linux_proc_exit(void *, struct proc *); 5455714Skrisvoid linux_schedtail(struct thread *); 5555714Skrisvoid linux_proc_exec(void *, struct proc *, struct image_params *); 5655714Skrisvoid linux_thread_dtor(void *arg __unused, struct thread *); 5755714Skrisvoid linux_thread_detach(struct thread *); 5855714Skrisint linux_common_execve(struct thread *, struct image_args *); 5955714Skris 6055714Skris/* process emuldata flags */ 6155714Skris#define LINUX_XDEPR_REQUEUEOP 0x00000001 /* uses deprecated 6255714Skris futex REQUEUE op*/ 6355714Skris#define LINUX_XUNSUP_EPOLL 0x00000002 /* unsupported epoll events */ 6459191Skris#define LINUX_XUNSUP_FUTEXPIOP 0x00000004 /* uses unsupported pi futex */ 6559191Skris 6659191Skrisstruct linux_pemuldata { 6759191Skris uint32_t flags; /* process emuldata flags */ 68238405Sjkim struct sx pem_sx; /* lock for this struct */ 6959191Skris void *epoll; /* epoll data */ 7059191Skris uint32_t persona; /* process execution domain */ 7159191Skris}; 7255714Skris 7355714Skris#define LINUX_PEM_XLOCK(p) sx_xlock(&(p)->pem_sx) 7455714Skris#define LINUX_PEM_XUNLOCK(p) sx_xunlock(&(p)->pem_sx) 75280297Sjkim#define LINUX_PEM_SLOCK(p) sx_slock(&(p)->pem_sx) 76280297Sjkim#define LINUX_PEM_SUNLOCK(p) sx_sunlock(&(p)->pem_sx) 77280297Sjkim 78280297Sjkimstruct linux_pemuldata *pem_find(struct proc *); 79194206Ssimon 80280297Sjkim#endif /* !_LINUX_EMUL_H_ */ 81280297Sjkim