From owner-freebsd-hackers@FreeBSD.ORG Wed Oct 13 20:15:14 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EA1C316A4CE for ; Wed, 13 Oct 2004 20:15:14 +0000 (GMT) Received: from jive.SoftHome.net (jive.SoftHome.net [66.54.152.27]) by mx1.FreeBSD.org (Postfix) with SMTP id 86AFD43D45 for ; Wed, 13 Oct 2004 20:15:14 +0000 (GMT) (envelope-from shawnwebb@softhome.net) Received: (qmail 4616 invoked by uid 417); 13 Oct 2004 19:37:15 -0000 Received: from charleston-.softhome.net (HELO softhome.net) (172.16.2.12) by shunt-smtp-out-0 with SMTP; 13 Oct 2004 19:37:15 -0000 Received: from shawns ([4.228.207.101]) (AUTH: LOGIN shawnwebb@softhome.net) by softhome.net with esmtp; Wed, 13 Oct 2004 13:37:13 -0600 Message-ID: <001201c4b224$fcd68320$65cfe404@shawns> From: "Shawn Webb" To: freebsd-hackers@freebsd.org Date: Thu, 14 Oct 2004 13:35:37 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Subject: RE: malloc calls and ioctl calls to soundcard cause segfault X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Oct 2004 20:15:15 -0000 I've got to rewrite the source due to hard disk problems, so I'll just put it in this email: /* dsp_seg.c */ /* If there are any compile errors, forgive me; I'm not on a FreeBSD box */ #include #include #include #include #include #include #include #define FORMAT AFMT_S16_LE #define RATE 8000 #define CHANNELS 1 char *buf; int fd; int buflen; void this_segfaults(void); int main(void) { fd = open("/dev/dsp", O_RDWR); if (fd < 0) { perror("open"); exit(1); } this_segfaults(); printf("m00\n"); exit(0); } void this_segfaults(void) { int arg; arg = FORMAT; if (ioctl(fd, SNDCTL_DSP_SETFMT, &arg) < 0) { perror("ioctl setfmt"); exit(1); } if (ioctl(fd, SNDCTL_DSP_GETOSPACE, &arg) < 0) { perror("ioctl getospace"); exit(1); } printf("arg: %d\n", arg); buf = malloc(arg); if (!buf) { perror("malloc"); exit(1); } arg = CHANNELS; if (ioctl(fd, SNDCTL_DSP_CHANNELS, &arg) < 0) { perror("ioctl channels"); exit(1); } arg = RATE; if (ioctl(fd, SNDCTL_DSP_SETRATE, &arg) < 0) { perror("ioctl setrate"); exit(1); } } /* End of source */ ----- Original Message ----- From: "Robert Watson" To: "Shawn Webb" Cc: Sent: Wednesday, October 13, 2004 1:47 AM Subject: Re: malloc calls and ioctl calls to soundcard cause segfault > > On Tue, 12 Oct 2004, Shawn Webb wrote: > > > (attached is the source code to the segfaulting application) > > Doesn't appear to be -- if it was a large attachment, maybe the mailing > list stripped it. Could you give a URL for the source? > > Robert N M Watson FreeBSD Core Team, TrustedBSD Projects > robert@fledge.watson.org Principal Research Scientist, McAfee Research > > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"