Line 1: |
Line 1: |
| CRIU-RPC is a remote procedure call (RPC) protocol which uses Google Protocol Buffers to encode its calls. The requests are served by CRIU service launched with <code>criu service</code> command. It uses a SEQPACKET Unix domain socket listening at <code>/var/run/criu-service.socket</code> as a transport. | | CRIU-RPC is a remote procedure call (RPC) protocol which uses Google Protocol Buffers to encode its calls. The requests are served by CRIU service launched with <code>criu service</code> command. It uses a SEQPACKET Unix domain socket listening at <code>/var/run/criu-service.socket</code> as a transport. |
| | | |
− | == Protobuf messages ==
| + | The criu_req/criu_resp are two main messages for requests/responses. They are to be used for transferring messages and needed to provide compatibility with an older versions of rpc. Field type in them ''must'' be set accordingly to type of request/response that is stored. Types of request/response are defined in enum criu_req_type. See the [[api compiance]] page for information what each option might mean. |
− | criu_req/criu_resp -- wrappers for requests/responses. They are to be used for transferring messages and needed to provide compatibility with an older versions of rpc. Field type in them ''must'' be set accordingly to type of request/response that is stored. Types of request/response are defined in enum criu_req_type. See the [[api compiance]] page for information what each option might mean. | + | |
| + | == Request == |
| | | |
− | === Request ===
| |
− | ==== criu_req ====
| |
| This is the header of the request. It defines the operation requested and options. | | This is the header of the request. It defines the operation requested and options. |
| | | |
Line 15: |
Line 14: |
| </pre> | | </pre> |
| | | |
− | ==== criu_req_type ====
| + | There are 8 request/response types for now. |
− | There are 8 request/response types for now. Comments show cmdline analogs. | |
| | | |
| <pre>enum criu_req_type { | | <pre>enum criu_req_type { |
Line 29: |
Line 27: |
| } | | } |
| </pre> | | </pre> |
− |
| |
− | ==== criu_opts ====
| |
− | It is used to store options.
| |
| | | |
| <pre>message criu_opts { | | <pre>message criu_opts { |
Line 71: |
Line 66: |
| </pre> | | </pre> |
| | | |
− | Comments to options. | + | === Comments and examples === |
| | | |
| * If no pid is set and type is DUMP, CRIU will dump client process by default. | | * If no pid is set and type is DUMP, CRIU will dump client process by default. |
Line 88: |
Line 83: |
| </pre> | | </pre> |
| | | |
− | ===== criu_page_server_info ===== | + | === Sub-messages for options === |
− | Stores info about page-server.
| + | ; Info about page-server. |
| + | |
| <pre> | | <pre> |
| message criu_page_server_info { | | message criu_page_server_info { |
Line 98: |
Line 94: |
| } | | } |
| </pre> | | </pre> |
− | ===== criu_veth_pair =====
| + | |
− | --veth-pair analog. | + | * If ''port'' is 0 server will auto-bind and the port will be returned back in responce. |
| + | |
| <pre> | | <pre> |
| message criu_veth_pair { | | message criu_veth_pair { |
Line 106: |
Line 103: |
| }; | | }; |
| </pre> | | </pre> |
− | ===== ext_mount_map =====
| + | |
− | --ext-mount-map analog. | + | ; Info about veth mappings (--ext-mount-map analogue) |
| <pre> | | <pre> |
| message ext_mount_map { | | message ext_mount_map { |
Line 114: |
Line 111: |
| }; | | }; |
| </pre> | | </pre> |
− | ===== cgroup_root =====
| + | |
− | --cgroup-root analog. | + | ; Specifying where cgroup root should be (--cgroup-root analogue) |
| <pre> | | <pre> |
| message cgroup_root { | | message cgroup_root { |
Line 122: |
Line 119: |
| }; | | }; |
| </pre> | | </pre> |
− | === Response ===
| + | |
− | ==== criu_resp ====
| + | == Response == |
− | <pre>message criu_resp { | + | |
| + | This message is sent after (un)successful execution of the request. |
| + | |
| + | <pre> |
| + | message criu_resp { |
| required criu_req_type type = 1; | | required criu_req_type type = 1; |
| required bool success = 2; | | required bool success = 2; |
Line 135: |
Line 136: |
| </pre> | | </pre> |
| Field "success" reports result of processing request, while criu_***_resp store some request-specific information. The response type is set to the corresponding request type or to <code>EMPTY</code> to report a "generic" error. | | Field "success" reports result of processing request, while criu_***_resp store some request-specific information. The response type is set to the corresponding request type or to <code>EMPTY</code> to report a "generic" error. |
− | ==== criu_dump_resp ====
| + | |
− | criu_dump_resp is used to store dump response from CRIU. | + | ;The criu_dump_resp is used to store response from DUMP request. |
| + | |
| <pre> | | <pre> |
| message criu_dump_resp { | | message criu_dump_resp { |
Line 143: |
Line 145: |
| </pre> | | </pre> |
| | | |
− | Field "restored" is set to "true" if process was restored.
| + | This message can be sent twice -- one for the process that calls DUMP and the other for the same process again if it requested a self-dump. In the latter case the ''restored'' field would be true. |
| + | |
| + | |
| + | ;The response on RESTORE request. |
| | | |
− | ==== criu_restore_resp ====
| |
| <pre> | | <pre> |
| message criu_restore_resp { | | message criu_restore_resp { |
Line 151: |
Line 155: |
| } | | } |
| </pre> | | </pre> |
− | Field "pid" is set to the PID of the restored process. | + | Field "pid" is set to the PID of the newly restored process. |
| + | |
| + | == Notifications == |
| | | |
− | ==== criu_notify ====
| |
| --action-script analog. | | --action-script analog. |
| <pre> | | <pre> |
Line 213: |
Line 218: |
| | | |
| There's a [[C_API|library]] that implements simple wrappers on top of RPC. | | There's a [[C_API|library]] that implements simple wrappers on top of RPC. |
− |
| |
− | == Security ==
| |
− |
| |
− | See [[Security]].
| |