当前位置: 首页>>代码示例>>Golang>>正文


Golang reexec.Register函数代码示例

本文整理汇总了Golang中github.com/docker/docker/pkg/reexec.Register函数的典型用法代码示例。如果您正苦于以下问题:Golang Register函数的具体用法?Golang Register怎么用?Golang Register使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Register函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: init

func init() {
	reexec.Register("namespaced", namespaced)

	if reexec.Init() {
		os.Exit(0)
	}
}
开发者ID:cloudfoundry,项目名称:guardian,代码行数:7,代码来源:main_linux.go

示例2: TestMain

func TestMain(m *testing.M) {
	reexec.Register("enqueue", reexecEnqueue)
	if reexec.Init() {
		return
	}
	os.Exit(m.Run())
}
开发者ID:fabiokung,项目名称:cqueue,代码行数:7,代码来源:cqueue_test.go

示例3: init

func init() {
	reexec.Register("chrootwrite", func() {
		var rootfs, path string
		var uid, gid int
		flag.StringVar(&rootfs, "rootfs", "", "rootfs")
		flag.StringVar(&path, "path", "", "path")
		flag.IntVar(&uid, "uid", 0, "uid")
		flag.IntVar(&gid, "gid", 0, "gid")
		flag.Parse()

		if err := syscall.Chroot(rootfs); err != nil {
			panic(err)
		}

		if err := os.Chdir("/"); err != nil {
			panic(err)
		}

		var contents bytes.Buffer
		if _, err := io.Copy(&contents, os.Stdin); err != nil {
			panic(err)
		}

		w := RootfsWriter{}
		if err := w.writeFile(lager.NewLogger("chroot-write"), path, contents.Bytes(), rootfs, uid, gid); err != nil {
			panic(err)
		}
	})
}
开发者ID:cloudfoundry,项目名称:guardian,代码行数:29,代码来源:rootfs_writer.go

示例4: TestMain

func TestMain(m *testing.M) {
	reexec.Register("allocate", allocate)
	if reexec.Init() {
		return
	}
	os.Exit(m.Run())
}
开发者ID:fabiokung,项目名称:numballoc,代码行数:7,代码来源:allocator_test.go

示例5: registerCmd

func registerCmd(cmd string, mainFunc func()) {
	log.Debugf("Registering main %s", cmd)
	reexec.Register(cmd, mainFunc)

	parts := strings.Split(cmd, "/")
	if len(parts) == 0 {
		return
	}

	last := parts[len(parts)-1]

	log.Debugf("Registering main %s", last)
	reexec.Register(last, mainFunc)

	log.Debugf("Registering main %s", "./"+last)
	reexec.Register("./"+last, mainFunc)
}
开发者ID:un1xer,项目名称:os,代码行数:17,代码来源:main.go

示例6: init

// init registers the windows graph drivers to the register.
func init() {
	graphdriver.Register("windowsfilter", InitFilter)
	// DOCKER_WINDOWSFILTER_NOREEXEC allows for inline processing which makes
	// debugging issues in the re-exec codepath significantly easier.
	if os.Getenv("DOCKER_WINDOWSFILTER_NOREEXEC") != "" {
		logrus.Warnf("WindowsGraphDriver is set to not re-exec. This is intended for debugging purposes only.")
		noreexec = true
	} else {
		reexec.Register("docker-windows-write-layer", writeLayerReexec)
	}
}
开发者ID:harche,项目名称:docker,代码行数:12,代码来源:windows.go

示例7: main

func main() {
	registerCmd("/init", osInit.MainInit)
	registerCmd(config.SYSINIT_BIN, sysinit.Main)
	registerCmd("/usr/bin/dockerlaunch", dockerlaunch.Main)
	registerCmd("/usr/bin/user-docker", userdocker.Main)
	registerCmd("/usr/bin/system-docker", systemdocker.Main)
	registerCmd("/sbin/poweroff", power.PowerOff)
	registerCmd("/sbin/reboot", power.Reboot)
	registerCmd("/sbin/halt", power.Halt)
	registerCmd("/sbin/shutdown", power.Main)
	registerCmd("/usr/bin/respawn", respawn.Main)
	registerCmd("/usr/bin/ros", control.Main)
	registerCmd("/usr/bin/cloud-init", cloudinit.Main)
	registerCmd("/usr/sbin/netconf", network.Main)
	registerCmd("/usr/sbin/wait-for-network", waitfornetwork.Main)
	registerCmd("/usr/sbin/wait-for-docker", wait.Main)

	if !reexec.Init() {
		reexec.Register(os.Args[0], control.Main)
		if !reexec.Init() {
			log.Fatalf("Failed to find an entry point for %s", os.Args[0])
		}
	}
}
开发者ID:carriercomm,项目名称:os,代码行数:24,代码来源:main.go

示例8: init

func init() {
	reexec.Register("configure-container-netns", func() {
		var netNsPath, containerIntf, containerIPStr, bridgeIPStr, subnetStr string
		var mtu int

		flag.StringVar(&netNsPath, "netNsPath", "", "netNsPath")
		flag.StringVar(&containerIntf, "containerIntf", "", "containerIntf")
		flag.StringVar(&containerIPStr, "containerIP", "", "containerIP")
		flag.StringVar(&bridgeIPStr, "bridgeIP", "", "bridgeIP")
		flag.StringVar(&subnetStr, "subnet", "", "subnet")
		flag.IntVar(&mtu, "mtu", 0, "mtu")
		flag.Parse()

		fd, err := os.Open(netNsPath)
		if err != nil {
			fmt.Fprintf(os.Stderr, "opening netns `%s`: %s", netNsPath, err)
			os.Exit(1)
		}
		defer fd.Close()

		netNsExecer := &netns.Execer{}

		if err = netNsExecer.Exec(fd, func() error {
			containerIP := net.ParseIP(containerIPStr)
			bridgeIP := net.ParseIP(bridgeIPStr)
			_, subnetIPNet, err := net.ParseCIDR(subnetStr)
			if err != nil {
				panic(err)
			}

			link := devices.Link{}

			intf, found, err := link.InterfaceByName(containerIntf)
			if err != nil {
				panic(err)
			}
			if !found {
				return fmt.Errorf("interface `%s` was not found", containerIntf)
			}

			if err := link.AddIP(intf, containerIP, subnetIPNet); err != nil {
				panic(err)
			}

			if err := link.SetUp(intf); err != nil {
				panic(err)
			}

			if err := link.AddDefaultGW(intf, bridgeIP); err != nil {
				panic(err)
			}

			if err := link.SetMTU(intf, mtu); err != nil {
				panic(err)
			}

			return nil
		}); err != nil {
			fmt.Fprintf(os.Stderr, err.Error())
			os.Exit(1)
		}
	})
}
开发者ID:cloudfoundry,项目名称:guardian,代码行数:63,代码来源:container.go

示例9: init

func init() {
	reexec.Register("fwmarker", fwMarker)
	reexec.Register("redirecter", redirecter)
}
开发者ID:SUSE,项目名称:docker.mirror,代码行数:4,代码来源:service_linux.go

示例10: init

func init() {
	reexec.Register("set-ipv6", reexecSetIPv6)
}
开发者ID:jwhonce,项目名称:docker,代码行数:3,代码来源:namespace_linux.go

示例11: init

func init() {
	reexec.Register(name, prepare)
}
开发者ID:cloudfoundry,项目名称:guardian,代码行数:3,代码来源:prepare.go

示例12: init

func init() {
	reexec.Register(dockerMonitor, execMonitor)
}
开发者ID:TencentSA,项目名称:docker-1.3,代码行数:3,代码来源:docker_monitor.go

示例13: init

func init() {
	reexec.Register("initd", start)
}
开发者ID:nagyistoce,项目名称:garden-linux,代码行数:3,代码来源:start.go

示例14: init

func init() {
	reexec.Register("containerd-nslistener", setupNsListener)
}
开发者ID:hyperhq,项目名称:runv,代码行数:3,代码来源:nslistener.go

示例15: init

// init registers the windows graph drivers to the register.
func init() {
	graphdriver.Register("windowsfilter", InitFilter)
	reexec.Register("docker-windows-write-layer", writeLayer)
}
开发者ID:errordeveloper,项目名称:docker,代码行数:5,代码来源:windows.go


注:本文中的github.com/docker/docker/pkg/reexec.Register函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。