Using GCC 3.3.1 on QNX NC 6.3.0

bridged with qnx.development_tools
Evan Hillas

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Evan Hillas » Thu Jun 16, 2005 9:39 pm

Colin Burgess wrote:
Danger - we don't support SA_RESTART so that was why it wasn't defined.
So you may have problems with interrupted kernel calls.
What constitutes an interrupted kernel call? I can guess at something like a wait being aborted. And what is likely to happen without this support?


Will Robertson

Colin Burgess

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Colin Burgess » Fri Jun 17, 2005 12:13 am

If a signal is dropped on you then the kernel call (say MsgReceivev)
will return with -1 and errno==EINTR

SA_RESTART is a unixism to tell the kernel to restart the kernel call as
if nothing happened.

Evan Hillas wrote:
Colin Burgess wrote:

Danger - we don't support SA_RESTART so that was why it wasn't
defined. So you may have problems with interrupted kernel calls.


What constitutes an interrupted kernel call? I can guess at something
like a wait being aborted. And what is likely to happen without this
support?


Will Robertson
--
cburgess@qnx.com

John Nagle

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by John Nagle » Fri Jun 17, 2005 10:41 pm

Evan Hillas wrote:
Evan Hillas wrote:

parse.C: In function `bool parse_int(const char*, const char*, int&)':
parse.C:68: error: invalid conversion from `const char*' to `char*'

Lines 67 and 68 from parse.C ...

bool parse_int(const char* buf, const char* tag, int& x) {
char* p = strstr(buf, tag);


Oh, click!, it is returning a pointer to a const char which means p
should be declared as such. Hmm, I just assumed they would have
something like that all nice and clean in such, supposedly, portable code.
Yes, you should declare p as "const char* p".

But unless you're compiling in C++ mode, the definition of "strstr"
should be

char *strstr(const char *s1, const char *s2);

This is a constness violation, but standardized as such in IEEE Std 1003.1-2001
for backwards compatibility with code that predates the
addition of "const" to C.

In C++ mode, there are two forms of "strstr", const and non-const.
Only C++ supports such overloading. So in C++, if you
put in "const" arguments to strstr, you get a const output,
which looks like what you're seeing.

So if you're getting that error, I suspect you've somehow
enabled C++ mode in "gcc". Which isn't necessarily bad;
good C code should compile in C++ mode.

Or maybe the Gnu people decided to pull that old compatibility hack
out.

John Nagle

David Bacon

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by David Bacon » Tue Jul 12, 2005 5:16 am

This "unixism" (SA_RESTART) is also an XSI extension.

Are we ever planning to support it?

Meanwhile, how can one distinguish between a system which doesn't
support it at all (like Neutrino) and one which just doesn't declare
SA_RESTART because automatic resumption is already the semantics
(like old BSD-based, non-XSI systems)?

dB

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Colin Burgess wrote ~ Thu, 16 Jun 2005 20:13:19 -0400:
If a signal is dropped on you then the kernel call (say MsgReceivev)
will return with -1 and errno==EINTR

SA_RESTART is a unixism to tell the kernel to restart the kernel call as
if nothing happened.

Evan Hillas wrote:
Colin Burgess wrote:

Danger - we don't support SA_RESTART so that was why it wasn't
defined. So you may have problems with interrupted kernel calls.


What constitutes an interrupted kernel call? I can guess at something
like a wait being aborted. And what is likely to happen without this
support?


Will Robertson

--
cburgess@qnx.com

Colin Burgess

Re: Using GCC 3.3.1 on QNX NC 6.3.0

Post by Colin Burgess » Tue Jul 12, 2005 1:14 pm

David Bacon wrote:
This "unixism" (SA_RESTART) is also an XSI extension.

Are we ever planning to support it?
I don't believe we have any plans.
Meanwhile, how can one distinguish between a system which doesn't
support it at all (like Neutrino) and one which just doesn't declare
SA_RESTART because automatic resumption is already the semantics
(like old BSD-based, non-XSI systems)?
I'm not sure. Some standards guy might be ablee to comment. :v)
dB

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Colin Burgess wrote ~ Thu, 16 Jun 2005 20:13:19 -0400:

If a signal is dropped on you then the kernel call (say MsgReceivev)
will return with -1 and errno==EINTR

SA_RESTART is a unixism to tell the kernel to restart the kernel call as
if nothing happened.

Evan Hillas wrote:

Colin Burgess wrote:


Danger - we don't support SA_RESTART so that was why it wasn't
defined. So you may have problems with interrupted kernel calls.


What constitutes an interrupted kernel call? I can guess at something
like a wait being aborted. And what is likely to happen without this
support?


Will Robertson

--
cburgess@qnx.com
--
cburgess@qnx.com

Post Reply

Return to “qnx.development_tools”