Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl(3) setting `odd' errno's

2009-01-17 Thread Mikko Työläjärvi
Hi Garrett, On Fri, 16 Jan 2009, Garrett Cooper wrote: On Fri, Jan 16, 2009 at 12:58 AM, Garrett Cooper wrote: On Fri, Jan 16, 2009 at 12:57 AM, Christoph Mallon wrote: Garrett Cooper schrieb: Good point. I modified the source to do that. Thanks, -Garrett You should reply to all so the

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl(3) setting `odd' errno's

2009-01-17 Thread Dag-Erling Smørgrav
Garrett Cooper writes: > #include > #include > #include > #include > #include You should always put your sys includes before your non-sys includes, and in any case, should always come first. > printf("Errno: %d\n", errno); > errx(errno, "Error: %s", strerror

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's

2009-01-16 Thread Stefan Farfeleder
On Fri, Jan 16, 2009 at 10:33:15AM -0800, Nate Eldredge wrote: > Pop quiz: which of the following statements is correct? > > #include > #include > > execl("/bin/sh", "/bin/sh", 0); > execl("/bin/sh", "/bin/sh", NULL); None, as NULL is allowed to expand to 0. You have to write execl("/bin/sh"

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's

2009-01-16 Thread Nate Eldredge
On Fri, 16 Jan 2009, Garrett Cooper wrote: On Fri, Jan 16, 2009 at 2:52 AM, Thierry Herbelot wrote: Le Friday 16 January 2009, Garrett Cooper a écrit : On Fri, Jan 16, 2009 at 2:21 AM, Christoph Mallon #include #include #include int main() { struct stat sb; int o_errno;

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's

2009-01-16 Thread Garrett Cooper
On Fri, Jan 16, 2009 at 2:52 AM, Thierry Herbelot wrote: > Le Friday 16 January 2009, Garrett Cooper a écrit : >> On Fri, Jan 16, 2009 at 2:21 AM, Christoph Mallon >> >> #include >> #include >> #include >> >> int >> main() >> { >> >> struct stat sb; >> >> int o_errno; >> >>

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's

2009-01-16 Thread Thierry Herbelot
Le Friday 16 January 2009, Garrett Cooper a écrit : > On Fri, Jan 16, 2009 at 2:21 AM, Christoph Mallon > > #include > #include > #include > > int > main() > { > > struct stat sb; > > int o_errno; > > if (stat("/some/file/that/doesn't/exist", &sb) != 0) { >

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's

2009-01-16 Thread Stefan Farfeleder
On Fri, Jan 16, 2009 at 01:33:38PM +0200, Danny Braniss wrote: > some facts: > #include > int > main() > { > printf("%s\n", strerror(2)); > return 0; > } > > 1- it works fine on i386 > 2- it bombs on amd64 > 3- with a local strerror.c (instead of the one in libc) >

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's

2009-01-16 Thread Danny Braniss
> On Fri, Jan 16, 2009 at 01:33:38PM +0200, Danny Braniss wrote: > > some facts: > > #include > > int > > main() > > { > > printf("%s\n", strerror(2)); > > return 0; > > } > > > > 1- it works fine on i386 > > 2- it bombs on amd64 > > 3- with a local strerror.c (instead of th

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's

2009-01-16 Thread Christoph Mallon
Danny Braniss schrieb: some facts: #include int main() { printf("%s\n", strerror(2)); return 0; } 1- it works fine on i386 2- it bombs on amd64 3- with a local strerror.c (instead of the one in libc) works fine so, there is something realy wrong goin

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's

2009-01-16 Thread Danny Braniss
> Garrett Cooper schrieb: > > Ok, I just installworld'ed, recompiled the program with the > > following modifications, and I still get segfaults. And the question > > of the night is: why amd64 on a VERY recent CURRENT? > > I'm going to try the same app on an amd64 freebsd VMware instance >

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's

2009-01-16 Thread Christoph Mallon
Garrett Cooper schrieb: On Fri, Jan 16, 2009 at 2:21 AM, Christoph Mallon wrote: Christian Kandeler schrieb: On Friday 16 January 2009 09:53, Christoph Mallon wrote: int main() { int mib[4]; size_t len; if (sysctlnametomib("kern.ipc.shmmax", mib, &len) != 0) {

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's

2009-01-16 Thread Christoph Mallon
Garrett Cooper schrieb: Ok, I just installworld'ed, recompiled the program with the following modifications, and I still get segfaults. And the question of the night is: why amd64 on a VERY recent CURRENT? I'm going to try the same app on an amd64 freebsd VMware instance with RELENG_7.

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's

2009-01-16 Thread Garrett Cooper
On Fri, Jan 16, 2009 at 2:35 AM, Garrett Cooper wrote: > On Fri, Jan 16, 2009 at 2:21 AM, Christoph Mallon > wrote: >> Christian Kandeler schrieb: >>> >>> On Friday 16 January 2009 09:53, Christoph Mallon wrote: >>> > int > main() { > >int mib[4]; > >size_t

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's

2009-01-16 Thread Garrett Cooper
On Fri, Jan 16, 2009 at 2:21 AM, Christoph Mallon wrote: > Christian Kandeler schrieb: >> >> On Friday 16 January 2009 09:53, Christoph Mallon wrote: >> int main() { int mib[4]; size_t len; if (sysctlnametomib("kern.ipc.shmmax", mib, &le

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's

2009-01-16 Thread Christoph Mallon
Christian Kandeler schrieb: On Friday 16 January 2009 09:53, Christoph Mallon wrote: 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", s

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl (3) setting `odd' errno's

2009-01-16 Thread Christian Kandeler
On Friday 16 January 2009 09:53, Christoph Mallon wrote: > > int > > main() { > > > > int mib[4]; > > > > size_t len; > > > > if (sysctlnametomib("kern.ipc.shmmax", mib, &len) != 0) { > > printf("Errno: %d\n", errno); > > errx(errno, "Error:

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl(3) setting `odd' errno's

2009-01-16 Thread Christoph Mallon
Garrett Cooper schrieb: On Fri, Jan 16, 2009 at 12:58 AM, Garrett Cooper wrote: On Fri, Jan 16, 2009 at 12:57 AM, Christoph Mallon wrote: Garrett Cooper schrieb: Good point. I modified the source to do that. Thanks, -Garrett You should reply to all so the discussion stays on the list. Yeah

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl(3) setting `odd' errno's

2009-01-16 Thread Garrett Cooper
On Fri, Jan 16, 2009 at 12:58 AM, Garrett Cooper wrote: > On Fri, Jan 16, 2009 at 12:57 AM, Christoph Mallon > wrote: >> Garrett Cooper schrieb: >>> >>> Good point. I modified the source to do that. >>> Thanks, >>> -Garrett >> >> You should reply to all so the discussion stays on the list. > > Ye

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl(3) setting `odd' errno's

2009-01-16 Thread Jacques Fourie
On Fri, Jan 16, 2009 at 10:44 AM, Garrett Cooper wrote: > On Fri, Jan 16, 2009 at 12:41 AM, Garrett Cooper wrote: >> 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) wh

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl(3) setting `odd' errno's

2009-01-16 Thread Garrett Cooper
On Fri, Jan 16, 2009 at 12:57 AM, Christoph Mallon wrote: > Garrett Cooper schrieb: >> >> Good point. I modified the source to do that. >> Thanks, >> -Garrett > > You should reply to all so the discussion stays on the list. Yeah, that was a goofup on my part. Go-go Gmail web interface! -Garrett _

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl(3) setting `odd' errno's

2009-01-16 Thread Jacques Fourie
On Fri, Jan 16, 2009 at 10:47 AM, Jacques Fourie wrote: > On Fri, Jan 16, 2009 at 10:44 AM, Garrett Cooper wrote: >> On Fri, Jan 16, 2009 at 12:41 AM, Garrett Cooper wrote: >>> Hi amd64 and Hackers, >>>Uh, I'm really confused why 1) this error (errno => ENOMEM) would >>> occur when I have mo

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl(3) setting `odd' errno's

2009-01-16 Thread Maxim Konovalov
On Fri, 16 Jan 2009, 00:44-0800, Garrett Cooper wrote: > On Fri, Jan 16, 2009 at 12:41 AM, Garrett Cooper wrote: > > 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)

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl(3) setting `odd' errno's

2009-01-16 Thread Garrett Cooper
On Fri, Jan 16, 2009 at 12:47 AM, Jacques Fourie wrote: > > You need to initialize len to the number of entries in the mib array. > Try adding 'len = 4' before calling sysctlnametomib() and see if your > issues go away. Ok, that solution works (I think). So, problem 2 down. Now: what about th

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl(3) setting `odd' errno's

2009-01-16 Thread Christoph Mallon
Garrett Cooper schrieb: 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 initializ

Re: Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl(3) setting `odd' errno's

2009-01-16 Thread Garrett Cooper
On Fri, Jan 16, 2009 at 12:41 AM, Garrett Cooper wrote: > 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 >

Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl(3) setting `odd' errno's

2009-01-16 Thread Garrett Cooper
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