Commit graph

192 commits

Author SHA1 Message Date
Sebastiaan van Stijn
2b41e84719
pkg/system: fix compile on darwin (macOS)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-11-10 20:49:09 +01:00
Paul "TBBle" Hampson
a158b53d86 Separate non-Windows mount code from common code
Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2020-11-08 23:15:15 +11:00
Kir Kolyshkin
2502db66d0 pkg/system: make EnsureRemoveAll unix-specific
The tricks performed by EnsureRemoveAll only make sense for Linux and
other Unices, so separate it out, and make EnsureRemoveAll for Windows
just an alias of os.RemoveAll.

This makes sure RecursiveUnmount is not called on Windows.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-09-21 01:23:28 -07:00
Leonardo Taccari
3d9120f744 Unify same fromStatT() implementation for FreeBSD and NetBSD
Suggested by Sebastiaan van Stijn, thanks!

Signed-off-by: Leonardo Taccari <leot@NetBSD.org>
2020-09-14 18:33:04 +02:00
Leonardo Taccari
6efa9e0575 Add support for NetBSD
Signed-off-by: Leonardo Taccari <leot@NetBSD.org>
2020-09-12 14:28:29 +02:00
Till Wegmüller
e3ab236309 Add solaris support to lstat
Signed-off-by: Till Wegmüller <toasterson@gmail.com>
2020-08-12 11:40:58 +02:00
Sebastiaan van Stijn
3f36764844
Merge pull request #40994 from gaurav1086/rm_test_fix_goroutine_leak
rm_test: fix goroutine leak
2020-07-14 17:41:43 +02:00
Xiaodong Liu
a366fe41cb fix "stat.Rdev" invalid operation mismatched types on mips64el
compile error the "stat.Rdev" variable and "s.Rdev" mismatched types on mips64el
convert "stat.Rdev" type to uint64 explicitly

Signed-off-by: Xiaodong Liu <liuxiaodong@loongson.cn>
2020-05-26 14:50:06 +08:00
Gaurav Singh
2a331a5ef7 rm_test: fix goroutine leak
Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
2020-05-18 20:58:26 -04:00
Tibor Vass
751d5f879a
Merge pull request #40646 from thaJeztah/builder_use_pkg_sys_windows
pkg/system: deprecate SetNamedSecurityInfo, GetSecurityDescriptorDacl
2020-05-08 08:21:17 -07:00
Brian Goff
71626b7bdf
Merge pull request #40766 from thaJeztah/lcow_build_tag
LCOW: add "no_lcow" build tag to allow disabling lcow
2020-04-20 10:43:53 -07:00
Brian Goff
620bce847d
Merge pull request #40749 from DanielQujun/zombie_check_for_container
add zombie check for container when killing it
2020-04-16 12:01:58 -07:00
屈骏
f3c1eec99e add zombie check for container when killing it, alernative fix for #40735.
Signed-off-by: 屈骏 <qujun@tiduyun.com>
2020-04-10 16:46:31 +08:00
Sebastiaan van Stijn
0d3b400ab5
LCOW: add "no_lcow" build tag to allow disabling lcow
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-02 19:54:16 +02:00
Kir Kolyshkin
39048cf656 Really switch to moby/sys/mount*
Switch to moby/sys/mount and mountinfo. Keep the pkg/mount for potential
outside users.

This commit was generated by the following bash script:

```
set -e -u -o pipefail

for file in $(git grep -l 'docker/docker/pkg/mount"' | grep -v ^pkg/mount); do
	sed -i -e 's#/docker/docker/pkg/mount"#/moby/sys/mount"#' \
		-e 's#mount\.\(GetMounts\|Mounted\|Info\|[A-Za-z]*Filter\)#mountinfo.\1#g' \
		$file
	goimports -w $file
done
```

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-03-20 09:46:25 -07:00
Kir Kolyshkin
26f8c7de91
Merge pull request #40647 from thaJeztah/simplify_is_abs
pkg/system: minor linting issues and refactor
2020-03-11 10:52:49 -07:00
Sebastiaan van Stijn
8bbba72499
Merge pull request #40637 from kolyshkin/ensure-remove-all
EnsureRemoveAll, RecursiveUnmount: don't call Mounted around Unmount
2020-03-11 18:05:36 +01:00
Brian Goff
389ddfd07c
Merge pull request #40649 from thaJeztah/deprecate_CommandLineToArgv
pkg/system: remove unused CommandLineToArgv
2020-03-10 15:46:01 -07:00
Kir Kolyshkin
f8dbc31b78 pkg/system.EnsureRemoveAll: don't call Mounted
1. Call to mount.Mounted() is very expensive and it's redundant
   to call it before Unmount().

2. Calling mount.Mounted() after an error from Unmount() is
   questionable -- if umount failed, the mount is probably
   still there anyway, it doesn't make sense to check it.

This should result in faster code with no change in functionality.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-03-09 13:08:57 -07:00
Sebastiaan van Stijn
bd2e288e56
pkg/system: remove unused CommandLineToArgv
This function was added in 9c4570a958,
but appears to never have been used.

Removing it, as it's not used in the codebase and, from a quick
search on GitHub, also doesn't look to be used by other projects.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-09 17:02:53 +01:00
Sebastiaan van Stijn
f2d49cb7ee
pkg/system: fix minor linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-09 16:40:05 +01:00
Sebastiaan van Stijn
dec7a1befb
pkg/system: simplify IsAbs()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-09 16:35:12 +01:00
Sebastiaan van Stijn
079fb80657
pkg/system: replace more uses of "syscall"
follow-up to 069fdc8a08, replacing
more uses of the syscall package in favor of their "windows"
equivalents in golang.org/x/sys.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-09 15:50:43 +01:00
Sebastiaan van Stijn
3bba43b894
pkg/system: deprecate SetNamedSecurityInfo, GetSecurityDescriptorDacl
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-09 12:41:31 +01:00
Kir Kolyshkin
669056f93d pkg/system.getxattr: handle changed size case
lgetxattr(2) man page says:

