Commit a65bf95d authored by Russ Cox's avatar Russ Cox

syscall: use correct pointer in recvfrom/sendto.

linux/386 stack trace: use 32-bit hex.

Fixes #159.

R=r
https://golang.org/cl/154178
parent 152bfa03
...@@ -10,19 +10,19 @@ ...@@ -10,19 +10,19 @@
void void
dumpregs(Sigcontext *r) dumpregs(Sigcontext *r)
{ {
printf("eax %X\n", r->eax); printf("eax %x\n", r->eax);
printf("ebx %X\n", r->ebx); printf("ebx %x\n", r->ebx);
printf("ecx %X\n", r->ecx); printf("ecx %x\n", r->ecx);
printf("edx %X\n", r->edx); printf("edx %x\n", r->edx);
printf("edi %X\n", r->edi); printf("edi %x\n", r->edi);
printf("esi %X\n", r->esi); printf("esi %x\n", r->esi);
printf("ebp %X\n", r->ebp); printf("ebp %x\n", r->ebp);
printf("esp %X\n", r->esp); printf("esp %x\n", r->esp);
printf("eip %X\n", r->eip); printf("eip %x\n", r->eip);
printf("eflags %X\n", r->eflags); printf("eflags %x\n", r->eflags);
printf("cs %X\n", r->cs); printf("cs %x\n", r->cs);
printf("fs %X\n", r->fs); printf("fs %x\n", r->fs);
printf("gs %X\n", r->gs); printf("gs %x\n", r->gs);
} }
/* /*
......
...@@ -125,7 +125,7 @@ func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) ...@@ -125,7 +125,7 @@ func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int)
func recvfrom(s int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int) { func recvfrom(s int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int) {
var base uintptr; var base uintptr;
if len(p) > 0 { if len(p) > 0 {
base = uintptr(unsafe.Pointer(&p)) base = uintptr(unsafe.Pointer(&p[0]))
} }
n, errno = socketcall(_RECVFROM, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))); n, errno = socketcall(_RECVFROM, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)));
return; return;
...@@ -134,7 +134,7 @@ func recvfrom(s int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockle ...@@ -134,7 +134,7 @@ func recvfrom(s int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockle
func sendto(s int, p []byte, flags int, to uintptr, addrlen _Socklen) (errno int) { func sendto(s int, p []byte, flags int, to uintptr, addrlen _Socklen) (errno int) {
var base uintptr; var base uintptr;
if len(p) > 0 { if len(p) > 0 {
base = uintptr(unsafe.Pointer(&p)) base = uintptr(unsafe.Pointer(&p[0]))
} }
_, errno = socketcall(_SENDTO, uintptr(s), base, uintptr(len(p)), uintptr(flags), to, uintptr(addrlen)); _, errno = socketcall(_SENDTO, uintptr(s), base, uintptr(len(p)), uintptr(flags), to, uintptr(addrlen));
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment