#include <fcntl.h>
#include "timeUtils.h"
#include <shlobj.h>
+#include <share.h>
#endif
#if HAVE_SYS_SELECT_H
#endif /* mingw32_TARGET_OS */
+INLINE int __hscore_open(char *file, int how, mode_t mode) {
+#ifdef mingw32_TARGET_OS
+ if ((how & O_WRONLY) || (how & O_RDWR) || (how & O_APPEND))
+ return _sopen(file,how,_SH_DENYRW,mode);
+ else
+ return _sopen(file,how,_SH_DENYWR,mode);
+#else
+ return open(file,how,mode);
+#endif
+}
+
// These are wrapped because on some OSs (eg. Linux) they are
// macros which redirect to the 64-bit-off_t versions when large file
// support is enabled.
//
-INLINE int __hscore_open(char *file, int how, mode_t mode) {
- return (open(file,how,mode));
-}
-
INLINE off_t __hscore_lseek(int fd, off_t off, int whence) {
return (lseek(fd,off,whence));
}
INLINE HsInt sizeofTimeVal(void) { return sizeof(struct timeval); }
INLINE HsInt getTicksOfDay(void)
-{
+{
struct timeval tv;
gettimeofday(&tv, (struct timezone *) NULL);
return (tv.tv_sec * TICK_FREQ +