diff options
| author | 2022-11-28 11:19:39 +0100 | |
|---|---|---|
| committer | 2022-11-28 11:19:39 +0100 | |
| commit | daf44ac2b709922512cfee3cde686b84b4868775 (patch) | |
| tree | 2967df466f8d4515d32c05cf520ba3e7a19d4fae /vendor/modernc.org/libc/libc_openbsd_amd64.go | |
| parent | [chore]: Bump codeberg.org/gruf/go-store/v2 from 2.0.9 to 2.0.10 (#1160) (diff) | |
| download | gotosocial-daf44ac2b709922512cfee3cde686b84b4868775.tar.xz | |
[chore] Bump database dependencies (#1164)
github.com/uptrace/bun v1.1.8 -> v1.1.9
github.com/uptrace/bun/pgdialect v1.1.8 -> v1.1.9
github.com/uptrace/bun/sqlitedialect v1.1.8 -> v1.1.9
modernc.org/sqlite v1.18.2 -> v1.19.5
Diffstat (limited to 'vendor/modernc.org/libc/libc_openbsd_amd64.go')
| -rw-r--r-- | vendor/modernc.org/libc/libc_openbsd_amd64.go | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/vendor/modernc.org/libc/libc_openbsd_amd64.go b/vendor/modernc.org/libc/libc_openbsd_amd64.go index 94432aef2..8843f989b 100644 --- a/vendor/modernc.org/libc/libc_openbsd_amd64.go +++ b/vendor/modernc.org/libc/libc_openbsd_amd64.go @@ -6,15 +6,22 @@ package libc // import "modernc.org/libc" import ( "strings" + "syscall" "unsafe" "golang.org/x/sys/unix" "modernc.org/libc/fcntl" + "modernc.org/libc/fts" "modernc.org/libc/sys/types" "modernc.org/libc/time" "modernc.org/libc/utime" ) +type ( + long = int64 + ulong = uint64 +) + // int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 { panic(todo("")) @@ -574,3 +581,53 @@ func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { return 0 } + +func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Errno) (r *fts.FTSENT) { + var statp uintptr + if stat != nil { + statp = Xmalloc(t, types.Size_t(unsafe.Sizeof(unix.Stat_t{}))) + if statp == 0 { + panic("OOM") + } + + *(*unix.Stat_t)(unsafe.Pointer(statp)) = *stat + } + csp, errx := CString(path) + if errx != nil { + panic("OOM") + } + + return &fts.FTSENT{ + Ffts_info: uint16(info), + Ffts_path: csp, + Ffts_pathlen: uint64(len(path)), + Ffts_statp: statp, + Ffts_errno: int32(err), + } +} + +// DIR *opendir(const char *name); +func Xopendir(t *TLS, name uintptr) uintptr { + p := Xmalloc(t, uint64(unsafe.Sizeof(darwinDir{}))) + if p == 0 { + panic("OOM") + } + + fd := int(Xopen(t, name, fcntl.O_RDONLY|fcntl.O_DIRECTORY|fcntl.O_CLOEXEC, 0)) + if fd < 0 { + if dmesgs { + dmesg("%v: FAIL %v", origin(1), (*darwinDir)(unsafe.Pointer(p)).fd) + } + Xfree(t, p) + return 0 + } + + if dmesgs { + dmesg("%v: ok", origin(1)) + } + (*darwinDir)(unsafe.Pointer(p)).fd = fd + (*darwinDir)(unsafe.Pointer(p)).h = 0 + (*darwinDir)(unsafe.Pointer(p)).l = 0 + (*darwinDir)(unsafe.Pointer(p)).eof = false + return p +} |
