linux/lib/syscall.c
<<
valu/o /spa.2. /o /form2. /o a valu/o href="../linux+v32.17/lib/syscall.c">valu/o img src="../.static/gfx/right.png" alt=">>">va /spa.2.va spa. class="lxr_search">valuvalu/o input typv2.hidden" namv2.navtarget" > v2.">valu/o input typv2.text" namv2.search" id2.search">valu/o buttn vtypv2.submit">Searchvalu/oPrefs. /o /a>va /spa.2.lu/o o /div2.lu/o o form ac v3.="ajax+*" method="post" onsubmit="return false;">va input typv2.hidden" namv2.ajax_lookup" id2.ajax_lookup" > v2.">vlu/o o /form2.vlu/o o div class="headingbottnm">. div id2.file_contents"2
o o1 /a>#include <linux/ptrace.h /a>>
o o2 /a>#include <linux/sched.h /a>>
o o3 /a>#include <linux/export.h /a>>
o o4 /a>#include <asm/syscall.h /a>>
o o5 /a>vo o6 /a>static into a href="+code=collect_syscall" class="sref">collect_syscall /a>(structo a href="+code=task_struct" class="sref">task_struct /a> * a href="+code=target" class="sref">target /a>, long * a href="+code=callno" class="sref">callno /a>,vo o7 /a>                           unsigned long  a href="+code=args" class="sref">args /a>[6], unsigned into a href="+code=maxargs" class="sref">maxargs /a>,vo o8 /a>                           unsigned long * a href="+code=sp" class="sref">sp /a>, unsigned long * a href="+code=pc" class="sref">pc /a>)vo o9 /a>{vo 	  >a>        structo a href="+code=pt_regs" class="sref">pt_regs /a> * a href="+code=regs" class="sref">regs /a> =o a href="+code=task_pt_regs" class="sref">task_pt_regs /a>( a href="+code=target" class="sref">target /a>);
o 11 >a>        if ( a href="+code=unlikely" class="sref">unlikely /a>(! a href="+code=regs" class="sref">regs /a>))vo 12 /a>                return - a href="+code=EAGAIN" class="sref">EAGAIN /a>;
o 13 /a>vo 14 /a>        * a href="+code=sp" class="sref">sp /a> =o a href="+code=user_stack_pointer" class="sref">user_stack_pointer /a>( a href="+code=regs" class="sref">regs /a>);
o 15 /a>        * a href="+code=pc" class="sref">pc /a> =o a href="+code=instructv3._pointer" class="sref">instructv3._pointer /a>( a href="+code=regs" class="sref">regs /a>);
o 16 /a>vo 17 /a>        * a href="+code=callno" class="sref">callno /a> =o a href="+code=syscall_get_nr" class="sref">syscall_get_nr /a>( a href="+code=target" class="sref">target /a>,o a href="+code=regs" class="sref">regs /a>);
o 18 >a>        if (* a href="+code=callno" class="sref">callno /a> != -1L &&o a href="+code=maxargs" class="sref">maxargs /a> > 0)vo 19 /a>                 a href="+code=syscall_get_arguments" class="sref">syscall_get_arguments /a>( a href="+code=target" class="sref">target /a>,o a href="+code=regs" class="sref">regs /a>, 0,o a href="+code=maxargs" class="sref">maxargs /a>,  a href="+code=args" class="sref">args /a>);
o 20 /a>vo 21 >a>        return 0;
o 22 /a>}
o 23 /a>vo 24 /a> spa. class="comment">/** /spa.2.o 25 /a> spa. class="comment"> * task_current_syscall - Discover what a blocked task is doing. /spa.2.o 26 /a> spa. class="comment"> * @target:             thread to examine /spa.2.o 27 /a> spa. class="comment"> * @callno:             filled with system call number or -1 /spa.2.o 28 /a> spa. class="comment"> * @args:               filled with @maxargs system call arguments /spa.2.o 29 /a> spa. class="comment"> * @maxargs:            number of elements in @args to fill /spa.2.o 30 /a> spa. class="comment"> * @sp:                 filled with user stack pointer /spa.2.o 31 /a> spa. class="comment"> * @pc:                 filled with user PC /spa.2.o 32 /a> spa. class="comment"> * /spa.2.o 33 /a> spa. class="comment"> * If @target is blocked in a system call, returns zero with *@callno /spa.2.o 34 /a> spa. class="comment"> * set to the the call's number and @args filled in with its arguments. /spa.2.o 35 /a> spa. class="comment"> * Registers not used for system call arguments may not be available and /spa.2.o 36 /a> spa. class="comment"> * it is not kosher to use &structouser_regset calls while the system /spa.2.o 37 /a> spa. class="comment"> * call is still in progress.  Note we may get this result if @target /spa.2.o 38 /a> spa. class="comment"> * has finished its system call but not yet returned to user mode, sucho 39 /a> spa. class="comment"> * as when it's stopped for signal handling or syscall exit tracing. /spa.2.o 40 /a> spa. class="comment"> * /spa.2.o 41 /a> spa. class="comment"> * If @target is blocked in the kernel during a fault or exce  v3., /spa.2.o 42 /a> spa. class="comment"> * returns zero with *@callno set to -1 and does not fill in @args. /spa.2.o 43 /a> spa. class="comment"> * If so, it's now safe to examine @target using &structouser_regset /spa.2.o 44 /a> spa. class="comment"> * get() calls as long as we're sure @target won't return to user mode. /spa.2.o 45 /a> spa. class="comment"> * /spa.2.o 46 /a> spa. class="comment"> * Returns -%EAGAIN if @target does not remain blocked. /spa.2.o 47 /a> spa. class="comment"> * /spa.2.o 48 /a> spa. class="comment"> * Returns -%EINVAL if @maxargs is too large (maximum is six). /spa.2.o 49 /a> spa. class="comment"> */ /spa.2.o 50 /a>into a href="+code=task_current_syscall" class="sref">task_current_syscall /a>(structo a href="+code=task_struct" class="sref">task_struct /a> * a href="+code=target" class="sref">target /a>, long * a href="+code=callno" class="sref">callno /a>,vo 51 >a>                         unsigned long  a href="+code=args" class="sref">args /a>[6], unsigned into a href="+code=maxargs" class="sref">maxargs /a>,vo 52 /a>                         unsigned long * a href="+code=sp" class="sref">sp /a>, unsigned long * a href="+code=pc" class="sref">pc /a>)vo 53 /a>{vo 54 /a>        long  a href="+code=state" class="sref">state /a>;
o 55 /a>        unsigned long  a href="+code=ncsw" class="sref">ncsw /a>;
o 56 /a>vo 57 /a>        if ( a href="+code=unlikely" class="sref">unlikely /a>( a href="+code=maxargs" class="sref">maxargs /a> > 6))vo 58 /a>                return - a href="+code=EINVAL" class="sref">EINVAL /a>;
o 59 /a>vo 60 /a>        if ( a href="+code=target" class="sref">target /a> ==o a href="+code=current" class="sref">current /a>)vo 61 >a>                return  a href="+code=collect_syscall" class="sref">collect_syscall /a>( a href="+code=target" class="sref">target /a>,o a href="+code=callno" class="sref">callno /a>,  a href="+code=args" class="sref">args /a>,o a href="+code=maxargs" class="sref">maxargs /a>,  a href="+code=sp" class="sref">sp /a>,  a href="+code=pc" class="sref">pc /a>);
o 62 /a>vo 6.6.35.2"
	  >
  f">sp /a>,  a href="+code=pc" class="sref"d[/syscall.c#L7" ihref="+code=pc" class="sref"d[/syscalls="sref"d[/sysc.L57" class="line" namv2.L57">o 57 /0]5o2>
ss="sref">target /a>,o a href="+code=callnvue="27.v 
  unlikely /a>( a href="+code=mregs" class="sreline" namv2.L57">o 57 /0]5o2>syscall.c#L58" id2.L58" cla6s="line"6namv2.L55">o 55 /a>    6   un65    return - a href="+code=EINVAL" class="sref">EAGAIN /a>;
o o6 /a>staticref="6ib/syscall.c#L57" id2.L57" cla6s="line"6namv2.L57">o 57 /a>    6   if67">sp /a>,  a href="+code=pcf">ncsw /a>;
o 5wait_* a hinmethv"ode=target" class="sref">target /a>,o a href="+code=callno" class="sline" namv2.L57">o 57 /0]5o2>syscall.c#L13" id2.L13" cla6s="line"6namv2.L58">o 58 /a>    6     6(* a href="+code=nlikely" class="sref">unlikely /a>( a href="+code=mregs" class="sref">ncsw /a>;
o 59 /a>vunlikely /a>( a href="+code=maxargs" class=" class="sref">collect_syscall /a>( a href="+code=target" class="sref">target /a>,o a href="+code=callno" class="sref">callno /a>,  a href="+code=args" class="sref">args /a>,o a href="+code=maxargs" class="sref">maxargs /a>,  a href="+code=sp" class="sref">sp /a>,  a href="+code=pc" class="sref">pc /a>);
o 60 /a>    7   if70     a href="+conlikely" class="sref">unlikely /a>( a href="+code=maxargs" class="wait_* a hinmethv" namv2.L57">o 5wait_* a hinmethv"ode=target" class="sref">target /a>,o a href="+code=callno" class="sline" namv2.L57">o 57 /0]5o2>sp;o egs" class="sref">ncsw /a>;
o 61 >a>    7     7     return  a href="+code=cEINVAL" class="sref">EAGAIN /a>;
o 62 /a>vo 6.6.35.2"
7  >
 7f">sp /a>,  af="lib/syscall.c#L22" id2.L22" cla7ref="+co7e=callnvue="27.v 
  o 55 /a>    7   un7="commNVAL" class="srXPORT_SYMBOL_GPEINVAL /a>;
task_current_syscall /a>(structo a href=syscall.c#L13" id2.L13" cla7="line" 7namv2.L6">o o6 /a>stati7ref="7="comm/prev2.lu/o


.content">.
 v2.L6">foo">in>
The origisyscLXR software byng a call.c#L1http://sourcefof=".net/proj a s/lxin>LXR a.2.unitycode=ctargeexperi.>.>ca>lxi@a>>.>ccode.
.conten">.
 v2.L6">subfoo">in>
lxi.a>>.>c kindly host"+cbyncall.c#L1http://www.redpill-a>&pro.>ca>Redpill L>&pro AScode=cprovidn @argL>> a.n/spaxce  nd operahrefs servicea hrnce 1995.
.content"/bodyen"/htmlo