|
Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
|
#include <assert.h>#include <ctype.h>#include <errno.h>#include <fcntl.h>#include <signal.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/wait.h>#include <sys/times.h>#include <sys/stat.h>#include <sys/types.h>#include "cmdopt.h"#include "target.h"#include "util.h"#include "exec.h"
Go to the source code of this file.
Macros | |
| #define | SIGHUP 1 /* Linux value */ |
| #define | SIGQUIT 3 /* Linux value */ |
| #define | SIGKILL 9 /* Linux value */ |
| #define | SIGALRM 14 /* Linux value */ |
| #define | ENOENT 1 /* Linux value */ |
| #define | ESRCH 3 /* Linux value */ |
| #define | EINTR 4 /* Linux value */ |
| #define | ECHILD 10 /* Linux value */ |
| #define | EINVAL 22 /* Linux value */ |
| #define | SIGNAL(val) { SIG ## val, #val } |
Typedefs | |
| typedef void(* | alarm_handler) (int) |
Functions | |
| int | kill (pid_t pid, int sig) |
| FILE * | fdopen (int fd, const char *mode) |
| int | get_signo (const char *signame) |
| const char * | get_signame (int signo) |
| void | exec_file (const struct target_opts *options, struct target_status *result) |
| #define SIGHUP 1 /* Linux value */ |
exec.cpp - Definitions of the child process subsystem
$Id$
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
| void exec_file | ( | const struct target_opts * | options, |
| struct target_status * | result | ||
| ) |
Entry point to the child process (watchdog) subsystem.
On UNIX systems, this method fork ()s, creating a child process. This child process becomes a process group leader, redirects input and output files, then exec ()s the target specified in argv [0], providing it with argv to use as its argv array. Meanwhile, the parent process calls the wait_for_child method to monitor the child process, passing the return value back to the calling method.
On Windows, this method creates a process using the windows CreateProcess API call. The startup context for this process is based on the context of the exec utility, but with the standard * file handles redirected. The execution of the process is monitored with the WaitForSingleObject API call. If the process doesn't complete within the allowed timeout, it is then killed. On Windows NT systems, a soft kill of the process (via the GenerateConsoleCtrlEvent API call) are first attempted attempted. The process is then hard killed via the TerminateProcess API call.
| exec_name | name of the child executable |
| argv | argv array for child process |
| FILE * fdopen | ( | int | fd, |
| const char * | mode | ||
| ) |
| const char * get_signame | ( | int | signo | ) |
Translates a signal number into a human understandable name
| signo | a signal number |
| int get_signo | ( | const char * | signame | ) |
exec.h - Interface declaration for the child process subsystem
$Id$
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Translates a human understandable signal name into a number usable by kill ().
This method understands several formats for signal names. They are as follows:
| signame | a signal name to decode |
| int kill | ( | pid_t | pid, |
| int | sig | ||
| ) |