<commit_before>package seccomp

import (
	"bytes"
	"encoding/binary"
	"fmt"
	"os"
	"syscall"
	"unsafe"
)

// #include "asm-generic/fcntl.h"
import "C"

var whences = map[int16]string{
	int16(os.SEEK_SET): "SEEK_SET",
	int16(os.SEEK_CUR): "SEEK_CUR",
	int16(os.SEEK_END): "SEEK_END",
}

var fcntllock = map[int16]string{
	C.F_RDLCK: "F_RDLCK",
	C.F_WRLCK: "F_WRLCK",
	C.F_UNLCK: "F_UNLCK",
}

var fcntlcmds = map[int32]string{
	C.F_DUPFD:         "F_DUPFD",
	C.F_GETFD:         "F_GETFD",
	C.F_SETFD:         "F_SETFD",
	C.F_GETFL:         "F_GETFL",
	C.F_SETFL:         "F_SETFL",
	C.F_GETLK:         "F_GETLK",
	C.F_SETLK:         "F_SETLK",
	C.F_SETLKW:        "F_SETLKW",
	C.F_SETOWN:        "F_SETOWN",
	C.F_GETOWN:        "F_GETOWN",
	C.F_SETSIG:        "F_SETSIG",
	C.F_GETSIG:        "F_GETSIG",
	C.F_GETLK64:       "F_GETLK64",
	C.F_SETLK64:       "F_SETLK64",
	C.F_SETLKW64:      "F_SETLKW64",
	C.F_SETOWN_EX:     "F_SETOWN_EX",
	C.F_GETOWN_EX:     "F_GETOWN_EX",
	C.F_GETOWNER_UIDS: "F_GETOWNER_UIDS",
}

var openflags = map[int32]string{
	C.O_RDONLY: "O_RDONLY",
	C.O_WRONLY: "O_WRONLY",
	C.O_RDWR:   "O_RDWR",
}

var fcntlflags = map[uint]string{
	C.O_APPEND:   "O_APPEND",
	C.O_SYNC:     "O_ASYNC",
	C.O_DIRECT:   "O_DIRECT",
	C.O_NOATIME:  "O_NOATIME",
	C.O_NONBLOCK: "O_NONBLOCK",
}

var creatflags = map[uint]string{
	C.O_CLOEXEC:   "O_CLOEXEC",
	C.O_CREAT:     "O_CREAT",
	C.O_DIRECTORY: "O_DIRECTORY",
	C.O_EXCL:      "O_EXCL",
	C.O_NOCTTY:    "O_NOCTTY",
	C.O_NOFOLLOW:  "O_NOFOLLOW",
	C.O_TRUNC:     "O_TRUNC",
	//	syscall.O_TTY_INIT:  "O_TTY_INIT",
	C.O_TMPFILE: "O_TMPFILE",
}

func render_openat(pid int, args RegisterArgs) (string, error) {<commit_msg>Add missing Linux fcntl(2) ops to renderer<commit_after>package seccomp

import (
	"bytes"
	"encoding/binary"
	"fmt"
	"os"
	"syscall"
	"unsafe"
)

// #include "linux/fcntl.h"
import "C"

var whences = map[int16]string{
	int16(os.SEEK_SET): "SEEK_SET",
	int16(os.SEEK_CUR): "SEEK_CUR",
	int16(os.SEEK_END): "SEEK_END",
}

var fcntllock = map[int16]string{
	C.F_RDLCK: "F_RDLCK",
	C.F_WRLCK: "F_WRLCK",
	C.F_UNLCK: "F_UNLCK",
}

var fcntlcmds = map[int32]string{
	C.F_DUPFD:         "F_DUPFD",
	C.F_GETFD:         "F_GETFD",
	C.F_SETFD:         "F_SETFD",
	C.F_GETFL:         "F_GETFL",
	C.F_SETFL:         "F_SETFL",
	C.F_GETLK:         "F_GETLK",
	C.F_SETLK:         "F_SETLK",
	C.F_SETLKW:        "F_SETLKW",
	C.F_SETOWN:        "F_SETOWN",
	C.F_GETOWN:        "F_GETOWN",
	C.F_SETSIG:        "F_SETSIG",
	C.F_GETSIG:        "F_GETSIG",
	C.F_GETLK64:       "F_GETLK64",
	C.F_SETLK64:       "F_SETLK64",
	C.F_SETLKW64:      "F_SETLKW64",
	C.F_SETOWN_EX:     "F_SETOWN_EX",
	C.F_GETOWN_EX:     "F_GETOWN_EX",
	C.F_GETOWNER_UIDS: "F_GETOWNER_UIDS",
	C.F_SETLEASE:      "F_SETLEASE",
	C.F_GETLEASE:      "F_GETLEASE",
	C.F_CANCELLK:      "F_CANCELLK",
	C.F_DUPFD_CLOEXEC: "F_DUPFD_CLOEXEC",
	C.F_NOTIFY:        "F_NOTIFY",
	C.F_SETPIPE_SZ:    "F_SETPIPE_SZ",
	C.F_ADD_SEALS:     "F_ADD_SEALS",
	C.F_GET_SEALS:     "F_GET_SEALS",
}

var openflags = map[int32]string{
	C.O_RDONLY: "O_RDONLY",
	C.O_WRONLY: "O_WRONLY",
	C.O_RDWR:   "O_RDWR",
}

var fcntlflags = map[uint]string{
	C.O_APPEND:   "O_APPEND",
	C.O_SYNC:     "O_ASYNC",
	C.O_DIRECT:   "O_DIRECT",
	C.O_NOATIME:  "O_NOATIME",
	C.O_NONBLOCK: "O_NONBLOCK",
}

var creatflags = map[uint]string{
	C.O_CLOEXEC:   "O_CLOEXEC",
	C.O_CREAT:     "O_CREAT",
	C.O_DIRECTORY: "O_DIRECTORY",
	C.O_EXCL:      "O_EXCL",
	C.O_NOCTTY:    "O_NOCTTY",
	C.O_NOFOLLOW:  "O_NOFOLLOW",
	C.O_TRUNC:     "O_TRUNC",
	//	syscall.O_TTY_INIT:  "O_TTY_INIT",
	C.O_TMPFILE: "O_TMPFILE",
}

func render_openat(pid int, args RegisterArgs) (string, error) {
{'fraction_non_alphanumeric': 0.16338259441707717, 'fraction_numerical': 0.014504652435686919, 'mean_word_length': 3.3152302243211333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4707102', 'n_tokens_mistral': 2026, 'n_tokens_neox': 1967, 'n_words': 262}