httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@gonzo.ben.algroup.co.uk>
Subject Operating System Independence
Date Sat, 14 Oct 1995 13:06:24 GMT
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.

Mime
View raw message