Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
1c50c32a
Commit
1c50c32a
authored
Dec 14, 2011
by
Yasuhiro Matsumoto
Committed by
Alex Brainman
Dec 14, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exp/winfsnotify: fix build.
R=golang-dev, alex.brainman CC=golang-dev
https://golang.org/cl/5483057
parent
599c18fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
winfsnotify.go
src/pkg/exp/winfsnotify/winfsnotify.go
+11
-11
No files found.
src/pkg/exp/winfsnotify/winfsnotify.go
View file @
1c50c32a
...
...
@@ -75,7 +75,7 @@ type Watcher struct {
// NewWatcher creates and returns a Watcher.
func
NewWatcher
()
(
*
Watcher
,
error
)
{
port
,
e
:=
syscall
.
CreateIoCompletionPort
(
syscall
.
InvalidHandle
,
0
,
0
,
0
)
if
e
!=
0
{
if
e
!=
nil
{
return
nil
,
os
.
NewSyscallError
(
"CreateIoCompletionPort"
,
e
)
}
w
:=
&
Watcher
{
...
...
@@ -147,7 +147,7 @@ func (w *Watcher) RemoveWatch(path string) error {
func
(
w
*
Watcher
)
wakeupReader
()
error
{
e
:=
syscall
.
PostQueuedCompletionStatus
(
w
.
port
,
0
,
0
,
nil
)
if
e
!=
0
{
if
e
!=
nil
{
return
os
.
NewSyscallError
(
"PostQueuedCompletionStatus"
,
e
)
}
return
nil
...
...
@@ -155,7 +155,7 @@ func (w *Watcher) wakeupReader() error {
func
getDir
(
pathname
string
)
(
dir
string
,
err
error
)
{
attr
,
e
:=
syscall
.
GetFileAttributes
(
syscall
.
StringToUTF16Ptr
(
pathname
))
if
e
!=
0
{
if
e
!=
nil
{
return
""
,
os
.
NewSyscallError
(
"GetFileAttributes"
,
e
)
}
if
attr
&
syscall
.
FILE_ATTRIBUTE_DIRECTORY
!=
0
{
...
...
@@ -173,11 +173,11 @@ func getIno(path string) (ino *inode, err error) {
syscall
.
FILE_SHARE_READ
|
syscall
.
FILE_SHARE_WRITE
|
syscall
.
FILE_SHARE_DELETE
,
nil
,
syscall
.
OPEN_EXISTING
,
syscall
.
FILE_FLAG_BACKUP_SEMANTICS
|
syscall
.
FILE_FLAG_OVERLAPPED
,
0
)
if
e
!=
0
{
if
e
!=
nil
{
return
nil
,
os
.
NewSyscallError
(
"CreateFile"
,
e
)
}
var
fi
syscall
.
ByHandleFileInformation
if
e
=
syscall
.
GetFileInformationByHandle
(
h
,
&
fi
);
e
!=
0
{
if
e
=
syscall
.
GetFileInformationByHandle
(
h
,
&
fi
);
e
!=
nil
{
syscall
.
CloseHandle
(
h
)
return
nil
,
os
.
NewSyscallError
(
"GetFileInformationByHandle"
,
e
)
}
...
...
@@ -222,7 +222,7 @@ func (w *Watcher) addWatch(pathname string, flags uint64) error {
}
watchEntry
:=
w
.
watches
.
get
(
ino
)
if
watchEntry
==
nil
{
if
_
,
e
:=
syscall
.
CreateIoCompletionPort
(
ino
.
handle
,
w
.
port
,
0
,
0
);
e
!=
0
{
if
_
,
e
:=
syscall
.
CreateIoCompletionPort
(
ino
.
handle
,
w
.
port
,
0
,
0
);
e
!=
nil
{
syscall
.
CloseHandle
(
ino
.
handle
)
return
os
.
NewSyscallError
(
"CreateIoCompletionPort"
,
e
)
}
...
...
@@ -295,7 +295,7 @@ func (w *Watcher) deleteWatch(watch *watch) {
// Must run within the I/O thread.
func
(
w
*
Watcher
)
startRead
(
watch
*
watch
)
error
{
if
e
:=
syscall
.
CancelIo
(
watch
.
ino
.
handle
);
e
!=
0
{
if
e
:=
syscall
.
CancelIo
(
watch
.
ino
.
handle
);
e
!=
nil
{
w
.
Error
<-
os
.
NewSyscallError
(
"CancelIo"
,
e
)
w
.
deleteWatch
(
watch
)
}
...
...
@@ -304,7 +304,7 @@ func (w *Watcher) startRead(watch *watch) error {
mask
|=
toWindowsFlags
(
m
)
}
if
mask
==
0
{
if
e
:=
syscall
.
CloseHandle
(
watch
.
ino
.
handle
);
e
!=
0
{
if
e
:=
syscall
.
CloseHandle
(
watch
.
ino
.
handle
);
e
!=
nil
{
w
.
Error
<-
os
.
NewSyscallError
(
"CloseHandle"
,
e
)
}
delete
(
w
.
watches
[
watch
.
ino
.
volume
],
watch
.
ino
.
index
)
...
...
@@ -312,7 +312,7 @@ func (w *Watcher) startRead(watch *watch) error {
}
e
:=
syscall
.
ReadDirectoryChanges
(
watch
.
ino
.
handle
,
&
watch
.
buf
[
0
],
uint32
(
unsafe
.
Sizeof
(
watch
.
buf
)),
false
,
mask
,
nil
,
&
watch
.
ov
,
0
)
if
e
!=
0
{
if
e
!=
nil
{
err
:=
os
.
NewSyscallError
(
"ReadDirectoryChanges"
,
e
)
if
e
==
syscall
.
ERROR_ACCESS_DENIED
&&
watch
.
mask
&
provisional
==
0
{
// Watched directory was probably removed
...
...
@@ -354,7 +354,7 @@ func (w *Watcher) readEvents() {
}
}
var
err
error
if
e
:=
syscall
.
CloseHandle
(
w
.
port
);
e
!=
0
{
if
e
:=
syscall
.
CloseHandle
(
w
.
port
);
e
!=
nil
{
err
=
os
.
NewSyscallError
(
"CloseHandle"
,
e
)
}
close
(
w
.
Event
)
...
...
@@ -386,7 +386,7 @@ func (w *Watcher) readEvents() {
default
:
w
.
Error
<-
os
.
NewSyscallError
(
"GetQueuedCompletionPort"
,
e
)
continue
case
0
:
case
nil
:
}
var
offset
uint32
...
...
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