Subject: Re: signal(SIGSEGV, SIG_IGN) -> 100% CPU
To: Gandhi woulda smacked you <greywolf@starwolf.com>
From: Todd Vierling <tv@pobox.com>
List: tech-kern
Date: 06/14/1999 17:04:45
On Mon, 14 Jun 1999, Gandhi woulda smacked you wrote:

: # Yeah.  Which would mean that pipe(3) would take three syscalls instead
: # of the one it presently takes.  Whether this would matter, of course,
: # is another issue.
: # 
: 
: I think it would matter since 3 system calls = at least 6 context switches.

Read My Lips:  One System Call.  <g>

If we claim to support two-way pipe() (which Solaris already does, so I'd
assume others do too without ill effects!), we may just:

int
pipe(fds)
	int *fds;
{
	return socketpair(PF_LOCAL, SOCK_STREAM, 0, fds);
}

This in libc, of course, not the kernel.  The usual behavior of one side of
a pipe() fd closing (causes SIGPIPE on read or write) also happens with a
closed-ended socket.  So, the behavior is /close to/ identical for
unidirectional data transfer.

-- 
-- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)