fd = PR_OpenFile(filename.get(), PR_WRONLY|PR_TRUNCATE, 0644); if (!fd)
fd = PR_OpenFile(filename.get(), PR_CREATE_FILE|PR_WRONLY|PR_TRUNCATE, 0644); if (!fd) {
writeFile(int cycles){    printf("writeFile\n");    PRFileDesc *fd;    PRInt32 fStatus;    int x;    char * data = (char*) malloc(DATASIZE);    for (x=0; x<DATASIZE; x++)        *data = '\0';    PRIntervalTime time = PR_IntervalNow();    while (cycles--) {        printf("writeFile [cycle=%d]\n", cycles);        // create "cache" directories        PR_MakeDir(TMPDIR "foo", 0755);                for (x=0; x<32; x++) {            nsCAutoString filename; filename.Assign(TMPDIR "foo" DIRSEP);            filename.AppendInt(x);            PR_MakeDir(filename.get(), 0755);        }                // create "cache" files        for (x=1; x<=ENTRYCOUNT; x++) {            nsCAutoString filename; filename.Assign(TMPDIR "foo" DIRSEP);            filename.AppendInt( x % 32 );            filename.Append(DIRSEP);            filename.AppendInt( x );            PRIntervalTime i1, i2, i3;            i1 = PR_IntervalNow();            fd = PR_OpenFile(filename.get(), PR_WRONLY|PR_TRUNCATE, 0644);            if (!fd)                printf("bad filename?  %s\n", filename.get());            i2 = PR_IntervalNow();            fStatus = PR_Write(fd, data, DATASIZE);              if (fStatus == -1) {                printf("Bad fStatus %d\n", PR_GetError());                exit(1);            }             i3 = PR_IntervalNow();            PR_Close(fd);/*            printf(" - writing %s [topen=%d twrite=%d]\n",                    filename.get(),                PR_IntervalToMilliseconds(i2 - i1),                 PR_IntervalToMilliseconds(i3 - i2));*/        }    }    return PR_IntervalToMilliseconds(PR_IntervalNow() - time);}