105 |
|
/* Open heap file */ |
106 |
|
if (!(pmap -> heap = tmpfile())) |
107 |
|
error(SYSTEM, "failed opening heap file in initPhotonHeap"); |
108 |
+ |
#ifdef F_SETFL /* XXX is there an alternate needed for Windows? */ |
109 |
|
fdFlags = fcntl(fileno(pmap -> heap), F_GETFL); |
110 |
|
fcntl(fileno(pmap -> heap), F_SETFL, fdFlags | O_APPEND); |
111 |
+ |
#endif |
112 |
|
/* ftruncate(fileno(pmap -> heap), 0); */ |
113 |
|
} |
114 |
|
} |
141 |
|
/*if (pwrite(fd, pmap -> heapBuf, len, lseek(fd, 0, SEEK_END)) != len) */ |
142 |
|
if (write(fd, pmap -> heapBuf, len) != len) |
143 |
|
error(SYSTEM, "failed append to heap file in flushPhotonHeap"); |
144 |
< |
|
144 |
> |
|
145 |
> |
#if !defined(_WIN32) && !defined(_WIN64) |
146 |
|
if (fsync(fd)) |
147 |
|
error(SYSTEM, "failed fsync in flushPhotonHeap"); |
148 |
< |
|
148 |
> |
#endif |
149 |
|
pmap -> heapBufLen = 0; |
150 |
|
} |
151 |
|
|