[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: |
Peng Yu |
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 08:56:20 -0600 |
> > 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
I don't follow the above code as it contains something that is not
relevant to my use case. Could you show the exact code on how to stop
a program named `myprog`? How to you make sure the program is stop
immediately upon it starts?
> https://github.com/build2/libbutl.bash/blob/master/libbutl/utility.bash.in#L32
--
Regards,
Peng