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
5e83d409
Commit
5e83d409
authored
Feb 09, 2011
by
Alex Brainman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
syscall: implement windows version of Fsync
R=golang-dev, rsc CC=golang-dev
https://golang.org/cl/4158043
parent
e6f9b2f1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
syscall_windows.go
src/pkg/syscall/syscall_windows.go
+8
-3
zsyscall_windows_386.go
src/pkg/syscall/zsyscall_windows_386.go
+16
-0
No files found.
src/pkg/syscall/syscall_windows.go
View file @
5e83d409
...
...
@@ -158,6 +158,7 @@ func NewCallback(fn interface{}) uintptr
//sys CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, errno int) [failretval==nil] = shell32.CommandLineToArgvW
//sys LocalFree(hmem uint32) (handle uint32, errno int) [failretval!=0]
//sys SetHandleInformation(handle int32, mask uint32, flags uint32) (ok bool, errno int)
//sys FlushFileBuffers(handle int32) (ok bool, errno int)
// syscall interface implementation for other packages
...
...
@@ -478,6 +479,13 @@ func Utimes(path string, tv []Timeval) (errno int) {
return
0
}
func
Fsync
(
fd
int
)
(
errno
int
)
{
if
ok
,
e
:=
FlushFileBuffers
(
int32
(
fd
));
!
ok
{
return
e
}
return
0
}
// net api calls
//sys WSAStartup(verreq uint32, data *WSAData) (sockerrno int) = wsock32.WSAStartup
...
...
@@ -732,9 +740,6 @@ func Chown(path string, uid int, gid int) (errno int) { return EWINDOWS }
func
Lchown
(
path
string
,
uid
int
,
gid
int
)
(
errno
int
)
{
return
EWINDOWS
}
func
Fchown
(
fd
int
,
uid
int
,
gid
int
)
(
errno
int
)
{
return
EWINDOWS
}
// TODO(brainman): use FlushFileBuffers Windows api to implement Fsync.
func
Fsync
(
fd
int
)
(
errno
int
)
{
return
EWINDOWS
}
func
Getuid
()
(
uid
int
)
{
return
-
1
}
func
Geteuid
()
(
euid
int
)
{
return
-
1
}
func
Getgid
()
(
gid
int
)
{
return
-
1
}
...
...
src/pkg/syscall/zsyscall_windows_386.go
View file @
5e83d409
...
...
@@ -67,6 +67,7 @@ var (
procCommandLineToArgvW
=
getSysProcAddr
(
modshell32
,
"CommandLineToArgvW"
)
procLocalFree
=
getSysProcAddr
(
modkernel32
,
"LocalFree"
)
procSetHandleInformation
=
getSysProcAddr
(
modkernel32
,
"SetHandleInformation"
)
procFlushFileBuffers
=
getSysProcAddr
(
modkernel32
,
"FlushFileBuffers"
)
procWSAStartup
=
getSysProcAddr
(
modwsock32
,
"WSAStartup"
)
procWSACleanup
=
getSysProcAddr
(
modwsock32
,
"WSACleanup"
)
procsocket
=
getSysProcAddr
(
modwsock32
,
"socket"
)
...
...
@@ -883,6 +884,21 @@ func SetHandleInformation(handle int32, mask uint32, flags uint32) (ok bool, err
return
}
func
FlushFileBuffers
(
handle
int32
)
(
ok
bool
,
errno
int
)
{
r0
,
_
,
e1
:=
Syscall
(
procFlushFileBuffers
,
1
,
uintptr
(
handle
),
0
,
0
)
ok
=
bool
(
r0
!=
0
)
if
!
ok
{
if
e1
!=
0
{
errno
=
int
(
e1
)
}
else
{
errno
=
EINVAL
}
}
else
{
errno
=
0
}
return
}
func
WSAStartup
(
verreq
uint32
,
data
*
WSAData
)
(
sockerrno
int
)
{
r0
,
_
,
_
:=
Syscall
(
procWSAStartup
,
2
,
uintptr
(
verreq
),
uintptr
(
unsafe
.
Pointer
(
data
)),
0
)
sockerrno
=
int
(
r0
)
...
...
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