473,387 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.sigev_notify = SIGEV_SIGNAL;
timer_event.sigev_signo = SIGRTMIN;
timer_event.sigev_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_action, 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 2253
In article <11*********************@k78g2000cwa.googlegroups. com>,
Achint Mehta <ac*********@gmail.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.programmer for help with the real-time signals stuff.

-Beej

Feb 23 '07 #2
On Feb 23, 3:18 pm, Beej Jorgensen <b...@beej.uswrote:
In article <1172228497.165452.91...@k78g2000cwa.googlegroups. com>,

Achint Mehta <achintme...@gmail.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.programmer 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.programmer.

Thanks again.

Feb 23 '07 #3

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

Similar topics

2
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...
2
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...
4
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...
11
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
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...
4
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...
1
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...
5
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...
9
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.