linux/fs/fcntl.c
<<
> > p/spa pspa class="lxr_search"> > ="+search" method="post" onsubmit="return do_search(this);"> > > > Search > p/spa > ="ajax+*" method="post" onsubmit="return false;"> pinput typ"v3hidden" nam"v3ajax_lookup" idv3ajax_lookup" lue="v3"> >
pdiv idv3file_contents"
o o1p/a>pspa
 class="comment">/*p/spa
  o o2p/a>pspa
 class="comment"> *  linux/fs/fcntl.cp/spa
  o o3p/a>pspa
 class="comment"> *p/spa
  o o4p/a>pspa
 class="comment"> *  Copyright (C) 1991, 1992  Linus Torluedsp/spa
  o o5p/a>pspa
 class="comment"> */p/spa
  o o6p/a> o o7p/a>#include <linux/syscalls.hp/a>> o o8p/a>#include <linux/init.hp/a>> o o9p/a>#include <linux/mm.hp/a>> o #include <linux/fs.hp/a>> o 11opa>#include <linux/file.hp/a>> o 12opa>#include <linux/fdtable.hp/a>> o 13opa>#include <linux/capability.hp/a>> o 14opa>#include <linux/dnotify.hp/a>> o 15p/a>#include <linux/slab.hp/a>> o 16p/a>#include <linux/module.hp/a>> o 17p/a>#include <linux/pipe_fs_i.hp/a>> o 18p/a>#include <linux/security.hp/a>> o 19p/a>#include <linux/ptrace.hp/a>> o 2/opa>#include <linux/signal.hp/a>> o 21opa>#include <linux/rcupdate.hp/a>> o 22opa>#include <linux/pid_nam"space.hp/a>> o 23opa>#include <linux/user_nam"space.hp/a>> o 24p/a> o 25p/a>#include <asm/poll.hp/a>> o 26p/a>#include <asm/siginfo.hp/a>> o 27p/a>#include <asm/uaccess.hp/a>> o 28p/a> o 29p/a>#defineopa href="+code=SETFL_MASK" class="sref">SETFL_MASKp/a> (pa href="+code=O_APPEND" class="sref">O_APPENDp/a> |opa href="+code=O_NONBLOCK" class="sref">O_NONBLOCKp/a> |opa href="+code=O_NDELAY" class="sref">O_NDELAYp/a> |opa href="+code=O_DIRECT" class="sref">O_DIRECTp/a> |opa href="+code=O_NOATIME" class="sref">O_NOATIMEp/a>) o 30p/a> o 31opa>static intopa href="+code=setfl" class="sref">setflopa>(intopa href="+code=fd" class="sref">fdopa>, structopa href="+code=file" class="sref">filep/a> *opa href="+code=filp" class="sref">filpopa>, unsigned longopa href="+code=arg" class="sref">argp/a>) o 32opa>{ o 33opa>        structopa href="+code=inode" class="sref">inodep/a> *opa href="+code=inode" class="sref">inodep/a> =opa href="+code=file_inode" class="sref">file_inodeopa>(pa href="+code=filp" class="sref">filpopa>); o 34opa>        intopa href="+code=error" class="sref">errorp/a> =o0; o 35p/a> o 36opa>        pspa
 class="comment">/*p/spa
  o 37p/a>pspa
 class="comment">         * O_APPEND cannot be cleared if the file is marked as append-onlyp/spa
  o 38p/a>pspa
 class="comment">         * and the file is open for write.p/spa
  o 39p/a>pspa
 class="comment">         */p/spa
  o 40opa>        if (((pa href="+code=arg" class="sref">argp/a> ^opa href="+code=filp" class="sref">filpopa>->pa href="+code=f_flags" class="sref">f_flagsopa>) &opa href="+code=O_APPEND" class="sref">O_APPENDp/a>) &&opa href="+code=IS_APPEND" class="sref">IS_APPENDopa>(pa href="+code=inode" class="sref">inodep/a>)) o 41opa>                return -pa href="+code=EPERM" class="sref">EPERMopa>; o 42p/a> o 43opa>        pspa
 class="comment">/* O_NOATIME can only be set by the owner or superuser */p/spa
  o 44opa>        if ((pa href="+code=arg" class="sref">argp/a> &opa href="+code=O_NOATIME" class="sref">O_NOATIMEp/a>) &&o!(pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_flags" class="sref">f_flagsopa> &opa href="+code=O_NOATIME" class="sref">O_NOATIMEp/a>)) o 45opa>                if (!pa href="+code=inode_owner_or_capable" class="sref">inode_owner_or_capableopa>(pa href="+code=inode" class="sref">inodep/a>)) o 46opa>                        return -pa href="+code=EPERM" class="sref">EPERMopa>; o 47p/a> o 48opa>        pspa
 class="comment">/* required for strictoSunOS emulaon va*/p/spa
  o 49opa>        if (pa href="+code=O_NONBLOCK" class="sref">O_NONBLOCKp/a> !=opa href="+code=O_NDELAY" class="sref">O_NDELAYp/a>) o 50opa>               if (pa href="+code=arg" class="sref">argp/a> &opa href="+code=O_NDELAY" class="sref">O_NDELAYp/a>) o 51opa>                  opa href="+code=arg" class="sref">argp/a> |=opa href="+code=O_NONBLOCK" class="sref">O_NONBLOCKp/a>; o 52p/a> o 53opa>        if (pa href="+code=arg" class="sref">argp/a> &opa href="+code=O_DIRECT" class="sref">O_DIRECTp/a>) { o 54opa>                if (!pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_mapping" class="sref">f_mappingp/a> || !pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_mapping" class="sref">f_mappingp/a>->pa href="+code=a_ops" class="sref">a_opsp/a> || o 55opa>                        !pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_mapping" class="sref">f_mappingp/a>->pa href="+code=a_ops" class="sref">a_opsp/a>->pa href="+code=direct_IO" class="sref">direct_IOp/a>) o 56opa>                                return -pa href="+code=EINVAL" class="sref">EINVALp/a>; o 57opa>        } o 58p/a> o 59opa>        if (pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_op" class="sref">f_opp/a> &&opa href="+code=filp" class="sref">filpopa>->pa href="+code=f_op" class="sref">f_opp/a>->pa href="+code=check_flags" class="sref">check_flagsp/a>) o 60opa>               opa href="+code=error" class="sref">errorp/a> =opa href="+code=filp" class="sref">filpopa>->pa href="+code=f_op" class="sref">f_opp/a>->pa href="+code=check_flags" class="sref">check_flagsp/a>(pa href="+code=arg" class="sref">argp/a>); o 61opa>        if (pa href="+code=error" class="sref">errorp/a>) o 62opa>                return pa href="+code=error" class="sref">errorp/a>; o 63p/a> o 64opa>        pspa
 class="comment">/*p/spa
  o 65p/a>pspa
 class="comment">         * ->fasync() is responsible for setting the FASYNC bit.p/spa
  o 66p/a>pspa
 class="comment">         */p/spa
  o 67opa>        if (((pa href="+code=arg" class="sref">argp/a> ^opa href="+code=filp" class="sref">filpopa>->pa href="+code=f_flags" class="sref">f_flagsopa>) &opa href="+code=FASYNC" class="sref">FASYNCp/a>) &&opa href="+code=filp" class="sref">filpopa>->pa href="+code=f_op" class="sref">f_opp/a> && o 68opa>                        pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_op" class="sref">f_opp/a>->pa href="+code=fasync" class="sref">fasyncp/a>) { o 69opa>               opa href="+code=error" class="sref">errorp/a> =opa href="+code=filp" class="sref">filpopa>->pa href="+code=f_op" class="sref">f_opp/a>->pa href="+code=fasync" class="sref">fasyncp/a>(pa href="+code=fd" class="sref">fdopa>, pa href="+code=filp" class="sref">filpopa>, (pa href="+code=arg" class="sref">argp/a> &opa href="+code=FASYNC" class="sref">FASYNCp/a>) !=o0); o 70opa>               oif (pa href="+code=error" class="sref">errorp/a> <o0) o 71opa>                  oooooogotoopa href="+code=out" class="sref">outp/a>; o 72opa>                if (pa href="+code=error" class="sref">errorp/a> >o0) o 73opa>                        pa href="+code=error" class="sref">errorp/a> =o0; o 74opa>        } o 75opa>        pa href="+code=spin_lock" class="sref">spin_lockp/a>(&pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_lock" class="sref">f_lockp/a>); o 76opa>        pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_flags" class="sref">f_flagsopa> = (pa href="+code=arg" class="sref">argp/a> &opa href="+code=SETFL_MASK" class="sref">SETFL_MASKp/a>) | (pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_flags" class="sref">f_flagsopa> &o~pa href="+code=SETFL_MASK" class="sref">SETFL_MASKp/a>); o 77opa>        pa href="+code=spin_unlock" class="sref">spin_unlockp/a>(&pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_lock" class="sref">f_lockp/a>); o 78p/a> o 79opa> pa href="+code=out" class="sref">outp/a>: o 80opa>        return pa href="+code=error" class="sref">errorp/a>; o 81opa>} o 82p/a> o 83opa>static void pa href="+code=f_modown" class="sref">f_modownp/a>(structopa href="+code=file" class="sref">filep/a> *pa href="+code=filp" class="sref">filpopa>, structopa href="+code=pid" class="sref">pidp/a> *pa href="+code=pid" class="sref">pidp/a>, enumopa href="+code=pid_typ"" class="sref">pid_typ"opa> pa href="+code=typ"" class="sref">typ"opa>, o 84opa>                     intopa href="+code=force" class="sref">forcep/a>) o 85opa>{ o 86opa>        pa href="+code=write_lock_irq" class="sref">write_lock_irqp/a>(&pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=lock" class="sref">lockp/a>); o 87opa>        if (pa href="+code=force" class="sref">forcep/a> || !pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=pid" class="sref">pidp/a>) { o 88opa>                pa href="+code=put_pid" class="sref">put_pidp/a>(pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=pid" class="sref">pidp/a>); o 89opa>               opa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=pid" class="sref">pidp/a> =opa href="+code=get_pid" class="sref">get_pidp/a>(pa href="+code=pid" class="sref">pidp/a>); o 90opa>               opa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=pid_typ"" class="sref">pid_typ"opa> =opa href="+code=typ"" class="sref">typ"opa>; o 91p/a> o 92opa>                if (pa href="+code=pid" class="sref">pidp/a>) { o 93opa>                        const structopa href="+code=cred" class="sref">credp/a> *pa href="+code=cred" class="sref">credp/a> =opa href="+code=current_cred" class="sref">current_credp/a>(); o 94opa>                       opa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=uid" class="sref">uidp/a> =opa href="+code=cred" class="sref">credp/a>->pa href="+code=uid" class="sref">uidp/a>; o 95opa>                        pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=euid" class="sref">euidp/a> =opa href="+code=cred" class="sref">credp/a>->pa href="+code=euid" class="sref">euidp/a>; o 96opa>                } o 97opa>        } o 98opa>        pa href="+code=write_unlock_irq" class="sref">write_unlock_irqp/a>(&pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=lock" class="sref">lockp/a>); o 99opa>} o100p/a> o101p/a>intopa href="+code=__f_setown" class="sref">__f_setownp/a>(structopa href="+code=file" class="sref">filep/a> *pa href="+code=filp" class="sref">filpopa>, structopa href="+code=pid" class="sref">pidp/a> *pa href="+code=pid" class="sref">pidp/a>, enumopa href="+code=pid_typ"" class="sref">pid_typ"opa> pa href="+code=typ"" class="sref">typ"opa>, o102opa>                intopa href="+code=force" class="sref">forcep/a>) o103opa>{ o104opa>        intopa href="+code=err" class="sref">errp/a>; o105p/a> o106opa>        pa href="+code=err" class="sref">errp/a> =opa href="+code=security_file_set_fowner" class="sref">security_file_set_fownerp/a>(pa href="+code=filp" class="sref">filpopa>); o107opa>        if (pa href="+code=err" class="sref">errp/a>) o108opa>                return pa href="+code=err" class="sref">errp/a>; o109p/a> o110opa>        pa href="+code=f_modown" class="sref">f_modownp/a>(pa href="+code=filp" class="sref">filpopa>, pa href="+code=pid" class="sref">pidp/a>, pa href="+code=typ"" class="sref">typ"opa>,opa href="+code=force" class="sref">forcep/a>); o111opa>        return 0; o112opa>} o113opa>pa href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOLp/a>(pa href="+code=__f_setown" class="sref">__f_setownp/a>); o114p/a> o115p/a>intopa href="+code=f_setown" class="sref">f_setownp/a>(structopa href="+code=file" class="sref">filep/a> *pa href="+code=filp" class="sref">filpopa>, unsigned longopa href="+code=arg" class="sref">argp/a>, intopa href="+code=force" class="sref">forcep/a>) o116p/a>{ o117opa>        enumopa href="+code=pid_typ"" class="sref">pid_typ"opa> pa href="+code=typ"" class="sref">typ"opa>; o118opa>        structopa href="+code=pid" class="sref">pidp/a> *pa href="+code=pid" class="sref">pidp/a>; o119opa>        intopa href="+code=who" class="sref">whop/a> =opa href="+code=arg" class="sref">argp/a>; o120opa>        intopa href="+code=result" class="sref">resultp/a>; o121opa>        pa href="+code=typ"" class="sref">typ"opa> =opa href="+code=PIDTYPE_PID" class="sref">PIDTYPE_PIDp/a>; o122opa>        if (pa href="+code=who" class="sref">whop/a> <o0) { o123opa>                pa href="+code=typ"" class="sref">typ"opa> =opa href="+code=PIDTYPE_PGID" class="sref">PIDTYPE_PGIDp/a>; o124opa>                pa href="+code=who" class="sref">whop/a> =o-pa href="+code=who" class="sref">whop/a>; o125opa>        } o126opa>        pa href="+code=rcu_read_lock" class="sref">rcu_read_lockp/a>(); o127opa>        pa href="+code=pid" class="sref">pidp/a> =opa href="+code=find_vpid" class="sref">find_vpidp/a>(pa href="+code=who" class="sref">whop/a>); o128opa>        pa href="+code=result" class="sref">resultp/a> =opa href="+code=__f_setown" class="sref">__f_setownp/a>(pa href="+code=filp" class="sref">filpopa>, pa href="+code=pid" class="sref">pidp/a>, pa href="+code=typ"" class="sref">typ"opa>,opa href="+code=force" class="sref">forcep/a>); o129opa>        pa href="+code=rcu_read_unlock" class="sref">rcu_read_unlockp/a>(); o130opa>        return pa href="+code=result" class="sref">resultp/a>; o131opa>} o132opa>pa href="+code=EXPORT_SYMBOL" class="sref">EXPORT_SYMBOLp/a>(pa href="+code=f_setown" class="sref">f_setownp/a>); o133p/a> o134opa>void pa href="+code=f_delown" class="sref">f_delownp/a>(structopa href="+code=file" class="sref">filep/a> *pa href="+code=filp" class="sref">filpopa>) o135opa>{ o136opa>        pa href="+code=f_modown" class="sref">f_modownp/a>(pa href="+code=filp" class="sref">filpopa>, pa href="+code=NULL" class="sref">NULLopa>, pa href="+code=PIDTYPE_PID" class="sref">PIDTYPE_PIDp/a>, 1); o137p/a>} o138p/a> o139p/a>pa href="+code=pid_t" class="sref">pid_topa> pa href="+code=f_getown" class="sref">f_getownp/a>(structopa href="+code=file" class="sref">filep/a> *pa href="+code=filp" class="sref">filpopa>) o140opa>{ o141opa>        pa href="+code=pid_t" class="sref">pid_topa> pa href="+code=pid" class="sref">pidp/a>; o142opa>        pa href="+code=read_lock" class="sref">read_lockp/a>(&pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=lock" class="sref">lockp/a>); o143opa>        pa href="+code=pid" class="sref">pidp/a> =opa href="+code=pid_vnr" class="sref">pid_vnrp/a>(pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=pid" class="sref">pidp/a>); o144opa>        if (pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=pid_typ"" class="sref">pid_typ"opa> ==opa href="+code=PIDTYPE_PGID" class="sref">PIDTYPE_PGIDp/a>) o145opa>                pa href="+code=pid" class="sref">pidp/a> =o-pa href="+code=pid" class="sref">pidp/a>; o146opa>        pa href="+code=read_unlock" class="sref">read_unlockp/a>(&pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=lock" class="sref">lockp/a>); o147opa>        return pa href="+code=pid" class="sref">pidp/a>; o148opa>} o149p/a> o150opa>static intopa href="+code=f_setown_ex" class="sref">f_setown_exp/a>(structopa href="+code=file" class="sref">filep/a> *pa href="+code=filp" class="sref">filpopa>, unsigned longopa href="+code=arg" class="sref">argp/a>) o151opa>{ o152opa>        structopa href="+code=f_owner_ex" class="sref">f_owner_exopa> pa href="+code=__user" class="sref">__userp/a> *pa href="+code=owner_p" class="sref">owner_pp/a> =o(void pa href="+code=__user" class="sref">__userp/a> *)pa href="+code=arg" class="sref">argp/a>; o153opa>        structopa href="+code=f_owner_ex" class="sref">f_owner_exopa> pa href="+code=owner" class="sref">owneropa>; o154opa>        structopa href="+code=pid" class="sref">pidp/a> *pa href="+code=pid" class="sref">pidp/a>; o155opa>        intopa href="+code=typ"" class="sref">typ"opa>; o156opa>        intopa href="+code=ret" class="sref">retp/a>; o157p/a> o158opa>        pa href="+code=ret" class="sref">retp/a> =opa href="+code=copy_from_user" class="sref">copy_from_userp/a>(&pa href="+code=owner" class="sref">owneropa>, pa href="+code=owner_p" class="sref">owner_pp/a>, sizeof(pa href="+code=owner" class="sref">owneropa>)); o159opa>        if (pa href="+code=ret" class="sref">retp/a>) o160opa>               oreturn -pa href="+code=EFAULT" class="sref">EFAULTp/a>; o161p/a> o162opa>        switch (pa href="+code=owner" class="sref">owneropa>.pa href="+code=typ"" class="sref">typ"opa>) { o163opa>        caseopa href="+code=F_OWNER_TID" class="sref">F_OWNER_TIDopa>: o164opa>                pa href="+code=typ"" class="sref">typ"opa> =opa href="+code=PIDTYPE_MAX" class="sref">PIDTYPE_MAXp/a>; o165opa>                break; o166p/a> o167opa>        caseopa href="+code=F_OWNER_PID" class="sref">F_OWNER_PIDopa>: o168opa>                pa href="+code=typ"" class="sref">typ"opa> =opa href="+code=PIDTYPE_PID" class="sref">PIDTYPE_PIDp/a>; o169opa>               obreak; o170p/a> o171opa>        caseopa href="+code=F_OWNER_PGRP" class="sref">F_OWNER_PGRPopa>: o172opa>                pa href="+code=typ"" class="sref">typ"opa> =opa href="+code=PIDTYPE_PGID" class="sref">PIDTYPE_PGIDp/a>; o173opa>                break; o174p/a> o175opa>        default: o176opa>                return -pa href="+code=EINVAL" class="sref">EINVALp/a>; o177opa>        } o178p/a> o179opa>        pa href="+code=rcu_read_lock" class="sref">rcu_read_lockp/a>(); o180opa>        pa href="+code=pid" class="sref">pidp/a> =opa href="+code=find_vpid" class="sref">find_vpidp/a>(pa href="+code=owner" class="sref">owneropa>.pa href="+code=pid" class="sref">pidp/a>); o181opa>        if (pa href="+code=owner" class="sref">owneropa>.pa href="+code=pid" class="sref">pidp/a> &&o!pa href="+code=pid" class="sref">pidp/a>) o182opa>                pa href="+code=ret" class="sref">retp/a> =o-pa href="+code=ESRCH" class="sref">ESRCHp/a>; o183opa>        else o184opa>                pa href="+code=ret" class="sref">retp/a> =opa href="+code=__f_setown" class="sref">__f_setownp/a>(pa href="+code=filp" class="sref">filpopa>, pa href="+code=pid" class="sref">pidp/a>, pa href="+code=typ"" class="sref">typ"opa>,o1); o185opa>        pa href="+code=rcu_read_unlock" class="sref">rcu_read_unlockp/a>(); o186p/a> o187opa>        return pa href="+code=ret" class="sref">retp/a>; o188opa>} o189p/a> o190opa>static intopa href="+code=f_getown_ex" class="sref">f_getown_exp/a>(structopa href="+code=file" class="sref">filep/a> *pa href="+code=filp" class="sref">filpopa>, unsigned longopa href="+code=arg" class="sref">argp/a>) o191opa>{ o192opa>        structopa href="+code=f_owner_ex" class="sref">f_owner_exopa> pa href="+code=__user" class="sref">__userp/a> *pa href="+code=owner_p" class="sref">owner_pp/a> =o(void pa href="+code=__user" class="sref">__userp/a> *)pa href="+code=arg" class="sref">argp/a>; o193opa>        structopa href="+code=f_owner_ex" class="sref">f_owner_exopa> pa href="+code=owner" class="sref">owneropa>; o194opa>        intopa href="+code=ret" class="sref">retp/a> =o0; o195p/a> o196opa>        pa href="+code=read_lock" class="sref">read_lockp/a>(&pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=lock" class="sref">lockp/a>); o197opa>        pa href="+code=owner" class="sref">owneropa>.pa href="+code=pid" class="sref">pidp/a> =opa href="+code=pid_vnr" class="sref">pid_vnrp/a>(pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=pid" class="sref">pidp/a>); o198opa>        switch (pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=pid_typ"" class="sref">pid_typ"opa>) { o199opa>        caseopa href="+code=PIDTYPE_MAX" class="sref">PIDTYPE_MAXp/a>: o200opa>               opa href="+code=owner" class="sref">owneropa>.pa href="+code=typ"" class="sref">typ"opa> =opa href="+code=F_OWNER_TID" class="sref">F_OWNER_TIDopa>; o201opa>                break; o202p/a> o203opa>        caseopa href="+code=PIDTYPE_PID" class="sref">PIDTYPE_PIDp/a>: o204opa>                pa href="+code=owner" class="sref">owneropa>.pa href="+code=typ"" class="sref">typ"opa> =opa href="+code=F_OWNER_PID" class="sref">F_OWNER_PIDopa>; o205opa>                break; o206p/a> o207opa>        caseopa href="+code=PIDTYPE_PGID" class="sref">PIDTYPE_PGIDp/a>: o208opa>                pa href="+code=owner" class="sref">owneropa>.pa href="+code=typ"" class="sref">typ"opa> =opa href="+code=F_OWNER_PGRP" class="sref">F_OWNER_PGRPopa>; o209opa>               obreak; o210p/a> o211opa>        default: o212opa>                pa href="+code=WARN_ON" class="sref">WARN_ONp/a>(1); o213opa>                pa href="+code=ret" class="sref">retp/a> =o-pa href="+code=EINVAL" class="sref">EINVALp/a>; o214opa>                break; o215opa>        } o216opa>        pa href="+code=read_unlock" class="sref">read_unlockp/a>(&pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=lock" class="sref">lockp/a>); o217p/a> o218opa>        if (!pa href="+code=ret" class="sref">retp/a>) { o219opa>               opa href="+code=ret" class="sref">retp/a> =opa href="+code=copy_to_user" class="sref">copy_to_userp/a>(pa href="+code=owner_p" class="sref">owner_pp/a>, &pa href="+code=owner" class="sref">owneropa>, sizeof(pa href="+code=owner" class="sref">owneropa>)); o220opa>               oif (pa href="+code=ret" class="sref">retp/a>) o221opa>                  oooooopa href="+code=ret" class="sref">retp/a> =o-pa href="+code=EFAULT" class="sref">EFAULTp/a>; o222opa>        } o223opa>        return pa href="+code=ret" class="sref">retp/a>; o224opa>} o225p/a> o226opa>#ifdef pa href="+code=CONFIG_CHECKPOINT_RESTORE" class="sref">CONFIG_CHECKPOINT_RESTOREp/a> o227opa>static intopa href="+code=f_getowner_uids" class="sref">f_getowner_uidsp/a>(structopa href="+code=file" class="sref">filep/a> *pa href="+code=filp" class="sref">filpopa>, unsigned longopa href="+code=arg" class="sref">argp/a>) o228opa>{ o229opa>        structopa href="+code=user_nam"space" class="sref">user_nam"spacep/a> *pa href="+code=user_ns" class="sref">user_nsp/a> =opa href="+code=current_user_ns" class="sref">current_user_nsp/a>(); o230opa>        pa href="+code=uid_t" class="sref">uid_topa> pa href="+code=__user" class="sref">__userp/a> *pa href="+code=dst" class="sref">dstp/a> =o(void pa href="+code=__user" class="sref">__userp/a> *)pa href="+code=arg" class="sref">argp/a>; o231opa>        pa href="+code=uid_t" class="sref">uid_topa> pa href="+code=src" class="sref">srcopa>[2]; o232opa>        intopa href="+code=err" class="sref">errp/a>; o233p/a> o234opa>        pa href="+code=read_lock" class="sref">read_lockp/a>(&pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=lock" class="sref">lockp/a>); o235opa>        pa href="+code=src" class="sref">srcopa>[0] =opa href="+code=from_kuid" class="sref">from_kuidp/a>(pa href="+code=user_ns" class="sref">user_nsp/a>f="+code=fd" class="sref">fdopa>, pa href="+/a> o226opa>#ifdef pa href="+code7ilpef=ef pa href="+code7il2 idv32136" class="line" nam"v3L136">o235opa>        pa href="1code=src" class="sref">srcopa>[0] =opa href="+code=from_kuid" class="sref">from_kuidp/a>(pa href="+code=user_ns" class="sref">user_nsp/a>f="+code=fd" class="sref">fdopa>, pa href="+/a> credp/a>->pa href="+6">o226opa>#ifdef pa href=TOREp/a> o216opa>        pa href="+code=read_unlock" class="sref">read_unlockp/a>(&pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="sref">f_owneropa>.pa href="+code=lock" class="sref">lo137p/a>}2o138p/a>2o106opa>        pa href=""+code=pid" class="utdstp/a> =o(void pa h"utdstp/rom_kuid" class="sre>o235opa>        pa href="+cwner_p" class="sref">oref">__userp/a> *pa href="+ccode=lock" class="sref">lfilpopa>)2o106opa>        pa href="+code=arg" class=""utdstp/a> =o(void pa h"utdstp/rom_kuid" class="sre>o235opa>        pa href="1cwner_p" class="sref">oref">__userp/a> *pa href="1ccode=lock" class="sref">lfargp/a>; pidp/a>;2o108opa>                return pa href="+code=err" class="sref2ockp/a>);2pidp/a>);2o183opa>  2PGIDp/a>)2o227opa>static intopa href="+code=f_getowner_uids" class="sref">f_getowner_uidsp/a>(structopa href="+code=file" class="sref">filep/a> *pa href="+code=filp" class="sref">filpopa>, unsigned longopa href="+code=arg" class="sref">pidp/a>;2);2retp/a> =o-pa href="+code=EINVAL" class="sref">EI>pidp/a>;2}2o149p/a>2argp/a>)2filpopado_am"v3">__userp/a> *pao_am"v3ds" cine" nam"v3L227">o22ref">fasyncp/a>(pa href=de=filp" ine" nam"v3L227">o2cmf">euidp/a> =opa ma href=de=filp" class="sref">filpopa>, unsigned longopa href="lass="line" nam"v3L210">pidp/a>;2f_getownp/a>(structopa href="+code=file" class="sref">filep/a> *pa href="+code=filp" class="sref"2>argp/a>;2;2filpopa>o106opa>        pa href="+code=ret" class="sref">retp/a> =o-pa href="+code=EINVAL" class="sref">EI>pidp/a>;2;2o198opacmf">euidp/a> =opa ma hre"+code=ret" class="sref">r>retp/a>;2o167opDUPFopa> =opa href="+cDUPFo7" c"v3L211">o211opa>       >o157p/a>2o208opa>o106opa>        pa href="+code=err" class=f_dup2ref">fasyncp/a>(p_dup2rrom_kuid" class="sre>, unsigned longopa href="+de=file" class="sref">filep/a> *pa href="+coNC" class="sref">FASYNCp/2eropa>));2o209opa>             >retp/a>)2o167opDUPFo_CLOEXEgp/a> &opa hrpDUPFo_CLOEXEg7" c"v3L211">o211opa>       AULTp/a>;2o208opa>o106opa>        pa href="+code=err" class=f_dup2ref">fasyncp/a>(p_dup2rrom_kuid" class="sre>, unsigned longopa href="+de=file" class="sref">filep/a> *pa href="+code=file" class=O_CLOEXEgp/a> &opa hO_CLOEXEg7" cC" class="sref">FASYNCp/2>o161p/a>2o209opa>             >argp/a>;2o163opGETFopa> =opa href="+cGETFo7" c"v3L211">o211opa>       Aneropa>;2o164opa>o106opa>        pa href="+code=err" class=ef="close_o_gete235opa>        pef="close_o_gete2rom_kuid" class="sre2ref">fasyncp/a>(pa hre) ?nam"v3L163">o163oo_CLOEXEgp/a> &opa hro_CLOEXEg7" c :code=ret" class="sref">re2_MAXp/a>;2o165opa>            2   break;2o163opSETFopa> =opa href="+cSETFo7" c"v3L211">o211opa>       Aretp/a>;2o164opa>o106opa>        pa href="+code=ret" class="sref">re2_o157p/a>2o168opasf="close_o_gete235opa>        psf="close_o_gete2rom_kuid" class="sre2ref">fasyncp/a>(pa hrecode=file" class=sref">filpopa>, (pa href="+code=arg" class="srefo_CLOEXEgp/a> &opa hro_CLOEXEg7" cC" class="sref">FASYNCp/2>ropa>));2o169opa>            2  obreak;2o167opGETF>retp/a> =o-pa hopGETF>7" c"v3L211">o211opa>       >o170p/a>2o208opa>o106opa>        pa href="+code=err" class=fFL_MASKp/a>) | (pa href="+code=filp" class="sref">filpopa>->pa href="+code=f9">o169opa>            2 o161p/a>2o169opa>            2 argp/a>;2o163opSETF>retp/a> =o-pa hopSETF>7" c"v3L211">o211opa>       >neropa>;2o164opa>o106opa>        pa href="+code=err" class=sf=f3">__userp/a> *psf=f3rom_kuid" class="sre2ref">fasyncp/a>(pa hrecode=file" class="sref">filep/a> *pa href="+code=file" class=>, unsigned longopa href="9">o169opa>            2 MAXp/a>;2o165opa>            2 default:2o163opGETL &o~pa href=opGETL 7" c"v3L211">o211opa>       >retp/a>;2o164opa>o106opa>        pa href="+cde=file" class="a>  =f_glilpopa>->pa hra>  =f_glirom_kuid" class="sre2sref">filep/a> *pa href="+coclass="sref">f_getowner_">filpopa>->pa hr href="+st" class="sref">dstp/a> =o(void pa href="+code=__ode=file" class=>, unsigned longopa href="9">o169opa>            2 o157p/a>2o165opa>            2 ropa>));2o199opSETL &o~pa href=opSETL 7" c"v3L211">o211opa>       ckp/a>();2o167opSETL W&o~pa href=opSETL W7" c"v3L211">o211opa>       co170p/a>2o208opa>o106opa>        pa href="+code=err" class=fa>  =s_glilpopa>->pa hra>  =s_glirom_kuid" class="sre2ref">fasyncp/a>(pa hrecode=file" class="sref">filep/a> *pa href="+code=file" class=cmf">euidp/a> =opa ma href=class="sref">f_getowner_">filpopa>->pa hr href="+st" class="sref">dstp/a> =o(void pa href="+code=__ode=file" class=>, unsigned longopa href="9">o169opa>            2>pidp/a>)2o165opa>            2SRCHp/a>;2o163opGETOW           pa hropGETOW 7" c"v3L211">o211opa>       cneropa>;2/*,o1);2lass="line" nam" * XXX If ef="+co is a process group, thelass="line" nam" * negativeine" namvalue will f_g>o 9vertref=spanclass="line" nam"v3L225"oretp/a>;2lass="line" nam" * into anha hor.  Oops.  If we keep the2lass="line" nam" * e=curre syscall o 9ventions, the only way));2lass="line" nam" * to fix this will be in libc.o189p/a>2lass="line" nam" */o170p/a>2o208opa>o106opa>        pa href="+code=err" class=f_ref">pid_topa> pa href="+code=f_gede=file" class="sref">filep/a> *pa href="+c5">o165opa>            2o191opa>{2filep/a> *pa ref=_successfu =syscall_ne" na=f_gec5">o165opa>            2oRCHp/a>;2o165opa>            2wneropa>;2o167opSETOW           pa hropSETOW 7" c"v3L211">o211opa>       p/a> =o0;2o208opa>o106opa>        pa href="+code=err" class=f_5">o115p/a>intopa href="+code=f_sede=file" class="sref">filep/a> *pa href="+code=file" class=>, unsigned longopa href=code=typ"" class="sref">typ2>o195p/a>2o165opa>            2wretp/a>;2o167opGETOW _E  caseopa href="opGETOW _E 7" c"v3L211">o211opa>       po157p/a>2o208opa>o106opa>        pa href="+code=err" class=f_opa>static intopa href="+code=f_getown_ede=file" class="sref">filep/a> *pa href="+code=file" class=>, unsigned longopa href="9">o169opa>            2p"opa>) {2o169opa>            3_MAXp/a>:3o167opSETOW _E  caseopa href="opSETOW _E 7" c"v3L211">o211opa>      3_TIDopa>;3o208opa>o106opa>        pa href="+code=err" class=f_5">o11atic intopa href="+code=f_setown_ede=file" class="sref">filep/a> *pa href="+code=file" class=>, unsigned longopa href="9">o169opa>            3   break;3o169opa>            3_3 break;3o203opGETOW ER_UIDS caseopa href="opGETOW ER_UIDS7" c"v3L211">o211opa>      3_4 break;3o204opa>o106opa>        pa href="+code=err" class=f_opa>static intopa href="+code=f_getowner_uids" cde=file" class="sref">filep/a> *pa href="+code=file" class=>, unsigned longopa href="9">o169opa>            3 5 break;3o205opa>            3   break;3o163opGETSIG caseopa href="opGETSIG7" c"v3L211">o211opa>      3_7 break;3o164opa>o106opa>        pa href="+cde=file" class="unlockp/a>(&pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="s=filum">__userp/a> *psfilumde=f9">o169opa>            3PGIDp/a>:3o205opa>            3 9IDp/a>:3o199opSETSIG caseopa href="opSETSIG7" c"v3L211">o211opa>      3  obreak;3/* a h_typ0inestonesine" nam behaviour. */o210p/a>3o218valid_sfila3">__userp/a> *pvalid_sfila3rom_kuid" class="sre>, unsigned longopa href=)"+code=ret" class="sref">3 default:3o205opa>            3Np/a>(1);3;3o164opa>o106opa>        pa href="+code=ret" class="sref">re3   break;3o208opa"unlockp/a>(&pa href="+code=filp" class="sref">filpopa>->pa href="+code=f_owner" class="s=filum">__userp/a> *psfilumde=f"+code=who" class="sref">whop/a> =opa href="+code=arg" class="sref3        }3o165opa>            3ockp/a>);3o167opGETLEAS="+code=CONFIG_CopGETLEAS=7" c"v3L211">o211opa>      3 GIDp/a>:3o208opa>o106opa>        pa href="+code=err" class=fa>  =f_glee" lpopa>->pa hra>  =f_glee" =f_gede=file" class="sref">filep/a> *pa href="+c5">o165opa>            3etp/a>) {3o165opa>            3eropa>));3o167opSETLEAS="+code=CONFIG_CopSETLEAS=7" c"v3L211">o211opa>      3>retp/a>)3o208opa>o106opa>        pa href="+code=err" class=fa>  =s_glee" lpopa>->pa hra>  =s_glee" =f_gede=file" class="ref">fasyncp/a>(pa hrecode=file" class="sref">filep/a> *pa href="+code=file" class=>, unsigned longopa href="9">o169opa>            3AULTp/a>;3o169opa>            3        }3o203opNOTIFY"+code=CONFIG_CopNOTIFY7" c"v3L211">o211opa>      3>VALp/a>;3o124opa>o106opa>        pa href="+code=err" class=fa>  =dirnotifylpopa>->pa hra>  =dirnotify=f_gede=file" class="ref">fasyncp/a>(pa hrecode=file" class="sref">filep/a> *pa href="+code=file" class=>, unsigned longopa href="9">o169opa>            3A  break;3o205opa>            3>o225p/a>3o163opSETPIPE_SZ"+code=CONFIG_CopSETPIPE_SZ7" c"v3L211">o211opa>      3>ckp/a>);3o167opGETPIPE_SZ"+code=CONFIG_CopGETPIPE_SZ7" c"v3L211">o211opa>      3>GIDp/a>:3o208opa>o106opa>        pa href="+code=err" class=pipe_am"v3">__userp/a> *ppipe_am"v3ds" cde=file" class="sref">filep/a> *pa href="+code=file" class=cmf">euidp/a> =opa ma href=de=file" class=>, unsigned longopa href="9">o169opa>            3Atp/a>) {3o165opa>            3nsp/a>();3o211opa>      3>argp/a>;3o201opa>            3copa>[2];3errp/a>;3o223op          return pa href="+code=err" class="sref3>o233p/a>3);3o2check_am"v3_cmf">euidp/a> =opa heck_am"v3_cmfds" cde=filp" de=file" class=cmf">euidp/a> =opa ma hrecode=filp" class="sref"3=TOREp/a>33o137p/a>}3o198opacmf">euidp/a> =opa ma hre"+code=ret" class="sref">3>o138p/a>3o199opDUPFopa> =opa href="+cDUPFo7" c"v3L211">o211opa>      3filpopa>)3o167opDUPFo_CLOEXEgp/a> &opa hrpDUPFo_CLOEXEg7" c"v3L211">o211opa>      3fargp/a>;3o171opGETFopa> =opa href="+cGETFo7" c"v3L211">o211opa>      3>pidp/a>;3o163opSETFopa> =opa href="+cSETFo7" c"v3L211">o211opa>      3ockp/a>);3o163opGETF>retp/a> =o-pa hopGETF>7" c"v3L211">o211opa>      3pidp/a>);3o215opa3>pidp/a>;3re3ockp/a>);3o215opa3>137p/a>}3}3o163SYSCALL_DEFINE3retp/a> =o-pa hSYSCALL_DEFINE3ds" cde=file" class="m"v3">__userp/a> *pam"v3ds" f=de=filp" inecode=file" class="ref">fasyncp/a>(pa href=de=filp" inecode=file" class=cmf">euidp/a> =opa ma href=de=filp" clasf=de=file" class=>, unsigned longopa href="lass="line" nam"v3L1383>o149p/a>3argp/a>;3f_getowner_ref">fasyncp/a>(pa hresref">f_getowner_ef">fasyncp/a>(pref="+code=err" class=fdef="rawef">fasyncp/a>(paef="raw=f_gede=file" class="ref">fasyncp/a>(pa hre"9">o169opa>            3>pidp/a>;3filpopa>o106opa>        pa href="+code=ret" class="sBADF06opa>        psBADFref="+code=err" class="sref3>argp/a>;3;3o218_ef">fasyncp/a>(pref=_owner" class="setownp/a>(structopa href="+"lass="line" nam"v3L1383>GIDp/a>)3filpopaouf">__userp/a> *poufref="+code=err" class="sref3>pidp/a>;3retp/a>;3o220opa>   unlikelylpopa>->pa hunlikely=f_gede=file" class="ef">fasyncp/a>(pref=_owner" class="setownp/a>(structopa href="+code=filp" class="srefm="spopa>->pa hrefm="s7" cl+code=arg" class="srefMODE_PAT">retp/a> =o-pa fMODE_PAT"ref=)"+code=ret" class="sref">3>o157p/a>3o218check_am"v3_cmf">euidp/a> =opa heck_am"v3_cmfds" cv3L198">o198opacmf">euidp/a> =opa ma hre""lass="line" nam"v3L1383>148opa>}3filpopaouf1">__userp/a> *pouf1ref="+code=err" class="sref3>retp/a>)3o215opa3AULTp/a>;3o161p/a>3o208opa>o106opa>        pa href="+code=err" class=security_ hre_am"v3">__userp/a> *psecurity_ hre_am"v3=f_gede=file" class="ef">fasyncp/a>(pref=_owner" class="setownp/a>(structopa href="+code=file" class=cmf">euidp/a> =opa ma href=de=file" class=>, unsigned longopa href="9">o169opa>            3>argp/a>;3o218>o106opa>        pa href="lass="line" nam"v3L1383Aneropa>;3o164opa>o106opa>        pa href="+code=err" class=do_am"v3">__userp/a> *pao_am"v3ds" cde=file" class="ref">fasyncp/a>(pa hrecode=file" class=cmf">euidp/a> =opa ma href=de=file" class=>, unsigned longopa href=code=file" class="ef">fasyncp/a>(pref=_owner" class="setownp/a>(structopa href="+"9">o169opa>            3>GIDp/a>)3filpopaouf1">__userp/a> *pouf1ref="v3L211">o211opa>      3Aretp/a>;3__userp/a> *p"rpuf=f_gede=file" class="ef">fasyncp/a>(pref="9">o169opa>            3>o157p/a>3filpopaouf">__userp/a> *poufref="v3L211">o211opa>      3A148opa>}3o223op          return pa href="+code=err" class="sref3  obreak;3o215opa3>o170p/a>33;3o163SYSCALL_DEFINE3retp/a> =o-pa hSYSCALL_DEFINE3ds" cde=file" class="m"v3fasyncp/a>(pa href=de=filp" inecode=file" class=cmf">euidp/a> =opa ma hreflass="line" nam"v3L1613 neropa>;3, unsigned longopa href="lass="line" nam"v3L1383 MAXp/a>;3f_getowner_ref">fasyncp/a>(pa hresref">f_getowner_ef">fasyncp/a>(pref="+code=err" class=fdef="rawef">fasyncp/a>(paef="raw=f_gede=file" class="ref">fasyncp/a>(pa hre"9">o169opa>            3>retp/a>;3filpopa>o106opa>        pa href="+code=ret" class="sBADF06opa>        psBADFref="+code=err" class="sref3 o157p/a>3));3o218_ef">fasyncp/a>(pref=_owner" class="setownp/a>(structopa href="+"lass="line" nam"v3L1383ckp/a>();3filpopaouf">__userp/a> *poufref="+code=err" class="sref3co170p/a>3pidp/a>)3o220opa>   unlikelylpopa>->pa hunlikely=f_gede=file" class="ef">fasyncp/a>(pref=_owner" class="setownp/a>(structopa href="+code=filp" class="srefm="spopa>->pa hrefm="s7" cl+code=arg" class="srefMODE_PAT">retp/a> =o-pa fMODE_PAT"ref=)"+code=ret"ne" nam"v3L1613>argp/a>;3o218check_am"v3_cmf">euidp/a> =opa heck_am"v3_cmfds" cv3L198">o198opacmf">euidp/a> =opa ma hre""lass="line" nam"v3L1383cneropa>;3filpopaouf1">__userp/a> *pouf1ref="+code=err" class="sref3opa>,o1);3o215opa3odefault:3;3o106opa>        pa href="+code=err" class=security_ hre_am"v3">__userp/a> *psecurity_ hre_am"v3=f_gede=file" class="ef">fasyncp/a>(pref=_owner" class="setownp/a>(structopa href="+code=file" class=cmf">euidp/a> =opa ma href=de=file" class=>, unsigned longopa href="9">o169opa>            3oo157p/a>3o218>o106opa>        pa href="lass="line" nam"v3L1383oropa>));3filpopaouf1">__userp/a> *pouf1ref="+code=err" class="sref3>o189p/a>3o198opacmf">euidp/a> =opa ma hre"+code=ret" class="sref">3o191opa>{3o163opGETL o211opa>      3oRCHp/a>;3o106opa>        pa href="+code=err" class=ra>  =f_glkfasyncp/a>(pref=_owner" class="setownp/a>(structopa href="+coclass="sref">f_getowner_">fifif_getowner>dstp/a> =o(void pa href="+code=__ode=file" class=>, unsigned longopa href="9">o169opa>            3wneropa>;3o201opa>            3p/a> =o0;3o167opSETL o211opa>      3odefault:3o167opSETL Wo211opa>      3oretp/a>;3o106opa>        pa href="+code=err" class=ra>  =s_glkfasyncp/a>(pa hrecode=file" class="ef">fasyncp/a>(pref=_owner" class="setownp/a>(structopa href="+code=file" class=cmf">euidp/a> =opa ma hrefv3L211">o211opa>      3oo157p/a>3f_getowner_">fifif_getowner>dstp/a> =o(void pa href="+code=__ode=file" class=>, unsigned longopa href="9">o169opa>            3wropa>));3o201opa>            4_MAXp/a>:4o211opa>      4_TIDopa>;4o106opa>        pa href="+code=err" class=do_am"v3">__userp/a> *pao_am"v3ds" cde=file" class="ref">fasyncp/a>(pa hrecode=file" class=cmf">euidp/a> =opa ma href=de=file" class=>, unsigned longopa href=code=file" class="ef">fasyncp/a>(pref=_owner" class="setownp/a>(structopa href="+"9">o169opa>            4_2IDopa>;4o201opa>            4_3IDopa>;4o215opa4_4 break;4filpopaouf1">__userp/a> *pouf1ref="v3L211">o211opa>      4 5 break;4__userp/a> *p"rpuf=f_gede=file" class="ef">fasyncp/a>(pref="9">o169opa>            4   break;4filpopaouf">__userp/a> *poufref="v3L211">o211opa>      4_7 break;4o223op          return pa href="+code=err" class="sref4PGIDp/a>:4:4o210p/a>4/* Table to o 9vert sigio sfila3 223os into poll band bitmaps */;4filpopaband_table       return pband_table3" c[="sref">filpopaNSIGPOL>retp/a> =o-pa hNSIGPOL>3" ccodecode=ret" class="sref">4NVALp/a>;4filpopaPOL>I           pa hrPOL>I 4" cl|i="sref">filpopaPOL>RDNORM          pa hrPOL>RDNORMref=co"line" nam"lass="lidspanhref="fscomment">/* POL>_IN */OU>retp/a> =o-pa hPOL>OU>4" cl|i="sref">filpopaPOL>WRNORM          pa hrPOL>WRNORM4" cl|i="sref">filpopaPOL>WRBANopa> =opa href="POL>WRBANoref=co"linedspanhref="fscomment">/* POL>_OU> */I           pa hrPOL>I 4" cl|i="sref">filpopaPOL>RDNORM          pa hrPOL>RDNORMref=l|i="sref">filpopaPOL>MSG caseopa href="POL>MSGref=co"line" nadspanhref="fscomment">/* POL>_MSG */ERR caseopa href="POL>ERRref=co"line" nam"lass="linam"lass="lidspanhref="fscomment">/* POL>_ERR */:4PRI caseopa href="POL>PRI4" cl|i="sref">filpopaPOL>RDBANopa> =opa href="POL>RDBANoref=co"line" nam"lass="ldspanhref="fscomment">/* POL>_PRI */:4HUPpa> =opa href="POL>HUP4" cl|i="sref">filpopaPOL>ERR caseopa href="POL>ERRref=am"lass="linam"lass="lidspanhref="fscomment">/* POL>_HUP */));4;4filpopain/fcntlaseopa href="in/fcnref=aine" nam"v3L227">o2sigio_perm">__userp/a> *psfiio_perm=f_gelass="sref">f_getownertask_lass="">__userp/a> *ptask_lass="code=_ref">f_getowneref">filep/a> *pap hrefv3L211">o211opa>      4        }4f_getowner_=f_slass="">__userp/a> *p_=f_slass="code=_ref">f_getownerfo115p/a>intopa hrefode=f_s,aine" nam"v3L227">o2sig">__userp/a> *psfiref="lass="line" nam"v3L1384>VALp/a>;44A  break;4f_getownercref">euidp/a> =opa redcode=_ref">f_getownercref">euidp/a> =opa redcode"+code=err" class="sref4>  break;4o2ne"">euidp/a> =opane"code"+code=err" class="sref4>7 break;4o234opa>        pa href=cu_>o234opa>=f_ge"9">o169opa>            4Atp/a>) {4euidp/a> =opa redcode=+code=err" class=__task_cref">euidp/a> =opa__task_cref=f_gede=file" class=ef">filep/a> *pap hre"9">o169opa>            4nsp/a>();4euidp/a> =opane"code"+co220">o220opa>   uid_eqlpopa>->pa huid_eq=f_gede=file" class="o115p/a>intopa hrefode=f_scode=filp" class="sref">credp/a>->pa href="+code=file" class=GLOBAL_ROOT_UIDcredp/a>->paGLOBAL_ROOT_UID hre"+||">o169opa>            4nretp/a>)4o220opa>   uid_eqlpopa>->pa huid_eq=f_gede=file" class="o115p/a>intopa hrefode=f_scode=filp" class="sref">credp/a>->pa href="+code=file" class=cref">euidp/a> =opa redcodecode=filp" class="srsf">credp/a>->pashref="+6+||"20">o220opa>   uid_eqlpopa>->pa huid_eq=f_gede=file" class="o115p/a>intopa hrefode=f_scode=filp" class="sref">credp/a>->pa href="+code=file" class=cref">euidp/a> =opa redcodecode=filp" class="sr6" class="line" nam"v3L226+||">o169opa>            4nULTp/a>;4o220opa>   uid_eqlpopa>->pa huid_eq=f_gede=file" class="o115p/a>intopa hrefode=f_scode=filp" class="sr6" class="line" nam"v3L22,line" nam"v3L179"cref">euidp/a> =opa redcodecode=filp" class="srsf">credp/a>->pashref="+6+||"20">o220opa>   uid_eqlpopa>->pa huid_eq=f_gede=file" class="o115p/a>intopa hrefode=f_scode=filp" class="sr6" class="line" nam"v3L22,line" nam"v3L179"cref">euidp/a> =opa redcodecode=filp" class="sr6" class="line" nam"v3L226)l+code+code">o169opa>            4n       }4o218security_ hre_send_sfiiotaskcredp/a>->pasecurity_ hre_send_sfiiotask=f_gede=file" class=ef">filep/a> *pap hrecode=file" class="o115p/a>intopa hrefode=f_s,a nam"v3L227">o2sig">__userp/a> *psfiref=""9">o169opa>            4nVALp/a>;4filpopa=cu_>o234opa>        pa href="+cu_>o234opa>  =f_ge"9">o169opa>            4ockp/a>);4o223opne"">euidp/a> =opane"code"+code=err" class="sref4="+code7i4pef=ef pa href="+code7il4 idv34136" class="line" nam"v3L148"4=TOREp/a>4->pasend_sfiio_to_task=f_gelass="sref">f_getownertask_lass="">__userp/a> *ptask_lass="code=_ref">f_getowneref">filep/a> *pap hrefv3L211">o211opa>      4>o138p/a>4f_getowner_=f_slass="">__userp/a> *p_=f_slass="code=_ref">f_getownerfo115p/a>intopa hrefode=f_s,v3L211">o211opa>      4filpopa>)4o22ref">fasyncp/a>(pa href=ine" nam"v3L227">o2neaso15p/a>intopa hreneaso1 href=ine" nam"v3L227">o2group5p/a>intopa hregroupref="lass="line" nam"v3L1384fargp/a>;44>pidp/a>;4/*);4lass="lin* opSETSIG canhrhange code=sfilum a>  less in parallel, make);4lass="lin* sure we >o23 it once and use the sc#Lmvalue throughout.)4lass="lin*/pidp/a>;4o2=filum">__userp/a> *psfilumde=f"+code=who" class=ACCESS_ONCE">__userp/a> *pACCESS_ONCE=f_gede=file" class="o115p/a>intopa hrefode=f_scode=filp" class="sr=filum">__userp/a> *psfilumde=f"9">o169opa>            4ockp/a>);4o218sigio_perm">__userp/a> *psfiio_perm=f_gede=file" class=ef">filep/a> *pap hrecode=file" class="o115p/a>intopa hrefode=f_s,a nam"v3L227">o2siglum">__userp/a> *psfilumde=f""lass="line" nam"v3L1384fo138p/a>4o169opa>            4>o149p/a>4argp/a>;4o198opasiglum">__userp/a> *psfilumde=f"ecode=ret" class="sref">4>pidp/a>;4o220opa>   sfiinfo_t">__userp/a> *psfiinfo_t2" cl20">o220opa>   sf">__userp/a> *psfcode"+code=err" class="sref4>argp/a>;4o211opa>      4wneropa>;4/* Queue a rt sigla3 e" h the appropriate fd as itsGIDp/a>)4lass="line" nam"           value.  We use SI_SIGIO as the source, noe" /spanclass="line" nam"v3L2254>pidp/a>;4lass="line" nam"           SI_KERNEL, since kernel sigla3s always f_g> /spanclass="line" nam"v3L2254>ckp/a>);4lass="line" nam" "line" namnelivered evenine"we can't queue.  Failure to /spanclass="line" nam"v3L2254>137p/a>}4lass="line" nam"           queue in this ne" n_should_ be reportre;"we fall /spanclass="line" nam"v3L2254>o138p/a>4lass="line" nam"           back to SIGIO in that ne" . --s="s*/retp/a>)4o220opa>   sf">__userp/a> *psfcode_owner" class="s=f_sfilo">__userp/a> *psf_sfilode=f"+code=who" class==filum">__userp/a> *psfilumde=f9">o169opa>            4AULTp/a>;4__userp/a> *psfcode_owner" class="s=f_errlo">__userp/a> *psf_errlode=f"+code=ret" class="sref">re4>o161p/a>4__userp/a> *psfcode_owner" class="s=f_ss="">__userp/a> *psf_ss="2" cla+code=who" class=neaso15p/a>intopa hreneaso1 hrede=ret" class="sref">re4>argp/a>;4/* Make sure we are called e" h one of the POL>_*;4lass="linnnnnnnnnnnnnnnnnnnneaso1s, otherwise we could leak kernel stack into)4lass="line" nam"           f="+space.  */pidp/a>;4intopa hreBUG_ON=f_ge"v3L198">o198opaneaso15p/a>intopa hreneaso1 hrel+code=arg" class="sre__SI_MAS &o~pa href=__SI_MAS de=f"e!+code=err" class=__SI_POL>retp/a> =o-pa h__SI_POL>de=f"9">o169opa>            4Aretp/a>;4o218neaso15p/a>intopa hreneaso1 hrel-i="sref">filpopaPOL>_I           pa hrPOL>_I 4" clode=+code=err" class=NSIGPOL>retp/a> =o-pa hNSIGPOL>3" c"lass="line" nam"v3L1384>o157p/a>4__userp/a> *psfcode_owner" class="s=f_band">__userp/a> *psf_band2" cla+c~0L9">o169opa>            4Ao138p/a>4o169opa>            4  obreak;4__userp/a> *psfcode_owner" class="s=f_band">__userp/a> *psf_band2" cl+code=err" class=band_table       return pband_table3" c[="sref">filpopaneaso15p/a>intopa hreneaso1 hrel-i="sref">filpopaPOL>_I           pa hrPOL>_I 4" c]9">o169opa>            4>o170p/a>4__userp/a> *psfcode_owner" class="s=f_2ref">fasyncp/a>(=f_2r1" class+code=err" class=fdef">fasyncp/a>(pa hre9">o169opa>            4>o161p/a>4o218do_send_sfi_infoef">fasyncp/a>(do_send_sfi_info=f_gede=file" class==filum">__userp/a> *psfilumde=f,l+codede=file" class=sf">__userp/a> *psfcode,a nam"v3L227">o2ef">filep/a> *pap hrecode=file" class=group5p/a>intopa hregroupref=""lass="line" nam"v3L1384 argp/a>;4o201opa>            4 neropa>;4/* fall-through: fall back on the old plain SIGIO sigla3 */;4o211opa>      4 default:4fasyncp/a>(do_send_sfi_info=f_gede=file" class=SIGIOef">fasyncp/a>(SIGIO hrecode=file" class=SEND_SIG_PRIVef">fasyncp/a>(SEND_SIG_PRIVcode,a nam"v3L227">o2ef">filep/a> *pap hrecode=file" class=group5p/a>intopa hregroupref="1">o201opa>            4 retp/a>;44));4();4->pasend_sfiio=f_gelass="sref">f_getowner_=f_slass="">__userp/a> *p_=f_slass="code=_ref">f_getownerfo115p/a>intopa hrefode=f_s,aine" nam"v3L227">o22ref">fasyncp/a>(pa href=ine" nam"v3L227">o2band">__userp/a> *pband2" c"lass="line" nam"v3L1384co170p/a>44>pidp/a>)4f_getownertask_lass="">__userp/a> *ptask_lass="code=_ref">f_getowneref">filep/a> *pap hre1">o201opa>            4>argp/a>;4f_getownereid_type       return peid_type2" cl20">o220opa>   type       return ptype2" c1">o201opa>            4>neropa>;4f_getownerp" class="line" napidcode=_ref">f_getownerp" class="line" napidcode1">o201opa>            4>MAXp/a>;4o2group5p/a>intopa hregroupref=s+c1"+code=err" class="sref4odefault:4o234opa>        pa href=o234opa>=f_ge+codede=file" class="o115p/a>intopa hrefode=f_scode=filp" class="sropa>        pa hrefopa>=f_g"1">o201opa>            4oo157p/a>4));4intopa hrefode=f_scode=filp" class="sreid_type       return peid_type2" c1">o201opa>            4>o189p/a>4o218type       return ptype2" cs++code=err" class=PIDTYPE_MA  caseopa href="PIDTYPE_MA de=f"ecode=ret" class="sref">4>o170p/a>4o220opa>   group5p/a>intopa hregroupref=s+code=ret" class="sref">re4o191opa>{4->paPIDTYPE_PID2" c1">o201opa>            4>argp/a>;4o215opa4wneropa>;4o215opa4wMAXp/a>;4intopa hrefode=f_scode=filp" class="sreidclass="line" napidcode1">o201opa>            4odefault:4o218eidclass="line" napidcode"lass="line" nam"v3L1384oretp/a>;4filpopaouf4opa>  _fo115p/a>intopa hreouf4opa>  _fo11code1">o201opa>            4oo157p/a>4o201opa>            4oropa>));4o234opa>        pa href=o234opa>=f_ge+codede=file" class=tasklist4opa>        pa hreftasklist4opa>=f_g"1">o201opa>            5_MAXp/a>:5->pado_each_eid_task=f_gede=file" class=eidclass="line" napidcodecode=file" class=type       return ptype2" c,a nam"v3L227">o2ef">filep/a> *pap hre"ecode=ret" class="sref">5_TIDopa>;5->pasend_sfiio_to_task=f_ge nam"v3L227">o2ef">filep/a> *pap hrecode=file" class="o115p/a>intopa hrefode=f_s,a nam"v3L227">o2"ref">fasyncp/a>(pa hrecode=file" class=band">__userp/a> *pband2" ccode=file" class=group5p/a>intopa hregroupref="1">o201opa>            5_2IDopa>;5->pawhhre_each_eid_task=f_gede=file" class=eidclass="line" napidcodecode=file" class=type       return ptype2" c,a nam"v3L227">o2ef">filep/a> *pap hre"1">o201opa>            5_3IDopa>;5o234opa>        pa href="+o234opa>  =f_ge+codede=file" class=tasklist4opa>        pa hreftasklist4opa>=f_g"1">o201opa>            5_4IDopa>;5f_getownerouf4opa>  _fo115p/a>intopa hreouf4opa>  _fo11code"v3L211">o211opa>      5 5 break;5o234opa>        pa href="+o234opa>  =f_ge+codede=file" class="o115p/a>intopa hrefode=f_scode=filp" class="sropa>        pa hrefopa>=f_g"1">o201opa>            5   break;5->pasend_sfiurg_to_task=f_gelass="sref">f_getownertask_lass="">__userp/a> *ptask_lass="code=_ref">f_getowneref">filep/a> *pap hrefv3L211">o211opa>      5 9IDp/a>:5f_getowner_=f_slass="">__userp/a> *p_=f_slass="code=_ref">f_getownerfo115p/a>intopa hrefode=f_s,aine" nam"v3L227">o2group5p/a>intopa hregroupref="lass="line" nam"v3L1385  obreak;55>o210p/a>5o218sigio_perm">__userp/a> *psfiio_perm=f_gede=file" class=ef">filep/a> *pap hrecode=file" class="o115p/a>intopa hrefode=f_s,a nam"v3L227">o2SIGURG caseopa href="SIGURGref=""lass="line" nam"v3L1385 default:5fasyncp/a>(do_send_sfi_info=f_gede=file" class=SIGURG caseopa href="SIGURGref=code=file" class=SEND_SIG_PRIVef">fasyncp/a>(SEND_SIG_PRIVcode,a nam"v3L227">o2ef">filep/a> *pap hrecode=file" class=group5p/a>intopa hregroupref="1">o201opa>            5 3IDopa>;5;5o215opa5 5 break;5o2=end_sfiurgcredp/a>->pasend_sfiurg=f_gelass="sref">f_getowner_=f_slass="">__userp/a> *p_=f_slass="code=_ref">f_getownerfo115p/a>intopa hrefode=f_s"lass="line" nam"v3L1385   break;55>7 break;5f_getownertask_lass="">__userp/a> *ptask_lass="code=_ref">f_getowneref">filep/a> *pap hre1">o201opa>            5 GIDp/a>:5f_getownereid_type       return peid_type2" cl20">o220opa>   type       return ptype2" c1">o201opa>            5 9IDp/a>:5f_getownerp" class="line" napidcode=_ref">f_getownerp" class="line" napidcode1">o201opa>            5eropa>));5o2group5p/a>intopa hregroupref=s+c1"+code=err" class="sref5>retp/a>)5o2ne"">euidp/a> =opane"code"+code=ret" class="sref">re5AULTp/a>;5re5A3IDopa>;5o234opa>        pa href=o234opa>=f_ge+codede=file" class="o115p/a>intopa hrefode=f_scode=filp" class="sropa>        pa hrefopa>=f_g"1">o201opa>            5>VALp/a>;5o215opa5A  break;5intopa hrefode=f_scode=filp" class="sreid_type       return peid_type2" c1">o201opa>            5>  break;5o218type       return ptype2" cs++code=err" class=PIDTYPE_MA  caseopa href="PIDTYPE_MA de=f"ecode=ret" class="sref">5>7 break;5o220opa>   group5p/a>intopa hregroupref=s+code=ret" class="sref">re5>GIDp/a>:5->paPIDTYPE_PID2" c1">o201opa>            5Atp/a>) {5();5)5intopa hrefode=f_scode=filp" class="sreidclass="line" napidcode1">o201opa>            5nULTp/a>;5o218eidclass="line" napidcode"lass="line" nam"v3L1385n       }5filpopaouf4opa>  _fo115p/a>intopa hreouf4opa>  _fo11code1">o201opa>            5nVALp/a>;5o215opa5ockp/a>);5o"">euidp/a> =opane"code"+c1"+code=err" class="sref5="+code7i5pef=ef pa href="+code7il5 idv353L96" class="l+code=err" class="sref5=TOREp/a>5o234opa>        pa href=o234opa>=f_ge+codede=file" class=tasklist4opa>        pa hreftasklist4opa>=f_g"1">o201opa>            5o137p/a>}5->pado_each_eid_task=f_gede=file" class=eidclass="line" napidcodecode=file" class=type       return ptype2" c,a nam"v3L227">o2ef">filep/a> *pap hre"ecode=ret" class="sref">5>o138p/a>5->pasend_sfiurg_to_task=f_gede=file" class=ef">filep/a> *pap hrecode=file" class="o115p/a>intopa hrefode=f_s,a nam"v3L227">o2group5p/a>intopa hregroupref="1">o201opa>            5filpopa>)5->pawhhre_each_eid_task=f_gede=file" class=eidclass="line" napidcodecode=file" class=type       return ptype2" c,a nam"v3L227">o2ef">filep/a> *pap hre"1">o201opa>            5fargp/a>;5o234opa>        pa href="+o234opa>  =f_ge+codede=file" class=tasklist4opa>        pa hreftasklist4opa>=f_g"1">o201opa>            5>pidp/a>;5f_getownerouf4opa>  _fo115p/a>intopa hreouf4opa>  _fo11code"v3L211">o211opa>      5ockp/a>);5o234opa>        pa href="+o234opa>  =f_ge+codede=file" class="o115p/a>intopa hrefode=f_scode=filp" class="sropa>        pa hrefopa>=f_g"1">o201opa>            5pidp/a>);5o223opne"">euidp/a> =opane"code"+code=err" class="sref5PGIDp/a>)5pidp/a>;5);5filpopaDEFINE_SPINLOC &o~pa href=DEFINE_SPINLOC =f_gede=file" class=fasync4opa>        pa hreffasync4opa>=f_g"1">o201opa>            5p137p/a>}5f_getownerkmem_cache       return pkmem_cachecode=_ref">f_getownerfasync4cache       return pfasync4cache2" clref">f_getowner__>o234mostlylpopa>->pa h__>o234mostlycode"+code=err" class="sref5Po138p/a>5o149p/a>5f_getowner+cu_ho23">euidp/a> =opancu_ho23code=_ref">f_getownerho23">euidp/a> =opaho23code"lass="line" nam"v3L1385>argp/a>;55>pidp/a>;5f_getownerkmem_cache4free       return pkmem_cache4free=f_gede=file" class=fasync4cache       return pfasync4cache2" cfv3L211">o211opa>      5>argp/a>;5f_getownercontafcnr_o"ef">fasyncp/a>(contafcnr_o"=f_gede=file" class=ho23">euidp/a> =opaho23code,ilass="sref">f_getowner_async4lass="">__userp/a> *p_async4lass=" hrecode=file" class="a_rcu       return pfa_rcu=f_g""9">o169opa>            5wneropa>;5GIDp/a>)5pidp/a>;5/*ckp/a>);5l* Remove a _async entry. If successfullyinemoved,ine" na137p/a>}5l* positive and clear the FASYNC flag. If no entry exists,o138p/a>5l* do noehing and ne" nam0.retp/a>)5l*argp/a>;5l* NOTE! It is very important that the FASYNC flag alwayspidp/a>;5l* ma namthe state "is the filp on a _async list".argp/a>;5l*neropa>;5l*/)5o2_async4nemove_entry">__userp/a> *p_async4nemove_entry=f_gelass="sref">f_getowner_townp/a>(structopa href="+=_ref">f_getownerfilpnp/a>(structopa hrpcode,ilass="sref">f_getowner_async4lass="">__userp/a> *p_async4lass=" hre *_ref">f_getownerfappnp/a>(structopa appcode"lass="line" nam"v3L1385>pidp/a>;55Aretp/a>;5f_getowner_async4lass="">__userp/a> *p_async4lass=" hre *ref">f_getowner_a">__userp/a> *p_acode,i*_ref">f_getownerfpnp/a>(structopa p hre1">o201opa>            5>o157p/a>5o2nesul"">euidp/a> =opanesul"ref=s+code=ret" class="sref">re5Ao138p/a>5        pa hrefspin4opa>=f_ge+codede=file" class="ilpnp/a>(structopa hrpcodecode=filp" class="srefopa>        pa hreff4opa>=f_g"1">o201opa>            5>o170p/a>5        pa hrefspin4opa>=f_ge+codede=file" class="async4opa>        pa hreffasync4opa>=f_g"1">o201opa>            5>o161p/a>5o218fpnp/a>(structopa p hre=+code=err" class=fappnp/a>(structopa appcode;" am"v3L218">o218fa">__userp/a> *p_acode=+c_ref">f_getownerfpnp/a>(structopa p hre"e!+code=err" class=NUL>retp/a> =o-pa hNUL>3" ce=arg" class="srefpnp/a>(structopa p hre=+c+codede=file" class="a">__userp/a> *p_acodecode=filp" class="srea_nex"">__userp/a> *p_a_nex" hre"ecode=ret" class="sref">5 argp/a>;5o218"a">__userp/a> *p_acodecode=filp" class="srea__townp/a>(structopa a__tow93" c!+code=err" class="ilpnp/a>(structopa hrpcode"lass="line" nam"v3L1385 neropa>;5o201opa>            5>GIDp/a>)5_irqlpopa>->pa hspin4opa>_irq=f_ge+codede=file" class="a">__userp/a> *p_acodecode=filp" class="srea_opa>        pa hreffa4opa>=f_g"1">o201opa>            5>retp/a>;5o220opa>   "a">__userp/a> *p_acodecode=filp" class="srea__townp/a>(structopa a__tow93" c+code=err" class=NUL>retp/a> =o-pa hNUL>3" ce">o201opa>            5>o157p/a>5  _irqlpopa>->pa hspin4opa>  _irq=f_ge+codede=file" class="a">__userp/a> *p_acodecode=filp" class="srea_opa>        pa hreffa4opa>=f_g"1">o201opa>            5>o138p/a>5();5f_getownerfpnp/a>(structopa p hre=+code=err" class=fa">__userp/a> *p_acodecode=filp" class="srea_nex"">__userp/a> *p_a_nex" hre1">o201opa>            5co170p/a>5__userp/a> *p_acodecode=filp" class="srea_rcu       return pfa_rcu=f_gcode=file" class="async4free_rcu       return pfasync4free_rcu=f_g"1">o201opa>            5>pidp/a>)5(structopa hrpcodecode=filp" class="srefflags        pa hreff4flags92" c+code= ~filp" class="srFASYNC        pa hrefFASYNC hre1">o201opa>            5cargp/a>;5o2nesul"">euidp/a> =opanesul"ref=s+c1"+code=err" class="sref5>neropa>;5o201opa>            5>MAXp/a>;5  lpopa>->pa hspin4opa>  =f_ge+codede=file" class="async4opa>        pa hreffasync4opa>=f_g"1">o201opa>            5oretp/a>;5  lpopa>->pa hspin4opa>  =f_ge+codede=file" class="ilpnp/a>(structopa hrpcodecode=filp" class="srefopa>        pa hreff4opa>=f_g"1">o201opa>            5oo157p/a>5o223opnesul"">euidp/a> =opanesul"ref=1">o201opa>            5oo138p/a>5o189p/a>5o170p/a>5f_getowner_async4lass="">__userp/a> *p_async4lass=" hre *ref">f_getowner_async4alloc">__userp/a> *p_async4alloc=f_gevoi""lass="line" nam"v3L1385o191opa>{55>argp/a>;5o223opkmem_cache4alloc">__userp/a> *pkmem_cache4alloc=f_gede=file" class=fasync4cache       return pfasync4cache2" cfm"v3L223">o223opGFP_KERNEL       return pGFP_KERNEL=f_g"1">o201opa>            5wneropa>;5;5/*;5l* NOTE! This nen be used onlyifor"unused _async entries:5l* entries that actuallyigot insertre on the _async list5l* nere to be released by rcu - see _async4nemove_entry.:6l*/;6f_getowner_async4lass="">__userp/a> *p_async4lass=" hre *ref">f_getownernew">__userp/a> *pnewcode"lass="line" nam"v3L1386_2IDopa>;66_3IDopa>;6__userp/a> *pnewcode"1">o201opa>            6_4IDopa>;6/*l* Insert a new entry into the _async list.  Re" namthe pointer to thel* old one ne"we didn't use the new one.l*l* NOTE! It is very important that the FASYNC flag alwayso210p/a>6l* ma namthe state "is the filp on a _async list".l*/;6f_getowner_async4lass="">__userp/a> *p_async4lass=" hre *ref">f_getowner_async4insert_entry">__userp/a> *p_async4insert_entry=f_geine" nam"v3L227">o22ref">fasyncp/a>(pa href=lass="sref">f_getowner_townp/a>(structopa href="+=_ref">f_getownerfilpnp/a>(structopa hrpcode,ilass="sref">f_getowner_async4lass="">__userp/a> *p_async4lass=" hre *_ref">f_getownerfappnp/a>(structopa appcode,ilass="sref">f_getowner_async4lass="">__userp/a> *p_async4lass=" hre *ref">f_getownernew">__userp/a> *pnewcode"lass="line" nam"v3L1386NVALp/a>;66 5 break;6f_getowner_async4lass="">__userp/a> *p_async4lass=" hre *ref">f_getowner_a">__userp/a> *p_acode,i*_ref">f_getownerfpnp/a>(structopa p hre1">o201opa>            6   break;67 break;6        pa hrefspin4opa>=f_ge+codede=file" class="ilpnp/a>(structopa hrpcodecode=filp" class="srefopa>        pa hreff4opa>=f_g"1">o201opa>            6 GIDp/a>:6        pa hrefspin4opa>=f_ge+codede=file" class="async4opa>        pa hreffasync4opa>=f_g"1">o201opa>            6 9IDp/a>:6o218fpnp/a>(structopa p hre=+code=err" class=fappnp/a>(structopa appcode;" am"v3L218">o218fa">__userp/a> *p_acode=+c_ref">f_getownerfpnp/a>(structopa p hre"e!+code=err" class=NUL>retp/a> =o-pa hNUL>3" ce=arg" class="srefpnp/a>(structopa p hre=+c+codede=file" class="a">__userp/a> *p_acodecode=filp" class="srea_nex"">__userp/a> *p_a_nex" hre"ecode=ret" class="sref">6eropa>));6o218"a">__userp/a> *p_acodecode=filp" class="srea__townp/a>(structopa a__tow93" c!+code=err" class="ilpnp/a>(structopa hrpcode"lass="line" nam"v3L1386>retp/a>)6o201opa>            6AULTp/a>;6o201opa>            6A3IDopa>;6o2spin4opa>_irqlpopa>->pa hspin4opa>_irq=f_ge+codede=file" class="a">__userp/a> *p_acodecode=filp" class="srea_opa>        pa hreffa4opa>=f_g"1">o201opa>            6>VALp/a>;6o218"a">__userp/a> *p_acodecode=filp" class="srea__ref">fasyncp/a>(pa_2r1" cl+code=err" class=fdef">fasyncp/a>(pa hre9">o169opa>            6A  break;6  _irqlpopa>->pa hspin4opa>  _irq=f_ge+codede=file" class="a">__userp/a> *p_acodecode=filp" class="srea_opa>        pa hreffa4opa>=f_g"1">o201opa>            6>  break;6filpopaouf        pa hrefouf hre9">o169opa>            6A7 break;6GIDp/a>:6) {6_init">__userp/a> *pspin4opa>_init=f_ge+codede=file" class=new">__userp/a> *pnewcodecode=filp" class="srea_opa>        pa hreffa4opa>=f_g"1">o201opa>            6nsp/a>();6__userp/a> *pnewcodecode=filp" class="srmagic">__userp/a> *pmagic1" cl+code=err" class=FASYNC_MAGIC        pa hrefFASYNC_MAGIC hre9">o169opa>            6nretp/a>)6__userp/a> *pnewcodecode=filp" class="srea__townp/a>(structopa a__tow93" c+code=err" class="ilpnp/a>(structopa hrpcode9">o169opa>            6nULTp/a>;6f_getownernew">__userp/a> *pnewcodecode=filp" class="srea__ref">fasyncp/a>(pa_2r1" cl+code=err" class=fdef">fasyncp/a>(pa hre9">o169opa>            6n       }6__userp/a> *pnewcodecode=filp" class="srea_nex"">__userp/a> *p_a_nex" hre=+c_ref">f_getownerfappnp/a>(structopa appcode;">o169opa>            6nVALp/a>;6euidp/a> =opancu_f="ign_pointer=f_ge_ref">f_getownerfappnp/a>(structopa appcode,ine" nam"v3L179"new">__userp/a> *pnewcode"1">o201opa>            6ockp/a>);6o169opa>            6n  break;6pef=ef pa href="+code7il6 idv36386" class="line" nam"v3L1866=TOREp/a>6filpopaouf        pa hrefouf hre"v3L211">o211opa>      6o137p/a>}6  lpopa>->pa hspin4opa>  =f_ge+codede=file" class="async4opa>        pa hreffasync4opa>=f_g"1">o201opa>            6>o138p/a>6  lpopa>->pa hspin4opa>  =f_ge+codede=file" class="ilpnp/a>(structopa hrpcodecode=filp" class="srefopa>        pa hreff4opa>=f_g"1">o201opa>            6filpopa>)6o223op"a">__userp/a> *p_acode1">o201opa>            6fretp/a>)6pidp/a>;6o201opa>            6ockp/a>);6/*);6l* Add a _async entry. Re" namnegative on error, positive if);6l* added,iand zero"ne"did noehing but change an existing one.pidp/a>;6l*/);6o2_async4add_entry">__userp/a> *p_async4add_entry=f_geine" nam"v3L227">o22ref">fasyncp/a>(pa href=lass="sref">f_getowner_townp/a>(structopa href="+=_ref">f_getownerfilpnp/a>(structopa hrpcode,ilass="sref">f_getowner_async4lass="">__userp/a> *p_async4lass=" hre *_ref">f_getownerfappnp/a>(structopa appcode"lass="line" nam"v3L1386p137p/a>}66Po138p/a>6f_getowner_async4lass="">__userp/a> *p_async4lass=" hre *ref">f_getownernew">__userp/a> *pnewcode1">o201opa>            6>o149p/a>6argp/a>;6__userp/a> *pnewcode=+code=err" class=fasync4alloc">__userp/a> *p_async4alloc=f_ge"1">o201opa>            6>pidp/a>;6o218new">__userp/a> *pnewcode"lass="line" nam"v3L1386>argp/a>;6o218ENOMEM">__userp/a> *pENOMEMcode1">o201opa>            6>idp/a>);6o215opa6>GIDp/a>)6/*pidp/a>;6line" nam* _async4insert_entry()mne" nas the old (update) entry ifckp/a>);6line" nam* it existed.137p/a>}6line" nam*o138p/a>6line" nam* So free the (unused) new entry and ne" nam0 to let theretp/a>)6line" nam* caller know that we didn't add any new _async entries.argp/a>;6line" nam*/pidp/a>;6f_getowner_async4insert_entry">__userp/a> *p_async4insert_entry=f_ge nam"v3L227">o22ref">fasyncp/a>(pa href=ref">f_getownerfilpnp/a>(structopa hrpcode,iref">f_getownerfappnp/a>(structopa appcode,ine" nam"v3L179"new">__userp/a> *pnewcode""ecode=ret" class="sref">6>argp/a>;6o2fasync4free       return pfasync4free=f_gene" nam"v3L179"new">__userp/a> *pnewcode"1">o201opa>            6>neropa>;6o201opa>            6>GIDp/a>)6pidp/a>;6;66/*o170p/a>6l* fasync4helper()mis used by almost all character device driverso161p/a>6l* to set up the _async queue,iand for"regular files by the file;6l* lease L179. It ne" nas negative on error, 0iv3Lit did no changesneropa>;6l* and positive ifLit added/deletre the entry.GIDp/a>)6l*/o2_async4helper       return pfasync4helper=f_geine" nam"v3L227">o22ref">fasyncp/a>(pa href=lass="sref">f_getowner_townp/a>(structopa href="+=_=ref">f_getownerfilpnp/a>(structopa hrpcode,iine" nam"v3L227">o2o15p/a>intopa hreoncode,ilass="sref">f_getowner_async4lass="">__userp/a> *p_async4lass=" hre *_ref">f_getownerfappnp/a>(structopa appcode"lass="line" nam"v3L1386>retp/a>;66>o157p/a>6o218o15p/a>intopa hreoncode"lass="line" nam"v3L1386>o138p/a>6o223op"async4nemove_entry">__userp/a> *p_async4nemove_entry=f_geref">f_getownerfilpnp/a>(structopa hrpcode,iref">f_getownerfappnp/a>(structopa appcode"1">o201opa>            6ckp/a>();6o223op"async4add_entry">__userp/a> *p_async4add_entry=f_ge nam"v3L227">o22ref">fasyncp/a>(pa href=ref">f_getownerfilpnp/a>(structopa hrpcode,iref">f_getownerfappnp/a>(structopa appcode"1">o201opa>            6co170p/a>6pidp/a>)6o201opa>            6cargp/a>;6o218EXPORT_SYMBO>retp/a> =o-pa hEXPORT_SYMBO>=f_ge nam"v3L227">o22async4helper       return pfasync4helper=f_g"1">o201opa>            6cneropa>;6o215opa6>MAXp/a>;6/*l* rcu_=o234opa>()mis held;6l*/6f_getowner_async4lass="">__userp/a> *p_async4lass=" hre *ref">f_getowner_a">__userp/a> *p_acode,iine" nam"v3L227">o2=igcredp/a>->pasigcode,iine" nam"v3L227">o2band">__userp/a> *pband2" c"lass="line" nam"v3L1386oo138p/a>66>o189p/a>6o218"a">__userp/a> *p_acode"ecode=ret" class="sref">6>o170p/a>6f_getowner_=f_slass="">__userp/a> *p_=f_slass="code=_ref">f_getownerfo115p/a>intopa hrefode=f_s1">o201opa>            6o191opa>{6f_getowner_lags        pa hrefflags92" 1">o201opa>            6oargp/a>;6o201opa>            6oneropa>;6o218"a">__userp/a> *p_acodecode=filp" class="srmagic">__userp/a> *pmagic1" cl!+code=err" class=FASYNC_MAGIC        pa hrefFASYNC_MAGIC hre"ecode=ret" class="sref">6>MAXp/a>;6o2prine>        pa hrefprine>=f_ge nam"v3L227">o2KERN_ERR        pa hrefKERN_ERR5" clvspanhref="fslasing">"kill__async: bad magic number in ""_async4lass="!\n"o201opa>            6oretp/a>;6o201opa>            6oo157p/a>66_irqsavwnp/a>(structopaspin4opa>_irqsavw=f_ge+codede=file" class="a">__userp/a> *p_acodecode=filp" class="srea_opa>        pa hreffa4opa>=f_g,iref">f_getownerflags        pa hrefflags92" "1">o201opa>            7_MAXp/a>:7o218"a">__userp/a> *p_acodecode=filp" class="srea__townp/a>(structopa a__tow93" "ecode=ret" class="sref">7_TIDopa>;7intopa hrefode=f_s=+c+codede=file" class="a">__userp/a> *p_acodecode=filp" class="srea__townp/a>(structopa a__tow93" code=filp" class="srefodeer       return pffodeer92" 1">o201opa>            7_2IDopa>;7/* Don't send SIGURG to processesiwhhch havw noe set a;7lllllllllllllllllllllllllllqueued "ignum: SIGURG has its ode default "ignal/fcg;7lllllllllllllllllllllllllllmechanism.l*/o218sigcredp/a>->pasigcodes++code=err" class=SIGURG caseopa href="SIGURGref=c+code+codecode=err" class=fo115p/a>intopa hrefode=f_scode=filp" class="sr"ignumcredp/a>->pasignumcodes++c0""lass="line" nam"v3L1387   break;7fasyncp/a>(send_sfiio=f_ge nam"v3L227">o22o115p/a>intopa hrefode=f_s,a nam"v3L227">o2"a">__userp/a> *p_acodecode=filp" class="srea__ref">fasyncp/a>(pa_2r1" c,a nam"v3L227">o2band">__userp/a> *pband2" c"1">o201opa>            7_7 break;7  _irqrestorwnp/a>(structopaspin4opa>  _irqrestorw=f_ge+codede=file" class="a">__userp/a> *p_acodecode=filp" class="srea_opa>        pa hreffa4opa>=f_g,iref">f_getownerflags        pa hrefflags92" "1">o201opa>            7_9 break;7__userp/a> *p_acode=+cde=file" class=rcu_deileeilncwnp/a>(structoparcu_deileeilncw=f_ge nam"v3L227">o22a">__userp/a> *p_acodecode=filp" class="srea_nex"">__userp/a> *p_a_nex" hre"1">o201opa>            7  obreak;7o201opa>            7 TIDopa>;7o201opa>            7 3IDopa>;7f_getowner_async4lass="">__userp/a> *p_async4lass=" hre *_ref">f_getownerfpnp/a>(structopa p hre,iine" nam"v3L227">o2=igcredp/a>->pasigcode,iine" nam"v3L227">o2band">__userp/a> *pband2" c"lass="line" nam"v3L1387NVALp/a>;77 5 break;7/* First alquick test without opa>fcg: usuallyline" nam* the listmis empty.7 break;7line" nam*/:7f_getownerfpnp/a>(structopa p hre"ecode=ret" class="sref">7 9 break;7np/a>(structoparcu_=o234opa>=f_ge"1">o201opa>            7eropa>));7(structoparcu_deileeilncw=f_ge_ref">f_getownerfpnp/a>(structopa p hre",iref">f_getowner=igcredp/a>->pasigcode,i nam"v3L227">o2band">__userp/a> *pband2" c"1">o201opa>            7>retp/a>)7        pa href="+cu_=o234opa>  =f_ge"1">o201opa>            7edefault:7;7;7o218EXPORT_SYMBO>retp/a> =o-pa hEXPORT_SYMBO>=f_ge nam"v3L227">o2kill__async       return pkill__async=f_g"1">o201opa>            7e5 break;7  break;7o2__init">__userp/a> *p__init=f_gsref">f_getowner_m"v3_init">__userp/a> *p_m"v3_init=f_gevoi""lass="line" nam"v3L1387A7 break;77>GIDp/a>:7/*) {7line" nam* Please add new bits heil to ensuil allocss=on uniqueness.();7line" nam* Exceps=ons: O_NONBLOC mis a two bit deffcn on parisc; O_NDELAY)7line" nam*mis deffcnd as O_NONBLOC mon some platforms and noe on others.line" nam*/__userp/a> *pBUILD_BUG_ON=f_ge19 - 1idspanhref="fscomment">/* for"O_RDONLY being 0m*/;7retp/a> =o-pa hO_EXC>4" class="li|"ode=err" class=O_NOCTTY href="fs/a> *pO_NOCTTY4" class="|lass="line" nam"v3L2257n  break;7pef=ef pa href="+code7il7 idv373L96" class="line" namde=file" class=O_TRUNC        pa hrefO_TRUNC5" class="lil|"ode=err" class=O_APPEND        pa hrefO_APPEND4" class="|"ospanhref="fscomment">/* O_NONBLOC m|m*/o220opa>   __O_SYNC        pa href__O_SYNC4" class="li|"ode=err" class=O_DSYNC        pa hrefO_DSYNC4" class="l|"ode=err" class=FASYNC        pa hrefFASYNCcodelass="li|lass="line" nam"v3L2257nGIDp/a>:7) {7)7)7o169opa>            7>pidp/a>;7o201opa>            7ockp/a>);7"_async4cache"o211opa>      7pidp/a>);7f_getowner_async4lass="">__userp/a> *p_async4lass=" hre), 0,i nam"v3L227">o2SLAB_PANIC        pa hrefSLAB_PANICcode,i nam"v3L227">o2NUL>retp/a> =o-pa hNUL>3" c"9">o169opa>            7>5 break;7o201opa>            7>pidp/a>;7);7:7__userp/a> *pmodule_init=f_ge nam"v3L227">o22m"v3_init">__userp/a> *p_m"v3_init=f_g"lass="line" nam"v3L1387Po138p/a>7


The original LXR softwail by the ass="linehttp://sourceforge.net/projects/lxr">LXR communitycode,ithis experimental vers=on by ass="linemailto:lxr@/fcux.no">lxr@/fcux.nocode. lxr./fcux.no kindly hosted by ass="linehttp://www.redpill-/fcpro.no">Redpill Lfcpro AScode,iprovider of Lfcuxiconsul"ing and operss=ons services since 1995.