diff --git a/AUTHORS b/AUTHORS index 376ceb93..deef28c1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -12,8 +12,11 @@ Darren Stahl Derek McGowan Derek McGowan Edward Pilatowicz +Fu Wei +Hajime Tazaki Ian Campbell Ivan Markin +Jacob Blain Christen Justin Cormack Justin Cummins Kasper Fabæch Brandt @@ -23,10 +26,11 @@ Michael Crosby Michael Wan Mike Brown Niels de Vos +Phil Estes Phil Estes Phil Estes -Samuel Karp Sam Whited +Samuel Karp Sebastiaan van Stijn Shengjing Zhu Stephen J Day diff --git a/fs/copy_darwin.go b/fs/copy_darwin.go new file mode 100644 index 00000000..a079f84e --- /dev/null +++ b/fs/copy_darwin.go @@ -0,0 +1,42 @@ +// +build darwin + +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package fs + +import ( + "os" + "syscall" + + "github.com/pkg/errors" + "golang.org/x/sys/unix" +) + +func copyDevice(dst string, fi os.FileInfo) error { + st, ok := fi.Sys().(*syscall.Stat_t) + if !ok { + return errors.New("unsupported stat type") + } + return unix.Mknod(dst, uint32(fi.Mode()), int(st.Rdev)) +} + +func utimesNano(name string, atime, mtime syscall.Timespec) error { + at := unix.NsecToTimespec(atime.Nano()) + mt := unix.NsecToTimespec(mtime.Nano()) + utimes := [2]unix.Timespec{at, mt} + return unix.UtimesNanoAt(unix.AT_FDCWD, name, utimes[0:], unix.AT_SYMLINK_NOFOLLOW) +} diff --git a/fs/copy_darwinopenbsdsolaris.go b/fs/copy_openbsdsolaris.go similarity index 96% rename from fs/copy_darwinopenbsdsolaris.go rename to fs/copy_openbsdsolaris.go index 92ccacf9..e4df7bcb 100644 --- a/fs/copy_darwinopenbsdsolaris.go +++ b/fs/copy_openbsdsolaris.go @@ -1,4 +1,4 @@ -// +build darwin openbsd solaris +// +build openbsd solaris /* Copyright The containerd Authors. diff --git a/fs/du_cmd_freebsd_test.go b/fs/du_cmd_freebsddarwin_test.go similarity index 97% rename from fs/du_cmd_freebsd_test.go rename to fs/du_cmd_freebsddarwin_test.go index 6b2dcc3b..125461f6 100644 --- a/fs/du_cmd_freebsd_test.go +++ b/fs/du_cmd_freebsddarwin_test.go @@ -1,4 +1,4 @@ -// +build freebsd +// +build freebsd darwin /* Copyright The containerd Authors. diff --git a/fs/du_cmd_unix_test.go b/fs/du_cmd_unix_test.go index bf0b1ad0..c78d7c0d 100644 --- a/fs/du_cmd_unix_test.go +++ b/fs/du_cmd_unix_test.go @@ -1,4 +1,4 @@ -// +build !windows,!freebsd +// +build !windows,!freebsd,!darwin /* Copyright The containerd Authors.