pike.git / lib / modules / Process.pmod

version» Context lines:

pike.git/lib/modules/Process.pmod:50: Inside #if constant(Stdio.__HAVE_SEND_FD__)
   ([    "forkd":0,    "uid":getuid(),    "gid":getgid(),    "noinitgroups":1,    "fds":({    forkd_pipe->pipe(Stdio.PROP_BIDIRECTIONAL|    Stdio.PROP_SEND_FD),    }),    ])); +  if (forkd_pipe->read(1) != "\0") { +  // werror("Failed to start forkd.\n"); +  return 0;    } -  +  }    return forkd_pid && forkd_pid->kill(0);   }   #endif      protected int(0..1) forkd_default = 0;      //! Set the default value for the @expr{"forkd"@} modifier   //! to @[Process].   //!   //! @note
pike.git/lib/modules/Process.pmod:167:    m_delete(new_modifiers, "forkd");    }      #if constant(Stdio.__HAVE_SEND_FD__)    // Forkd mode requires send_fd().    if (zero_type(new_modifiers->forkd)) new_modifiers->forkd = forkd_default;    if (new_modifiers->forkd && assert_forkd()) {    process_fd = Stdio.File();    forkd_pipe->    send_fd(process_fd->pipe(Stdio.PROP_BIDIRECTIONAL|Stdio.PROP_SEND_FD)); -  forkd_pipe->write("\0"); +  while (forkd_pipe->write("\0") < 0) +  ;       m_delete(new_modifiers, "forkd");    __callback = m_delete(new_modifiers, "callback");       if (zero_type(new_modifiers->uid)) {    new_modifiers->uid = geteuid();    if (zero_type(new_modifiers->gid)) {    new_modifiers->gid = getegid();    }    if (!new_modifiers->setgroups) {
pike.git/lib/modules/Process.pmod:204: Inside #if constant(Stdio.__HAVE_SEND_FD__)
   new_modifiers->cwd = getcwd();    }       if (!new_modifiers->stdin) new_modifiers->stdin = Stdio.stdin;    if (!new_modifiers->stdout) new_modifiers->stdout = Stdio.stdout;    if (!new_modifiers->stderr) new_modifiers->stderr = Stdio.stderr;       string data = encode_value(({ command_args, new_modifiers }),    ForkdEncoder(process_fd));    data = sprintf("%4c%s", sizeof(data), data); +  // Wait for forkd to acknowledge the process_fd. +  if (process_fd->read(4) != "\0\0\0\0") { +  process_fd->close(); +  process_fd = UNDEFINED; +  error("Failed to create spawn request.\n"); +  }    int bytes = process_fd->write(data);    if (bytes != sizeof(data)) {    process_fd->close();    process_fd = UNDEFINED;    error("Failed to write spawn request (%d != %d).\n",    bytes, sizeof(data));    }    process_backend = Pike.SmallBackend();    process_backend->add_file(process_fd);    process_fd->set_nonblocking(got_data, UNDEFINED, got_close);