help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a way to hold the finish of a program so that /proc/<pid>/m


From: Boris Kolpackov
Subject: Re: Is there a way to hold the finish of a program so that /proc/<pid>/maps can be accessed?
Date: Tue, 26 Jan 2021 13:46:40 +0200
User-agent: Mutt/1.5.24 (2015-08-30)

Peng Yu <pengyu.ut@gmail.com> writes:

> Is there a way to hold the execuration of the program to give enough
> time to access /proc/<pid>/maps? In terms of psuedo code (in one
> script), it looks like something like this. Is there a way to do this?
> Thanks.
> 
> start_and_hold_program myprog &
> pid=$!
> cat /proc/$pid/maps
> let_it_finish $pid

We do something like this to work around coproc racy-ness; We start
the process that immediately suspends itself with SIGSTOP. In the
parent process we get the pid and then resume the child process
with SIGCONT. There are still some corner cases to handle, see
here for details:

https://github.com/build2/libbutl.bash/blob/master/libbutl/manifest-parser.bash.in#L84

https://github.com/build2/libbutl.bash/blob/master/libbutl/utility.bash.in#L32



reply via email to

[Prev in Thread] Current Thread [Next in Thread]