Andrew Buckeridge a écrit : > On Fri, 2 Mar 2007 01:39:16 -0700 > dann frazier <[EMAIL PROTECTED]> wrote: > >> On Fri, Mar 02, 2007 at 02:13:22PM +0800, Andrew Buckeridge wrote: >>> package: linux-image-2.6.18-4-amd64 >>> version: 2.6.18.dfsg.1-11 >>> >>> Trivial program now segfault and/or get garbled data from functions. >> Please include an example program, and instructions on compiling it. > Right, there is no such thing as a trivial program. > > [EMAIL PROTECTED]:~/public_html/c-run$ gcc-3.3 -o 4155-date 4155-date.c; > ./4155-date > Segmentation fault > [EMAIL PROTECTED]:~/public_html/c-run$ gcc-3.4 -o 4155-date 4155-date.c; > ./4155-date > Segmentation fault > [EMAIL PROTECTED]:~/public_html/c-run$ gcc-4.0 -o 4155-date 4155-date.c; > ./4155-date > Segmentation fault > [EMAIL PROTECTED]:~/public_html/c-run$ gcc-4.1 -o 4155-date 4155-date.c; > ./4155-date > 4280320909.M2475556863P9914.thot > Tue Jul 15 11:33:33 1969 > Tue, 15 Jul 1969 19:33:33 +0800 > [EMAIL PROTECTED]:~/public_html/c-run$ gcc -o 4155-date 4155-date.c; > ./4155-date > 4280320909.M2475556863P9914.thot > Tue Jul 15 11:33:33 1969 > Tue, 15 Jul 1969 19:33:33 +0800 > >> Also, what kernel did you upgrade from where this program did work? > kernel-image-2.6.8-12-amd64-k8 > 2.6.8-16sarge6 >> -- >> dann frazier >> >> >> >> ------------------------------------------------------------------------ >> >> #include <stdlib.h> >> #include <stdio.h> >> #include <stdarg.h> >> #include <unistd.h> >> #include <sys/time.h> >> #include <string.h> >> #include <time.h> >> #include <alloca.h> >> >> /* This shite is good for debugging non-std ANSI/ISO C */ >> >> /* +Ve == bytes written -Ve == bytes required */ >> >> int vunprintf(int fdout, int r, const char *fmt, va_list ap) { >> int i; >> char *p; >> >> p=alloca(r); >> i=vsnprintf(p,r,fmt,ap); >> if(i<0) >> return 1-2*r; >> if(i<r) >> return write(fdout,p,i); >> else >> return -i; >> } >> >> /* +Ve == bytes written -Ve == failure */ >> >> int vuprintf(int fdout, const char *fmt, va_list ap) { >> int i=BUFSIZ; >> i=vunprintf(fdout, i, fmt, ap); >> if(i<0) >> i=vunprintf(fdout, 1-i, fmt, ap); >> return i; >> } >> >> int uprintf(int fdout, const char *fmt, ...) { >> va_list ap; >> int r; >> >> va_start(ap, fmt); >> r=vuprintf(fdout, fmt, ap); >> va_end(ap); >> return r; >> } >> >> int uputs(char *s, int fdout) { >> int l; >> >> l=strlen(s); >> if(l>0) >> return write(fdout,s,l); >> else >> return l; >> } >> >> int main() { >> char *s, h[32], r[64]; >> int l; >> struct timeval *tp; >> >> /* time_t tr; */ >> /* tr=time(0); */ /* BROKEN arg must be NULL */ >> >> l=gettimeofday(tp, 0); ^^
Your problem is here, not in the kernel. tp is not yet allocated, hence the problem. -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [EMAIL PROTECTED] | [EMAIL PROTECTED] `- people.debian.org/~aurel32 | www.aurel32.net -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]