sendfile(2) SF_NOPUSH flag proposal
Igor Sysoev
is at rambler-co.ru
Wed May 28 01:08:32 PDT 2003
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/
More information about the freebsd-arch
mailing list