Move signal handling code to pkg/signal.Trap

Signed-off-by: Solomon Hykes <solomon@docker.com>
Cleanup: refactor shutdown and signal handling facility

This disentangles the following functions, which were previously all mixed together:

* 1) Waiting for jobs to terminate when shutting down
* 2) Handling signals in the Docker daemon
* 3) Per-subsystem cleanup handlers
* 4) pidfile management

Responsibilities are dispatched as follows:

* Signal traps are set in `main`, and trigger `engine.Shutdown`
* `engine.Shutdown` coordinates cleanup by waiting for jobs to complete, and calling shutdown handlers
* To perform cleanup at shutdown, each subsystem registers handlers with `engine.OnShutdown`
* `daemon` is one subsystem, so it registers cleanup via `engine.OnShutdown`.
* `daemon` owns the pidfile, which is used to lock access to `/var/lib/docker`. Part of its cleanup is to remove the pidfile.

Signed-off-by: Solomon Hykes <solomon@docker.com>
Remove unnecessary job "initserverpidfile"

That job was a hacky solution to a real race condition. This removes the
hack without re-introducing the race.

Signed-off-by: Solomon Hykes <solomon@docker.com>
Replace Server.IsRunning with Engine.IsShutdown

Signed-off-by: Solomon Hykes <solomon@docker.com>
Extra testing for engine.Shutdown

Signed-off-by: Solomon Hykes <solomon@docker.com>
Remove last trace of Daemon->Server dependency

This removes a shim `daemon.Server` interface which was used to start
separating Daemon from Server *gradually*, without getting cyclic
dependency errors.

Now that the last Daemon->Server dependency has been removed, we can
finally remove the shim. Yay!

Signed-off-by: Solomon Hykes <solomon@docker.com>
Remove unused field from engine.Job

Signed-off-by: Solomon Hykes <solomon@docker.com>
Engine.Shutdown only waits 5 seconds for active jobs to complete

Signed-off-by: Solomon Hykes <solomon@docker.com>
Fix TestBuildForbiddenContextPath after TMPDIR change

Signed-off-by: Tibor Vass <teabee89@gmail.com>
Update hack/vendor.sh to use libcontainer's update-vendor.sh script as the source of truth for libcontainer deps and not include them in Docker's repo twice

Signed-off-by: Andrew Page <admwiggin@gmail.com>
Update vendor with the updated canonical deps from libcontainer

Signed-off-by: Andrew Page <admwiggin@gmail.com>
Fix integration tests by adding DOCKER_TMPDIR env in the test init function

Signed-off-by: Tibor Vass <teabee89@gmail.com>
Merge pull request #27 from tianon/update-libcontainer

Update hack/vendor.sh to use libcontainer's update-vendor.sh script as the source of truth for libcontainer deps and not include them in Docker's repo twice
Merge pull request #7448 from tiborvass/fix-tmpdir-integration-tests

Fix tmpdir integration tests
Cleanup: extract bindmount spec parsing

Docker-DCO-1.1-Signed-off-by: Brian Goff <cpuguy83@gmail.com> (github: cpuguy83)
Merge pull request #7428 from crosbymichael/update-libcontainer-aug2

Update libcontainer to 5589d4d879f1d7e31967a927d3e
Merge pull request #7431 from tamsky/fixes-7105

add warning re: changing value of `dm.basesize`.
Merge pull request #7430 from tamsky/docfixes

style, grammar, spelling fixes.
Replace "amd64" build tags with "cgo" as appropriate, and remove where unnecessary

Signed-off-by: Andrew Page <admwiggin@gmail.com>
utils/broadcastwriter -> pkg/broadcastwriter

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)