Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 May 2003 12:08:27 +0400 (MSD)
From:      Igor Sysoev <is@rambler-co.ru>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        arch@freebsd.org
Subject:   Re: sendfile(2) SF_NOPUSH flag proposal
Message-ID:  <Pine.BSF.4.21.0305281140420.50420-100000@is>
In-Reply-To: <3ED45145.5389980@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 27 May 2003, Terry Lambert wrote:

> Igor Sysoev wrote:
> > > I don't think overhead is the issue, at this point: say we agree
> > > with you on overhead, for your particular application, and we are
> > > not against you solving your overhead problem: why exactly does
> > > the API have to change to fix the root cause of the problem?
> > 
> > I do not propose the change of the API, I propose the source and binary
> > compatible addition.
> 
> The "Subject:" line says you want to add a flag.  This is
> binary backward compatible, but it is not binary portable,
> and it is not source portable to systems that use your flag.
> 
> What happens when you want to recompile or run your code
> that uses the new flag on NetBSD, Darwin, MacOS X, etc.?
> 
> I'll tell you what happens: you get a compilation error
> with an undefined variable.

Really ?  I think that on NetBSD, Darwin, and MacOS X I would get:
-----
warning: implicit declaration of function `sendfile'
-----
and then:
-----
/tmp/ccQ50515.o(.text+0x7): undefined reference to `sendfile'
-----

On Solaris and Linux I will get:
-----
implicit declaration of function `sendfile'
-----
if I do not #include <sys/sendfile.> (it's not exist on FreeBSD) or
-----
too many arguments to function `sendfile'
-----

sendfile() is very and very unportable interface.  If developer want
to use the lowest common things then he should use #defines that
emulate Linux's interface - it sends file only.  And #define can hide
any flags.  If developer want to use maximum features that available
on the platform then he should use a huge wrapper something like
Apache 2.0's one:
http://cvs.apache.org/viewcvs.cgi/apr/network_io/unix/sendrecv.c


Igor Sysoev
http://sysoev.ru/en/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0305281140420.50420-100000>