2011-06-26 19:16:58     F_SETSIG is undefined

Document created by Aaronwu Employee on Aug 27, 2013
Version 1Show Document
  • View in full screen mode

2011-06-26 19:16:58     F_SETSIG is undefined

Dale Gifford (UNITED STATES)

Message: 101687   

 

While attempting to use the fcntl system call to receive notification that a named pipe has data to read, I get the compile time error that F_SETSIG is undefined. Is there an alternative way to setup a SIGIO for notification that data is available to read from a FIFO?

QuoteReplyEditDelete

 

 

2011-06-26 19:52:22     Re: F_SETSIG is undefined

Mike Frysinger (UNITED STATES)

Message: 101688   

 

works fine for me.  did you define _GNU_SOURCE and include fcntl.h first ?

QuoteReplyEditDelete

 

 

2011-06-27 14:50:30     Re: F_SETSIG is undefined

Dale Gifford (UNITED STATES)

Message: 101717   

 

Thanks for the help the _GNU_SOURCE define fixed the problem.

 

Just curious, what is the _GNU_SOURCE thing all about? I don't recall ever needing to define this in any application I've ever created in the past 20 years.

QuoteReplyEditDelete

 

 

2011-06-27 14:58:25     Re: F_SETSIG is undefined

Mike Frysinger (UNITED STATES)

Message: 101719   

 

that's probably because you havent used a GNU extension before.  if you refer to the POSIX or any pure-*nix manual, you will not see any mention of F_SETSIG.  this is an extension the GNU project has added.

 

read about feature test macros here:

  pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_02

 

or read the man page: `man feature_test_macros`

QuoteReplyEditDelete

 

 

2011-06-28 12:53:44     Re: F_SETSIG is undefined

Dale Gifford (UNITED STATES)

Message: 101802   

 

Thanks for the explaination. If the F_SETSIG is a GNU extension, then is there a more traditional mechanism for receiving a signal when a FIFO has data that can be read? I need to wait for multiple events (FIFO and network socket), so receiving a signal, such as SIGIO, seemed like the correct way to wait for the arrival of data from more than one source (without polling).

QuoteReplyEditDelete

 

 

2011-06-28 23:56:32     Re: F_SETSIG is undefined

Mike Frysinger (UNITED STATES)

Message: 101812   

 

i honestly dont know ... ive never done signal based i/o like that before.  for something like this, i'd reach for a func like epoll/poll/select with a timeout.  and if i wanted to have that be done in the bg, then use a dedicated i/o thread to handle notification.

 

i dont know how you've structured your code to say which is more appropriate.  if you're only writing code to work under Linux, then F_SETSIG is fine to use.

QuoteReplyEditDelete

 

 

2011-07-02 03:11:55     Re: F_SETSIG is undefined

Mike Frysinger (UNITED STATES)

Message: 101985   

 

i randomly came across this today:

  davmac.org/davpage/linux/async-io.html

 

maybe you'll find something useful

Attachments

    Outcomes