linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Andrey Vagin <avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	criu-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org
Subject: Re: [PATCH 2/3] ptrace.2: add description for PTRACE_PEEKSIGINFO
Date: Mon, 20 Jan 2014 11:02:06 +0100	[thread overview]
Message-ID: <52DCF41E.1060604@gmail.com> (raw)
In-Reply-To: <1373962773-2041-3-git-send-email-avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>

Andrey,


On 07/16/2013 10:19 AM, Andrey Vagin wrote:
> Retrieve signals without removing them from a queue.
> 
> Signed-off-by: Andrey Vagin <avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
> ---
>  man2/ptrace.2 | 39 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/man2/ptrace.2 b/man2/ptrace.2
> index 5fcac2b..e74535e 100644
> --- a/man2/ptrace.2
> +++ b/man2/ptrace.2
> @@ -317,6 +317,45 @@ itself.
>  .RI ( addr
>  is ignored.)
>  .TP
> +.BR PTRACE_PEEKSIGINFO " (since Linux 3.10)"
> +.\" commit 84c751bd4aebbaae995fe32279d3dba48327bad4
> +Retrieve
> +.I siginfo_t
> +structures without removing signals from a queue.
> +.I addr
> +points to a
> +.I ptrace_peeksiginfo_args
> +structure.
> +.I siginfo_t
> +structures are copied into the buffer starting at
> +.I data.
> +The return value contains a number of copied signals (zero indicates
> +that a signal with this sequence number doesn't exist).
> +A result
> +.I siginfo
> +contains a kernel part of
> +.IR si_code
> +(
> +.BR __SI_CHLD,
> +.BR __SI_FAULT,
> +etc), which is not shown in other places.
> +.PP
> +.in +10n
> +.nf
> +struct ptrace_peeksiginfo_args {
> +	u64 off;        /* from which siginfo to start */
> +	u32 flags;
> +	s32 nr;         /* how may siginfos to take */
> +};
> +.fi
> +
> +Currently here is only one flag
> +.BR PTRACE_PEEKSIGINFO_SHARED
> +for dumping signals from process-wide queue.
> +If this flag is not set, signals are read from a per-thread queue.
> +.in
> +.PP
> +.TP
>  .BR PTRACE_SETOPTIONS " (since Linux 2.4.6; see BUGS for caveats)"
>  Set ptrace options from
>  .IR data .

Long after the fact, I've applied this patch. I reworked the text 
somewhat as well. Could you please check that the following is correct:

       PTRACE_PEEKSIGINFO (since Linux 3.10)
              Retrieve  siginfo_t  structures without removing signals
              from a queue.  addr points to a  ptrace_peeksiginfo_args
              structure that specifies the ordinal position from which
              copying of signals should start, and the number of  sig‐
              nals  to copy.  siginfo_t structures are copied into the
              buffer pointed to by data.  The  return  value  contains
              the  number of copied signals (zero indicates that there
              is no signal  corresponding  to  the  specified  ordinal
              position).   Within the returned siginfo structures, the
              si_code   field   includes    information    (__SI_CHLD,
              __SI_FAULT,  etc.),  that  are  not otherwise exposed to
              user space.

                 struct ptrace_peeksiginfo_args {
                     u64 off;    /* Ordinal position in queue at which
                                    to start copying signals */
                     u32 flags;  /* PTRACE_PEEKSIGINFO_SHARED or 0 */
                     s32 nr;     /* Number of signals to copy */
                 };

                 Currently, there is only  one  flag,  PTRACE_PEEKSIG‐
                 INFO_SHARED,  for  dumping  signals from the process-
                 wide signal queue.  If this flag is not set,  signals
                 are  read  from the per-thread queue of the specified
                 thread.

Thanks for the patch!

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-01-20 10:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16  8:19 [PATCH 0/3] ptrace.2: explain new commands to work with signals Andrey Vagin
2013-07-16  8:19 ` [PATCH 1/3] ptrace.2: place GETSIGINFO and SETSIGINFO near each other Andrey Vagin
     [not found]   ` <1373962773-2041-2-git-send-email-avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2013-07-18  1:13     ` Michael Kerrisk
     [not found]       ` <51E74143.4040709-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-08 14:43         ` Andrew Vagin
2013-07-16  8:19 ` [PATCH 2/3] ptrace.2: add description for PTRACE_PEEKSIGINFO Andrey Vagin
     [not found]   ` <1373962773-2041-3-git-send-email-avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2014-01-20 10:02     ` Michael Kerrisk (man-pages) [this message]
2013-07-16  8:19 ` [PATCH 3/3] ptrace.2: add description for PTRACE_{GET,SET}SIGMASK Andrey Vagin
     [not found]   ` <1373962773-2041-4-git-send-email-avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2014-01-20 10:03     ` Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52DCF41E.1060604@gmail.com \
    --to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    --cc=criu-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).