apache中的文件与目录(2)[12]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

                do {
                    do {
                        rv = write(thefile->filedes, buf, *nbytes);
                    } while (rv == (apr_size_t)-1 && errno == EINTR);
                    if (rv == (apr_size_t)-1 &&
                        (errno == EAGAIN || errno == EWOULDBLOCK)) {
                        *nbytes /= 2;
                    }
                    else {
                        break;
                    }
                } while (1);
            }
        } 
#endif
        if (rv == (apr_size_t)-1) {
            (*nbytes) = 0;
           return errno;
        }
        *nbytes = rv;
        return APR_SUCCESS;
 
对于缓冲写入,其实现代码如下所示:
    apr_size_t rv;
 
    if (thefile->buffered) {
        char *pos = (char *)buf;
        int blocksize;
        int size = *nbytes;
 
        if ( thefile->direction == 0 ) {
            apr_int64_t offset = thefile->filePtr - thefile->dataRead + thefile->bufpos;
            if (offset != thefile->filePtr)
                lseek(thefile->filedes, offset, SEEK_SET);                  u
            thefile->bufpos = thefile->dataRead = 0;

本文关键:apache中的文件与目录(2)
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top