diff options
Diffstat (limited to 'vendor/modernc.org/libc/libc_windows_386.go')
| -rw-r--r-- | vendor/modernc.org/libc/libc_windows_386.go | 163 |
1 files changed, 146 insertions, 17 deletions
diff --git a/vendor/modernc.org/libc/libc_windows_386.go b/vendor/modernc.org/libc/libc_windows_386.go index d48e6f65c..5865b0ac6 100644 --- a/vendor/modernc.org/libc/libc_windows_386.go +++ b/vendor/modernc.org/libc/libc_windows_386.go @@ -17,6 +17,9 @@ import ( // int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 { + if __ccgo_strace { + trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2)) + } panic(todo("")) // // musl/arch/x32/ksigaction.h // // @@ -62,6 +65,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 { // int fcntl(int fd, int cmd, ... /* arg */ ); func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 { + if __ccgo_strace { + trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2)) + } panic(todo("")) // var arg uintptr // if args != 0 { @@ -84,6 +90,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 { // int lstat(const char *pathname, struct stat *statbuf); func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 { + if __ccgo_strace { + trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_LSTAT64, pathname, statbuf, 0); err != 0 { // if dmesgs { @@ -101,6 +110,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 { // int stat(const char *pathname, struct stat *statbuf); func Xstat64(t *TLS, pathname, statbuf uintptr) int32 { + if __ccgo_strace { + trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_STAT64, pathname, statbuf, 0); err != 0 { // if dmesgs { @@ -118,6 +130,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 { // int fstat(int fd, struct stat *statbuf); func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 { + if __ccgo_strace { + trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_FSTAT64, uintptr(fd), statbuf, 0); err != 0 { // if dmesgs { @@ -135,6 +150,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 { // void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */); func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr { + if __ccgo_strace { + trc("t=%v old_address=%v new_size=%v flags=%v args=%v, (%v:)", t, old_address, new_size, flags, args, origin(2)) + } panic(todo("")) // var arg uintptr // if args != 0 { @@ -156,11 +174,17 @@ func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags } func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr { + if __ccgo_strace { + trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2)) + } return Xmmap64(t, addr, length, prot, flags, fd, offset) } // void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset); func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr { + if __ccgo_strace { + trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2)) + } panic(todo("")) // data, _, err := unix.Syscall6(unix.SYS_MMAP2, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset>>12)) // if err != 0 { @@ -179,6 +203,9 @@ func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, o // int ftruncate(int fd, off_t length); func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 { + if __ccgo_strace { + trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE64, uintptr(fd), uintptr(length), uintptr(length>>32)); err != 0 { // if dmesgs { @@ -196,6 +223,9 @@ func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 { // off64_t lseek64(int fd, off64_t offset, int whence); func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t { + if __ccgo_strace { + trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2)) + } panic(todo("")) // bp := t.Alloc(int(unsafe.Sizeof(types.X__loff_t(0)))) // defer t.Free(int(unsafe.Sizeof(types.X__loff_t(0)))) @@ -215,6 +245,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t { // int utime(const char *filename, const struct utimbuf *times); func Xutime(t *TLS, filename, times uintptr) int32 { + if __ccgo_strace { + trc("t=%v times=%v, (%v:)", t, times, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_UTIME, filename, times, 0); err != 0 { // t.setErrno(err) @@ -226,6 +259,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 { // unsigned int alarm(unsigned int seconds); func Xalarm(t *TLS, seconds uint32) uint32 { + if __ccgo_strace { + trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2)) + } panic(todo("")) // n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0) // if err != 0 { @@ -237,6 +273,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 { // int getrlimit(int resource, struct rlimit *rlim); func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { + if __ccgo_strace { + trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 { // t.setErrno(err) @@ -248,6 +287,9 @@ func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { // time_t time(time_t *tloc); func Xtime(t *TLS, tloc uintptr) types.Time_t { + if __ccgo_strace { + trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2)) + } panic(todo("")) // n, _, err := unix.Syscall(unix.SYS_TIME, tloc, 0, 0) // if err != 0 { @@ -263,6 +305,9 @@ func Xtime(t *TLS, tloc uintptr) types.Time_t { // int mkdir(const char *path, mode_t mode); func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 { + if __ccgo_strace { + trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_MKDIR, path, uintptr(mode), 0); err != 0 { // t.setErrno(err) @@ -277,6 +322,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 { // int symlink(const char *target, const char *linkpath); func Xsymlink(t *TLS, target, linkpath uintptr) int32 { + if __ccgo_strace { + trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_SYMLINK, target, linkpath, 0); err != 0 { // t.setErrno(err) @@ -291,6 +339,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 { // int utimes(const char *filename, const struct timeval times[2]); func Xutimes(t *TLS, filename, times uintptr) int32 { + if __ccgo_strace { + trc("t=%v times=%v, (%v:)", t, times, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_UTIMES, filename, times, 0); err != 0 { // t.setErrno(err) @@ -305,6 +356,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 { // int unlink(const char *pathname); func Xunlink(t *TLS, pathname uintptr) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2)) + } err := syscall.DeleteFile((*uint16)(unsafe.Pointer(pathname))) if err != nil { t.setErrno(err) @@ -319,25 +373,11 @@ func Xunlink(t *TLS, pathname uintptr) int32 { } -// int access(const char *pathname, int mode); -func Xaccess(t *TLS, pathname uintptr, mode int32) int32 { - panic(todo("")) - // if _, _, err := unix.Syscall(unix.SYS_ACCESS, pathname, uintptr(mode), 0); err != 0 { - // if dmesgs { - // dmesg("%v: %q: %v", origin(1), GoString(pathname), err) - // } - // t.setErrno(err) - // return -1 - // } - // - // if dmesgs { - // dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode) - // } - // return 0 -} - // int rmdir(const char *pathname); func Xrmdir(t *TLS, pathname uintptr) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_RMDIR, pathname, 0, 0); err != 0 { // t.setErrno(err) @@ -352,6 +392,9 @@ func Xrmdir(t *TLS, pathname uintptr) int32 { // int mknod(const char *pathname, mode_t mode, dev_t dev); func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 { // t.setErrno(err) @@ -374,6 +417,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 // int link(const char *oldpath, const char *newpath); func Xlink(t *TLS, oldpath, newpath uintptr) int32 { + if __ccgo_strace { + trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 { // t.setErrno(err) @@ -385,6 +431,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 { // int pipe(int pipefd[2]); func Xpipe(t *TLS, pipefd uintptr) int32 { + if __ccgo_strace { + trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_PIPE, pipefd, 0, 0); err != 0 { // t.setErrno(err) @@ -396,6 +445,9 @@ func Xpipe(t *TLS, pipefd uintptr) int32 { // int dup2(int oldfd, int newfd); func Xdup2(t *TLS, oldfd, newfd int32) int32 { + if __ccgo_strace { + trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2)) + } panic(todo("")) // n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) // if err != 0 { @@ -408,6 +460,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 { // ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize); func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t { + if __ccgo_strace { + trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2)) + } panic(todo("")) // n, _, err := unix.Syscall(unix.SYS_READLINK, path, buf, uintptr(bufsize)) // if err != 0 { @@ -420,6 +475,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t { // FILE *fopen64(const char *pathname, const char *mode); func Xfopen64(t *TLS, pathname, mode uintptr) uintptr { + if __ccgo_strace { + trc("t=%v mode=%v, (%v:)", t, mode, origin(2)) + } m := strings.ReplaceAll(GoString(mode), "b", "") var flags int @@ -456,14 +514,23 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr { } func Xrecv(t *TLS, sockfd uint32, buf uintptr, len, flags int32) int32 { + if __ccgo_strace { + trc("t=%v sockfd=%v buf=%v flags=%v, (%v:)", t, sockfd, buf, flags, origin(2)) + } panic(todo("")) } func Xsend(t *TLS, sockfd uint32, buf uintptr, len, flags int32) int32 { + if __ccgo_strace { + trc("t=%v sockfd=%v buf=%v flags=%v, (%v:)", t, sockfd, buf, flags, origin(2)) + } panic(todo("")) } func Xshutdown(t *TLS, sockfd uint32, how int32) int32 { + if __ccgo_strace { + trc("t=%v sockfd=%v how=%v, (%v:)", t, sockfd, how, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_SHUTDOWN, uintptr(sockfd), uintptr(how), 0); err != 0 { // t.setErrno(err) @@ -474,40 +541,67 @@ func Xshutdown(t *TLS, sockfd uint32, how int32) int32 { } func Xgetpeername(t *TLS, sockfd uint32, addr uintptr, addrlen uintptr) int32 { + if __ccgo_strace { + trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2)) + } panic(todo("")) } func Xgetsockname(t *TLS, sockfd uint32, addr, addrlen uintptr) int32 { + if __ccgo_strace { + trc("t=%v sockfd=%v addrlen=%v, (%v:)", t, sockfd, addrlen, origin(2)) + } panic(todo("")) } func Xsocket(t *TLS, domain, type1, protocol int32) uint32 { + if __ccgo_strace { + trc("t=%v protocol=%v, (%v:)", t, protocol, origin(2)) + } panic(todo("")) } func Xbind(t *TLS, sockfd uint32, addr uintptr, addrlen int32) int32 { + if __ccgo_strace { + trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2)) + } panic(todo("")) } func Xconnect(t *TLS, sockfd uint32, addr uintptr, addrlen int32) int32 { + if __ccgo_strace { + trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2)) + } panic(todo("")) } func Xlisten(t *TLS, sockfd uint32, backlog int32) int32 { + if __ccgo_strace { + trc("t=%v sockfd=%v backlog=%v, (%v:)", t, sockfd, backlog, origin(2)) + } panic(todo("")) } func Xaccept(t *TLS, sockfd uint32, addr uintptr, addrlen uintptr) uint32 { + if __ccgo_strace { + trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2)) + } panic(todo("")) } // struct tm *_localtime32( const __time32_t *sourceTime ); func X_localtime32(t *TLS, sourceTime uintptr) uintptr { + if __ccgo_strace { + trc("t=%v sourceTime=%v, (%v:)", t, sourceTime, origin(2)) + } panic(todo("")) } // struct tm *_gmtime32( const __time32_t *sourceTime ); func X_gmtime32(t *TLS, sourceTime uintptr) uintptr { + if __ccgo_strace { + trc("t=%v sourceTime=%v, (%v:)", t, sourceTime, origin(2)) + } panic(todo("")) } @@ -519,6 +613,9 @@ func X_gmtime32(t *TLS, sourceTime uintptr) uintptr { // // ); func XSetWindowLongW(t *TLS, hwnd uintptr, nIndex int32, dwNewLong long) long { + if __ccgo_strace { + trc("t=%v hwnd=%v nIndex=%v dwNewLong=%v, (%v:)", t, hwnd, nIndex, dwNewLong, origin(2)) + } panic(todo("")) } @@ -529,6 +626,9 @@ func XSetWindowLongW(t *TLS, hwnd uintptr, nIndex int32, dwNewLong long) long { // // ); func XGetWindowLongW(t *TLS, hwnd uintptr, nIndex int32) long { + if __ccgo_strace { + trc("t=%v hwnd=%v nIndex=%v, (%v:)", t, hwnd, nIndex, origin(2)) + } panic(todo("")) } @@ -555,6 +655,9 @@ func XSendMessageTimeoutW(t *TLS, _ ...interface{}) int32 { // // ); func X_fstat(t *TLS, fd int32, buffer uintptr) int32 { + if __ccgo_strace { + trc("t=%v fd=%v buffer=%v, (%v:)", t, fd, buffer, origin(2)) + } f, ok := fdToFile(fd) if !ok { t.setErrno(EBADF) @@ -581,3 +684,29 @@ func X_fstat(t *TLS, fd int32, buffer uintptr) int32 { return 0 } + +func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */ + if __ccgo_strace { + trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2)) + } + bp := tls.Alloc(32) + defer tls.Free(32) + + var a uintptr = s + *(*[8]size_t)(unsafe.Pointer(bp /* byteset */)) = [8]size_t{0: size_t(0)} + + if !(int32(*(*int8)(unsafe.Pointer(c))) != 0) { + return size_t(0) + } + if !(int32(*(*int8)(unsafe.Pointer(c + 1))) != 0) { + for ; int32(*(*int8)(unsafe.Pointer(s))) == int32(*(*int8)(unsafe.Pointer(c))); s++ { + } + return size_t((int32(s) - int32(a)) / 1) + } + + for ; *(*int8)(unsafe.Pointer(c)) != 0 && AssignOrPtrUint32(bp+uintptr(size_t(*(*uint8)(unsafe.Pointer(c)))/(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))*4, size_t(size_t(1))<<(size_t(*(*uint8)(unsafe.Pointer(c)))%(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))) != 0; c++ { + } + for ; *(*int8)(unsafe.Pointer(s)) != 0 && *(*size_t)(unsafe.Pointer(bp + uintptr(size_t(*(*uint8)(unsafe.Pointer(s)))/(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))*4))&(size_t(size_t(1))<<(size_t(*(*uint8)(unsafe.Pointer(s)))%(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))) != 0; s++ { + } + return size_t((int32(s) - int32(a)) / 1) +} |
