Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
217693e9
Commit
217693e9
authored
Jan 12, 2011
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
os: add Sync to *File, wraps syscall.Fsync
R=rsc, brainman, r, r2 CC=golang-dev
https://golang.org/cl/3887042
parent
02e88019
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
src/pkg/os/file.go
src/pkg/os/file.go
+13
-0
src/pkg/syscall/syscall_windows.go
src/pkg/syscall/syscall_windows.go
+3
-0
No files found.
src/pkg/os/file.go
View file @
217693e9
...
...
@@ -408,6 +408,19 @@ func (f *File) Truncate(size int64) Error {
return
nil
}
// Sync commits the current contents of the file to stable storage.
// Typically, this means flushing the file system's in-memory copy
// of recently written data to disk.
func
(
file
*
File
)
Sync
()
(
err
Error
)
{
if
file
==
nil
{
return
EINVAL
}
if
e
:=
syscall
.
Fsync
(
file
.
fd
);
e
!=
0
{
return
NewSyscallError
(
"fsync"
,
e
)
}
return
nil
}
// Chtimes changes the access and modification times of the named
// file, similar to the Unix utime() or utimes() functions.
//
...
...
src/pkg/syscall/syscall_windows.go
View file @
217693e9
...
...
@@ -684,6 +684,9 @@ 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
}
...
...
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