Fix AUFS silent mount errors on many layers

Fixes #1171
Fixes #6465

Data passed to mount(2) is clipped to PAGE_SIZE if its bigger. Previous 
implementation checked if error was returned and then started to append layers 
one by one. But if the PAGE_SIZE clipping appeared in between the paths, in the 
permission sections or in xino definition the call would not error and 
remaining layers would just be skipped(or some other unknown situation).

This also optimizes system calls as it tries to mount as much as possible with 
the first mount.


Signed-off-by: Tõnis Tiigi <tonistiigi@gmail.com> (github: tonistiigi)
pkg/devicemapper: cleanup removeDevice differences

Fixes failure on RemoveDevice when host is AUFS, and running
devicemapper test docker-in-docker

https://gist.github.com/tonistiigi/59559cbfb3f2df26b29c

Signed-off-by: Vincent Batts <vbatts@redhat.com>
pkg/devicemapper: defer udev wait during removal

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Merge pull request #9164 from vbatts/vbatts-dm_removedevice

pkg/devicemapper: cleanup removeDevice differences
Merge pull request #9151 from tonistiigi/aufs-clipping-fix

Fix AUFS silent mount errors on many layers
Refactor pkg/term package for Windows tty support

Signed-off-by: John Gossman <johngos@microsoft.com>
Extract client signals to pkg/signal

SIGCHLD and SIGWINCH used in api/client (cli code) are not
available on Windows. Extracting into separate files with build
tags.

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
Consolidate tmpdir implementations, include Windows

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
Extract TreeSize to daemon build

TreeSize uses syscall.Stat_t which is not available on Windows.
It's called only on daemon path, therefore extracting it to daemon
with build tag 'daemon'

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
Extract mknod, umask, lstat to pkg/system

Some parts of pkg/archive is called on both client/daemon code. To get
it compiling on Windows, these funcs are extracted into files with
build tags.

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
Refactor pkg/archive with a platform-independent stat struct

pkg/archive contains code both invoked from cli (cross platform) and
daemon (linux only) and Unix-specific dependencies break compilation on
Windows. We extracted those stat-related funcs into platform specific
implementations at pkg/system and added unit tests.

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
Remove unused sysinfo parameter to runconfig.Parse

Removing dead code.

Signed-off-by: John Gossman <johngos@microsoft.com>
Use USERPROFILE path on Windows as home directory

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
Fix input volume path check on Windows

used path package instead of path/filepath so that --volumes and
--device parameters to always validate paths as unix paths instead of
OS-dependent path convention

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
Add windows/(386,amd64) to cross platforms list

Edited make scripts to append .exe to windows binary

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
Add --log-level support

Next steps, in another PR, would be:
- make all logging go through the logrus stuff
- I'd like to see if we can remove the env var stuff (like DEBUG) but we'll see

Closes #5198

Signed-off-by: Doug Davis <dug@us.ibm.com>
Merge pull request #9113 from Azure/windows-client

Windows port of Docker Client
Merge pull request #8335 from duglin/Issue5198

Add --log-level support - Issue #5198
Allocate daemon listening ports

Mark the daemon listening ports as allocated in the portallocator in
order to prevent containers from exposing this port themselves.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>