View topic - MSG_NOSIGNAL undeclared

MSG_NOSIGNAL undeclared

General Help about QNX

MSG_NOSIGNAL undeclared

Postby bricedebrignaisplage » Sat May 24, 2008 5:02 pm

When trying to compile this code:
http://tldp.org/LDP/LG/issue74/tougher.html#4.2

I got an error message about MSG_NOSIGNAL being undeclared

g++ -c -o ServerSocket.o ServerSocket.cpp
g++ -c -o Socket.o Socket.cpp
Socket.cpp: In method `bool Socket::send(basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >) const':
Socket.cpp:112: `MSG_NOSIGNAL' undeclared (first use this function)
Socket.cpp:112: (Each undeclared identifier is reported only once
Socket.cpp:112: for each function it appears in.)
make: *** [Socket.o] Error 1


Is there a fix?
bricedebrignaisplage
Active Member
 
Posts: 10
Joined: Tue Dec 04, 2007 9:55 am
Location: singapore

Re: MSG_NOSIGNAL undeclared

Postby rgallen » Sat May 24, 2008 5:42 pm

bricedebrignaisplage wrote:When trying to compile this code:
http://tldp.org/LDP/LG/issue74/tougher.html#4.2

I got an error message about MSG_NOSIGNAL being undeclared

g++ -c -o ServerSocket.o ServerSocket.cpp
g++ -c -o Socket.o Socket.cpp
Socket.cpp: In method `bool Socket::send(basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >) const':
Socket.cpp:112: `MSG_NOSIGNAL' undeclared (first use this function)
Socket.cpp:112: (Each undeclared identifier is reported only once
Socket.cpp:112: for each function it appears in.)
make: *** [Socket.o] Error 1


Is there a fix?


MSG_NOSIGNAL is a proprietary Linux manifest (i.e. it is non-posix/Xopen). Just replace it with 0 (the number 0).

The posix/xopen way of accomplishing the same result is to use sigprocmask/sigwait (see: http://opengroup.org/onlinepubs/0079087 ... gwait.html) to direct all signals synchronously to a signal handling thread.

Before continuing any further, make sure you understand this issue completely, as it is a fundamental element of multi-threaded programming.
rgallen
QNX Master
 
Posts: 671
Joined: Thu Jul 11, 2002 6:48 pm

RE: Re: MSG_NOSIGNAL undeclared

Postby bricedebrignaisplage » Mon May 26, 2008 7:27 am

so could I use pthread_sigmask to tell that thread to ignore SIGPIPE signals and check return code and errno to detect broken pipe? What I want to do ultimately is a client-server mechanism where both ends would try to reconnect when communication is broken.
bricedebrignaisplage
Active Member
 
Posts: 10
Joined: Tue Dec 04, 2007 9:55 am
Location: singapore

Re: MSG_NOSIGNAL undeclared

Postby seanb » Mon May 26, 2008 6:46 pm

bricedebrignaisplage wrote:When trying to compile this code:
http://tldp.org/LDP/LG/issue74/tougher.html#4.2

I got an error message about MSG_NOSIGNAL being undeclared

g++ -c -o ServerSocket.o ServerSocket.cpp
g++ -c -o Socket.o Socket.cpp
Socket.cpp: In method `bool Socket::send(basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >) const':
Socket.cpp:112: `MSG_NOSIGNAL' undeclared (first use this function)
Socket.cpp:112: (Each undeclared identifier is reported only once
Socket.cpp:112: for each function it appears in.)
make: *** [Socket.o] Error 1


Is there a fix?


The BSD's have been bringing this in. MSG_NOSIGNAL
will be supported in 6.4

-seanb
seanb
QNX Master
 
Posts: 133
Joined: Fri Jul 28, 2006 5:36 pm

Re: RE: Re: MSG_NOSIGNAL undeclared

Postby rgallen » Tue May 27, 2008 7:10 pm

bricedebrignaisplage wrote:so could I use pthread_sigmask to tell that thread to ignore SIGPIPE signals and check return code and errno to detect broken pipe? What I want to do ultimately is a client-server mechanism where both ends would try to reconnect when communication is broken.


Almost... you must block SIGPIPE at the process level, since you can't control which thread will pick it up otherwise. You should mask all signals and dedicate a thread to processing them synchronously. Any good book on pthreads will recommend this idiom.

If you are using QNX 6.4, then you can (as Sean suggests) just recompile against io-pkt which does have this manifest. Of course, this is non-posix.
rgallen
QNX Master
 
Posts: 671
Joined: Thu Jul 11, 2002 6:48 pm

Postby reya67 » Mon Oct 05, 2009 5:55 am

I want to asked that new device driver need to be added to an image? And i can apply the new driver directly or not?

__________________________
EX0-101 practice exam | 642-845 practice exam | 000-330 practice exam
reya67
New Member
 
Posts: 5
Joined: Mon Oct 05, 2009 5:52 am


Return to Help

Who is online

Users browsing this forum: No registered users and 2 guests

cron