You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ben Laurie <be...@gonzo.ben.algroup.co.uk> on 1995/10/14 14:06:24 UTC

Operating System Independence

One of the things that changes most from system to system is the handling of
sockets. Particularly under Windows (all flavours), where sockets are not
files, so things like fprintf cannot be used on them! This is easy enough to
handle, we just have an os_conn_printf() for printf'ing to a socket, but this
raises a small style problem. The way I see it, the neat thing to do is to
replace the FILE *client and FILE *request_in members of conn_rec with
a OS-dependent structure (called, say, os_conn_rec). Then functions like
fclose, fflush, fprintf, etc. are replaced (when used on a connection) with
os_conn_fclose, etc. This can be done in such a way as to have no performance
impact on the existing system, using #defines. The snag occurs with printf,
since #defines don't support varargs. As I see it, there's really only one
way round this if we want to not hit performance, which is to do something
tacky like:

#define os_conn_printf(conn)	fprintf(conn->client.out

which is used like:

	os_conn_printf(conn),"Print %s, %s and %s",this,that,theother);

Horrid. But useable. Just. Anyone got any better ideas?

Also, does anyone support/object to the idea of incorporating such changes?

Cheers,

Ben.

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant        Fax:   +44 (181) 994 6472
and Technical Director      Email: ben@algroup.co.uk
A.L. Digital Ltd,
London, England.