httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Question. fopen() in ap_pfopen() background ?
Date Fri, 08 Oct 1999 07:38:19 GMT
Folks, I have a few questions from the developers on this list.
The following code is from src/main/alloc.c file at
    if (*mode == 'a') {
	/* Work around faulty implementations of fopen */
	baseFlag = (*(mode + 1) == '+') ? O_RDWR : O_WRONLY;
	desc = open(name, baseFlag | O_APPEND | O_CREAT,
	if (desc >= 0) {
	    desc = ap_slack(desc, AP_SLACK_LOW);
	    fd = ap_fdopen(desc, mode);
    else {
	fd = fopen(name, mode);
According to the comment some fopen() implementations have a 
problem with fopen() and "-a" option. 

Here are my questions:
1) What is the problem with fopen() "-a" and on what platform?

2) Why is fopen() used for opening the error log in 
   src/main/http_log.c file at open_error_log() function?
   The buffering performance boost that fopen() provides is very minimal
   in the case of writing to error log.

3) The Solaris implementation has a problem with any fopen() which
   opens a file above the 256 file descriptor. HPUX and AIX do not have
   this problem. This means that some fopen's will fail if there are
   fd's open on the Solaris platform. Isn't open()/read()/write() a 
   cleaner implementation for logging ?


View raw message