From: "Kevin B. Hendricks" <khendricks@ivey.uwo.ca>
To: Roman Zippel <zippel@fh-brandenburg.de>, jekacur@ca.ibm.com
Cc: khendricks@ivey.uwo.ca, linuxppc-dev@lists.linuxppc.org
Subject: Re:sigcontext on Linux-ppc in user space, another hack.
Date: Thu, 25 Jan 2001 20:05:51 -0500 [thread overview]
Message-ID: <01012520055100.11290@localhost> (raw)
In-Reply-To: <Pine.GSO.4.10.10101252352100.1508-100000@zeus.fh-brandenburg.de>
Hi,
> Please ignore the last patch!
> Anyway, in the code example the last argument is not a sigcontext
> structure but an ucontext_t structure, which is defined in <ucontext.h>.
Yes.
Here is the revised sample program and it works:
[root@localhost kbhend]# ./junk
SIGUSR1 = 10
uc = 7ffff794
uc->uc_mcontext.signal = 10
[root@localhost kbhend]# cat junk.c
#include <stdio.h>
#include <signal.h>
#include <ucontext.h>
/* Function Prototypes */
void install_sigusr1_handler(void);
void sigusr_handler(int , siginfo_t *, struct ucontext * uc);
int main(void)
{
install_sigusr1_handler();
printf("SIGUSR1 = %d\n", SIGUSR1);
raise(SIGUSR1);
exit(0);
}
void install_sigusr1_handler(void)
{
struct sigaction newAct;
if (sigemptyset(&newAct.sa_mask) != 0) {
fprintf(stderr, "Warning, sigemptyset failed.\n");
}
newAct.sa_flags = 0;
newAct.sa_flags |= SA_SIGINFO | SA_RESTART;
newAct.sa_sigaction = (void
(*)(int,siginfo_t*,void*))sigusr_handler;
if (sigaction(SIGUSR1, &newAct, NULL) != 0) {
fprintf(stderr, "Couldn't install SIGUSR1 handler.\n");
fprintf(stderr, "Exiting.\n");
exit(1);
}
}
void sigusr_handler(int signo, siginfo_t *siginfp, struct ucontext * uc)
{
printf("uc = %08x\n", uc);
printf("uc->uc_mcontext.signal = %d\n", uc->uc_mcontext.signal);
}
[[root@localhost kbhend]# cat junk.c
#include <stdio.h>
#include <signal.h>
#include <ucontext.h>
/* Function Prototypes */
void install_sigusr1_handler(void);
void sigusr_handler(int , siginfo_t *, struct ucontext * uc);
int main(void)
{
install_sigusr1_handler();
printf("SIGUSR1 = %d\n", SIGUSR1);
raise(SIGUSR1);
exit(0);
}
void install_sigusr1_handler(void)
{
struct sigaction newAct;
if (sigemptyset(&newAct.sa_mask) != 0) {
fprintf(stderr, "Warning, sigemptyset failed.\n");
}
newAct.sa_flags = 0;
newAct.sa_flags |= SA_SIGINFO | SA_RESTART;
newAct.sa_sigaction = (void
(*)(int,siginfo_t*,void*))sigusr_handler;
if (sigaction(SIGUSR1, &newAct, NULL) != 0) {
fprintf(stderr, "Couldn't install SIGUSR1 handler.\n");
fprintf(stderr, "Exiting.\n");
exit(1);
}
}
void sigusr_handler(int signo, siginfo_t *siginfp, struct ucontext * uc)
{
printf("uc = %08x\n", uc);
printf("uc->uc_mcontext.signal = %d\n", uc->uc_mcontext.signal);
}
[root@localhost kbhend]# ./junk
SIGUSR1 = 10
uc = 7ffff794
uc->uc_mcontext.signal = 10
So no patch needed.
Thanks for finding that.
Kevin
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
prev parent reply other threads:[~2001-01-26 1:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-25 20:31 Re:sigcontext on Linux-ppc in user space, another hack jekacur
2001-01-25 23:04 ` Roman Zippel
2001-01-26 1:05 ` Kevin B. Hendricks [this message]
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=01012520055100.11290@localhost \
--to=khendricks@ivey.uwo.ca \
--cc=jekacur@ca.ibm.com \
--cc=linuxppc-dev@lists.linuxppc.org \
--cc=zippel@fh-brandenburg.de \
/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.