diff options
Diffstat (limited to 'vendor/modernc.org/libc/libc_netbsd.go')
-rw-r--r-- | vendor/modernc.org/libc/libc_netbsd.go | 71 |
1 files changed, 13 insertions, 58 deletions
diff --git a/vendor/modernc.org/libc/libc_netbsd.go b/vendor/modernc.org/libc/libc_netbsd.go index aa476e02c..978c5955e 100644 --- a/vendor/modernc.org/libc/libc_netbsd.go +++ b/vendor/modernc.org/libc/libc_netbsd.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" @@ -32,6 +33,7 @@ import ( "modernc.org/libc/termios" "modernc.org/libc/time" "modernc.org/libc/unistd" + "modernc.org/libc/uuid" ) var ( @@ -751,47 +753,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 { @@ -1391,11 +1352,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) @@ -1405,18 +1361,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) @@ -1637,3 +1581,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 +} |