diff options
author | Russ Cox <rsc@golang.org> | 2010-05-19 17:47:57 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-05-19 17:47:57 -0700 |
commit | 94b3292622846b33dafe15d32d2b20cd2ce1fbef (patch) | |
tree | 2fd3111eff2c99cd45e4a5dd459ee4adbed688dc /src/pkg/syscall/syscall_linux.go | |
parent | c94d037cd17b64739dd53ea17d170d100965aa00 (diff) | |
download | golang-94b3292622846b33dafe15d32d2b20cd2ce1fbef.tar.gz |
syscall: add Utimes on Darwin/FreeBSD, add Futimes everywhere
Needed for CL 1103041 and beyond.
R=adg, bradfitzpatrick
CC=bradfitz, golang-dev
http://codereview.appspot.com/1172042
Diffstat (limited to 'src/pkg/syscall/syscall_linux.go')
-rw-r--r-- | src/pkg/syscall/syscall_linux.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pkg/syscall/syscall_linux.go b/src/pkg/syscall/syscall_linux.go index f98b4cb7a..39ab10309 100644 --- a/src/pkg/syscall/syscall_linux.go +++ b/src/pkg/syscall/syscall_linux.go @@ -49,12 +49,18 @@ func Utimes(path string, tv []Timeval) (errno int) { return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) } -//sys futimesat(dirfd int, path string, times *[2]Timeval) (errno int) +//sys futimesat(dirfd int, path *byte, times *[2]Timeval) (errno int) func Futimesat(dirfd int, path string, tv []Timeval) (errno int) { if len(tv) != 2 { return EINVAL } - return futimesat(dirfd, path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) + return futimesat(dirfd, StringBytePtr(path), (*[2]Timeval)(unsafe.Pointer(&tv[0]))) +} + +func Futimes(fd int, tv []Timeval) (errno int) { + // Believe it or not, this is the best we can do on Linux + // (and is what glibc does). + return Utimes("/proc/self/fd/"+str(fd), tv) } const ImplementsGetwd = true |