Skip to content

Commit 32f571b

Browse files
Michael Holzheupcmoore
authored andcommitted
golang: add missing defines for PPC / S390 goloang bindings
Signed-off-by: Michael Holzheu <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent 60c9953 commit 32f571b

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

seccomp_internal.go

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,26 @@ const uint32_t C_ARCH_BAD = ARCH_BAD;
5858
#define SCMP_ARCH_MIPSEL64N32 ARCH_BAD
5959
#endif
6060
61+
#ifndef SCMP_ARCH_PPC
62+
#define SCMP_ARCH_PPC ARCH_BAD
63+
#endif
64+
65+
#ifndef SCMP_ARCH_PPC64
66+
#define SCMP_ARCH_PPC64 ARCH_BAD
67+
#endif
68+
69+
#ifndef SCMP_ARCH_PPC64LE
70+
#define SCMP_ARCH_PPC64LE ARCH_BAD
71+
#endif
72+
73+
#ifndef SCMP_ARCH_S390
74+
#define SCMP_ARCH_S390 ARCH_BAD
75+
#endif
76+
77+
#ifndef SCMP_ARCH_S390X
78+
#define SCMP_ARCH_S390X ARCH_BAD
79+
#endif
80+
6181
const uint32_t C_ARCH_NATIVE = SCMP_ARCH_NATIVE;
6282
const uint32_t C_ARCH_X86 = SCMP_ARCH_X86;
6383
const uint32_t C_ARCH_X86_64 = SCMP_ARCH_X86_64;
@@ -70,6 +90,11 @@ const uint32_t C_ARCH_MIPS64N32 = SCMP_ARCH_MIPS64N32;
7090
const uint32_t C_ARCH_MIPSEL = SCMP_ARCH_MIPSEL;
7191
const uint32_t C_ARCH_MIPSEL64 = SCMP_ARCH_MIPSEL64;
7292
const uint32_t C_ARCH_MIPSEL64N32 = SCMP_ARCH_MIPSEL64N32;
93+
const uint32_t C_ARCH_PPC = SCMP_ARCH_PPC;
94+
const uint32_t C_ARCH_PPC64 = SCMP_ARCH_PPC64;
95+
const uint32_t C_ARCH_PPC64LE = SCMP_ARCH_PPC64LE;
96+
const uint32_t C_ARCH_S390 = SCMP_ARCH_S390;
97+
const uint32_t C_ARCH_S390X = SCMP_ARCH_S390X;
7398
7499
const uint32_t C_ACT_KILL = SCMP_ACT_KILL;
75100
const uint32_t C_ACT_TRAP = SCMP_ACT_TRAP;
@@ -140,7 +165,7 @@ const (
140165
scmpError C.int = -1
141166
// Comparison boundaries to check for architecture validity
142167
archStart ScmpArch = ArchNative
143-
archEnd ScmpArch = ArchMIPSEL64N32
168+
archEnd ScmpArch = ArchS390X
144169
// Comparison boundaries to check for action validity
145170
actionStart ScmpAction = ActKill
146171
actionEnd ScmpAction = ActAllow
@@ -349,6 +374,16 @@ func archFromNative(a C.uint32_t) (ScmpArch, error) {
349374
return ArchMIPSEL64, nil
350375
case C.C_ARCH_MIPSEL64N32:
351376
return ArchMIPSEL64N32, nil
377+
case C.C_ARCH_PPC:
378+
return ArchPPC, nil
379+
case C.C_ARCH_PPC64:
380+
return ArchPPC64, nil
381+
case C.C_ARCH_PPC64LE:
382+
return ArchPPC64LE, nil
383+
case C.C_ARCH_S390:
384+
return ArchS390, nil
385+
case C.C_ARCH_S390X:
386+
return ArchS390X, nil
352387
default:
353388
return 0x0, fmt.Errorf("unrecognized architecture")
354389
}
@@ -379,6 +414,16 @@ func (a ScmpArch) toNative() C.uint32_t {
379414
return C.C_ARCH_MIPSEL64
380415
case ArchMIPSEL64N32:
381416
return C.C_ARCH_MIPSEL64N32
417+
case ArchPPC:
418+
return C.C_ARCH_PPC
419+
case ArchPPC64:
420+
return C.C_ARCH_PPC64
421+
case ArchPPC64LE:
422+
return C.C_ARCH_PPC64LE
423+
case ArchS390:
424+
return C.C_ARCH_S390
425+
case ArchS390X:
426+
return C.C_ARCH_S390X
382427
case ArchNative:
383428
return C.C_ARCH_NATIVE
384429
default:

0 commit comments

Comments
 (0)