> If size is specified as zero, these calls return the  current  size  of
> the  named extended attribute (and leave value unchanged).  This can be
> used to determine the size of the buffer that should be supplied  in  a
> subsequent  call.   (But, bear in mind that there is a possibility that
> the attribute value may change between the two calls,  so  that  it  is
> still necessary to check the return status from the second call.)

The current code does not handle the case when the size changes between
the two calls, and the new size is larger.

Fix the above problem, and slightly simplify the code.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-02-26 07:56:12 -08:00
Sebastiaan van Stijn
9f0b3f5609
bump gotest.tools v3.0.1 for compatibility with Go 1.14
full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-11 00:06:42 +01:00
Brian Goff
8d2456d1e6
Merge pull request #40246 from thaJeztah/system_windows_cleanup
pkg/system: minor cleanups and remove use of deprecated system.GetOSVersion()
2019-12-19 11:36:29 -08:00
Brian Goff
db85ef598b
Merge pull request #40247 from thaJeztah/pkg_system_consts
pkg/system: deprecate constants in favor of golang.org/x/sys/windows
2019-12-19 11:35:00 -08:00
Brian Goff
b95fad8e51
Merge pull request #40263 from thaJeztah/normalize_comments
Normalize comment formatting
2019-12-12 12:06:22 -08:00
Sascha Grunert
4138cd22ab
Fix possible runtime panic in Lgetxattr
If `unix.Lgetxattr` returns an error, then `sz == -1` which will cause a
runtime panic if `errno == unix.ERANGE`.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-12-04 14:26:02 +01:00
Sebastiaan van Stijn
0fb5630784
pkg/system: normalize comment formatting
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-11-27 15:38:17 +01:00
Sebastiaan van Stijn
f572df7c22
pkg/system: deprecate constants in favor of golang.org/x/sys/windows
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-11-25 15:39:34 +01:00
Sebastiaan van Stijn
33d8492ce4
pkg/system/windows: remove unnecessary conversions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-11-25 13:35:00 +01:00
Sebastiaan van Stijn
4cdb796b54
pkg/system/windows: remove obsolete comment
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-11-25 13:31:09 +01:00
Brian Goff
8840071c26
Merge pull request #40135 from thaJeztah/nitfix_galore
pkg/system: make OSVersion an alias for hcsshim OSVersion
2019-11-24 07:36:05 -08:00
Tõnis Tiigi
d1d5f64766
Merge pull request #40021 from thaJeztah/carry_40017
Use newer x/sys/windows SecurityAttributes struct (carry 40017)
2019-11-21 08:57:22 -08:00
Sebastiaan van Stijn
9d12bc2573
pkg/system: make OSVersion an alias for hcsshim OSVersion
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-25 00:31:36 +02:00
Sebastiaan van Stijn
86b3703182
Deprecate pkg/system.GetOSVersion() in favor of hcsshim/osversion.Get()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-22 02:53:09 +02:00
Sebastiaan van Stijn
6b91ceff74
Use hcsshim osversion package for Windows versions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-22 02:53:00 +02:00
Jason A. Donenfeld
c3a0a37446
Use newer x/sys/windows SecurityAttributes struct
This struct now has a properly typed member, so use the properly typed
functions with it.

Also update the vendor directory and hope nothing explodes.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-02 21:12:23 +02:00
Sebastiaan van Stijn
2c31edbbb6
unconvert: remove unnescessary conversions
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-18 12:57:33 +02:00
Sebastiaan van Stijn
07ff4f1de8
goimports: fix imports
Format the source according to latest goimports.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-18 12:56:54 +02:00
Sebastiaan van Stijn
a9aeda8343
Rename some references to docker.exe to dockerd.exe
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-11 15:16:27 +02:00
Jon Johnson
57ade2652a Narrow dependencies of pkg/system
CheckSystemDriveAndRemoveDriveLetter depends on pathdriver.PathDriver
unnecessarily. This depends on the minimal interface that it actually
needs, to avoid callers from unnecessarily bringing in a
containerd/continuity dependency.

Signed-off-by: Jon Johnson <jonjohnson@google.com>
2019-09-06 16:25:14 -07:00
Tobias Klauser
6751718196 Remove *_solaris.go files
Support for GOOS=solaris was removed in PR #35373. Remove two leftover
*_solaris.go files missed in this PR.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2019-09-02 10:15:15 +02:00
Tibor Vass
32688a47f3
Merge pull request #39699 from thaJeztah/mkdirall_dropin
Allow system.MkDirAll() to be used as drop-in for os.MkDirAll()
2019-08-27 16:27:53 -07:00
Tobias Klauser
e551e5a73d Use UtimesNano from x/sys/unix to implement LUtimesNano
This allows to merge the implementation for Linux and FreeBSD.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2019-08-22 08:25:13 +02:00
Sebastiaan van Stijn
e554ab5589
Allow system.MkDirAll() to be used as drop-in for os.MkDirAll()
also renamed the non-windows variant of this file to be
consistent with other files in this package

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-08 15:05:49 +02:00
Dominic
5f0231bca1
cast Dev and Rdev of Stat_t to uint64 for mips
Signed-off-by: Dominic <yindongchao@inspur.com>
Signed-off-by: Dominic Yin <yindongchao@inspur.com>
2019-08-01 20:22:49 +08:00
Brian Goff
ffabf0d542
Merge pull request #38020 from thaJeztah/remove_iot_check
Remove skip evaluation of symlinks to data root on IoT Core
2019-07-15 11:13:19 -07:00