github.com/DataDog/datadog-agent/pkg/security/secl@v0.55.0-devel.0.20240517055856-10c4965fea94/model/consts_linux.go (about)

     1  // Unless explicitly stated otherwise all files in this repository are licensed
     2  // under the Apache License Version 2.0.
     3  // This product includes software developed at Datadog (https://www.datadoghq.com/).
     4  // Copyright 2016-present Datadog, Inc.
     5  
     6  // Package model holds model related files
     7  package model
     8  
     9  import (
    10  	"syscall"
    11  
    12  	"golang.org/x/sys/unix"
    13  )
    14  
    15  var (
    16  	// errorConstants are the supported error constants
    17  	// generate_constants:Error constants,Error constants are the supported error constants.
    18  	errorConstants = map[string]int{
    19  		"E2BIG":           -int(syscall.E2BIG),
    20  		"EACCES":          -int(syscall.EACCES),
    21  		"EADDRINUSE":      -int(syscall.EADDRINUSE),
    22  		"EADDRNOTAVAIL":   -int(syscall.EADDRNOTAVAIL),
    23  		"EADV":            -int(syscall.EADV),
    24  		"EAFNOSUPPORT":    -int(syscall.EAFNOSUPPORT),
    25  		"EAGAIN":          -int(syscall.EAGAIN),
    26  		"EALREADY":        -int(syscall.EALREADY),
    27  		"EBADE":           -int(syscall.EBADE),
    28  		"EBADF":           -int(syscall.EBADF),
    29  		"EBADFD":          -int(syscall.EBADFD),
    30  		"EBADMSG":         -int(syscall.EBADMSG),
    31  		"EBADR":           -int(syscall.EBADR),
    32  		"EBADRQC":         -int(syscall.EBADRQC),
    33  		"EBADSLT":         -int(syscall.EBADSLT),
    34  		"EBFONT":          -int(syscall.EBFONT),
    35  		"EBUSY":           -int(syscall.EBUSY),
    36  		"ECANCELED":       -int(syscall.ECANCELED),
    37  		"ECHILD":          -int(syscall.ECHILD),
    38  		"ECHRNG":          -int(syscall.ECHRNG),
    39  		"ECOMM":           -int(syscall.ECOMM),
    40  		"ECONNABORTED":    -int(syscall.ECONNABORTED),
    41  		"ECONNREFUSED":    -int(syscall.ECONNREFUSED),
    42  		"ECONNRESET":      -int(syscall.ECONNRESET),
    43  		"EDEADLK":         -int(syscall.EDEADLK),
    44  		"EDEADLOCK":       -int(syscall.EDEADLOCK),
    45  		"EDESTADDRREQ":    -int(syscall.EDESTADDRREQ),
    46  		"EDOM":            -int(syscall.EDOM),
    47  		"EDOTDOT":         -int(syscall.EDOTDOT),
    48  		"EDQUOT":          -int(syscall.EDQUOT),
    49  		"EEXIST":          -int(syscall.EEXIST),
    50  		"EFAULT":          -int(syscall.EFAULT),
    51  		"EFBIG":           -int(syscall.EFBIG),
    52  		"EHOSTDOWN":       -int(syscall.EHOSTDOWN),
    53  		"EHOSTUNREACH":    -int(syscall.EHOSTUNREACH),
    54  		"EIDRM":           -int(syscall.EIDRM),
    55  		"EILSEQ":          -int(syscall.EIDRM),
    56  		"EINPROGRESS":     -int(syscall.EINPROGRESS),
    57  		"EINTR":           -int(syscall.EINTR),
    58  		"EINVAL":          -int(syscall.EINVAL),
    59  		"EIO":             -int(syscall.EIO),
    60  		"EISCONN":         -int(syscall.EISCONN),
    61  		"EISDIR":          -int(syscall.EISDIR),
    62  		"EISNAM":          -int(syscall.EISNAM),
    63  		"EKEYEXPIRED":     -int(syscall.EKEYEXPIRED),
    64  		"EKEYREJECTED":    -int(syscall.EKEYREJECTED),
    65  		"EKEYREVOKED":     -int(syscall.EKEYREVOKED),
    66  		"EL2HLT":          -int(syscall.EL2HLT),
    67  		"EL2NSYNC":        -int(syscall.EL2NSYNC),
    68  		"EL3HLT":          -int(syscall.EL3HLT),
    69  		"EL3RST":          -int(syscall.EL3RST),
    70  		"ELIBACC":         -int(syscall.ELIBACC),
    71  		"ELIBBAD":         -int(syscall.ELIBBAD),
    72  		"ELIBEXEC":        -int(syscall.ELIBEXEC),
    73  		"ELIBMAX":         -int(syscall.ELIBMAX),
    74  		"ELIBSCN":         -int(syscall.ELIBSCN),
    75  		"ELNRNG":          -int(syscall.ELNRNG),
    76  		"ELOOP":           -int(syscall.ELOOP),
    77  		"EMEDIUMTYPE":     -int(syscall.EMEDIUMTYPE),
    78  		"EMFILE":          -int(syscall.EMFILE),
    79  		"EMLINK":          -int(syscall.EMLINK),
    80  		"EMSGSIZE":        -int(syscall.EMSGSIZE),
    81  		"EMULTIHOP":       -int(syscall.EMULTIHOP),
    82  		"ENAMETOOLONG":    -int(syscall.ENAMETOOLONG),
    83  		"ENAVAIL":         -int(syscall.ENAVAIL),
    84  		"ENETDOWN":        -int(syscall.ENETDOWN),
    85  		"ENETRESET":       -int(syscall.ENETRESET),
    86  		"ENETUNREACH":     -int(syscall.ENETUNREACH),
    87  		"ENFILE":          -int(syscall.ENFILE),
    88  		"ENOANO":          -int(syscall.ENOANO),
    89  		"ENOBUFS":         -int(syscall.ENOBUFS),
    90  		"ENOCSI":          -int(syscall.ENOCSI),
    91  		"ENODATA":         -int(syscall.ENODATA),
    92  		"ENODEV":          -int(syscall.ENODEV),
    93  		"ENOENT":          -int(syscall.ENOENT),
    94  		"ENOEXEC":         -int(syscall.ENOEXEC),
    95  		"ENOKEY":          -int(syscall.ENOKEY),
    96  		"ENOLCK":          -int(syscall.ENOLCK),
    97  		"ENOLINK":         -int(syscall.ENOLINK),
    98  		"ENOMEDIUM":       -int(syscall.ENOMEDIUM),
    99  		"ENOMEM":          -int(syscall.ENOMEM),
   100  		"ENOMSG":          -int(syscall.ENOMSG),
   101  		"ENONET":          -int(syscall.ENONET),
   102  		"ENOPKG":          -int(syscall.ENOPKG),
   103  		"ENOPROTOOPT":     -int(syscall.ENOPROTOOPT),
   104  		"ENOSPC":          -int(syscall.ENOSPC),
   105  		"ENOSR":           -int(syscall.ENOSR),
   106  		"ENOSTR":          -int(syscall.ENOSTR),
   107  		"ENOSYS":          -int(syscall.ENOSYS),
   108  		"ENOTBLK":         -int(syscall.ENOTBLK),
   109  		"ENOTCONN":        -int(syscall.ENOTCONN),
   110  		"ENOTDIR":         -int(syscall.ENOTDIR),
   111  		"ENOTEMPTY":       -int(syscall.ENOTEMPTY),
   112  		"ENOTNAM":         -int(syscall.ENOTNAM),
   113  		"ENOTRECOVERABLE": -int(syscall.ENOTRECOVERABLE),
   114  		"ENOTSOCK":        -int(syscall.ENOTSOCK),
   115  		"ENOTSUP":         -int(syscall.ENOTSUP),
   116  		"ENOTTY":          -int(syscall.ENOTTY),
   117  		"ENOTUNIQ":        -int(syscall.ENOTUNIQ),
   118  		"ENXIO":           -int(syscall.ENXIO),
   119  		"EOPNOTSUPP":      -int(syscall.EOPNOTSUPP),
   120  		"EOVERFLOW":       -int(syscall.EOVERFLOW),
   121  		"EOWNERDEAD":      -int(syscall.EOWNERDEAD),
   122  		"EPERM":           -int(syscall.EPERM),
   123  		"EPFNOSUPPORT":    -int(syscall.EPFNOSUPPORT),
   124  		"EPIPE":           -int(syscall.EPIPE),
   125  		"EPROTO":          -int(syscall.EPROTO),
   126  		"EPROTONOSUPPORT": -int(syscall.EPROTONOSUPPORT),
   127  		"EPROTOTYPE":      -int(syscall.EPROTOTYPE),
   128  		"ERANGE":          -int(syscall.ERANGE),
   129  		"EREMCHG":         -int(syscall.EREMCHG),
   130  		"EREMOTE":         -int(syscall.EREMOTE),
   131  		"EREMOTEIO":       -int(syscall.EREMOTEIO),
   132  		"ERESTART":        -int(syscall.ERESTART),
   133  		"ERFKILL":         -int(syscall.ERFKILL),
   134  		"EROFS":           -int(syscall.EROFS),
   135  		"ESHUTDOWN":       -int(syscall.ESHUTDOWN),
   136  		"ESOCKTNOSUPPORT": -int(syscall.ESOCKTNOSUPPORT),
   137  		"ESPIPE":          -int(syscall.ESPIPE),
   138  		"ESRCH":           -int(syscall.ESRCH),
   139  		"ESRMNT":          -int(syscall.ESRMNT),
   140  		"ESTALE":          -int(syscall.ESTALE),
   141  		"ESTRPIPE":        -int(syscall.ESTRPIPE),
   142  		"ETIME":           -int(syscall.ETIME),
   143  		"ETIMEDOUT":       -int(syscall.ETIMEDOUT),
   144  		"ETOOMANYREFS":    -int(syscall.ETOOMANYREFS),
   145  		"ETXTBSY":         -int(syscall.ETXTBSY),
   146  		"EUCLEAN":         -int(syscall.EUCLEAN),
   147  		"EUNATCH":         -int(syscall.EUNATCH),
   148  		"EUSERS":          -int(syscall.EUSERS),
   149  		"EWOULDBLOCK":     -int(syscall.EWOULDBLOCK),
   150  		"EXDEV":           -int(syscall.EXDEV),
   151  		"EXFULL":          -int(syscall.EXFULL),
   152  	}
   153  
   154  	// openFlagsConstants are the supported flags for the open syscall
   155  	// generate_constants:Open flags,Open flags are the supported flags for the open syscall.
   156  	openFlagsConstants = map[string]int{
   157  		"O_RDONLY":    syscall.O_RDONLY,
   158  		"O_WRONLY":    syscall.O_WRONLY,
   159  		"O_RDWR":      syscall.O_RDWR,
   160  		"O_APPEND":    syscall.O_APPEND,
   161  		"O_CREAT":     syscall.O_CREAT,
   162  		"O_EXCL":      syscall.O_EXCL,
   163  		"O_SYNC":      syscall.O_SYNC,
   164  		"O_TRUNC":     syscall.O_TRUNC,
   165  		"O_ACCMODE":   syscall.O_ACCMODE,
   166  		"O_ASYNC":     syscall.O_ASYNC,
   167  		"O_CLOEXEC":   syscall.O_CLOEXEC,
   168  		"O_DIRECT":    syscall.O_DIRECT,
   169  		"O_DIRECTORY": syscall.O_DIRECTORY,
   170  		"O_DSYNC":     syscall.O_DSYNC,
   171  		"O_FSYNC":     syscall.O_FSYNC,
   172  		// "O_LARGEFILE": syscall.O_LARGEFILE, golang defines this as 0
   173  		"O_NDELAY":   syscall.O_NDELAY,
   174  		"O_NOATIME":  syscall.O_NOATIME,
   175  		"O_NOCTTY":   syscall.O_NOCTTY,
   176  		"O_NOFOLLOW": syscall.O_NOFOLLOW,
   177  		"O_NONBLOCK": syscall.O_NONBLOCK,
   178  		"O_RSYNC":    syscall.O_RSYNC,
   179  	}
   180  
   181  	// fileModeConstants contains the constants describing file permissions as well as the set-user-ID, set-group-ID, and sticky bits.
   182  	// generate_constants:File mode constants,File mode constants are the supported file permissions as well as constants for the set-user-ID, set-group-ID, and sticky bits.
   183  	fileModeConstants = map[string]int{
   184  		// "S_IREAD":  syscall.S_IREAD, deprecated
   185  		"S_ISUID": syscall.S_ISUID,
   186  		"S_ISGID": syscall.S_ISGID,
   187  		"S_ISVTX": syscall.S_ISVTX,
   188  		"S_IRWXU": syscall.S_IRWXU,
   189  		"S_IRUSR": syscall.S_IRUSR,
   190  		"S_IWUSR": syscall.S_IWUSR,
   191  		"S_IXUSR": syscall.S_IXUSR,
   192  		"S_IRWXG": syscall.S_IRWXG,
   193  		"S_IRGRP": syscall.S_IRGRP,
   194  		"S_IWGRP": syscall.S_IWGRP,
   195  		"S_IXGRP": syscall.S_IXGRP,
   196  		"S_IRWXO": syscall.S_IRWXO,
   197  		"S_IROTH": syscall.S_IROTH,
   198  		"S_IWOTH": syscall.S_IWOTH,
   199  		"S_IXOTH": syscall.S_IXOTH,
   200  		// "S_IWRITE": syscall.S_IWRITE, deprecated
   201  	}
   202  
   203  	// inodeModeConstants are the supported file types and file modes
   204  	// generate_constants:Inode mode constants,Inode mode constants are the supported file type constants as well as the file mode constants.
   205  	inodeModeConstants = map[string]int{
   206  		// "S_IEXEC":  syscall.S_IEXEC, deprecated
   207  		"S_IFMT":   syscall.S_IFMT,
   208  		"S_IFSOCK": syscall.S_IFSOCK,
   209  		"S_IFLNK":  syscall.S_IFLNK,
   210  		"S_IFREG":  syscall.S_IFREG,
   211  		"S_IFBLK":  syscall.S_IFBLK,
   212  		"S_IFDIR":  syscall.S_IFDIR,
   213  		"S_IFCHR":  syscall.S_IFCHR,
   214  		"S_IFIFO":  syscall.S_IFIFO,
   215  		"S_ISUID":  syscall.S_ISUID,
   216  		"S_ISGID":  syscall.S_ISGID,
   217  		"S_ISVTX":  syscall.S_ISVTX,
   218  		"S_IRWXU":  syscall.S_IRWXU,
   219  		"S_IRUSR":  syscall.S_IRUSR,
   220  		"S_IWUSR":  syscall.S_IWUSR,
   221  		"S_IXUSR":  syscall.S_IXUSR,
   222  		"S_IRWXG":  syscall.S_IRWXG,
   223  		"S_IRGRP":  syscall.S_IRGRP,
   224  		"S_IWGRP":  syscall.S_IWGRP,
   225  		"S_IXGRP":  syscall.S_IXGRP,
   226  		"S_IRWXO":  syscall.S_IRWXO,
   227  		"S_IROTH":  syscall.S_IROTH,
   228  		"S_IWOTH":  syscall.S_IWOTH,
   229  		"S_IXOTH":  syscall.S_IXOTH,
   230  	}
   231  
   232  	// KernelCapabilityConstants list of kernel capabilities
   233  	// generate_constants:Kernel Capability constants,Kernel Capability constants are the supported Linux Kernel Capability.
   234  	KernelCapabilityConstants = map[string]uint64{
   235  		"CAP_AUDIT_CONTROL":      1 << unix.CAP_AUDIT_CONTROL,
   236  		"CAP_AUDIT_READ":         1 << unix.CAP_AUDIT_READ,
   237  		"CAP_AUDIT_WRITE":        1 << unix.CAP_AUDIT_WRITE,
   238  		"CAP_BLOCK_SUSPEND":      1 << unix.CAP_BLOCK_SUSPEND,
   239  		"CAP_BPF":                1 << unix.CAP_BPF,
   240  		"CAP_CHECKPOINT_RESTORE": 1 << unix.CAP_CHECKPOINT_RESTORE,
   241  		"CAP_CHOWN":              1 << unix.CAP_CHOWN,
   242  		"CAP_DAC_OVERRIDE":       1 << unix.CAP_DAC_OVERRIDE,
   243  		"CAP_DAC_READ_SEARCH":    1 << unix.CAP_DAC_READ_SEARCH,
   244  		"CAP_FOWNER":             1 << unix.CAP_FOWNER,
   245  		"CAP_FSETID":             1 << unix.CAP_FSETID,
   246  		"CAP_IPC_LOCK":           1 << unix.CAP_IPC_LOCK,
   247  		"CAP_IPC_OWNER":          1 << unix.CAP_IPC_OWNER,
   248  		"CAP_KILL":               1 << unix.CAP_KILL,
   249  		"CAP_LEASE":              1 << unix.CAP_LEASE,
   250  		"CAP_LINUX_IMMUTABLE":    1 << unix.CAP_LINUX_IMMUTABLE,
   251  		"CAP_MAC_ADMIN":          1 << unix.CAP_MAC_ADMIN,
   252  		"CAP_MAC_OVERRIDE":       1 << unix.CAP_MAC_OVERRIDE,
   253  		"CAP_MKNOD":              1 << unix.CAP_MKNOD,
   254  		"CAP_NET_ADMIN":          1 << unix.CAP_NET_ADMIN,
   255  		"CAP_NET_BIND_SERVICE":   1 << unix.CAP_NET_BIND_SERVICE,
   256  		"CAP_NET_BROADCAST":      1 << unix.CAP_NET_BROADCAST,
   257  		"CAP_NET_RAW":            1 << unix.CAP_NET_RAW,
   258  		"CAP_PERFMON":            1 << unix.CAP_PERFMON,
   259  		"CAP_SETFCAP":            1 << unix.CAP_SETFCAP,
   260  		"CAP_SETGID":             1 << unix.CAP_SETGID,
   261  		"CAP_SETPCAP":            1 << unix.CAP_SETPCAP,
   262  		"CAP_SETUID":             1 << unix.CAP_SETUID,
   263  		"CAP_SYSLOG":             1 << unix.CAP_SYSLOG,
   264  		"CAP_SYS_ADMIN":          1 << unix.CAP_SYS_ADMIN,
   265  		"CAP_SYS_BOOT":           1 << unix.CAP_SYS_BOOT,
   266  		"CAP_SYS_CHROOT":         1 << unix.CAP_SYS_CHROOT,
   267  		"CAP_SYS_MODULE":         1 << unix.CAP_SYS_MODULE,
   268  		"CAP_SYS_NICE":           1 << unix.CAP_SYS_NICE,
   269  		"CAP_SYS_PACCT":          1 << unix.CAP_SYS_PACCT,
   270  		"CAP_SYS_PTRACE":         1 << unix.CAP_SYS_PTRACE,
   271  		"CAP_SYS_RAWIO":          1 << unix.CAP_SYS_RAWIO,
   272  		"CAP_SYS_RESOURCE":       1 << unix.CAP_SYS_RESOURCE,
   273  		"CAP_SYS_TIME":           1 << unix.CAP_SYS_TIME,
   274  		"CAP_SYS_TTY_CONFIG":     1 << unix.CAP_SYS_TTY_CONFIG,
   275  		"CAP_WAKE_ALARM":         1 << unix.CAP_WAKE_ALARM,
   276  	}
   277  
   278  	// ptraceConstants are the supported ptrace commands for the ptrace syscall
   279  	// generate_constants:Ptrace constants,Ptrace constants are the supported ptrace commands for the ptrace syscall.
   280  	ptraceConstants = map[string]uint32{
   281  		"PTRACE_TRACEME":    unix.PTRACE_TRACEME,
   282  		"PTRACE_PEEKTEXT":   unix.PTRACE_PEEKTEXT,
   283  		"PTRACE_PEEKDATA":   unix.PTRACE_PEEKDATA,
   284  		"PTRACE_PEEKUSR":    unix.PTRACE_PEEKUSR,
   285  		"PTRACE_POKETEXT":   unix.PTRACE_POKETEXT,
   286  		"PTRACE_POKEDATA":   unix.PTRACE_POKEDATA,
   287  		"PTRACE_POKEUSR":    unix.PTRACE_POKEUSR,
   288  		"PTRACE_CONT":       unix.PTRACE_CONT,
   289  		"PTRACE_KILL":       unix.PTRACE_KILL,
   290  		"PTRACE_SINGLESTEP": unix.PTRACE_SINGLESTEP,
   291  		"PTRACE_ATTACH":     unix.PTRACE_ATTACH,
   292  		"PTRACE_DETACH":     unix.PTRACE_DETACH,
   293  		"PTRACE_SYSCALL":    unix.PTRACE_SYSCALL,
   294  
   295  		"PTRACE_SETOPTIONS":           unix.PTRACE_SETOPTIONS,
   296  		"PTRACE_GETEVENTMSG":          unix.PTRACE_GETEVENTMSG,
   297  		"PTRACE_GETSIGINFO":           unix.PTRACE_GETSIGINFO,
   298  		"PTRACE_SETSIGINFO":           unix.PTRACE_SETSIGINFO,
   299  		"PTRACE_GETREGSET":            unix.PTRACE_GETREGSET,
   300  		"PTRACE_SETREGSET":            unix.PTRACE_SETREGSET,
   301  		"PTRACE_SEIZE":                unix.PTRACE_SEIZE,
   302  		"PTRACE_INTERRUPT":            unix.PTRACE_INTERRUPT,
   303  		"PTRACE_LISTEN":               unix.PTRACE_LISTEN,
   304  		"PTRACE_PEEKSIGINFO":          unix.PTRACE_PEEKSIGINFO,
   305  		"PTRACE_GETSIGMASK":           unix.PTRACE_GETSIGMASK,
   306  		"PTRACE_SETSIGMASK":           unix.PTRACE_SETSIGMASK,
   307  		"PTRACE_SECCOMP_GET_FILTER":   unix.PTRACE_SECCOMP_GET_FILTER,
   308  		"PTRACE_SECCOMP_GET_METADATA": unix.PTRACE_SECCOMP_GET_METADATA,
   309  		"PTRACE_GET_SYSCALL_INFO":     unix.PTRACE_GET_SYSCALL_INFO,
   310  	}
   311  
   312  	// protConstants are the supported protections for the mmap syscall
   313  	// generate_constants:Protection constants,Protection constants are the supported protections for the mmap syscall.
   314  	protConstants = map[string]uint64{
   315  		"PROT_NONE":      unix.PROT_NONE,
   316  		"PROT_READ":      unix.PROT_READ,
   317  		"PROT_WRITE":     unix.PROT_WRITE,
   318  		"PROT_EXEC":      unix.PROT_EXEC,
   319  		"PROT_GROWSDOWN": unix.PROT_GROWSDOWN,
   320  		"PROT_GROWSUP":   unix.PROT_GROWSUP,
   321  	}
   322  
   323  	// mmapFlagConstants are the supported flags for the mmap syscall
   324  	// generate_constants:MMap flags,MMap flags are the supported flags for the mmap syscall.
   325  	mmapFlagConstants = map[string]uint64{
   326  		"MAP_SHARED":          unix.MAP_SHARED,          /* Share changes */
   327  		"MAP_PRIVATE":         unix.MAP_PRIVATE,         /* Changes are private */
   328  		"MAP_SHARED_VALIDATE": unix.MAP_SHARED_VALIDATE, /* share + validate extension flags */
   329  		"MAP_ANON":            unix.MAP_ANON,
   330  		"MAP_ANONYMOUS":       unix.MAP_ANONYMOUS,       /* don't use a file */
   331  		"MAP_DENYWRITE":       unix.MAP_DENYWRITE,       /* ETXTBSY */
   332  		"MAP_EXECUTABLE":      unix.MAP_EXECUTABLE,      /* mark it as an executable */
   333  		"MAP_FIXED":           unix.MAP_FIXED,           /* Interpret addr exactly */
   334  		"MAP_FIXED_NOREPLACE": unix.MAP_FIXED_NOREPLACE, /* MAP_FIXED which doesn't unmap underlying mapping */
   335  		"MAP_GROWSDOWN":       unix.MAP_GROWSDOWN,       /* stack-like segment */
   336  		"MAP_HUGETLB":         unix.MAP_HUGETLB,         /* create a huge page mapping */
   337  		"MAP_LOCKED":          unix.MAP_LOCKED,          /* pages are locked */
   338  		"MAP_NONBLOCK":        unix.MAP_NONBLOCK,        /* do not block on IO */
   339  		"MAP_NORESERVE":       unix.MAP_NORESERVE,       /* don't check for reservations */
   340  		"MAP_POPULATE":        unix.MAP_POPULATE,        /* populate (prefault) pagetables */
   341  		"MAP_STACK":           unix.MAP_STACK,           /* give out an address that is best suited for process/thread stacks */
   342  		"MAP_SYNC":            unix.MAP_SYNC,            /* perform synchronous page faults for the mapping */
   343  		"MAP_UNINITIALIZED":   0x4000000,                /* For anonymous mmap, memory could be uninitialized */
   344  		"MAP_HUGE_16KB":       14 << unix.MAP_HUGE_SHIFT,
   345  		"MAP_HUGE_64KB":       16 << unix.MAP_HUGE_SHIFT,
   346  		"MAP_HUGE_512KB":      19 << unix.MAP_HUGE_SHIFT,
   347  		"MAP_HUGE_1MB":        20 << unix.MAP_HUGE_SHIFT,
   348  		"MAP_HUGE_2MB":        21 << unix.MAP_HUGE_SHIFT,
   349  		"MAP_HUGE_8MB":        23 << unix.MAP_HUGE_SHIFT,
   350  		"MAP_HUGE_16MB":       24 << unix.MAP_HUGE_SHIFT,
   351  		"MAP_HUGE_32MB":       25 << unix.MAP_HUGE_SHIFT,
   352  		"MAP_HUGE_256MB":      28 << unix.MAP_HUGE_SHIFT,
   353  		"MAP_HUGE_512MB":      29 << unix.MAP_HUGE_SHIFT,
   354  		"MAP_HUGE_1GB":        30 << unix.MAP_HUGE_SHIFT,
   355  		"MAP_HUGE_2GB":        31 << unix.MAP_HUGE_SHIFT,
   356  		"MAP_HUGE_16GB":       34 << unix.MAP_HUGE_SHIFT,
   357  	}
   358  
   359  	// SignalConstants are the supported signals for the kill syscall
   360  	// generate_constants:Signal constants,Signal constants are the supported signals for the kill syscall.
   361  	SignalConstants = map[string]int{
   362  		"SIGHUP":    int(unix.SIGHUP),
   363  		"SIGINT":    int(unix.SIGINT),
   364  		"SIGQUIT":   int(unix.SIGQUIT),
   365  		"SIGILL":    int(unix.SIGILL),
   366  		"SIGTRAP":   int(unix.SIGTRAP),
   367  		"SIGABRT":   int(unix.SIGABRT),
   368  		"SIGIOT":    int(unix.SIGIOT),
   369  		"SIGBUS":    int(unix.SIGBUS),
   370  		"SIGFPE":    int(unix.SIGFPE),
   371  		"SIGKILL":   int(unix.SIGKILL),
   372  		"SIGUSR1":   int(unix.SIGUSR1),
   373  		"SIGSEGV":   int(unix.SIGSEGV),
   374  		"SIGUSR2":   int(unix.SIGUSR2),
   375  		"SIGPIPE":   int(unix.SIGPIPE),
   376  		"SIGALRM":   int(unix.SIGALRM),
   377  		"SIGTERM":   int(unix.SIGTERM),
   378  		"SIGSTKFLT": int(unix.SIGSTKFLT),
   379  		"SIGCHLD":   int(unix.SIGCHLD),
   380  		"SIGCONT":   int(unix.SIGCONT),
   381  		"SIGSTOP":   int(unix.SIGSTOP),
   382  		"SIGTSTP":   int(unix.SIGTSTP),
   383  		"SIGTTIN":   int(unix.SIGTTIN),
   384  		"SIGTTOU":   int(unix.SIGTTOU),
   385  		"SIGURG":    int(unix.SIGURG),
   386  		"SIGXCPU":   int(unix.SIGXCPU),
   387  		"SIGXFSZ":   int(unix.SIGXFSZ),
   388  		"SIGVTALRM": int(unix.SIGVTALRM),
   389  		"SIGPROF":   int(unix.SIGPROF),
   390  		"SIGWINCH":  int(unix.SIGWINCH),
   391  		"SIGIO":     int(unix.SIGIO),
   392  		"SIGPOLL":   int(unix.SIGPOLL),
   393  		"SIGPWR":    int(unix.SIGPWR),
   394  		"SIGSYS":    int(unix.SIGSYS),
   395  	}
   396  
   397  	// unlinkFlagsConstants are the supported unlink flags for the unlink syscall
   398  	// generate_constants:Unlink flags,Unlink flags are the supported flags for the unlink syscall.
   399  	unlinkFlagsConstants = map[string]int{
   400  		"AT_REMOVEDIR": unix.AT_REMOVEDIR,
   401  	}
   402  
   403  	// addressFamilyConstants are the supported network address families
   404  	// generate_constants:Network Address Family constants,Network Address Family constants are the supported network address families.
   405  	addressFamilyConstants = map[string]uint16{
   406  		"AF_UNSPEC":     unix.AF_UNSPEC,
   407  		"AF_LOCAL":      unix.AF_LOCAL,
   408  		"AF_UNIX":       unix.AF_UNIX,
   409  		"AF_FILE":       unix.AF_FILE,
   410  		"AF_INET":       unix.AF_INET,
   411  		"AF_AX25":       unix.AF_AX25,
   412  		"AF_IPX":        unix.AF_IPX,
   413  		"AF_APPLETALK":  unix.AF_APPLETALK,
   414  		"AF_NETROM":     unix.AF_NETROM,
   415  		"AF_BRIDGE":     unix.AF_BRIDGE,
   416  		"AF_ATMPVC":     unix.AF_ATMPVC,
   417  		"AF_X25":        unix.AF_X25,
   418  		"AF_INET6":      unix.AF_INET6,
   419  		"AF_ROSE":       unix.AF_ROSE,
   420  		"AF_DECnet":     unix.AF_DECnet,
   421  		"AF_NETBEUI":    unix.AF_NETBEUI,
   422  		"AF_SECURITY":   unix.AF_SECURITY,
   423  		"AF_KEY":        unix.AF_KEY,
   424  		"AF_NETLINK":    unix.AF_NETLINK,
   425  		"AF_ROUTE":      unix.AF_ROUTE,
   426  		"AF_PACKET":     unix.AF_PACKET,
   427  		"AF_ASH":        unix.AF_ASH,
   428  		"AF_ECONET":     unix.AF_ECONET,
   429  		"AF_ATMSVC":     unix.AF_ATMSVC,
   430  		"AF_RDS":        unix.AF_RDS,
   431  		"AF_SNA":        unix.AF_SNA,
   432  		"AF_IRDA":       unix.AF_IRDA,
   433  		"AF_PPPOX":      unix.AF_PPPOX,
   434  		"AF_WANPIPE":    unix.AF_WANPIPE,
   435  		"AF_LLC":        unix.AF_LLC,
   436  		"AF_IB":         unix.AF_IB,
   437  		"AF_MPLS":       unix.AF_MPLS,
   438  		"AF_CAN":        unix.AF_CAN,
   439  		"AF_TIPC":       unix.AF_TIPC,
   440  		"AF_BLUETOOTH":  unix.AF_BLUETOOTH,
   441  		"AF_IUCV":       unix.AF_IUCV,
   442  		"AF_RXRPC":      unix.AF_RXRPC,
   443  		"AF_ISDN":       unix.AF_ISDN,
   444  		"AF_PHONET":     unix.AF_PHONET,
   445  		"AF_IEEE802154": unix.AF_IEEE802154,
   446  		"AF_CAIF":       unix.AF_CAIF,
   447  		"AF_ALG":        unix.AF_ALG,
   448  		"AF_NFC":        unix.AF_NFC,
   449  		"AF_VSOCK":      unix.AF_VSOCK,
   450  		"AF_KCM":        unix.AF_KCM,
   451  		"AF_QIPCRTR":    unix.AF_QIPCRTR,
   452  		"AF_SMC":        unix.AF_SMC,
   453  		"AF_XDP":        unix.AF_XDP,
   454  		"AF_MAX":        unix.AF_MAX,
   455  	}
   456  )