summaryrefslogtreecommitdiffstats
path: root/vendor/modernc.org/libc/libc_unix.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2023-08-05 20:43:19 +0200
committerGitHub <noreply@github.com>2023-08-05 20:43:19 +0200
commit56e7bd01ca09ad52b0c4f48f146a20a4f1b78696 (patch)
treeb1355645342667209263cbd355dc0b4254f1e8fe /vendor/modernc.org/libc/libc_unix.go
parent9459495484d6e06a3d46de64fccd8d06f7ccc72c (diff)
downloadmatterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.tar.gz
matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.tar.bz2
matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.zip
Update dependencies and remove old matterclient lib (#2067)HEADmaster
Diffstat (limited to 'vendor/modernc.org/libc/libc_unix.go')
-rw-r--r--vendor/modernc.org/libc/libc_unix.go32
1 files changed, 30 insertions, 2 deletions
diff --git a/vendor/modernc.org/libc/libc_unix.go b/vendor/modernc.org/libc/libc_unix.go
index eb31f1d3..085c86b3 100644
--- a/vendor/modernc.org/libc/libc_unix.go
+++ b/vendor/modernc.org/libc/libc_unix.go
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build linux || darwin || freebsd || netbsd || openbsd
-// +build linux darwin freebsd netbsd openbsd
+//go:build unix
+// +build unix
package libc // import "modernc.org/libc"
import (
"bufio"
+ "encoding/hex"
"io/ioutil"
"math"
"math/rand"
@@ -992,3 +993,30 @@ func Xctime_r(t *TLS, timep, buf uintptr) uintptr {
copy((*RawMem)(unsafe.Pointer(buf))[:26:26], s)
return buf
}
+
+// ssize_t pread(int fd, void *buf, size_t count, off_t offset);
+func Xpread(t *TLS, fd int32, buf uintptr, count types.Size_t, offset types.Off_t) types.Ssize_t {
+ var n int
+ var err error
+ switch {
+ case count == 0:
+ n, err = unix.Pread(int(fd), nil, int64(offset))
+ default:
+ n, err = unix.Pread(int(fd), (*RawMem)(unsafe.Pointer(buf))[:count:count], int64(offset))
+ if dmesgs && err == nil {
+ dmesg("%v: fd %v, off %#x, count %#x, n %#x\n%s", origin(1), fd, offset, count, n, hex.Dump((*RawMem)(unsafe.Pointer(buf))[:n:n]))
+ }
+ }
+ if err != nil {
+ if dmesgs {
+ dmesg("%v: %v FAIL", origin(1), err)
+ }
+ t.setErrno(err)
+ return -1
+ }
+
+ if dmesgs {
+ dmesg("%v: ok", origin(1))
+ }
+ return types.Ssize_t(n)
+}