2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00
criu/images/sk-unix.proto

58 lines
1.5 KiB
Protocol Buffer
Raw Normal View History

// SPDX-License-Identifier: MIT
syntax = "proto2";
import "opts.proto";
import "fown.proto";
import "sk-opts.proto";
message file_perms_entry {
required uint32 mode = 1;
required uint32 uid = 2;
required uint32 gid = 3;
}
message unix_sk_entry {
/*
* Few words about why we need both -- id and ino.
*
* The former one is used to link file descriptor from
* fdinfo image with the unix_sk_entry that should be
* opened under it.
*
* The latter one ties together unix peers -- the peer
* member on this structure is the ino one of its peer
* and simetimes vise-versa.
*/
required uint32 id = 1;
required uint32 ino = 2;
required uint32 type = 3 [(criu).dict = "sk"];
required uint32 state = 4 [(criu).dict = "sk"];
required uint32 flags = 5 [(criu).hex = true];
required uint32 uflags = 6 [(criu).hex = true];
required uint32 backlog = 7;
required uint32 peer = 8;
required fown_entry fown = 9;
required sk_opts_entry opts = 10;
/*
* Abstract name may contain \0 at any point,
* so we need to carry it as byte sequence...
*/
required bytes name = 11 [(criu).conv = "unix_name"];
optional sk_shutdown shutdown = 12;
optional file_perms_entry file_perms = 13;
sk-unix: Add trivial name resolver for sockets with relative names Unix sockets may be created with non-absolute (relative) path (when kernel creates one it always use AT_FDCWD for name resolving), So when we collect sockets we see them as having names without leading slash. In common cases for such sockets application doesn't change own working directory after that but this is not always the true. So we need to invent some name resolver. The good candidate is IRMAP cache but after a number of testings I found that it might slow down performance very dramatically. Thus we need some more intelligent way here. For a while, for common applications such as postfix, fetching dumpee working directory and root is enough. So here what we do - when socket get collected from diag interface we remember its relative name parameters (device and inode) but postprone name resolving to not bring perf penalty until really needed - when we meet a socket to dump with relative name assigned we try to use $cwd/name and $root/name for this socket to check if it has been created in those directories. On success we simply remember the directory in image and when restore such socket call for chdir helper to change working dir and generate relative name v2: - Use new unlink_stale to remove sockets we're to restore - Use *at() helpers once we're changed working dir in bind_unix_sk - Add more debug ouput Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-07-28 17:02:36 +03:00
/*
* Relative socket name may have prefix.
*/
optional string name_dir = 14;
optional bool deleted = 15;
optional uint32 ns_id = 16;
optional sint32 mnt_id = 17 [default = -1];
/* Please, don't use field with number 18. */
}