Re: [RFC,PATCH] SIGPIPE masking in local socket connections

From: Marko Kreen <markokr(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeremy Kerr <jk(at)ozlabs(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [RFC,PATCH] SIGPIPE masking in local socket connections
Date: 2009-06-02 14:43:36
Message-ID: e51f66da0906020743o72237f42k28ea9832759f2676@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 6/2/09, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Marko Kreen <markokr(at)gmail(dot)com> writes:
> > On 6/2/09, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> >> We've had problems before with userland headers not being in sync
> >> with what the kernel knows.
>
> > Well, we could just test in configure perhaps?
>
>
> The single most common way to get into that kind of trouble is to
> compile on machine A then install the executables on machine B with
> a different kernel. So a configure test wouldn't give me any warm
> feeling at all.

Agreed. Another problem would be cross-compilation.

> A feature that is exercised via setsockopt is probably fairly safe,
> since you can check for failure of the setsockopt call and then do
> it the old way. MSG_NOSIGNAL is a recv() flag, no? The question
> is whether you could expect that the recv() would fail if it had
> any unrecognized flags. Not sure if I trust that. SO_NOSIGPIPE
> seems safer.

send(). The question is if the kernel would give error (good)
or simply ignore it (bad). I guess with MSG_NOSIGNAL only safe
way is to hardcode working OSes.

Are there any OS-es that have MSG_NOSIGNAL but not SO_NOSIGPIPE?

*grep* Eh, seems like Linux is such OS... But I also see it existing
as of Linux 2.2.0 in working state, so should be safe to use on linux
despite the kernel version.

--
marko

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-06-02 14:45:17 Re: [RFC,PATCH] SIGPIPE masking in local socket connections
Previous Message Tom Lane 2009-06-02 14:38:27 Re: explain analyze rows=%.0f