mirror of
https://github.com/samba-team/samba.git
synced 2025-03-11 16:58:40 +03:00
This reverts commit 292e46ab12d8ec172c9d3b26330d8d6028a1d5a5. Processes run by tfork will have a parent pid of 1, they won't be childs of the caller anymore. When the source4 samba process uses samba_runcmd_send() to launch smbd and winbindd the resulting process hierarchy becomes: PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND 1 516 510 510 ? -1 S 111 0:02 avahi-daemon: running [samba-ad.local] 1 29209 29209 29209 ? -1 Ss 0 0:00 ./bin/samba 29209 29210 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29211 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29213 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29215 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29216 29209 29209 ? -1 R 0 0:00 \_ ./bin/samba 29209 29217 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29218 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29220 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29221 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29222 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29223 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29224 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29225 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 1 29214 29209 29209 ? -1 S 0 0:00 ./bin/samba 29214 29219 29219 29219 ? -1 Ss 0 0:00 \_ /home/slow/git/samba/scratch/bin/smbd -D --option=server role check:inhibit=yes --foreground 29219 29236 29219 29219 ? -1 S 0 0:00 \_ /home/slow/git/samba/scratch/bin/smbd -D --option=server role check:inhibit=yes --foreground 29219 29237 29219 29219 ? -1 S 0 0:00 \_ /home/slow/git/samba/scratch/bin/smbd -D --option=server role check:inhibit=yes --foreground 29219 29238 29219 29219 ? -1 S 0 0:00 \_ /home/slow/git/samba/scratch/bin/smbd -D --option=server role check:inhibit=yes --foreground 1 29228 29209 29209 ? -1 S 0 0:00 ./bin/samba 29228 29230 29230 29230 ? -1 Ss 0 0:00 \_ /home/slow/git/samba/scratch/bin/winbindd -D --option=server role check:inhibit=yes --foreground 29230 29239 29230 29230 ? -1 S 0 0:00 \_ /home/slow/git/samba/scratch/bin/winbindd -D --option=server role check:inhibit=yes --foreground They will still be in the same process group and session, but just not be a child or subchild. For childs of the source4 samba process this might be non desirable. killing all processes by sending a signal to the main samba process still works, because a pipe is used between the samba process and the smbd and winbindd childs. Both watch for EOF on the pipe. In the output above smbd and winbindd are in their own process group ans session because they call become_daemon(). See also the discussion in this mailthread: <https://lists.samba.org/archive/samba-technical/2017-April/120257.html> Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Sun Apr 30 17:21:05 CEST 2017 on sn-devel-144
36 lines
1006 B
C
36 lines
1006 B
C
/*
|
|
Unix SMB/CIFS implementation.
|
|
|
|
run a child command
|
|
|
|
Copyright (C) Andrew Tridgell 2010
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#include <tevent.h>
|
|
|
|
struct samba_runcmd_state {
|
|
int stdout_log_level;
|
|
int stderr_log_level;
|
|
struct tevent_fd *fde_stdout;
|
|
struct tevent_fd *fde_stderr;
|
|
int fd_stdin, fd_stdout, fd_stderr;
|
|
char *arg0;
|
|
pid_t pid;
|
|
char buf[1024];
|
|
uint16_t buf_used;
|
|
};
|