473,888 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Purify error in Signal handler

Hi,

I am running purify on my program (on linux with gcc ver. 3.4.6)
I have installed a signal handler (for timer) using sigaction.
I am passing a pointer (data) into the sival_ptr which I intend to
access later in the signal handler.

timer_event.sig ev_notify = SIGEV_SIGNAL;
timer_event.sig ev_signo = SIGRTMIN;
timer_event.sig ev_value.sival_ ptr = data;

sigfillset (&timer_action. sa_mask);
timer_action.sa _flags = SA_SIGINFO ; /* realtime signal */
timer_action.sa _sigaction = handle_download _retry;
sigaction (SIGRTMIN, &timer_actio n, NULL);
....
timer_create(.. .)
...
timer_settime(. ..)
When I access this pointer in the signal handler purify gives me
Memory Segment error (which means that I am accessing memory from some
other segment)

I was accessing the pointer as
void handle_download _retry (int sigval, siginfo_t *extra, void *what)
{
. . .
p_msgData->data = (void *)(extra->si_value.sival _ptr); /* MSE :
Memory segment error */

}

However, even if I change the
p_msgData->data = (void *)(extra->si_value.sival _ptr);
to
p_msgData->data = (void *)(extra);
even then I get the error which means that purify doesn't like "extra"
being accessed.

Although the program does not dump core (with or without purify) but
can somebody tell me whether the signal handler code is correct ?

Thanks in advance.

Regards,
Achint

Feb 23 '07 #1
2 2287
In article <11************ *********@k78g2 000cwa.googlegr oups.com>,
Achint Mehta <ac*********@gm ail.comwrote:
>However, even if I change the
p_msgData->data = (void *)(extra->si_value.sival _ptr);
to
p_msgData->data = (void *)(extra);
even then I get the error which means that purify doesn't like "extra"
being accessed.
Or maybe p_msgData is not valid, and the problem is when you try to
access p_msgData->data?

Try comp.unix.progr ammer for help with the real-time signals stuff.

-Beej

Feb 23 '07 #2
On Feb 23, 3:18 pm, Beej Jorgensen <b...@beej.uswr ote:
In article <1172228497.165 452.91...@k78g2 000cwa.googlegr oups.com>,

Achint Mehta <achintme...@gm ail.comwrote:
However, even if I change the
p_msgData->data = (void *)(extra->si_value.sival _ptr);
to
p_msgData->data = (void *)(extra);
even then I get the error which means thatpurifydoesn 't like "extra"
being accessed.

Or maybe p_msgData is not valid, and the problem is when you try to
access p_msgData->data?

Try comp.unix.progr ammer for help with the real-time signals stuff.

-Beej

Thanks for the suggestion Beej.
I tried some combinations such as
p_msgData->data = 10;
and I did not get the purify error. So it seems that the error is
because of accessing "extra".
Also, p_msgData is a pointer to a global variable. Hope this is ok.

I will repost my query to comp.unix.progr ammer.

Thanks again.

Feb 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3975
by: Gary Robinson | last post by:
In some code we're writing we're making an assumption, and I'd like to confirm that the assumption is valid. Suppose a signal arrives while a file is being written, and the signal handler explicitly raises a SystemExit exception. My understanding is that the C-level I/O code will continue and the signal won't be processed until the end of the atomic python interpreter instruction that invoked that C code.
2
2217
by: lpw | last post by:
I have dilligently reviewed FAQ-lite Section 3.2, "How do I pass a pointer-to-member-function to a signal handler, X event callback, system call that starts a thread/task, etc." The only suggestion on how to deliver a signal to an object is to do it via a global variable and a wrapper function, a technique that is generally a Bad Idea (due to the usage of a global variable). I understand that this ng is dedicated to the discussion of...
4
2025
by: Eric Boutin | last post by:
Hi ! currently reading C docs, I think I'm reading docs about the stdc lib, but I'm not shure.. it talks about signals, does *all* OS implement the signal function, and use it well ? I mean.. I know Unixes do it, but what about windows ? does it implements all SIG* signal promptly ? Thanks ! -Eric Boutin
11
2987
by: Jackie | last post by:
Hi everyone, I'd like to know when and how signals are used (e.g. SIGFPE, SIGABRT, SIGTERM, SIGSEGV, SIGINT)? Thank you so much.
2
3258
by: saby | last post by:
Can anybody knowing Rational Purify help me? I am instrumenting an exe on solaris using Rational Purify. While building the exe, known as "DPSRun", it does not give any problem. But while I use Rational Purify, it gives a link error as given below. Linking Undefined first referenced
4
3006
by: sudheer786 | last post by:
A purify error while doing build is setup -------------------------------------------------------------------------------- Hi all, I was facing a strange error while trying to run my labeled build once after the make depend and make all was sucessful in solaris. When I tried to attach dbx and run the build on solaris 5.4 release , it shows a wrong a menory address which is cascaded. Neither of the memory is freed. dbx: cannot...
1
5554
by: sudheer786 | last post by:
Hi all, I was facing a strange error while trying to run my labeled build once after the make depend and make all was sucessful in solaris. When I tried to attach dbx and run the build on solaris 5.4 release , it shows a wrong a menory address which is cascaded. Neither of the memory is freed. dbx: cannot access address 0xffffffffffffffd4 When I tried to run with purify it shows
5
6657
by: david | last post by:
I'm developing a program that runs using an asyncore loop. Right now I can adequately terminate it using Control-C, but as things get refined I need a better way to stop it. I've developed another program that executes it as a child process using popen2.Popen4(). I was attempting to use signals to stop it (using os.kill()) but I keep running into a problem where sending the signal causes an infinite loop of printing the message...
9
5851
by: thagor2008 | last post by:
Is the behaviour of throwing exceptions in a unix signal handler defined? eg: void sighandler(int sig) { ... do something throw myobj; }
0
9961
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9802
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11186
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10887
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7148
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5825
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6015
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4248
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3252
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.