• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/curl/curl-7.36.0/tests/

Lines Matching refs:pid

33 # pidfromfile returns the pid stored in the given pidfile.  The value
34 # of the returned pid will never be a negative value. It will be zero
35 # on any file related error or if a pid can not be extracted from the
40 my $pid = 0;
43 $pid = 0 + <PIDFH>;
45 $pid = 0 unless($pid > 0);
47 return $pid;
51 # pidexists checks if a process with a given pid exists and is alive.
52 # This will return the positive pid if the process exists and is alive.
53 # This will return the negative pid if the process exists differently.
57 my $pid = $_[0];
59 if($pid > 0) {
61 if(kill(0, $pid)) {
62 return $pid;
67 my $filter = "PID eq $pid";
69 if(index($result, "$pid") != -1) {
70 return -$pid;
79 # pidterm asks the process with a given pid to terminate gracefully.
82 my $pid = $_[0];
84 if($pid > 0) {
86 kill("TERM", $pid);
90 my $filter = "PID eq $pid";
92 if(index($result, "$pid") != -1) {
100 # pidkill kills the process with a given pid mercilessly andforcefully.
103 my $pid = $_[0];
105 if($pid > 0) {
107 kill("KILL", $pid);
111 my $filter = "PID eq $pid";
113 if(index($result, "$pid") != -1) {
116 system("tskill $pid >nul 2>&1");
123 # processexists checks if a process with the pid stored in the given
125 # error or if a pid can not be extracted from the given file. When a
126 # process with the same pid as the one extracted from the given file
127 # is currently alive this returns that positive pid. Otherwise, when
128 # the process is not alive, will return the negative value of the pid.
134 # fetch pid from pidfile
135 my $pid = pidfromfile($pidfile);
137 if($pid > 0) {
139 if(pidexists($pid)) {
140 return $pid;
144 unlink($pidfile) if($pid == pidfromfile($pidfile));
146 waitpid($pid, &WNOHANG);
148 return -$pid;
155 # killpid attempts to gracefully stop processes in the given pid list
184 my $pid = $1;
185 if($pid > 0) {
186 if(pidexists($pid)) {
187 print("RUN: Process with pid $pid signalled to die\n")
189 pidterm($pid);
190 push @signalled, $pid;
193 print("RUN: Process with pid $pid already dead\n")
196 waitpid($pid, &WNOHANG);
197 push @reapchild, $pid;
208 my $pid = $signalled[$i];
209 if(!pidexists($pid)) {
210 print("RUN: Process with pid $pid gracefully died\n")
214 waitpid($pid, &WNOHANG);
215 push @reapchild, $pid;
225 foreach my $pid (@signalled) {
226 if($pid > 0) {
227 print("RUN: Process with pid $pid forced to die with SIGKILL\n")
229 pidkill($pid);
231 waitpid($pid, &WNOHANG);
232 push @reapchild, $pid;
239 foreach my $pid (@reapchild) {
240 if($pid > 0) {
241 waitpid($pid, 0);
254 my $pid;
265 $pid = processexists($pidfile);
266 if($pid > 0) {
267 printf("* kill pid for %s-%s => %d\n", $server,
268 ($proto eq 'ftp')?'ctrl':'filt', $pid) if($verbose);
269 pidkill($pid);
270 waitpid($pid, 0);
279 $pid = processexists($pidfile);
280 if($pid > 0) {
281 printf("* kill pid for %s-data => %d\n", $server,
282 $pid) if($verbose);
283 pidkill($pid);
284 waitpid($pid, 0);