summaryrefslogtreecommitdiff
path: root/vendor/modernc.org/libc/libc_freebsd.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-03-07 11:08:26 +0100
committerLibravatar GitHub <noreply@github.com>2022-03-07 11:08:26 +0100
commit07727753b96d209406783e5e539725bcdafebdc7 (patch)
treeb32f11cbc304d633ed0acd8f84b4c11e909bb5f3 /vendor/modernc.org/libc/libc_freebsd.go
parent[documentation] Creates Docker documentation and docker-compose.yaml (#416) (diff)
downloadgotosocial-07727753b96d209406783e5e539725bcdafebdc7.tar.xz
[feature] Clean up/uncache remote media (#407)
* Add whereNotEmptyAndNotNull * Add GetRemoteOlderThanDays * Add GetRemoteOlderThanDays * Add PruneRemote to Manager interface * Start implementing PruneRemote * add new attachment + status to tests * fix up and test GetRemoteOlderThan * fix bad import * PruneRemote: return number pruned * add Cached column to mediaattachment * update + test pruneRemote * update mediaTest * use Cached column * upstep bun to latest version * embed structs in mediaAttachment * migrate mediaAttachment to new format * don't default cached to true * select only remote media * update db dependencies * step bun back to last working version * update pruneRemote to use Cached field * fix storage path of test attachments * add recache logic to manager * fix trimmed aspect ratio * test prune and recache * return errwithcode * tidy up different paths for emoji vs attachment * fix incorrect thumbnail type being stored * expose TransportController to media processor * implement tee-ing recached content * add thoughts of dog to test fedi attachments * test get remote files * add comment on PruneRemote * add postData cleanup to recache * test thumbnail fetching * add incredible diagram * go mod tidy * buffer pipes for recache streaming * test for client stops reading after 1kb * add media-remote-cache-days to config * add cron package * wrap logrus so it's available to cron * start and stop cron jobs gracefully
Diffstat (limited to 'vendor/modernc.org/libc/libc_freebsd.go')
-rw-r--r--vendor/modernc.org/libc/libc_freebsd.go142
1 files changed, 13 insertions, 129 deletions
diff --git a/vendor/modernc.org/libc/libc_freebsd.go b/vendor/modernc.org/libc/libc_freebsd.go
index 55fe70112..ff6578dd4 100644
--- a/vendor/modernc.org/libc/libc_freebsd.go
+++ b/vendor/modernc.org/libc/libc_freebsd.go
@@ -16,6 +16,7 @@ import (
gotime "time"
"unsafe"
+ guuid "github.com/google/uuid"
"golang.org/x/sys/unix"
"modernc.org/libc/errno"
"modernc.org/libc/fcntl"
@@ -34,17 +35,13 @@ import (
"modernc.org/libc/termios"
"modernc.org/libc/time"
"modernc.org/libc/unistd"
+ "modernc.org/libc/uuid"
)
var (
in6_addr_any in.In6_addr
)
-type (
- long = int64
- ulong = uint64
-)
-
// // Keep these outside of the var block otherwise go generate will miss them.
var X__stderrp = Xstdout
var X__stdinp = Xstdin
@@ -715,71 +712,6 @@ func Xfileno(t *TLS, stream uintptr) int32 {
panic(todo(""))
}
-// int mkstemps(char *template, int suffixlen);
-func Xmkstemps(t *TLS, template uintptr, suffixlen int32) int32 {
- return Xmkstemps64(t, template, suffixlen)
-}
-
-// int mkstemps(char *template, int suffixlen);
-func Xmkstemps64(t *TLS, template uintptr, suffixlen int32) int32 {
- len := uintptr(Xstrlen(t, template))
- x := template + uintptr(len-6) - uintptr(suffixlen)
- for i := uintptr(0); i < 6; i++ {
- if *(*byte)(unsafe.Pointer(x + i)) != 'X' {
- if dmesgs {
- dmesg("%v: FAIL", origin(1))
- }
- t.setErrno(errno.EINVAL)
- return -1
- }
- }
-
- fd, err := tempFile(template, x)
- if err != nil {
- if dmesgs {
- dmesg("%v: %v FAIL", origin(1), err)
- }
- t.setErrno(err)
- return -1
- }
-
- return int32(fd)
-}
-
-// int mkstemp(char *template);
-func Xmkstemp(t *TLS, template uintptr) int32 {
- return Xmkstemp64(t, template)
-}
-
-// int mkstemp(char *template);
-func Xmkstemp64(t *TLS, template uintptr) int32 {
- return Xmkstemps64(t, template, 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: int32(info),
- Ffts_path: csp,
- Ffts_pathlen: uint64(len(path)),
- Ffts_statp: statp,
- Ffts_errno: int32(err),
- }
-}
-
func newCFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Errno) uintptr {
p := Xcalloc(t, 1, types.Size_t(unsafe.Sizeof(fts.FTSENT{})))
if p == 0 {
@@ -1354,11 +1286,6 @@ func Xwritev(t *TLS, fd int32, iov uintptr, iovcnt int32) types.Ssize_t {
panic(todo(""))
}
-// void endpwent(void);
-func Xendpwent(t *TLS) {
- // nop
-}
-
// int __isoc99_sscanf(const char *str, const char *format, ...);
func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
r := Xsscanf(t, str, format, va)
@@ -1368,18 +1295,6 @@ func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
return r
}
-var ctimeStaticBuf [32]byte
-
-// char *ctime(const time_t *timep);
-func Xctime(t *TLS, timep uintptr) uintptr {
- return Xctime_r(t, timep, uintptr(unsafe.Pointer(&ctimeStaticBuf[0])))
-}
-
-// char *ctime_r(const time_t *timep, char *buf);
-func Xctime_r(t *TLS, timep, buf uintptr) uintptr {
- panic(todo(""))
-}
-
// void __assert(const char * func, const char * file, int line, const char *expr) __dead2;
func X__assert(t *TLS, fn, file uintptr, line int32, expr uintptr) {
X__assert_fail(t, expr, file, uint32(line), fn)
@@ -1464,53 +1379,11 @@ func Xclosedir(t *TLS, dir uintptr) int32 {
return r
}
-// 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
-}
-
// int __xuname(int namesize, void *namebuf)
func X__xuname(t *TLS, namesize int32, namebuf uintptr) int32 {
return Xuname(t, namebuf)
}
-// int chflags(const char *path, u_int flags);
-func Xchflags(t *TLS, path uintptr, flags uint64) int32 {
- if err := unix.Chflags(GoString(path), int(flags)); err != nil {
- if dmesgs {
- dmesg("%v: %v FAIL", origin(1), err)
- }
- t.setErrno(err)
- return -1
- }
-
- if dmesgs {
- dmesg("%v: ok", origin(1))
- }
- return 0
-}
-
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
var a [2]int
@@ -1623,3 +1496,14 @@ func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pth
(*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr = (((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & Uint32FromInt32(CplInt32(3))) | uint32(type1))
return 0
}
+
+// int uuid_parse( char *in, uuid_t uu);
+func Xuuid_parse(t *TLS, in uintptr, uu uintptr) int32 {
+ r, err := guuid.Parse(GoString(in))
+ if err != nil {
+ return -1
+ }
+
+ copy((*RawMem)(unsafe.Pointer(uu))[:unsafe.Sizeof(uuid.Uuid_t{})], r[:])
+ return 0
+}