Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
716ffc5b
Commit
716ffc5b
authored
Mar 20, 2002
by
Bill Medland
Committed by
Alexandre Julliard
Mar 20, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Connect the msvcrt file byte locking up to ntdll.
parent
f12f4d7d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
1 deletion
+87
-1
file.c
dlls/msvcrt/file.c
+55
-0
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+1
-1
Makefile.in
include/Makefile.in
+1
-0
locking.h
include/msvcrt/sys/locking.h
+30
-0
No files found.
dlls/msvcrt/file.c
View file @
716ffc5b
...
...
@@ -32,6 +32,7 @@
#include "msvcrt/direct.h"
#include "msvcrt/fcntl.h"
#include "msvcrt/io.h"
#include "msvcrt/sys/locking.h"
#include "msvcrt/stdio.h"
#include "msvcrt/stdlib.h"
#include "msvcrt/string.h"
...
...
@@ -508,6 +509,60 @@ LONG _lseek(int fd, LONG offset, int whence)
}
/*********************************************************************
* _locking (MSVCRT.@)
*
* This is untested; the underlying LockFile doesn't work yet.
*/
int
_locking
(
int
fd
,
int
mode
,
LONG
nbytes
)
{
BOOL
ret
;
DWORD
cur_locn
;
HANDLE
hand
=
msvcrt_fdtoh
(
fd
);
TRACE
(
":fd (%d) handle (%d)
\n
"
,
fd
,
hand
);
if
(
hand
==
INVALID_HANDLE_VALUE
)
return
-
1
;
if
(
mode
<
0
||
mode
>
4
)
{
SET_THREAD_VAR
(
errno
,
MSVCRT_EINVAL
);
return
-
1
;
}
TRACE
(
":fd (%d) by 0x%08lx mode %s
\n
"
,
fd
,
nbytes
,(
mode
==
_LK_UNLCK
)
?
"_LK_UNLCK"
:
(
mode
==
_LK_LOCK
)
?
"_LK_LOCK"
:
(
mode
==
_LK_NBLCK
)
?
"_LK_NBLCK"
:
(
mode
==
_LK_RLCK
)
?
"_LK_RLCK"
:
(
mode
==
_LK_NBRLCK
)
?
"_LK_NBRLCK"
:
"UNKNOWN"
);
if
((
cur_locn
=
SetFilePointer
(
hand
,
0L
,
NULL
,
SEEK_CUR
))
==
0xffffffff
)
{
FIXME
(
"Seek failed
\n
"
);
SET_THREAD_VAR
(
errno
,
MSVCRT_EINVAL
);
/* FIXME */
return
-
1
;
}
if
(
mode
==
_LK_LOCK
||
mode
==
_LK_RLCK
)
{
int
nretry
=
10
;
ret
=
1
;
/* just to satisfy gcc */
while
(
nretry
--
)
{
ret
=
LockFile
(
hand
,
cur_locn
,
0L
,
nbytes
,
0L
);
if
(
ret
)
break
;
sleep
(
1
);
}
}
else
if
(
mode
==
_LK_UNLCK
)
ret
=
UnlockFile
(
hand
,
cur_locn
,
0L
,
nbytes
,
0L
);
else
ret
=
LockFile
(
hand
,
cur_locn
,
0L
,
nbytes
,
0L
);
/* FIXME - what about error settings? */
return
ret
?
0
:
-
1
;
}
/*********************************************************************
* rewind (MSVCRT.@)
*/
void
MSVCRT_rewind
(
MSVCRT_FILE
*
file
)
...
...
dlls/msvcrt/msvcrt.spec
View file @
716ffc5b
...
...
@@ -326,7 +326,7 @@ debug_channels (msvcrt)
@ cdecl _loaddll(str) _loaddll
@ cdecl _local_unwind2(ptr long) _local_unwind2
@ cdecl _lock(long) _lock
@
stub _locking #(long long long)
@
cdecl _locking(long long long) _locking
@ cdecl _logb( double ) _logb
@ stub _longjmpex
@ cdecl _lrotl(long long) _lrotl
...
...
include/Makefile.in
View file @
716ffc5b
...
...
@@ -78,6 +78,7 @@ INSTALLED_INCLUDES = \
msvcrt/stdio.h
\
msvcrt/stdlib.h
\
msvcrt/string.h
\
msvcrt/sys/locking.h
\
msvcrt/sys/stat.h
\
msvcrt/sys/timeb.h
\
msvcrt/sys/types.h
\
...
...
include/msvcrt/sys/locking.h
0 → 100644
View file @
716ffc5b
/*
* _locking constants
*
* Copyright 2002 Bill Medland
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_SYS_LOCKING_H__
#define __WINE_SYS_LOCKING_H__
#define __WINE_USE_MSVCRT
#define _LK_UNLCK 0
#define _LK_LOCK 1
#define _LK_NBLCK 2
#define _LK_RLCK 3
#define _LK_NBRLCK 4
#endif
/* __WINE_SYS_LOCKING_H__ : Do not place anything after this #endif */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment