Hi amd64 and Hackers, Uh, I'm really confused why 1) this error (errno => ENOMEM) would occur when I have more than enough free memory (both on x86 and amd64) and 2) why strerror would segfault in the call to errx in the attached sourcefile on amd64 only. Not initializing len causes the second output sample (errno => 14, which is EFAULT). Any ideas? Please CC me if mailing on amd64@ as I'm not subscribed to the list. Thanks, -Garrett
/* Program */ #include <err.h> #include <errno.h> #include <stdio.h> #include <sys/types.h> #include <sys/sysctl.h> int main() { int mib[4]; size_t len; if (sysctlnametomib("kern.ipc.shmmax", mib, &len) != 0) { printf("Errno: %d\n", errno); errx(errno, "Error: %s", strerror(errno)); } printf("%lu\n", len); return 0; } # output for len preset to 0: [gcoo...@optimus ~]$ ./test2 Errno: 12 test2: Segmentation fault: 11 (core dumped) [gcoo...@optimus ~]$ uname -a FreeBSD optimus.gateway.2wire.net 8.0-CURRENT FreeBSD 8.0-CURRENT #4: Sun Jan 11 12:30:31 PST 2009 r...@optimus.gateway.2wire.net:/usr/obj/usr/src/sys/OPTIMUS amd64 [gcoo...@orangebox /usr/home/gcooper]$ ./test Errno: 12 test: Error: Cannot allocate memory [gcoo...@orangebox /usr/home/gcooper]$ uname -a FreeBSD orangebox.gateway.2wire.net 8.0-CURRENT FreeBSD 8.0-CURRENT #4: Sat Jan 3 22:54:52 PST 2009 gcoo...@orangebox.gateway.2wire.net:/usr/obj/usr/src/sys/ORANGEBOX i386 # output for len not preset to 0: [gcoo...@optimus ~]$ ./test2 Errno: 14 test2: Segmentation fault: 11 (core dumped) _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"