1d6aa1cc5SFrançois Tigeot /* 21e8d33eeSFrançois Tigeot * Copyright (c) 2018-2019 François Tigeot <ftigeot@wolfpond.org> 3d6aa1cc5SFrançois Tigeot * All rights reserved. 4d6aa1cc5SFrançois Tigeot * 5d6aa1cc5SFrançois Tigeot * Redistribution and use in source and binary forms, with or without 6d6aa1cc5SFrançois Tigeot * modification, are permitted provided that the following conditions 7d6aa1cc5SFrançois Tigeot * are met: 8d6aa1cc5SFrançois Tigeot * 1. Redistributions of source code must retain the above copyright 9d6aa1cc5SFrançois Tigeot * notice unmodified, this list of conditions, and the following 10d6aa1cc5SFrançois Tigeot * disclaimer. 11d6aa1cc5SFrançois Tigeot * 2. Redistributions in binary form must reproduce the above copyright 12d6aa1cc5SFrançois Tigeot * notice, this list of conditions and the following disclaimer in the 13d6aa1cc5SFrançois Tigeot * documentation and/or other materials provided with the distribution. 14d6aa1cc5SFrançois Tigeot * 15d6aa1cc5SFrançois Tigeot * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16d6aa1cc5SFrançois Tigeot * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17d6aa1cc5SFrançois Tigeot * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18d6aa1cc5SFrançois Tigeot * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19d6aa1cc5SFrançois Tigeot * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20d6aa1cc5SFrançois Tigeot * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21d6aa1cc5SFrançois Tigeot * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22d6aa1cc5SFrançois Tigeot * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23d6aa1cc5SFrançois Tigeot * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24d6aa1cc5SFrançois Tigeot * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25d6aa1cc5SFrançois Tigeot */ 26d6aa1cc5SFrançois Tigeot 27d6aa1cc5SFrançois Tigeot #ifndef _ASM_CURRENT_H_ 28d6aa1cc5SFrançois Tigeot #define _ASM_CURRENT_H_ 29d6aa1cc5SFrançois Tigeot 30*0e32b8c5SMatthew Dillon struct task_struct; 31*0e32b8c5SMatthew Dillon struct mm_struct; 32*0e32b8c5SMatthew Dillon struct thread; 33*0e32b8c5SMatthew Dillon struct proc; 34*0e32b8c5SMatthew Dillon 35*0e32b8c5SMatthew Dillon struct task_struct *linux_task_alloc(struct thread *td); 36*0e32b8c5SMatthew Dillon void linux_task_drop(struct thread *td); 37*0e32b8c5SMatthew Dillon void linux_proc_drop(struct proc *p); 38*0e32b8c5SMatthew Dillon void linux_mm_drop(struct mm_struct *mm); 39*0e32b8c5SMatthew Dillon 40*0e32b8c5SMatthew Dillon #define current ({ \ 41*0e32b8c5SMatthew Dillon struct task_struct *__task; \ 42*0e32b8c5SMatthew Dillon \ 43*0e32b8c5SMatthew Dillon if ((__task = curthread->td_linux_task) == NULL) \ 44*0e32b8c5SMatthew Dillon __task = linux_task_alloc(curthread); \ 45*0e32b8c5SMatthew Dillon __task; }) 461e8d33eeSFrançois Tigeot 47d6aa1cc5SFrançois Tigeot #endif /* _ASM_CURRENT_H_ */ 48