Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2008-09

MSG_NOSIGNAL in Mac OS X

10 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Felipe Monteiro de Carvalho

Hello,

The sockets unit for Mac OS X (FPC 2.2.2) does not contain MSG_NOSIGNAL, which is necessary for the correct functioning of the Synapse library.

I modifyed the Synapse source (locally) to use $20000 for MSG_NOSIGNAL, which is the same value for FreeBSD/NetBSD.

Note that I have very little knowledge of sockets, or what those constants mean, or why they are necessary in Synapse. I am just saying that maybe MSG_NOSIGNAL should be added to the darwin sockets unit. What do you think?

MSG_NOSIGNAL = $20000; { Do not generate SIGPIPE }

thanks,

Felipe Monteiro de Carvalho

Reply by email

Marco van de Voort
to Felipe Monteiro de Carvalho

In our previous episode, Felipe Monteiro de Carvalho said:

Show quoted text 13 lines
The sockets unit for Mac OS X (FPC 2.2.2) does not contain MSG_NOSIGNAL, which is necessary for the correct functioning of the Synapse library. I modifyed the Synapse source (locally) to use $20000 for MSG_NOSIGNAL, which is the same value for FreeBSD/NetBSD. Note that I have very little knowledge of sockets, or what those constants mean, or why they are necessary in Synapse. I am just saying that maybe MSG_NOSIGNAL should be added to the darwin sockets unit. What do you think? MSG_NOSIGNAL = $20000; { Do not generate SIGPIPE }

If the identifier is already exported cross-platform, it is ok.

Even non crossplatform values are allowed, as long as they are relevant to core sockets operating (so not an entire epoll implementation or so), and serve a clear use (which is the case here).

Almindor and I added heaps of constants for Indy's benefit too.

Reply by email

Marco van de Voort
to Felipe Monteiro de Carvalho

In our previous episode, Felipe Monteiro de Carvalho said:

Show quoted text 5 lines
Some searching says it doesn't exist in Mac OS X: http://lists.apple.com/archives/macnetworkprog/2002/Dec/msg00091.html But they have an equivalent.

I checked on my 10.4 and it is as there. It is not in the headers, and SO_nosigpipe is with value $1022

Curiously, my very simple webserver worked when hardcoding the constant =P http://wiki.lazarus.freepascal.org/Networking#Webserver_example

More research required then. I assumed you found it in Apple's headers.

Reply by email

Aleš Katona
to Marco van de Voort: In our previous episode, Felipe Monteiro de Carvalho said: If the identifier is already…

Dňa Št, 2008-09-18 o 13:49 +0200, Marco van de Voort napísal:

Show quoted text 15 lines
In our previous episode, Felipe Monteiro de Carvalho said: > The sockets unit for Mac OS X (FPC 2.2.2) does not contain > MSG_NOSIGNAL, which is necessary for the correct functioning of the > Synapse library. > > I modifyed the Synapse source (locally) to use $20000 for > MSG_NOSIGNAL, which is the same value for FreeBSD/NetBSD. > > Note that I have very little knowledge of sockets, or what those > constants mean, or why they are necessary in Synapse. I am just saying > that maybe MSG_NOSIGNAL should be added to the darwin sockets unit. > What do you think? > > MSG_NOSIGNAL = $20000; { Do not generate SIGPIPE }

It's not officially documented, and I don't have a Mac so I didn't include it. I found it odd myself, but then FreeBSD added this relatively recently, and I think Apple just copied without notifying later (thus no docs etc.).

Anyway if it's really there and tested, it should be added to the Darwin unxsockh.inc.

Very useful this flag, lNet uses it too if possible.

Ales

Reply by email

Marco van de Voort
to Aleš Katona

In our previous episode, Aleš Katona said:

Anyway if it's really there and tested, it should be added to the Darwin unxsockh.inc.

As Jonas said, testing is non-trivial, since it is about a certain errorhandling condition, not a basic compile+connect.

Reply by email

Aleš Katona
to Marco van de Voort

Dňa Pi, 2008-09-19 o 10:45 +0200, Marco van de Voort napísal:

Show quoted text 6 lines
In our previous episode, Aleš Katona said: > Anyway if it's really there and tested, it should be added to the Darwin > unxsockh.inc. As Jonas said, testing is non-trivial, since it is about a certain errorhandling condition, not a basic compile+connect.

That's why I said tested, not "compiles". Any number compiles.

All you need to do is break a send, make a program which repeats sends and kill it in the middle of one. If the other end exits with SIGPIPE we've got a loser.

Ales

Reply by email

Jonas Maebe
to Aleš Katona
Aleš Katona wrote
All you need to do is break a send, make a program which repeats sends and kill it in the middle of one. If the other end exits with SIGPIPE we've got a loser.

No, if the kernel developers say it is not supported, then you don't use it. Because even if by some freak accident it works today, it may stop working tomorrow.

Jonas

Reply by email

Aleš Katona
to Jonas Maebe

Dňa Pi, 2008-09-19 o 19:31 +0100, Jonas Maebe napísal:

Show quoted text 10 lines
On 19 Sep 2008, at 11:16, Aleš Katona wrote: > All you need to do is break a send, make a program which repeats sends > and kill it in the middle of one. If the other end exits with SIGPIPE > we've got a loser. No, if the kernel developers say it is not supported, then you don't use it. Because even if by some freak accident it works today, it may stop working tomorrow.

I agree with that, but from the previous mails I had the feeling people were more inclined to add it?

Ales

Reply by email