From: JobHunts02@aol.com
To: linux-kernel@vger.kernel.org
Subject: Sending siginfo from kernel to user space
Date: Thu, 2 Sep 2004 04:31:51 EDT [thread overview]
Message-ID: <1a9.284c240d.2e683477@aol.com> (raw)
I am sending a signal from kernel space to user space with Linux 2.4.20-8.
In user space, I have installed a signal handler:
saio.sa_handler = signal_handler_IO;
sigemptyset(&saio.sa_mask);
saio.sa_flags = SA_SIGINFO;
saio.sa_restorer = NULL;
sigaction(SA_SIGINFO, &saio, NULL);
In kernel space:
info.si_errno = 1212;
info.si_code = SI_KERNEL;
send_sig_info(SA_SIGINFO, &info, find_task_by_pid(pid));
This results in the signal handler,
void signal_handler_IO (int status, struct siginfo *info, void *p)
being called in user space, which gives the following values in info:
info->si_signo = 4 /* corresponds to SA_SIGINFO */
info->si_errno = 0 /* expect 1212 */
info->si_code = 0 /* expect SI_KERNEL (128) */
Note that the values I put in si_errno and si_code do not get passed to the
user. si_signo has the correct value, but the user can know this from the
original sigaction call.
If instead, I call send_sig_info(SA_SIGINFO, (struct siginfo*)0,
find_task_by_pid(pid)), as expected I get:
info->si_signo = 4
info->si_errno = 0
info->si_code = 0 /* corresponds to SI_USER, as expected */
If I call send_sig_info(SA_SIGINFO, (struct siginfo*)1,
find_task_by_pid(pid)), as expected I get:
info->si_signo = 4
info->si_errno = 0
info->si_code = 128 /* corresponds to SI_KERNEL, as expected */
Apparently, there is a problem copying the info structure. I need to pass
info to the kernel. Any ideas?
Thank you.
reply other threads:[~2004-09-02 8:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1a9.284c240d.2e683477@aol.com \
--to=jobhunts02@aol.com \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.