Open Bug 1102709 Opened 10 years ago Updated 2 years ago

The implementation of _PR_MD_TLOCKFILE and _PR_MD_LOCKFILE should be exchanged in w95io.c

Categories

(NSPR :: NSPR, defect)

x86_64
Windows 7
defect

Tracking

(Not tracked)

People

(Reporter: jwwang, Unassigned)

References

(Depends on 1 open bug)

Details

Attachments

(1 file)

See http://msdn.microsoft.com/en-us/library/windows/desktop/aa365202(v=vs.85).aspx

If LockFile cannot lock a region of a file, it returns zero immediately. It does not block. To issue a file lock request that will block until the lock is acquired, use LockFileEx without the LOCKFILE_FAIL_IMMEDIATELY flag.
exchange the implementation of _PR_MD_TLOCKFILE and _PR_MD_LOCKFILE.
Assignee: wtc → jwwang
Status: NEW → ASSIGNED
Attachment #8526583 - Flags: review?(ted)
Comment on attachment 8526583 [details] [diff] [review]
1102709_exchange_PR_MD_LOCKFILE_and_PR_MD_TLOCKFILE.patch

Review of attachment 8526583 [details] [diff] [review]:
-----------------------------------------------------------------

Thank you for the patch. I suggest some improvements.

::: pr/src/md/windows/w95io.c
@@ +947,5 @@
>  
>  PRStatus
>  _PR_MD_LOCKFILE(PROsfd f)
>  {
> +    PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );

Could you implement this function using LockFileEx?

@@ +959,5 @@
> +    DWORD     rv;
> +
> +    rv = LockFile( (HANDLE)f,
> +        0l, 0l,
> +        0x0l, 0xffffffffl );

Nit: please put all the arguments on one line.

@@ +961,5 @@
> +    rv = LockFile( (HANDLE)f,
> +        0l, 0l,
> +        0x0l, 0xffffffffl );
> +    if ( rv == 0 ) {
> +        DWORD rc = GetLastError();

I have a patch for this line because this |rc| variable
hides the |rc| variable declared in the outer scope.

Could you please review my patch in bug 1089908? Or
you can incorporate my patch into this patch? Note that
I also added a _PR_MD_MAP_DEFAULT_ERROR call to map the
Windows error code to an NSPR error code.
Thanks. I will wait for bug 1089908 and try to implement _PR_MD_LOCKFILE.
Depends on: 1089908
Comment on attachment 8526583 [details] [diff] [review]
1102709_exchange_PR_MD_LOCKFILE_and_PR_MD_TLOCKFILE.patch

Review of attachment 8526583 [details] [diff] [review]:
-----------------------------------------------------------------

Sounds like Wan-Teh has this. Flag me for review if you need anything else.
Attachment #8526583 - Flags: review?(ted)
Assignee: jwwang → nobody
Status: ASSIGNED → NEW
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: