Skip to content

Commit c4cdab6

Browse files
Use string array instead of map
Signed-off-by: Mauricio Vásquez <[email protected]>
1 parent e0f6871 commit c4cdab6

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

config-linux.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ The following parameters can be specified to set up seccomp:
632632
If sending to this socket fails, the runtime MUST [generate an error](runtime.md#errors).
633633
If the `SCMP_ACT_NOTIFY` action is not used this value is ignored.
634634

635-
The runtime sends the following file descriptors using `SCM_RIGHTS` and set their corresponding indexes in the `fdIndexes` map of the [container process state](#containerprocessstate):
635+
The runtime sends the following file descriptors using `SCM_RIGHTS` and set their names in the `fds` array of the [container process state](#containerprocessstate):
636636

637637
* **`seccompFd`** (int, REQUIRED) is the seccomp file descriptor returned by the seccomp syscall.
638638
* **`pidFd`** (int, OPTIONAL) is the process file descriptor (e.g as returned by `pidfd_open(2)` or by `clone(2)` with the `CLONE_PID` flag).
@@ -713,7 +713,7 @@ If more than one `sendmsg(2)` is used, the file descriptors MUST be sent only in
713713
The container processs state includes the following properties:
714714

715715
* **`ociVersion`** (string, REQUIRED) is version of the Open Container Initiative Runtime Specification with which the container processs state complies.
716-
* **`fdIndexes`** (map, OPTIONAL) are the indexes of the file descriptors in the `SCM_RIGHTS` array.
716+
* **`fds`** (array, OPTIONAL) is a string array containing the names of the file descriptors passed. The index of the name in this array corresponds to index of the file descriptor the `SCM_RIGHTS` array.
717717
* **`pid`** (int, REQUIRED) is the container process ID, as seen by the runtime.
718718
* **`metadata`** (string, OPTIONAL) opaque metadata.
719719
* **`state`** (map, REQUIRED) is the [state](runtime.md#state) of the container.
@@ -723,10 +723,10 @@ Example:
723723
```json
724724
{
725725
"ociVersion": "0.2.0",
726-
"fdIndexes": {
727-
"seccompFd": 0,
728-
"pidFd": 1
729-
},
726+
"fds": [
727+
"seccompFd",
728+
"pidFd"
729+
],
730730
"pid": 4422,
731731
"metadata": "MKNOD=/dev/null,/dev/net/tun;BPF_MAP_TYPES=hash,array",
732732
"state": {

specs-go/state.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,21 @@ type State struct {
3434
Annotations map[string]string `json:"annotations,omitempty"`
3535
}
3636

37-
// FdIndexKey is the key used in the FdIndexes map of the ContainerProcessState struct.
38-
type FdIndexKey string
39-
4037
const (
41-
// SeccompFdIndexKey is the index of the seccomp notify file descriptor.
42-
SeccompFdIndexKey FdIndexKey = "seccompFd"
43-
// PidFdIndexKey is the index of the target process file descriptor.
44-
PidFdIndexKey FdIndexKey = "pidFd"
38+
// SeccompFdName is the name of the seccomp notify file descriptor.
39+
SeccompFdName string = "seccompFd"
40+
// PidFdName is the name of the target process file descriptor.
41+
PidFdName string = "pidFd"
4542
)
4643

4744
// ContainerProcessState holds information about the state of a container process.
4845
type ContainerProcessState struct {
4946
// Version is the version of the specification that is supported.
5047
Version string `json:"ociVersion"`
51-
// FdIndexes is a map containing the indexes of the file descriptors in the `SCM_RIGHTS` array.
52-
FdIndexes map[FdIndexKey]int `json:"fdIndexes"`
48+
// Fds is a string array containing the names of the file descriptors passed.
49+
// The index of the name in this array corresponds to index of the file
50+
// descriptor the `SCM_RIGHTS` array.
51+
Fds []string `json:"fds"`
5352
// Pid is the process ID as seen by the runtime.
5453
Pid int `json:"pid"`
5554
// Opaque metadata.

0 commit comments

Comments
 (0)