Re: Win32 rename()/unlink() questions
От | Bruce Momjian |
---|---|
Тема | Re: Win32 rename()/unlink() questions |
Дата | |
Msg-id | 200209201431.g8KEVMg13344@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: Win32 rename()/unlink() questions (Mike Mascari <mascarm@mascari.com>) |
Список | pgsql-hackers |
I don't think we are not going to be supporting Win9X so there isn't an issue there. We will be supporting Win2000/NT/XP. I don't understand FILE_SHARE_DELETE. I read the description at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/createfile.asp but I don't understand it: FILE_SHARE_DELETE - Windows NT/2000/XP: Subsequent open operations onthe object will succeed only if delete access is requested. --------------------------------------------------------------------------- Mike Mascari wrote: > Stephan Szabo wrote: > > On Fri, 20 Sep 2002, Mike Mascari wrote: > >> > >>Yes! Indeed that does work. > > > > > > Thinking back, I think that may still fail on Win95 (using MoveFile). > > Once in the past I had to work on (un)installers for Win* and I > > vaguely remember Win95 being more strict than Win98 but that may just > > have been with moving the executable you're currently running. > > Well, here's the test: > > foo.txt contains "This is FOO!" > bar.txt contains "This is BAR!" > > Process 1 opens foo.txt > Process 2 opens foo.txt > Process 1 sleeps 7.5 seconds > Process 2 sleeps 15 seconds > Process 1 uses MoveFile() to rename "foo.txt" to "foo2.txt" > Process 1 uses MoveFile() to rename "bar.txt" to "foo.txt" > Process 1 uses DeleteFile() to remove "foo2.txt" > Process 2 awakens and displays "This is FOO!" > > On the filesystem, we then have: > > foo.txt containing "This is BAR!" > > The good news is that this works fine under NT 4 using just > MoveFile(). The bad news is that it requires the files be opened > using CreateFile() with the FILE_SHARE_DELETE flag set. The C > library which ships with Visual C++ 6 ultimately calls > CreateFile() via fopen() but with no opportunity through the > standard C library routines to use the FILE_SHARE_DELETE flag. > And the FILE_SHARE_DELETE flag cannot be used under Windows > 95/98 (Bad Parameter). Which means, on those platforms, there > still doesn't appear to be a solution. Under NT/XP/2K, > AllocateFile() will have to modified to call CreateFile() > instead of fopen(). I'm not sure about ME, but I suspect it > behaves similarly to 95/98. > > Mike Mascari > mascarm@mascari.com > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
В списке pgsql-hackers по дате отправления: