pax_global_header00006660000000000000000000000064133750163700014517gustar00rootroot0000000000000052 comment=17b0214f6c48980c45dc47ecb0cfd6d9e02df723 go-criu-3.11/000077500000000000000000000000001337501637000130105ustar00rootroot00000000000000go-criu-3.11/.gitignore000066400000000000000000000000651337501637000150010ustar00rootroot00000000000000test/test test/piggie test/phaul image rpc/rpc.proto go-criu-3.11/.travis.yml000066400000000000000000000014071337501637000151230ustar00rootroot00000000000000language: go sudo: required os: - linux go: - "1.8" - "1.9" - "1.10" env: # Run the tests with CRIU master and criu-dev - CRIU_BRANCH="master" - CRIU_BRANCH="criu-dev" install: - sudo apt-get update - sudo apt-get install -y libprotobuf-dev libprotobuf-c0-dev protobuf-c-compiler protobuf-compiler python-protobuf libnl-3-dev libnet-dev libcap-dev - go get github.com/checkpoint-restore/go-criu - git clone --single-branch -b ${CRIU_BRANCH} https://github.com/checkpoint-restore/criu.git - cd criu; make - sudo install -D -m 755 criu/criu /usr/sbin/ - cd .. script: # This builds the code without running the tests. - make build phaul test/test test/phaul test/piggie # Run actual test as root as it uses CRIU. - sudo make test phaul-test go-criu-3.11/LICENSE000066400000000000000000000261351337501637000140240ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. go-criu-3.11/Makefile000066400000000000000000000022371337501637000144540ustar00rootroot00000000000000GO ?= go CC ?= gcc ifeq ($(GOPATH),) export GOPATH := $(shell $(GO) env GOPATH) endif FIRST_GOPATH := $(firstword $(subst :, ,$(GOPATH))) GOBIN := $(shell $(GO) env GOBIN) ifeq ($(GOBIN),) GOBIN := $(FIRST_GOPATH)/bin endif all: build test phaul phaul-test lint: @golint . test phaul build: @$(GO) build -v test/piggie: test/piggie.c @$(CC) $^ -o $@ test/test: test/main.go @$(GO) build -v -o test/test test/main.go test: test/test test/piggie mkdir -p image test/piggie test/test dump `pidof piggie` image test/test restore image pkill -9 piggie || : phaul: @cd phaul; go build -v test/phaul: test/phaul-main.go @$(GO) build -v -o test/phaul test/phaul-main.go phaul-test: test/phaul test/piggie rm -rf image test/piggie test/phaul `pidof piggie` pkill -9 piggie || : clean: @rm -f test/test test/piggie test/phaul @rm -rf image @rm -f rpc/rpc.proto install.tools: if [ ! -x "$(GOBIN)/golint" ]; then \ $(GO) get -u golang.org/x/lint/golint; \ fi rpc/rpc.proto: curl -s https://raw.githubusercontent.com/checkpoint-restore/criu/master/images/rpc.proto -o $@ rpc/rpc.pb.go: rpc/rpc.proto protoc --go_out=. $^ .PHONY: build test clean lint phaul go-criu-3.11/README.md000066400000000000000000000047641337501637000143020ustar00rootroot00000000000000[![master](https://travis-ci.org/checkpoint-restore/go-criu.svg?branch=master)](https://travis-ci.org/checkpoint-restore/go-criu) ## go-criu -- Go bindings for [CRIU](https://criu.org/) This repository provides Go bindings for CRIU. The code is based on the Go based PHaul implementation from the CRIU repository. For easier inclusion into other Go projects the CRIU Go bindings have been moved to this repository. The Go bindings provide an easy way to use the CRIU RPC calls from Go without the need to set up all the infrastructure to make the actual RPC connection to CRIU. The following example would print the version of CRIU: ``` c := criu.MakeCriu() version, err := c.GetCriuVersion() fmt.Println(version) ``` or to just check if at least a certain CRIU version is installed: ``` c := criu.MakeCriu() result, err := c.IsCriuAtLeast(31100) ``` ## How to contribute While bug fixes can first be identified via an "issue", that is not required. It's ok to just open up a PR with the fix, but make sure you include the same information you would have included in an issue - like how to reproduce it. PRs for new features should include some background on what use cases the new code is trying to address. When possible and when it makes sense, try to break-up larger PRs into smaller ones - it's easier to review smaller code changes. But only if those smaller ones make sense as stand-alone PRs. Regardless of the type of PR, all PRs should include: * well documented code changes * additional testcases. Ideally, they should fail w/o your code change applied * documentation changes Squash your commits into logical pieces of work that might want to be reviewed separate from the rest of the PRs. Ideally, each commit should implement a single idea, and the PR branch should pass the tests at every commit. GitHub makes it easy to review the cumulative effect of many commits; so, when in doubt, use smaller commits. PRs that fix issues should include a reference like `Closes #XXXX` in the commit message so that github will automatically close the referenced issue when the PR is merged. Contributors must assert that they are in compliance with the [Developer Certificate of Origin 1.1](http://developercertificate.org/). This is achieved by adding a "Signed-off-by" line containing the contributor's name and e-mail to every commit message. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch. ### License The license of go-criu is the Apache 2.0 license. go-criu-3.11/main.go000066400000000000000000000122251337501637000142650ustar00rootroot00000000000000package criu import ( "errors" "fmt" "os" "os/exec" "strconv" "syscall" "github.com/checkpoint-restore/go-criu/rpc" "github.com/golang/protobuf/proto" ) // Criu struct type Criu struct { swrkCmd *exec.Cmd swrkSk *os.File } // MakeCriu returns the Criu object required for most operations func MakeCriu() *Criu { return &Criu{} } // Prepare sets up everything for the RPC communication to CRIU func (c *Criu) Prepare() error { fds, err := syscall.Socketpair(syscall.AF_LOCAL, syscall.SOCK_SEQPACKET, 0) if err != nil { return err } cln := os.NewFile(uintptr(fds[0]), "criu-xprt-cln") syscall.CloseOnExec(fds[0]) srv := os.NewFile(uintptr(fds[1]), "criu-xprt-srv") defer srv.Close() args := []string{"swrk", strconv.Itoa(fds[1])} cmd := exec.Command("criu", args...) err = cmd.Start() if err != nil { cln.Close() return err } c.swrkCmd = cmd c.swrkSk = cln return nil } // Cleanup cleans up func (c *Criu) Cleanup() { if c.swrkCmd != nil { c.swrkSk.Close() c.swrkSk = nil c.swrkCmd.Wait() c.swrkCmd = nil } } func (c *Criu) sendAndRecv(reqB []byte) ([]byte, int, error) { cln := c.swrkSk _, err := cln.Write(reqB) if err != nil { return nil, 0, err } respB := make([]byte, 2*4096) n, err := cln.Read(respB) if err != nil { return nil, 0, err } return respB, n, nil } func (c *Criu) doSwrk(reqType rpc.CriuReqType, opts *rpc.CriuOpts, nfy Notify) error { resp, err := c.doSwrkWithResp(reqType, opts, nfy) if err != nil { return err } respType := resp.GetType() if respType != reqType { return errors.New("unexpected responce") } return nil } func (c *Criu) doSwrkWithResp(reqType rpc.CriuReqType, opts *rpc.CriuOpts, nfy Notify) (*rpc.CriuResp, error) { var resp *rpc.CriuResp req := rpc.CriuReq{ Type: &reqType, Opts: opts, } if nfy != nil { opts.NotifyScripts = proto.Bool(true) } if c.swrkCmd == nil { err := c.Prepare() if err != nil { return nil, err } defer c.Cleanup() } for { reqB, err := proto.Marshal(&req) if err != nil { return nil, err } respB, respS, err := c.sendAndRecv(reqB) if err != nil { return nil, err } resp = &rpc.CriuResp{} err = proto.Unmarshal(respB[:respS], resp) if err != nil { return nil, err } if !resp.GetSuccess() { return resp, fmt.Errorf("operation failed (msg:%s err:%d)", resp.GetCrErrmsg(), resp.GetCrErrno()) } respType := resp.GetType() if respType != rpc.CriuReqType_NOTIFY { break } if nfy == nil { return resp, errors.New("unexpected notify") } notify := resp.GetNotify() switch notify.GetScript() { case "pre-dump": err = nfy.PreDump() case "post-dump": err = nfy.PostDump() case "pre-restore": err = nfy.PreRestore() case "post-restore": err = nfy.PostRestore(notify.GetPid()) case "network-lock": err = nfy.NetworkLock() case "network-unlock": err = nfy.NetworkUnlock() case "setup-namespaces": err = nfy.SetupNamespaces(notify.GetPid()) case "post-setup-namespaces": err = nfy.PostSetupNamespaces() case "post-resume": err = nfy.PostResume() default: err = nil } if err != nil { return resp, err } req = rpc.CriuReq{ Type: &respType, NotifySuccess: proto.Bool(true), } } return resp, nil } // Dump dumps a process func (c *Criu) Dump(opts rpc.CriuOpts, nfy Notify) error { return c.doSwrk(rpc.CriuReqType_DUMP, &opts, nfy) } // Restore restores a process func (c *Criu) Restore(opts rpc.CriuOpts, nfy Notify) error { return c.doSwrk(rpc.CriuReqType_RESTORE, &opts, nfy) } // PreDump does a pre-dump func (c *Criu) PreDump(opts rpc.CriuOpts, nfy Notify) error { return c.doSwrk(rpc.CriuReqType_PRE_DUMP, &opts, nfy) } // StartPageServer starts the page server func (c *Criu) StartPageServer(opts rpc.CriuOpts) error { return c.doSwrk(rpc.CriuReqType_PAGE_SERVER, &opts, nil) } // StartPageServerChld starts the page server and returns PID and port func (c *Criu) StartPageServerChld(opts rpc.CriuOpts) (int, int, error) { resp, err := c.doSwrkWithResp(rpc.CriuReqType_PAGE_SERVER_CHLD, &opts, nil) if err != nil { return 0, 0, err } return int(resp.Ps.GetPid()), int(resp.Ps.GetPort()), nil } // GetCriuVersion executes the VERSION RPC call and returns the version // as an integer. Major * 10000 + Minor * 100 + SubLevel func (c *Criu) GetCriuVersion() (int, error) { resp, err := c.doSwrkWithResp(rpc.CriuReqType_VERSION, nil, nil) if err != nil { return 0, err } if resp.GetType() != rpc.CriuReqType_VERSION { return 0, fmt.Errorf("Unexpected CRIU RPC response") } version := int(*resp.GetVersion().Major) * 10000 version += int(*resp.GetVersion().Minor) * 100 if resp.GetVersion().Sublevel != nil { version += int(*resp.GetVersion().Sublevel) } if resp.GetVersion().Gitid != nil { // taken from runc: if it is a git release -> increase minor by 1 version -= (version % 100) version += 100 } return version, nil } // IsCriuAtLeast checks if the version is at least the same // as the parameter version func (c *Criu) IsCriuAtLeast(version int) (bool, error) { criuVersion, err := c.GetCriuVersion() if err != nil { return false, err } if criuVersion >= version { return true, nil } return false, nil } go-criu-3.11/notify.go000066400000000000000000000020371337501637000146510ustar00rootroot00000000000000package criu //Notify interface type Notify interface { PreDump() error PostDump() error PreRestore() error PostRestore(pid int32) error NetworkLock() error NetworkUnlock() error SetupNamespaces(pid int32) error PostSetupNamespaces() error PostResume() error } // NoNotify struct type NoNotify struct { } // PreDump NoNotify func (c NoNotify) PreDump() error { return nil } // PostDump NoNotify func (c NoNotify) PostDump() error { return nil } // PreRestore NoNotify func (c NoNotify) PreRestore() error { return nil } // PostRestore NoNotify func (c NoNotify) PostRestore(pid int32) error { return nil } // NetworkLock NoNotify func (c NoNotify) NetworkLock() error { return nil } // NetworkUnlock NoNotify func (c NoNotify) NetworkUnlock() error { return nil } // SetupNamespaces NoNotify func (c NoNotify) SetupNamespaces(pid int32) error { return nil } // PostSetupNamespaces NoNotify func (c NoNotify) PostSetupNamespaces() error { return nil } // PostResume NoNotify func (c NoNotify) PostResume() error { return nil } go-criu-3.11/phaul/000077500000000000000000000000001337501637000141215ustar00rootroot00000000000000go-criu-3.11/phaul/api.go000066400000000000000000000025721337501637000152270ustar00rootroot00000000000000package phaul import ( "github.com/checkpoint-restore/go-criu" ) // Config is the configuration which is passed around // // Pid is what we migrate // Memfd is the file descriptor via which criu can transfer memory pages. // Wdir is the directory where phaul can put images and other stuff type Config struct { Pid int Memfd int Wdir string } // Remote interface // Rpc between PhaulClient and PhaulServer. When client // calls anything on this one, the corresponding method // should be called on PhaulServer object. type Remote interface { StartIter() error StopIter() error } // Local interface // Interface to local classes. Client calls them when it needs something on the source node. // //Methods: // // - DumpCopyRestore() is called on client side when the // pre-iterations are over and it's time to do full dump, // copy images and restore them on the server side. // All the time this method is executed victim tree is // frozen on client. Returning nil kills the tree, error // unfreezes it and resumes. The criu argument is the // pointer on created criu.Criu object on which client // may call Dump(). The requirement on opts passed are: // set Ps.Fd to comm.Memfd // set ParentImg to lastClientImagesPath // set TrackMem to true type Local interface { DumpCopyRestore(criu *criu.Criu, c Config, lastClientImagesPath string) error } go-criu-3.11/phaul/client.go000066400000000000000000000050751337501637000157350ustar00rootroot00000000000000package phaul import ( "fmt" "github.com/checkpoint-restore/go-criu" "github.com/checkpoint-restore/go-criu/rpc" "github.com/checkpoint-restore/go-criu/stats" "github.com/golang/protobuf/proto" ) const minPagesWritten uint64 = 64 const maxIters int = 8 const maxGrowDelta int64 = 32 // Client struct type Client struct { local Local remote Remote cfg Config } // MakePhaulClient function // Main entry point. Caller should create the client object by // passing here local, remote and comm. See comment in corresponding // interfaces/structs for explanation. // // Then call client.Migrate() and enjoy :) func MakePhaulClient(l Local, r Remote, c Config) (*Client, error) { return &Client{local: l, remote: r, cfg: c}, nil } func isLastIter(iter int, stats *stats.DumpStatsEntry, prevStats *stats.DumpStatsEntry) bool { if iter >= maxIters { fmt.Printf("`- max iters reached\n") return true } pagesWritten := stats.GetPagesWritten() if pagesWritten < minPagesWritten { fmt.Printf("`- tiny pre-dump (%d) reached\n", int(pagesWritten)) return true } pagesDelta := int64(pagesWritten) - int64(prevStats.GetPagesWritten()) if pagesDelta >= maxGrowDelta { fmt.Printf("`- grow iter (%d) reached\n", int(pagesDelta)) return true } return false } // Migrate function func (pc *Client) Migrate() error { criu := criu.MakeCriu() psi := rpc.CriuPageServerInfo{ Fd: proto.Int32(int32(pc.cfg.Memfd)), } opts := rpc.CriuOpts{ Pid: proto.Int32(int32(pc.cfg.Pid)), LogLevel: proto.Int32(4), LogFile: proto.String("pre-dump.log"), Ps: &psi, } err := criu.Prepare() if err != nil { return err } defer criu.Cleanup() imgs, err := preparePhaulImages(pc.cfg.Wdir) if err != nil { return err } prevStats := &stats.DumpStatsEntry{} iter := 0 for { err = pc.remote.StartIter() if err != nil { return err } prevP := imgs.lastImagesDir() imgDir, err := imgs.openNextDir() if err != nil { return err } opts.ImagesDirFd = proto.Int32(int32(imgDir.Fd())) if prevP != "" { opts.ParentImg = proto.String(prevP) } err = criu.PreDump(opts, nil) imgDir.Close() if err != nil { return err } err = pc.remote.StopIter() if err != nil { return err } st, err := criuGetDumpStats(imgDir) if err != nil { return err } if isLastIter(iter, st, prevStats) { break } prevStats = st } err = pc.remote.StartIter() if err == nil { prevP := imgs.lastImagesDir() err = pc.local.DumpCopyRestore(criu, pc.cfg, prevP) err2 := pc.remote.StopIter() if err == nil { err = err2 } } return err } go-criu-3.11/phaul/images.go000066400000000000000000000011741337501637000157200ustar00rootroot00000000000000package phaul import ( "fmt" "os" "path/filepath" ) type images struct { cursor int dir string } func preparePhaulImages(wdir string) (*images, error) { return &images{dir: wdir}, nil } func (i *images) getPath(idx int) string { return fmt.Sprintf(i.dir+"/%d", idx) } func (i *images) openNextDir() (*os.File, error) { ipath := i.getPath(i.cursor) err := os.Mkdir(ipath, 0700) if err != nil { return nil, err } i.cursor++ return os.Open(ipath) } func (i *images) lastImagesDir() string { var ret string if i.cursor == 0 { ret = "" } else { ret, _ = filepath.Abs(i.getPath(i.cursor - 1)) } return ret } go-criu-3.11/phaul/server.go000066400000000000000000000035431337501637000157630ustar00rootroot00000000000000package phaul import ( "fmt" "os" "github.com/checkpoint-restore/go-criu" "github.com/checkpoint-restore/go-criu/rpc" "github.com/golang/protobuf/proto" "path/filepath" ) // Server struct type Server struct { cfg Config imgs *images cr *criu.Criu process *os.Process } // MakePhaulServer function // Main entry point. Make the server with comm and call PhaulRemote // methods on it upon client requests. func MakePhaulServer(c Config) (*Server, error) { img, err := preparePhaulImages(c.Wdir) if err != nil { return nil, err } cr := criu.MakeCriu() return &Server{imgs: img, cfg: c, cr: cr}, nil } // // StartIter phaul.Remote methods func (s *Server) StartIter() error { fmt.Printf("S: start iter\n") psi := rpc.CriuPageServerInfo{ Fd: proto.Int32(int32(s.cfg.Memfd)), } opts := rpc.CriuOpts{ LogLevel: proto.Int32(4), LogFile: proto.String("ps.log"), Ps: &psi, } prevP := s.imgs.lastImagesDir() imgDir, err := s.imgs.openNextDir() if err != nil { return err } defer imgDir.Close() opts.ImagesDirFd = proto.Int32(int32(imgDir.Fd())) if prevP != "" { p, err := filepath.Abs(imgDir.Name()) if err != nil { return err } rel, err := filepath.Rel(p, prevP) if err != nil { return err } opts.ParentImg = proto.String(rel) } pid, _, err := s.cr.StartPageServerChld(opts) if err != nil { return err } s.process, err = os.FindProcess(pid) if err != nil { return err } return nil } // StopIter function func (s *Server) StopIter() error { state, err := s.process.Wait() if err != nil { return nil } if !state.Success() { return fmt.Errorf("page-server failed: %s", s) } return nil } // Server-local methods // LastImagesDir function func (s *Server) LastImagesDir() string { return s.imgs.lastImagesDir() } // GetCriu function func (s *Server) GetCriu() *criu.Criu { return s.cr } go-criu-3.11/phaul/stats.go000066400000000000000000000011351337501637000156060ustar00rootroot00000000000000package phaul import ( "os" "github.com/checkpoint-restore/go-criu/stats" "github.com/golang/protobuf/proto" ) /* FIXME: report stats from CriuResp */ func criuGetDumpStats(imgDir *os.File) (*stats.DumpStatsEntry, error) { stf, err := os.Open(imgDir.Name() + "/stats-dump") if err != nil { return nil, err } defer stf.Close() buf := make([]byte, 2*4096) sz, err := stf.Read(buf) if err != nil { return nil, err } st := &stats.StatsEntry{} // Skip 2 magic values and entry size err = proto.Unmarshal(buf[12:sz], st) if err != nil { return nil, err } return st.GetDump(), nil } go-criu-3.11/rpc/000077500000000000000000000000001337501637000135745ustar00rootroot00000000000000go-criu-3.11/rpc/rpc.pb.go000066400000000000000000001247651337501637000153260ustar00rootroot00000000000000// Code generated by protoc-gen-go. DO NOT EDIT. // source: rpc/rpc.proto /* Package rpc is a generated protocol buffer package. It is generated from these files: rpc/rpc.proto It has these top-level messages: CriuPageServerInfo CriuVethPair ExtMountMap JoinNamespace InheritFd CgroupRoot UnixSk CriuOpts CriuDumpResp CriuRestoreResp CriuNotify CriuFeatures CriuReq CriuResp CriuVersion */ package rpc import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type CriuCgMode int32 const ( CriuCgMode_IGNORE CriuCgMode = 0 CriuCgMode_CG_NONE CriuCgMode = 1 CriuCgMode_PROPS CriuCgMode = 2 CriuCgMode_SOFT CriuCgMode = 3 CriuCgMode_FULL CriuCgMode = 4 CriuCgMode_STRICT CriuCgMode = 5 CriuCgMode_DEFAULT CriuCgMode = 6 ) var CriuCgMode_name = map[int32]string{ 0: "IGNORE", 1: "CG_NONE", 2: "PROPS", 3: "SOFT", 4: "FULL", 5: "STRICT", 6: "DEFAULT", } var CriuCgMode_value = map[string]int32{ "IGNORE": 0, "CG_NONE": 1, "PROPS": 2, "SOFT": 3, "FULL": 4, "STRICT": 5, "DEFAULT": 6, } func (x CriuCgMode) Enum() *CriuCgMode { p := new(CriuCgMode) *p = x return p } func (x CriuCgMode) String() string { return proto.EnumName(CriuCgMode_name, int32(x)) } func (x *CriuCgMode) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(CriuCgMode_value, data, "CriuCgMode") if err != nil { return err } *x = CriuCgMode(value) return nil } func (CriuCgMode) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } type CriuReqType int32 const ( CriuReqType_EMPTY CriuReqType = 0 CriuReqType_DUMP CriuReqType = 1 CriuReqType_RESTORE CriuReqType = 2 CriuReqType_CHECK CriuReqType = 3 CriuReqType_PRE_DUMP CriuReqType = 4 CriuReqType_PAGE_SERVER CriuReqType = 5 CriuReqType_NOTIFY CriuReqType = 6 CriuReqType_CPUINFO_DUMP CriuReqType = 7 CriuReqType_CPUINFO_CHECK CriuReqType = 8 CriuReqType_FEATURE_CHECK CriuReqType = 9 CriuReqType_VERSION CriuReqType = 10 CriuReqType_WAIT_PID CriuReqType = 11 CriuReqType_PAGE_SERVER_CHLD CriuReqType = 12 ) var CriuReqType_name = map[int32]string{ 0: "EMPTY", 1: "DUMP", 2: "RESTORE", 3: "CHECK", 4: "PRE_DUMP", 5: "PAGE_SERVER", 6: "NOTIFY", 7: "CPUINFO_DUMP", 8: "CPUINFO_CHECK", 9: "FEATURE_CHECK", 10: "VERSION", 11: "WAIT_PID", 12: "PAGE_SERVER_CHLD", } var CriuReqType_value = map[string]int32{ "EMPTY": 0, "DUMP": 1, "RESTORE": 2, "CHECK": 3, "PRE_DUMP": 4, "PAGE_SERVER": 5, "NOTIFY": 6, "CPUINFO_DUMP": 7, "CPUINFO_CHECK": 8, "FEATURE_CHECK": 9, "VERSION": 10, "WAIT_PID": 11, "PAGE_SERVER_CHLD": 12, } func (x CriuReqType) Enum() *CriuReqType { p := new(CriuReqType) *p = x return p } func (x CriuReqType) String() string { return proto.EnumName(CriuReqType_name, int32(x)) } func (x *CriuReqType) UnmarshalJSON(data []byte) error { value, err := proto.UnmarshalJSONEnum(CriuReqType_value, data, "CriuReqType") if err != nil { return err } *x = CriuReqType(value) return nil } func (CriuReqType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } type CriuPageServerInfo struct { Address *string `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` Port *int32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"` Pid *int32 `protobuf:"varint,3,opt,name=pid" json:"pid,omitempty"` Fd *int32 `protobuf:"varint,4,opt,name=fd" json:"fd,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CriuPageServerInfo) Reset() { *m = CriuPageServerInfo{} } func (m *CriuPageServerInfo) String() string { return proto.CompactTextString(m) } func (*CriuPageServerInfo) ProtoMessage() {} func (*CriuPageServerInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } func (m *CriuPageServerInfo) GetAddress() string { if m != nil && m.Address != nil { return *m.Address } return "" } func (m *CriuPageServerInfo) GetPort() int32 { if m != nil && m.Port != nil { return *m.Port } return 0 } func (m *CriuPageServerInfo) GetPid() int32 { if m != nil && m.Pid != nil { return *m.Pid } return 0 } func (m *CriuPageServerInfo) GetFd() int32 { if m != nil && m.Fd != nil { return *m.Fd } return 0 } type CriuVethPair struct { IfIn *string `protobuf:"bytes,1,req,name=if_in,json=ifIn" json:"if_in,omitempty"` IfOut *string `protobuf:"bytes,2,req,name=if_out,json=ifOut" json:"if_out,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CriuVethPair) Reset() { *m = CriuVethPair{} } func (m *CriuVethPair) String() string { return proto.CompactTextString(m) } func (*CriuVethPair) ProtoMessage() {} func (*CriuVethPair) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } func (m *CriuVethPair) GetIfIn() string { if m != nil && m.IfIn != nil { return *m.IfIn } return "" } func (m *CriuVethPair) GetIfOut() string { if m != nil && m.IfOut != nil { return *m.IfOut } return "" } type ExtMountMap struct { Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` Val *string `protobuf:"bytes,2,req,name=val" json:"val,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *ExtMountMap) Reset() { *m = ExtMountMap{} } func (m *ExtMountMap) String() string { return proto.CompactTextString(m) } func (*ExtMountMap) ProtoMessage() {} func (*ExtMountMap) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } func (m *ExtMountMap) GetKey() string { if m != nil && m.Key != nil { return *m.Key } return "" } func (m *ExtMountMap) GetVal() string { if m != nil && m.Val != nil { return *m.Val } return "" } type JoinNamespace struct { Ns *string `protobuf:"bytes,1,req,name=ns" json:"ns,omitempty"` NsFile *string `protobuf:"bytes,2,req,name=ns_file,json=nsFile" json:"ns_file,omitempty"` ExtraOpt *string `protobuf:"bytes,3,opt,name=extra_opt,json=extraOpt" json:"extra_opt,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *JoinNamespace) Reset() { *m = JoinNamespace{} } func (m *JoinNamespace) String() string { return proto.CompactTextString(m) } func (*JoinNamespace) ProtoMessage() {} func (*JoinNamespace) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } func (m *JoinNamespace) GetNs() string { if m != nil && m.Ns != nil { return *m.Ns } return "" } func (m *JoinNamespace) GetNsFile() string { if m != nil && m.NsFile != nil { return *m.NsFile } return "" } func (m *JoinNamespace) GetExtraOpt() string { if m != nil && m.ExtraOpt != nil { return *m.ExtraOpt } return "" } type InheritFd struct { Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"` Fd *int32 `protobuf:"varint,2,req,name=fd" json:"fd,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *InheritFd) Reset() { *m = InheritFd{} } func (m *InheritFd) String() string { return proto.CompactTextString(m) } func (*InheritFd) ProtoMessage() {} func (*InheritFd) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } func (m *InheritFd) GetKey() string { if m != nil && m.Key != nil { return *m.Key } return "" } func (m *InheritFd) GetFd() int32 { if m != nil && m.Fd != nil { return *m.Fd } return 0 } type CgroupRoot struct { Ctrl *string `protobuf:"bytes,1,opt,name=ctrl" json:"ctrl,omitempty"` Path *string `protobuf:"bytes,2,req,name=path" json:"path,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CgroupRoot) Reset() { *m = CgroupRoot{} } func (m *CgroupRoot) String() string { return proto.CompactTextString(m) } func (*CgroupRoot) ProtoMessage() {} func (*CgroupRoot) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } func (m *CgroupRoot) GetCtrl() string { if m != nil && m.Ctrl != nil { return *m.Ctrl } return "" } func (m *CgroupRoot) GetPath() string { if m != nil && m.Path != nil { return *m.Path } return "" } type UnixSk struct { Inode *uint32 `protobuf:"varint,1,req,name=inode" json:"inode,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *UnixSk) Reset() { *m = UnixSk{} } func (m *UnixSk) String() string { return proto.CompactTextString(m) } func (*UnixSk) ProtoMessage() {} func (*UnixSk) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } func (m *UnixSk) GetInode() uint32 { if m != nil && m.Inode != nil { return *m.Inode } return 0 } type CriuOpts struct { ImagesDirFd *int32 `protobuf:"varint,1,req,name=images_dir_fd,json=imagesDirFd" json:"images_dir_fd,omitempty"` Pid *int32 `protobuf:"varint,2,opt,name=pid" json:"pid,omitempty"` LeaveRunning *bool `protobuf:"varint,3,opt,name=leave_running,json=leaveRunning" json:"leave_running,omitempty"` ExtUnixSk *bool `protobuf:"varint,4,opt,name=ext_unix_sk,json=extUnixSk" json:"ext_unix_sk,omitempty"` TcpEstablished *bool `protobuf:"varint,5,opt,name=tcp_established,json=tcpEstablished" json:"tcp_established,omitempty"` EvasiveDevices *bool `protobuf:"varint,6,opt,name=evasive_devices,json=evasiveDevices" json:"evasive_devices,omitempty"` ShellJob *bool `protobuf:"varint,7,opt,name=shell_job,json=shellJob" json:"shell_job,omitempty"` FileLocks *bool `protobuf:"varint,8,opt,name=file_locks,json=fileLocks" json:"file_locks,omitempty"` LogLevel *int32 `protobuf:"varint,9,opt,name=log_level,json=logLevel,def=2" json:"log_level,omitempty"` LogFile *string `protobuf:"bytes,10,opt,name=log_file,json=logFile" json:"log_file,omitempty"` Ps *CriuPageServerInfo `protobuf:"bytes,11,opt,name=ps" json:"ps,omitempty"` NotifyScripts *bool `protobuf:"varint,12,opt,name=notify_scripts,json=notifyScripts" json:"notify_scripts,omitempty"` Root *string `protobuf:"bytes,13,opt,name=root" json:"root,omitempty"` ParentImg *string `protobuf:"bytes,14,opt,name=parent_img,json=parentImg" json:"parent_img,omitempty"` TrackMem *bool `protobuf:"varint,15,opt,name=track_mem,json=trackMem" json:"track_mem,omitempty"` AutoDedup *bool `protobuf:"varint,16,opt,name=auto_dedup,json=autoDedup" json:"auto_dedup,omitempty"` WorkDirFd *int32 `protobuf:"varint,17,opt,name=work_dir_fd,json=workDirFd" json:"work_dir_fd,omitempty"` LinkRemap *bool `protobuf:"varint,18,opt,name=link_remap,json=linkRemap" json:"link_remap,omitempty"` Veths []*CriuVethPair `protobuf:"bytes,19,rep,name=veths" json:"veths,omitempty"` CpuCap *uint32 `protobuf:"varint,20,opt,name=cpu_cap,json=cpuCap,def=4294967295" json:"cpu_cap,omitempty"` ForceIrmap *bool `protobuf:"varint,21,opt,name=force_irmap,json=forceIrmap" json:"force_irmap,omitempty"` ExecCmd []string `protobuf:"bytes,22,rep,name=exec_cmd,json=execCmd" json:"exec_cmd,omitempty"` ExtMnt []*ExtMountMap `protobuf:"bytes,23,rep,name=ext_mnt,json=extMnt" json:"ext_mnt,omitempty"` ManageCgroups *bool `protobuf:"varint,24,opt,name=manage_cgroups,json=manageCgroups" json:"manage_cgroups,omitempty"` CgRoot []*CgroupRoot `protobuf:"bytes,25,rep,name=cg_root,json=cgRoot" json:"cg_root,omitempty"` RstSibling *bool `protobuf:"varint,26,opt,name=rst_sibling,json=rstSibling" json:"rst_sibling,omitempty"` InheritFd []*InheritFd `protobuf:"bytes,27,rep,name=inherit_fd,json=inheritFd" json:"inherit_fd,omitempty"` AutoExtMnt *bool `protobuf:"varint,28,opt,name=auto_ext_mnt,json=autoExtMnt" json:"auto_ext_mnt,omitempty"` ExtSharing *bool `protobuf:"varint,29,opt,name=ext_sharing,json=extSharing" json:"ext_sharing,omitempty"` ExtMasters *bool `protobuf:"varint,30,opt,name=ext_masters,json=extMasters" json:"ext_masters,omitempty"` SkipMnt []string `protobuf:"bytes,31,rep,name=skip_mnt,json=skipMnt" json:"skip_mnt,omitempty"` EnableFs []string `protobuf:"bytes,32,rep,name=enable_fs,json=enableFs" json:"enable_fs,omitempty"` UnixSkIno []*UnixSk `protobuf:"bytes,33,rep,name=unix_sk_ino,json=unixSkIno" json:"unix_sk_ino,omitempty"` ManageCgroupsMode *CriuCgMode `protobuf:"varint,34,opt,name=manage_cgroups_mode,json=manageCgroupsMode,enum=CriuCgMode" json:"manage_cgroups_mode,omitempty"` GhostLimit *uint32 `protobuf:"varint,35,opt,name=ghost_limit,json=ghostLimit,def=1048576" json:"ghost_limit,omitempty"` IrmapScanPaths []string `protobuf:"bytes,36,rep,name=irmap_scan_paths,json=irmapScanPaths" json:"irmap_scan_paths,omitempty"` External []string `protobuf:"bytes,37,rep,name=external" json:"external,omitempty"` EmptyNs *uint32 `protobuf:"varint,38,opt,name=empty_ns,json=emptyNs" json:"empty_ns,omitempty"` JoinNs []*JoinNamespace `protobuf:"bytes,39,rep,name=join_ns,json=joinNs" json:"join_ns,omitempty"` CgroupProps *string `protobuf:"bytes,41,opt,name=cgroup_props,json=cgroupProps" json:"cgroup_props,omitempty"` CgroupPropsFile *string `protobuf:"bytes,42,opt,name=cgroup_props_file,json=cgroupPropsFile" json:"cgroup_props_file,omitempty"` CgroupDumpController []string `protobuf:"bytes,43,rep,name=cgroup_dump_controller,json=cgroupDumpController" json:"cgroup_dump_controller,omitempty"` FreezeCgroup *string `protobuf:"bytes,44,opt,name=freeze_cgroup,json=freezeCgroup" json:"freeze_cgroup,omitempty"` Timeout *uint32 `protobuf:"varint,45,opt,name=timeout" json:"timeout,omitempty"` TcpSkipInFlight *bool `protobuf:"varint,46,opt,name=tcp_skip_in_flight,json=tcpSkipInFlight" json:"tcp_skip_in_flight,omitempty"` WeakSysctls *bool `protobuf:"varint,47,opt,name=weak_sysctls,json=weakSysctls" json:"weak_sysctls,omitempty"` LazyPages *bool `protobuf:"varint,48,opt,name=lazy_pages,json=lazyPages" json:"lazy_pages,omitempty"` StatusFd *int32 `protobuf:"varint,49,opt,name=status_fd,json=statusFd" json:"status_fd,omitempty"` OrphanPtsMaster *bool `protobuf:"varint,50,opt,name=orphan_pts_master,json=orphanPtsMaster" json:"orphan_pts_master,omitempty"` ConfigFile *string `protobuf:"bytes,51,opt,name=config_file,json=configFile" json:"config_file,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CriuOpts) Reset() { *m = CriuOpts{} } func (m *CriuOpts) String() string { return proto.CompactTextString(m) } func (*CriuOpts) ProtoMessage() {} func (*CriuOpts) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } const Default_CriuOpts_LogLevel int32 = 2 const Default_CriuOpts_CpuCap uint32 = 4294967295 const Default_CriuOpts_GhostLimit uint32 = 1048576 func (m *CriuOpts) GetImagesDirFd() int32 { if m != nil && m.ImagesDirFd != nil { return *m.ImagesDirFd } return 0 } func (m *CriuOpts) GetPid() int32 { if m != nil && m.Pid != nil { return *m.Pid } return 0 } func (m *CriuOpts) GetLeaveRunning() bool { if m != nil && m.LeaveRunning != nil { return *m.LeaveRunning } return false } func (m *CriuOpts) GetExtUnixSk() bool { if m != nil && m.ExtUnixSk != nil { return *m.ExtUnixSk } return false } func (m *CriuOpts) GetTcpEstablished() bool { if m != nil && m.TcpEstablished != nil { return *m.TcpEstablished } return false } func (m *CriuOpts) GetEvasiveDevices() bool { if m != nil && m.EvasiveDevices != nil { return *m.EvasiveDevices } return false } func (m *CriuOpts) GetShellJob() bool { if m != nil && m.ShellJob != nil { return *m.ShellJob } return false } func (m *CriuOpts) GetFileLocks() bool { if m != nil && m.FileLocks != nil { return *m.FileLocks } return false } func (m *CriuOpts) GetLogLevel() int32 { if m != nil && m.LogLevel != nil { return *m.LogLevel } return Default_CriuOpts_LogLevel } func (m *CriuOpts) GetLogFile() string { if m != nil && m.LogFile != nil { return *m.LogFile } return "" } func (m *CriuOpts) GetPs() *CriuPageServerInfo { if m != nil { return m.Ps } return nil } func (m *CriuOpts) GetNotifyScripts() bool { if m != nil && m.NotifyScripts != nil { return *m.NotifyScripts } return false } func (m *CriuOpts) GetRoot() string { if m != nil && m.Root != nil { return *m.Root } return "" } func (m *CriuOpts) GetParentImg() string { if m != nil && m.ParentImg != nil { return *m.ParentImg } return "" } func (m *CriuOpts) GetTrackMem() bool { if m != nil && m.TrackMem != nil { return *m.TrackMem } return false } func (m *CriuOpts) GetAutoDedup() bool { if m != nil && m.AutoDedup != nil { return *m.AutoDedup } return false } func (m *CriuOpts) GetWorkDirFd() int32 { if m != nil && m.WorkDirFd != nil { return *m.WorkDirFd } return 0 } func (m *CriuOpts) GetLinkRemap() bool { if m != nil && m.LinkRemap != nil { return *m.LinkRemap } return false } func (m *CriuOpts) GetVeths() []*CriuVethPair { if m != nil { return m.Veths } return nil } func (m *CriuOpts) GetCpuCap() uint32 { if m != nil && m.CpuCap != nil { return *m.CpuCap } return Default_CriuOpts_CpuCap } func (m *CriuOpts) GetForceIrmap() bool { if m != nil && m.ForceIrmap != nil { return *m.ForceIrmap } return false } func (m *CriuOpts) GetExecCmd() []string { if m != nil { return m.ExecCmd } return nil } func (m *CriuOpts) GetExtMnt() []*ExtMountMap { if m != nil { return m.ExtMnt } return nil } func (m *CriuOpts) GetManageCgroups() bool { if m != nil && m.ManageCgroups != nil { return *m.ManageCgroups } return false } func (m *CriuOpts) GetCgRoot() []*CgroupRoot { if m != nil { return m.CgRoot } return nil } func (m *CriuOpts) GetRstSibling() bool { if m != nil && m.RstSibling != nil { return *m.RstSibling } return false } func (m *CriuOpts) GetInheritFd() []*InheritFd { if m != nil { return m.InheritFd } return nil } func (m *CriuOpts) GetAutoExtMnt() bool { if m != nil && m.AutoExtMnt != nil { return *m.AutoExtMnt } return false } func (m *CriuOpts) GetExtSharing() bool { if m != nil && m.ExtSharing != nil { return *m.ExtSharing } return false } func (m *CriuOpts) GetExtMasters() bool { if m != nil && m.ExtMasters != nil { return *m.ExtMasters } return false } func (m *CriuOpts) GetSkipMnt() []string { if m != nil { return m.SkipMnt } return nil } func (m *CriuOpts) GetEnableFs() []string { if m != nil { return m.EnableFs } return nil } func (m *CriuOpts) GetUnixSkIno() []*UnixSk { if m != nil { return m.UnixSkIno } return nil } func (m *CriuOpts) GetManageCgroupsMode() CriuCgMode { if m != nil && m.ManageCgroupsMode != nil { return *m.ManageCgroupsMode } return CriuCgMode_IGNORE } func (m *CriuOpts) GetGhostLimit() uint32 { if m != nil && m.GhostLimit != nil { return *m.GhostLimit } return Default_CriuOpts_GhostLimit } func (m *CriuOpts) GetIrmapScanPaths() []string { if m != nil { return m.IrmapScanPaths } return nil } func (m *CriuOpts) GetExternal() []string { if m != nil { return m.External } return nil } func (m *CriuOpts) GetEmptyNs() uint32 { if m != nil && m.EmptyNs != nil { return *m.EmptyNs } return 0 } func (m *CriuOpts) GetJoinNs() []*JoinNamespace { if m != nil { return m.JoinNs } return nil } func (m *CriuOpts) GetCgroupProps() string { if m != nil && m.CgroupProps != nil { return *m.CgroupProps } return "" } func (m *CriuOpts) GetCgroupPropsFile() string { if m != nil && m.CgroupPropsFile != nil { return *m.CgroupPropsFile } return "" } func (m *CriuOpts) GetCgroupDumpController() []string { if m != nil { return m.CgroupDumpController } return nil } func (m *CriuOpts) GetFreezeCgroup() string { if m != nil && m.FreezeCgroup != nil { return *m.FreezeCgroup } return "" } func (m *CriuOpts) GetTimeout() uint32 { if m != nil && m.Timeout != nil { return *m.Timeout } return 0 } func (m *CriuOpts) GetTcpSkipInFlight() bool { if m != nil && m.TcpSkipInFlight != nil { return *m.TcpSkipInFlight } return false } func (m *CriuOpts) GetWeakSysctls() bool { if m != nil && m.WeakSysctls != nil { return *m.WeakSysctls } return false } func (m *CriuOpts) GetLazyPages() bool { if m != nil && m.LazyPages != nil { return *m.LazyPages } return false } func (m *CriuOpts) GetStatusFd() int32 { if m != nil && m.StatusFd != nil { return *m.StatusFd } return 0 } func (m *CriuOpts) GetOrphanPtsMaster() bool { if m != nil && m.OrphanPtsMaster != nil { return *m.OrphanPtsMaster } return false } func (m *CriuOpts) GetConfigFile() string { if m != nil && m.ConfigFile != nil { return *m.ConfigFile } return "" } type CriuDumpResp struct { Restored *bool `protobuf:"varint,1,opt,name=restored" json:"restored,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CriuDumpResp) Reset() { *m = CriuDumpResp{} } func (m *CriuDumpResp) String() string { return proto.CompactTextString(m) } func (*CriuDumpResp) ProtoMessage() {} func (*CriuDumpResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } func (m *CriuDumpResp) GetRestored() bool { if m != nil && m.Restored != nil { return *m.Restored } return false } type CriuRestoreResp struct { Pid *int32 `protobuf:"varint,1,req,name=pid" json:"pid,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CriuRestoreResp) Reset() { *m = CriuRestoreResp{} } func (m *CriuRestoreResp) String() string { return proto.CompactTextString(m) } func (*CriuRestoreResp) ProtoMessage() {} func (*CriuRestoreResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } func (m *CriuRestoreResp) GetPid() int32 { if m != nil && m.Pid != nil { return *m.Pid } return 0 } type CriuNotify struct { Script *string `protobuf:"bytes,1,opt,name=script" json:"script,omitempty"` Pid *int32 `protobuf:"varint,2,opt,name=pid" json:"pid,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CriuNotify) Reset() { *m = CriuNotify{} } func (m *CriuNotify) String() string { return proto.CompactTextString(m) } func (*CriuNotify) ProtoMessage() {} func (*CriuNotify) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } func (m *CriuNotify) GetScript() string { if m != nil && m.Script != nil { return *m.Script } return "" } func (m *CriuNotify) GetPid() int32 { if m != nil && m.Pid != nil { return *m.Pid } return 0 } // // List of features which can queried via // CRIU_REQ_TYPE__FEATURE_CHECK type CriuFeatures struct { MemTrack *bool `protobuf:"varint,1,opt,name=mem_track,json=memTrack" json:"mem_track,omitempty"` LazyPages *bool `protobuf:"varint,2,opt,name=lazy_pages,json=lazyPages" json:"lazy_pages,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CriuFeatures) Reset() { *m = CriuFeatures{} } func (m *CriuFeatures) String() string { return proto.CompactTextString(m) } func (*CriuFeatures) ProtoMessage() {} func (*CriuFeatures) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } func (m *CriuFeatures) GetMemTrack() bool { if m != nil && m.MemTrack != nil { return *m.MemTrack } return false } func (m *CriuFeatures) GetLazyPages() bool { if m != nil && m.LazyPages != nil { return *m.LazyPages } return false } type CriuReq struct { Type *CriuReqType `protobuf:"varint,1,req,name=type,enum=CriuReqType" json:"type,omitempty"` Opts *CriuOpts `protobuf:"bytes,2,opt,name=opts" json:"opts,omitempty"` NotifySuccess *bool `protobuf:"varint,3,opt,name=notify_success,json=notifySuccess" json:"notify_success,omitempty"` // // When set service won't close the connection but // will wait for more req-s to appear. Works not // for all request types. KeepOpen *bool `protobuf:"varint,4,opt,name=keep_open,json=keepOpen" json:"keep_open,omitempty"` // // 'features' can be used to query which features // are supported by the installed criu/kernel // via RPC. Features *CriuFeatures `protobuf:"bytes,5,opt,name=features" json:"features,omitempty"` // 'pid' is used for WAIT_PID Pid *uint32 `protobuf:"varint,6,opt,name=pid" json:"pid,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CriuReq) Reset() { *m = CriuReq{} } func (m *CriuReq) String() string { return proto.CompactTextString(m) } func (*CriuReq) ProtoMessage() {} func (*CriuReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } func (m *CriuReq) GetType() CriuReqType { if m != nil && m.Type != nil { return *m.Type } return CriuReqType_EMPTY } func (m *CriuReq) GetOpts() *CriuOpts { if m != nil { return m.Opts } return nil } func (m *CriuReq) GetNotifySuccess() bool { if m != nil && m.NotifySuccess != nil { return *m.NotifySuccess } return false } func (m *CriuReq) GetKeepOpen() bool { if m != nil && m.KeepOpen != nil { return *m.KeepOpen } return false } func (m *CriuReq) GetFeatures() *CriuFeatures { if m != nil { return m.Features } return nil } func (m *CriuReq) GetPid() uint32 { if m != nil && m.Pid != nil { return *m.Pid } return 0 } type CriuResp struct { Type *CriuReqType `protobuf:"varint,1,req,name=type,enum=CriuReqType" json:"type,omitempty"` Success *bool `protobuf:"varint,2,req,name=success" json:"success,omitempty"` Dump *CriuDumpResp `protobuf:"bytes,3,opt,name=dump" json:"dump,omitempty"` Restore *CriuRestoreResp `protobuf:"bytes,4,opt,name=restore" json:"restore,omitempty"` Notify *CriuNotify `protobuf:"bytes,5,opt,name=notify" json:"notify,omitempty"` Ps *CriuPageServerInfo `protobuf:"bytes,6,opt,name=ps" json:"ps,omitempty"` CrErrno *int32 `protobuf:"varint,7,opt,name=cr_errno,json=crErrno" json:"cr_errno,omitempty"` Features *CriuFeatures `protobuf:"bytes,8,opt,name=features" json:"features,omitempty"` CrErrmsg *string `protobuf:"bytes,9,opt,name=cr_errmsg,json=crErrmsg" json:"cr_errmsg,omitempty"` Version *CriuVersion `protobuf:"bytes,10,opt,name=version" json:"version,omitempty"` Status *int32 `protobuf:"varint,11,opt,name=status" json:"status,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CriuResp) Reset() { *m = CriuResp{} } func (m *CriuResp) String() string { return proto.CompactTextString(m) } func (*CriuResp) ProtoMessage() {} func (*CriuResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } func (m *CriuResp) GetType() CriuReqType { if m != nil && m.Type != nil { return *m.Type } return CriuReqType_EMPTY } func (m *CriuResp) GetSuccess() bool { if m != nil && m.Success != nil { return *m.Success } return false } func (m *CriuResp) GetDump() *CriuDumpResp { if m != nil { return m.Dump } return nil } func (m *CriuResp) GetRestore() *CriuRestoreResp { if m != nil { return m.Restore } return nil } func (m *CriuResp) GetNotify() *CriuNotify { if m != nil { return m.Notify } return nil } func (m *CriuResp) GetPs() *CriuPageServerInfo { if m != nil { return m.Ps } return nil } func (m *CriuResp) GetCrErrno() int32 { if m != nil && m.CrErrno != nil { return *m.CrErrno } return 0 } func (m *CriuResp) GetFeatures() *CriuFeatures { if m != nil { return m.Features } return nil } func (m *CriuResp) GetCrErrmsg() string { if m != nil && m.CrErrmsg != nil { return *m.CrErrmsg } return "" } func (m *CriuResp) GetVersion() *CriuVersion { if m != nil { return m.Version } return nil } func (m *CriuResp) GetStatus() int32 { if m != nil && m.Status != nil { return *m.Status } return 0 } // Answer for criu_req_type.VERSION requests type CriuVersion struct { Major *int32 `protobuf:"varint,1,req,name=major" json:"major,omitempty"` Minor *int32 `protobuf:"varint,2,req,name=minor" json:"minor,omitempty"` Gitid *string `protobuf:"bytes,3,opt,name=gitid" json:"gitid,omitempty"` Sublevel *int32 `protobuf:"varint,4,opt,name=sublevel" json:"sublevel,omitempty"` Extra *int32 `protobuf:"varint,5,opt,name=extra" json:"extra,omitempty"` Name *string `protobuf:"bytes,6,opt,name=name" json:"name,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *CriuVersion) Reset() { *m = CriuVersion{} } func (m *CriuVersion) String() string { return proto.CompactTextString(m) } func (*CriuVersion) ProtoMessage() {} func (*CriuVersion) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } func (m *CriuVersion) GetMajor() int32 { if m != nil && m.Major != nil { return *m.Major } return 0 } func (m *CriuVersion) GetMinor() int32 { if m != nil && m.Minor != nil { return *m.Minor } return 0 } func (m *CriuVersion) GetGitid() string { if m != nil && m.Gitid != nil { return *m.Gitid } return "" } func (m *CriuVersion) GetSublevel() int32 { if m != nil && m.Sublevel != nil { return *m.Sublevel } return 0 } func (m *CriuVersion) GetExtra() int32 { if m != nil && m.Extra != nil { return *m.Extra } return 0 } func (m *CriuVersion) GetName() string { if m != nil && m.Name != nil { return *m.Name } return "" } func init() { proto.RegisterType((*CriuPageServerInfo)(nil), "criu_page_server_info") proto.RegisterType((*CriuVethPair)(nil), "criu_veth_pair") proto.RegisterType((*ExtMountMap)(nil), "ext_mount_map") proto.RegisterType((*JoinNamespace)(nil), "join_namespace") proto.RegisterType((*InheritFd)(nil), "inherit_fd") proto.RegisterType((*CgroupRoot)(nil), "cgroup_root") proto.RegisterType((*UnixSk)(nil), "unix_sk") proto.RegisterType((*CriuOpts)(nil), "criu_opts") proto.RegisterType((*CriuDumpResp)(nil), "criu_dump_resp") proto.RegisterType((*CriuRestoreResp)(nil), "criu_restore_resp") proto.RegisterType((*CriuNotify)(nil), "criu_notify") proto.RegisterType((*CriuFeatures)(nil), "criu_features") proto.RegisterType((*CriuReq)(nil), "criu_req") proto.RegisterType((*CriuResp)(nil), "criu_resp") proto.RegisterType((*CriuVersion)(nil), "criu_version") proto.RegisterEnum("CriuCgMode", CriuCgMode_name, CriuCgMode_value) proto.RegisterEnum("CriuReqType", CriuReqType_name, CriuReqType_value) } func init() { proto.RegisterFile("rpc/rpc.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ // 1835 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xeb, 0x72, 0x5b, 0xb7, 0x11, 0x0e, 0x29, 0xf1, 0x06, 0x5e, 0x7c, 0x0c, 0x5f, 0x02, 0xc7, 0xb5, 0xad, 0xd0, 0x51, 0xa2, 0x2a, 0x2e, 0x93, 0x30, 0x76, 0x5c, 0x67, 0xda, 0x1f, 0x1e, 0x8a, 0x74, 0xd8, 0x48, 0x22, 0x07, 0xa4, 0xdc, 0xc9, 0x2f, 0xcc, 0xd1, 0x39, 0x20, 0x05, 0xf3, 0xdc, 0x0a, 0x80, 0x8a, 0xe4, 0x97, 0xe8, 0xbf, 0x3e, 0x57, 0xde, 0xa4, 0xaf, 0xd0, 0xd9, 0x05, 0x28, 0x4b, 0x49, 0x66, 0xd2, 0x7f, 0xd8, 0x0f, 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e, 0x7e, 0x33, 0x14, 0xb3, 0x21, 0x7f, 0x3b, 0xe4, 0x41, 0x05, 0xbe, 0x3d, 0x9e, 0xcc, 0xc7, 0xa3, 0x9f, 0x82, 0x2a, 0x0d, 0x48, 0x6b, 0x30, 0x3d, 0x19, 0x1f, 0x8f, 0x26, 0x8e, 0xbd, 0x46, 0x6f, 0x93, 0xf6, 0x06, 0x71, 0xef, 0xd5, 0x01, 0x1a, 0x0d, 0x5f, 0xcf, 0x4f, 0xf8, 0xd0, 0x43, 0x0d, 0xf8, 0xfa, 0xed, 0x90, 0xcf, 0xc6, 0x93, 0xe3, 0x80, 0xc0, 0x7f, 0xff, 0x7c, 0x3d, 0x9e, 0x8b, 0xe9, 0xf8, 0x20, 0x68, 0xd2, 0xbb, 0x24, 0xb8, 0xf6, 0x9f, 0x18, 0xfc, 0x70, 0x78, 0x10, 0xb4, 0xfe, 0x17, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x9f, 0x0e, 0x7d, 0xca, 0x0d, 0x00, 0x00, } go-criu-3.11/stats/000077500000000000000000000000001337501637000141465ustar00rootroot00000000000000go-criu-3.11/stats/stats.pb.go000066400000000000000000000205751337501637000162440ustar00rootroot00000000000000// Code generated by protoc-gen-go. // source: stats.proto // DO NOT EDIT! /* Package stats is a generated protocol buffer package. It is generated from these files: stats.proto It has these top-level messages: DumpStatsEntry RestoreStatsEntry StatsEntry */ package stats import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // This one contains statistics about dump/restore process type DumpStatsEntry struct { FreezingTime *uint32 `protobuf:"varint,1,req,name=freezing_time,json=freezingTime" json:"freezing_time,omitempty"` FrozenTime *uint32 `protobuf:"varint,2,req,name=frozen_time,json=frozenTime" json:"frozen_time,omitempty"` MemdumpTime *uint32 `protobuf:"varint,3,req,name=memdump_time,json=memdumpTime" json:"memdump_time,omitempty"` MemwriteTime *uint32 `protobuf:"varint,4,req,name=memwrite_time,json=memwriteTime" json:"memwrite_time,omitempty"` PagesScanned *uint64 `protobuf:"varint,5,req,name=pages_scanned,json=pagesScanned" json:"pages_scanned,omitempty"` PagesSkippedParent *uint64 `protobuf:"varint,6,req,name=pages_skipped_parent,json=pagesSkippedParent" json:"pages_skipped_parent,omitempty"` PagesWritten *uint64 `protobuf:"varint,7,req,name=pages_written,json=pagesWritten" json:"pages_written,omitempty"` IrmapResolve *uint32 `protobuf:"varint,8,opt,name=irmap_resolve,json=irmapResolve" json:"irmap_resolve,omitempty"` PagesLazy *uint64 `protobuf:"varint,9,req,name=pages_lazy,json=pagesLazy" json:"pages_lazy,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *DumpStatsEntry) Reset() { *m = DumpStatsEntry{} } func (m *DumpStatsEntry) String() string { return proto.CompactTextString(m) } func (*DumpStatsEntry) ProtoMessage() {} func (*DumpStatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } func (m *DumpStatsEntry) GetFreezingTime() uint32 { if m != nil && m.FreezingTime != nil { return *m.FreezingTime } return 0 } func (m *DumpStatsEntry) GetFrozenTime() uint32 { if m != nil && m.FrozenTime != nil { return *m.FrozenTime } return 0 } func (m *DumpStatsEntry) GetMemdumpTime() uint32 { if m != nil && m.MemdumpTime != nil { return *m.MemdumpTime } return 0 } func (m *DumpStatsEntry) GetMemwriteTime() uint32 { if m != nil && m.MemwriteTime != nil { return *m.MemwriteTime } return 0 } func (m *DumpStatsEntry) GetPagesScanned() uint64 { if m != nil && m.PagesScanned != nil { return *m.PagesScanned } return 0 } func (m *DumpStatsEntry) GetPagesSkippedParent() uint64 { if m != nil && m.PagesSkippedParent != nil { return *m.PagesSkippedParent } return 0 } func (m *DumpStatsEntry) GetPagesWritten() uint64 { if m != nil && m.PagesWritten != nil { return *m.PagesWritten } return 0 } func (m *DumpStatsEntry) GetIrmapResolve() uint32 { if m != nil && m.IrmapResolve != nil { return *m.IrmapResolve } return 0 } func (m *DumpStatsEntry) GetPagesLazy() uint64 { if m != nil && m.PagesLazy != nil { return *m.PagesLazy } return 0 } type RestoreStatsEntry struct { PagesCompared *uint64 `protobuf:"varint,1,req,name=pages_compared,json=pagesCompared" json:"pages_compared,omitempty"` PagesSkippedCow *uint64 `protobuf:"varint,2,req,name=pages_skipped_cow,json=pagesSkippedCow" json:"pages_skipped_cow,omitempty"` ForkingTime *uint32 `protobuf:"varint,3,req,name=forking_time,json=forkingTime" json:"forking_time,omitempty"` RestoreTime *uint32 `protobuf:"varint,4,req,name=restore_time,json=restoreTime" json:"restore_time,omitempty"` PagesRestored *uint64 `protobuf:"varint,5,opt,name=pages_restored,json=pagesRestored" json:"pages_restored,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *RestoreStatsEntry) Reset() { *m = RestoreStatsEntry{} } func (m *RestoreStatsEntry) String() string { return proto.CompactTextString(m) } func (*RestoreStatsEntry) ProtoMessage() {} func (*RestoreStatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } func (m *RestoreStatsEntry) GetPagesCompared() uint64 { if m != nil && m.PagesCompared != nil { return *m.PagesCompared } return 0 } func (m *RestoreStatsEntry) GetPagesSkippedCow() uint64 { if m != nil && m.PagesSkippedCow != nil { return *m.PagesSkippedCow } return 0 } func (m *RestoreStatsEntry) GetForkingTime() uint32 { if m != nil && m.ForkingTime != nil { return *m.ForkingTime } return 0 } func (m *RestoreStatsEntry) GetRestoreTime() uint32 { if m != nil && m.RestoreTime != nil { return *m.RestoreTime } return 0 } func (m *RestoreStatsEntry) GetPagesRestored() uint64 { if m != nil && m.PagesRestored != nil { return *m.PagesRestored } return 0 } type StatsEntry struct { Dump *DumpStatsEntry `protobuf:"bytes,1,opt,name=dump" json:"dump,omitempty"` Restore *RestoreStatsEntry `protobuf:"bytes,2,opt,name=restore" json:"restore,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *StatsEntry) Reset() { *m = StatsEntry{} } func (m *StatsEntry) String() string { return proto.CompactTextString(m) } func (*StatsEntry) ProtoMessage() {} func (*StatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } func (m *StatsEntry) GetDump() *DumpStatsEntry { if m != nil { return m.Dump } return nil } func (m *StatsEntry) GetRestore() *RestoreStatsEntry { if m != nil { return m.Restore } return nil } func init() { proto.RegisterType((*DumpStatsEntry)(nil), "dump_stats_entry") proto.RegisterType((*RestoreStatsEntry)(nil), "restore_stats_entry") proto.RegisterType((*StatsEntry)(nil), "stats_entry") } func init() { proto.RegisterFile("stats.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ // 362 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xc1, 0x4e, 0xe3, 0x30, 0x10, 0x86, 0x95, 0x6c, 0x76, 0xbb, 0x9d, 0xb4, 0x40, 0x43, 0x0f, 0xbe, 0x20, 0x42, 0x2b, 0xa4, 0x8a, 0x43, 0x84, 0x78, 0x85, 0x5e, 0x39, 0x20, 0x83, 0xc4, 0x31, 0x8a, 0x9a, 0x69, 0x15, 0xb5, 0x8e, 0x2d, 0xc7, 0x50, 0x35, 0xef, 0xc9, 0x9d, 0x47, 0x41, 0x1e, 0x3b, 0xa1, 0x45, 0x5c, 0x3f, 0x7f, 0x99, 0xfc, 0xfe, 0xc7, 0x10, 0x37, 0xa6, 0x30, 0x4d, 0xa6, 0xb4, 0x34, 0x72, 0xf6, 0x19, 0xc2, 0x45, 0xf9, 0x26, 0x54, 0x4e, 0x30, 0xc7, 0xda, 0xe8, 0x43, 0x32, 0x87, 0xf1, 0x5a, 0x23, 0xb6, 0x55, 0xbd, 0xc9, 0x4d, 0x25, 0x90, 0x05, 0x69, 0xb8, 0x18, 0xf3, 0x51, 0x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 0xcf, 0xba, 0xad, 0x74, 0x61, 0x8e, 0x1a, 0x8f, 0x3d, 0x23, 0xa5, 0x0f, 0xe6, 0xa1, 0x6d, 0x3c, 0xe8, 0x83, 0x71, 0x0f, 0x67, 0xa5, 0x7f, 0x49, 0xfd, 0x75, 0x22, 0xbb, 0x57, 0x16, 0xa4, 0xc1, 0x22, 0x7e, 0x98, 0x64, 0x3f, 0x5f, 0x15, 0xa7, 0xe3, 0x24, 0x83, 0x81, 0x1f, 0xcb, 0x42, 0x32, 0xa7, 0xd9, 0x2f, 0xe5, 0xf0, 0x4e, 0xfa, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x61, 0xbd, 0xc8, 0x4b, 0xae, 0x02, 0x00, 0x00, } go-criu-3.11/test/000077500000000000000000000000001337501637000137675ustar00rootroot00000000000000go-criu-3.11/test/main.go000066400000000000000000000047711337501637000152530ustar00rootroot00000000000000package main import ( "fmt" "github.com/checkpoint-restore/go-criu" "github.com/checkpoint-restore/go-criu/rpc" "github.com/golang/protobuf/proto" "os" "strconv" ) // TestNfy struct type TestNfy struct { criu.NoNotify } // PreDump test function func (c TestNfy) PreDump() error { fmt.Printf("TEST PRE DUMP\n") return nil } func doDump(c *criu.Criu, pidS string, imgDir string, pre bool, prevImg string) error { fmt.Printf("Dumping\n") pid, _ := strconv.Atoi(pidS) img, err := os.Open(imgDir) if err != nil { return fmt.Errorf("can't open image dir (%s)", err) } defer img.Close() opts := rpc.CriuOpts{ Pid: proto.Int32(int32(pid)), ImagesDirFd: proto.Int32(int32(img.Fd())), LogLevel: proto.Int32(4), LogFile: proto.String("dump.log"), } if prevImg != "" { opts.ParentImg = proto.String(prevImg) opts.TrackMem = proto.Bool(true) } if pre { err = c.PreDump(opts, TestNfy{}) } else { err = c.Dump(opts, TestNfy{}) } if err != nil { return fmt.Errorf("dump fail (%s)", err) } return nil } // Usage: test $act $pid $images_dir func main() { c := criu.MakeCriu() // Read out CRIU version version, err := c.GetCriuVersion() if err != nil { fmt.Println(err) os.Exit(1) } fmt.Println("CRIU version", version) // Check if version at least 3.2 result, err := c.IsCriuAtLeast(30200) if err != nil { fmt.Println(err) os.Exit(1) } if !result { fmt.Println("CRIU too old") os.Exit(1) } act := os.Args[1] switch act { case "dump": err := doDump(c, os.Args[2], os.Args[3], false, "") if err != nil { fmt.Print(err) os.Exit(1) } case "dump2": err := c.Prepare() if err != nil { fmt.Print(err) os.Exit(1) } err = doDump(c, os.Args[2], os.Args[3]+"/pre", true, "") if err != nil { fmt.Printf("pre-dump failed") fmt.Print(err) os.Exit(1) } err = doDump(c, os.Args[2], os.Args[3], false, "./pre") if err != nil { fmt.Printf("dump failed") fmt.Print(err) os.Exit(1) } c.Cleanup() case "restore": fmt.Printf("Restoring\n") img, err := os.Open(os.Args[2]) if err != nil { fmt.Printf("can't open image dir") os.Exit(1) } defer img.Close() opts := rpc.CriuOpts{ ImagesDirFd: proto.Int32(int32(img.Fd())), LogLevel: proto.Int32(4), LogFile: proto.String("restore.log"), } err = c.Restore(opts, nil) if err != nil { fmt.Printf("Error:") fmt.Print(err) fmt.Printf("\n") os.Exit(1) } default: fmt.Printf("unknown action\n") os.Exit(1) } fmt.Printf("Success\n") } go-criu-3.11/test/phaul-main.go000066400000000000000000000073401337501637000163550ustar00rootroot00000000000000package main import ( "fmt" "os" "strconv" "strings" "syscall" "github.com/checkpoint-restore/go-criu" "github.com/checkpoint-restore/go-criu/phaul" "github.com/checkpoint-restore/go-criu/rpc" "github.com/golang/protobuf/proto" ) type testLocal struct { criu.NoNotify r *testRemote } type testRemote struct { srv *phaul.Server } /* Dir where test will put dump images */ const imagesDir = "image" func prepareImages() error { err := os.Mkdir(imagesDir, 0700) if err != nil { return err } /* Work dir for PhaulClient */ err = os.Mkdir(imagesDir+"/local", 0700) if err != nil { return err } /* Work dir for PhaulServer */ err = os.Mkdir(imagesDir+"/remote", 0700) if err != nil { return err } /* Work dir for DumpCopyRestore */ err = os.Mkdir(imagesDir+"/test", 0700) if err != nil { return err } return nil } func mergeImages(dumpDir, lastPreDumpDir string) error { idir, err := os.Open(dumpDir) if err != nil { return err } defer idir.Close() imgs, err := idir.Readdirnames(0) if err != nil { return err } for _, fname := range imgs { if !strings.HasSuffix(fname, ".img") { continue } fmt.Printf("\t%s -> %s/\n", fname, lastPreDumpDir) err = syscall.Link(dumpDir+"/"+fname, lastPreDumpDir+"/"+fname) if err != nil { return err } } return nil } func (r *testRemote) doRestore() error { lastSrvImagesDir := r.srv.LastImagesDir() /* * In imagesDir we have images from dump, in the * lastSrvImagesDir -- where server-side images * (from page server, with pages and pagemaps) are. * Need to put former into latter and restore from * them. */ err := mergeImages(imagesDir+"/test", lastSrvImagesDir) if err != nil { return err } imgDir, err := os.Open(lastSrvImagesDir) if err != nil { return err } defer imgDir.Close() opts := rpc.CriuOpts{ LogLevel: proto.Int32(4), LogFile: proto.String("restore.log"), ImagesDirFd: proto.Int32(int32(imgDir.Fd())), } cr := r.srv.GetCriu() fmt.Printf("Do restore\n") return cr.Restore(opts, nil) } func (l *testLocal) PostDump() error { return l.r.doRestore() } func (l *testLocal) DumpCopyRestore(cr *criu.Criu, cfg phaul.Config, lastClnImagesDir string) error { fmt.Printf("Final stage\n") imgDir, err := os.Open(imagesDir + "/test") if err != nil { return err } defer imgDir.Close() psi := rpc.CriuPageServerInfo{ Fd: proto.Int32(int32(cfg.Memfd)), } opts := rpc.CriuOpts{ Pid: proto.Int32(int32(cfg.Pid)), LogLevel: proto.Int32(4), LogFile: proto.String("dump.log"), ImagesDirFd: proto.Int32(int32(imgDir.Fd())), TrackMem: proto.Bool(true), ParentImg: proto.String(lastClnImagesDir), Ps: &psi, } fmt.Printf("Do dump\n") return cr.Dump(opts, l) } func main() { pid, _ := strconv.Atoi(os.Args[1]) fds, err := syscall.Socketpair(syscall.AF_LOCAL, syscall.SOCK_STREAM, 0) if err != nil { fmt.Printf("Can't make socketpair: %v\n", err) os.Exit(1) } err = prepareImages() if err != nil { fmt.Printf("Can't prepare dirs for images: %v\n", err) os.Exit(1) return } fmt.Printf("Make server part (socket %d)\n", fds[1]) srv, err := phaul.MakePhaulServer(phaul.Config{ Pid: pid, Memfd: fds[1], Wdir: imagesDir + "/remote"}) if err != nil { fmt.Printf("Unable to run a server: %v", err) os.Exit(1) return } r := &testRemote{srv} fmt.Printf("Make client part (socket %d)\n", fds[0]) cln, err := phaul.MakePhaulClient(&testLocal{r: r}, srv, phaul.Config{ Pid: pid, Memfd: fds[0], Wdir: imagesDir + "/local"}) if err != nil { fmt.Printf("Unable to run a client: %v\n", err) os.Exit(1) } fmt.Printf("Migrate\n") err = cln.Migrate() if err != nil { fmt.Printf("Failed: %v\n", err) os.Exit(1) } fmt.Printf("SUCCESS!\n") } go-criu-3.11/test/piggie.c000066400000000000000000000015701337501637000154020ustar00rootroot00000000000000#define _GNU_SOURCE #include #include #include #include #include #include #define STKS (4*4096) #ifndef CLONE_NEWPID #define CLONE_NEWPID 0x20000000 #endif static int do_test(void *logf) { int fd, i = 0; setsid(); close(0); close(1); close(2); fd = open("/dev/null", O_RDONLY); if (fd != 0) { dup2(fd, 0); close(fd); } fd = open(logf, O_WRONLY | O_TRUNC | O_CREAT, 0600); dup2(fd, 1); dup2(fd, 2); if (fd != 1 && fd != 2) close(fd); while (1) { sleep(1); printf("%d\n", i++); fflush(stdout); } return 0; } int main(int argc, char **argv) { int pid; void *stk; stk = mmap(NULL, STKS, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_GROWSDOWN, 0, 0); pid = clone(do_test, stk + STKS, SIGCHLD | CLONE_NEWPID, argv[1]); printf("Child forked, pid %d\n", pid); return 0; }