mirror of
				https://github.com/containers/podman.git
				synced 2025-10-31 18:08:51 +08:00 
			
		
		
		
	 0f7d54b026
			
		
	
	0f7d54b026
	
	
	
		
			
			Migrate the Podman code base over to `common/libimage` which replaces `libpod/image` and a lot of glue code entirely. Note that I tried to leave bread crumbs for changed tests. Miscellaneous changes: * Some errors yield different messages which required to alter some tests. * I fixed some pre-existing issues in the code. Others were marked as `//TODO`s to prevent the PR from exploding. * The `NamesHistory` of an image is returned as is from the storage. Previously, we did some filtering which I think is undesirable. Instead we should return the data as stored in the storage. * Touched handlers use the ABI interfaces where possible. * Local image resolution: previously Podman would match "foo" on "myfoo". This behaviour has been changed and Podman will now only match on repository boundaries such that "foo" would match "my/foo" but not "myfoo". I consider the old behaviour to be a bug, at the very least an exotic corner case. * Futhermore, "foo:none" does *not* resolve to a local image "foo" without tag anymore. It's a hill I am (almost) willing to die on. * `image prune` prints the IDs of pruned images. Previously, in some cases, the names were printed instead. The API clearly states ID, so we should stick to it. * Compat endpoint image removal with _force_ deletes the entire not only the specified tag. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
		
			
				
	
	
		
			109 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			109 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| // +build linux
 | |
| // +build !mips,!mipsle,!mips64,!mips64le
 | |
| 
 | |
| // Signal handling for Linux only.
 | |
| package signal
 | |
| 
 | |
| // Copyright 2013-2018 Docker, Inc.
 | |
| 
 | |
| // NOTE: this package has originally been copied from github.com/docker/docker.
 | |
| 
 | |
| import (
 | |
| 	"os"
 | |
| 	"os/signal"
 | |
| 	"syscall"
 | |
| 
 | |
| 	"golang.org/x/sys/unix"
 | |
| )
 | |
| 
 | |
| const (
 | |
| 	sigrtmin = 34
 | |
| 	sigrtmax = 64
 | |
| 
 | |
| 	SIGWINCH = syscall.SIGWINCH // For cross-compilation with Windows
 | |
| )
 | |
| 
 | |
| // signalMap is a map of Linux signals.
 | |
| var signalMap = map[string]syscall.Signal{
 | |
| 	"ABRT":     unix.SIGABRT,
 | |
| 	"ALRM":     unix.SIGALRM,
 | |
| 	"BUS":      unix.SIGBUS,
 | |
| 	"CHLD":     unix.SIGCHLD,
 | |
| 	"CLD":      unix.SIGCLD,
 | |
| 	"CONT":     unix.SIGCONT,
 | |
| 	"FPE":      unix.SIGFPE,
 | |
| 	"HUP":      unix.SIGHUP,
 | |
| 	"ILL":      unix.SIGILL,
 | |
| 	"INT":      unix.SIGINT,
 | |
| 	"IO":       unix.SIGIO,
 | |
| 	"IOT":      unix.SIGIOT,
 | |
| 	"KILL":     unix.SIGKILL,
 | |
| 	"PIPE":     unix.SIGPIPE,
 | |
| 	"POLL":     unix.SIGPOLL,
 | |
| 	"PROF":     unix.SIGPROF,
 | |
| 	"PWR":      unix.SIGPWR,
 | |
| 	"QUIT":     unix.SIGQUIT,
 | |
| 	"SEGV":     unix.SIGSEGV,
 | |
| 	"STKFLT":   unix.SIGSTKFLT,
 | |
| 	"STOP":     unix.SIGSTOP,
 | |
| 	"SYS":      unix.SIGSYS,
 | |
| 	"TERM":     unix.SIGTERM,
 | |
| 	"TRAP":     unix.SIGTRAP,
 | |
| 	"TSTP":     unix.SIGTSTP,
 | |
| 	"TTIN":     unix.SIGTTIN,
 | |
| 	"TTOU":     unix.SIGTTOU,
 | |
| 	"URG":      unix.SIGURG,
 | |
| 	"USR1":     unix.SIGUSR1,
 | |
| 	"USR2":     unix.SIGUSR2,
 | |
| 	"VTALRM":   unix.SIGVTALRM,
 | |
| 	"WINCH":    unix.SIGWINCH,
 | |
| 	"XCPU":     unix.SIGXCPU,
 | |
| 	"XFSZ":     unix.SIGXFSZ,
 | |
| 	"RTMIN":    sigrtmin,
 | |
| 	"RTMIN+1":  sigrtmin + 1,
 | |
| 	"RTMIN+2":  sigrtmin + 2,
 | |
| 	"RTMIN+3":  sigrtmin + 3,
 | |
| 	"RTMIN+4":  sigrtmin + 4,
 | |
| 	"RTMIN+5":  sigrtmin + 5,
 | |
| 	"RTMIN+6":  sigrtmin + 6,
 | |
| 	"RTMIN+7":  sigrtmin + 7,
 | |
| 	"RTMIN+8":  sigrtmin + 8,
 | |
| 	"RTMIN+9":  sigrtmin + 9,
 | |
| 	"RTMIN+10": sigrtmin + 10,
 | |
| 	"RTMIN+11": sigrtmin + 11,
 | |
| 	"RTMIN+12": sigrtmin + 12,
 | |
| 	"RTMIN+13": sigrtmin + 13,
 | |
| 	"RTMIN+14": sigrtmin + 14,
 | |
| 	"RTMIN+15": sigrtmin + 15,
 | |
| 	"RTMAX-14": sigrtmax - 14,
 | |
| 	"RTMAX-13": sigrtmax - 13,
 | |
| 	"RTMAX-12": sigrtmax - 12,
 | |
| 	"RTMAX-11": sigrtmax - 11,
 | |
| 	"RTMAX-10": sigrtmax - 10,
 | |
| 	"RTMAX-9":  sigrtmax - 9,
 | |
| 	"RTMAX-8":  sigrtmax - 8,
 | |
| 	"RTMAX-7":  sigrtmax - 7,
 | |
| 	"RTMAX-6":  sigrtmax - 6,
 | |
| 	"RTMAX-5":  sigrtmax - 5,
 | |
| 	"RTMAX-4":  sigrtmax - 4,
 | |
| 	"RTMAX-3":  sigrtmax - 3,
 | |
| 	"RTMAX-2":  sigrtmax - 2,
 | |
| 	"RTMAX-1":  sigrtmax - 1,
 | |
| 	"RTMAX":    sigrtmax,
 | |
| }
 | |
| 
 | |
| // CatchAll catches all signals and relays them to the specified channel.
 | |
| func CatchAll(sigc chan os.Signal) {
 | |
| 	handledSigs := make([]os.Signal, 0, len(signalMap))
 | |
| 	for _, s := range signalMap {
 | |
| 		handledSigs = append(handledSigs, s)
 | |
| 	}
 | |
| 	signal.Notify(sigc, handledSigs...)
 | |
| }
 | |
| 
 | |
| // StopCatch stops catching the signals and closes the specified channel.
 | |
| func StopCatch(sigc chan os.Signal) {
 | |
| 	signal.Stop(sigc)
 | |
| 	close(sigc)
 | |
| }
 |