Re: [PATCH 04/15] Set _O_BINARY as default fmode for both MinGW and MSVC
- From
Marius Storm-Olsen <mstormo@gmail.com>
- Date
- Sep 17, 2009, 08:45 UTC
- Message-ID
- <4AB1F71B.6050004@gmail.com>
- In-Reply-To
- <e2480c70909170139x9580bb4pcc1ad8e1b93aef17@mail.gmail.com>
Alexey Borzenkov said the following on 17.09.2009 10:39:
Show 21 quoted lines
> On Thu, Sep 17, 2009 at 12:10 PM, Johannes Sixt <j.sixt@viscovery.net> wrote: >> Marius Storm-Olsen schrieb: >>> BTW, I ran all the tests (make /k test) before and after the >>> whole series, with msysgit 'devel' branch + plain git.git 'next', >>> and it turns out that 2 more tests pass after this series :) >> Sorry to disappoint you: these 2 tests only passed by chance. For a >> work-around see e95a73ef in mingw.git (it papers over an undetected >> racily-clean index). > > Maybe we should just implement nsec for mingw? The code is already almost there: > > Converter filetime_to_timespec is available in cygwin.c > Definition of struct timespec and struct stat that uses it can be > borrowed from cygwin's cygwin/stat.h and cygwin/types.h, we could call > it struct mingw_timespec and struct mingw_stat. Then #define timespec > mingw_timespec and #define stat mingw_stat, as well as #define > st_atime (st_atim.tv_sec) and similarly others, just like > cygwin/stat.h does. > Since we already reimplement stat/lstat/fstat it should be relatively > simple and we don't care about usage of mingw's stat. > Do you want me to cook up a patch?
we already override the stat() implementation with our own :)
compat/mingw.h (~174):
/* Use mingw_lstat() instead of lstat()/stat() and * mingw_fstat() instead of fstat() on Windows. */ #define off_t off64_t #define stat _stati64 #define lseek _lseeki64 int mingw_lstat(const char *file_name, struct stat *buf); int mingw_fstat(int fd, struct stat *buf); #define fstat mingw_fstat #define lstat mingw_lstat #define _stati64(x,y) mingw_lstat(x,y)
int mingw_utime(const char *file_name, const struct utimbuf *times); #define utime mingw_utime
See compat/mingw.c for implementation..
-- .marius