aboutsummaryrefslogtreecommitdiffhomepage
path: root/postfork.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-29 11:27:14 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-29 16:14:51 -0800
commit8ada404c5f1ec068a8bad144b63878d9962aa1f0 (patch)
tree6964537047cec6e4b09d0744a01c3208b26dbfea /postfork.cpp
parentebba30d67157cf0dee46edfa5f47a216b1f35ae6 (diff)
More work towards improving relationship between multithreading and fork
Diffstat (limited to 'postfork.cpp')
-rw-r--r--postfork.cpp30
1 files changed, 1 insertions, 29 deletions
diff --git a/postfork.cpp b/postfork.cpp
index 0be31562..425dc526 100644
--- a/postfork.cpp
+++ b/postfork.cpp
@@ -32,19 +32,6 @@
#define FD_ERROR _( L"An error occurred while redirecting file descriptor %d" )
-/**
- This function should be called by both the parent process and the
- child right after fork() has been called. If job control is
- enabled, the child is put in the jobs group, and if the child is
- also in the foreground, it is also given control of the
- terminal. When called in the parent process, this function may
- fail, since the child might have already finished and called
- exit. The parent process may safely ignore the exit status of this
- call.
-
- Returns 0 on sucess, -1 on failiure.
-*/
-
// PCA These calls to debug are rather sketchy because they may allocate memory. Fortunately they only occur if an error occurs.
int set_child_group( job_t *j, process_t *p, int print_errors )
{
@@ -61,6 +48,7 @@ int set_child_group( job_t *j, process_t *p, int print_errors )
{
if( getpgid( p->pid) != j->pgid && print_errors )
{
+ // PCA FIXME This is sketchy to do in a forked child because it may allocate memory. This needs to call only safe functions.
debug( 1,
_( L"Could not send process %d, '%ls' in job %d, '%ls' from group %d to group %d" ),
p->pid,
@@ -284,22 +272,6 @@ static int handle_child_io( io_data_t *io )
}
-/**
- Initialize a new child process. This should be called right away
- after forking in the child process. If job control is enabled for
- this job, the process is put in the process group of the job, all
- signal handlers are reset, signals are unblocked (this function may
- only be called inside the exec function, which blocks all signals),
- and all IO redirections and other file descriptor actions are
- performed.
-
- \param j the job to set up the IO for
- \param p the child process to set up
-
- \return 0 on sucess, -1 on failiure. When this function returns,
- signals are always unblocked. On failiure, signal handlers, io
- redirections and process group of the process is undefined.
-*/
int setup_child_process( job_t *j, process_t *p )
{
int res=0;