From owner-freebsd-current@FreeBSD.ORG Wed Jun 15 11:07:54 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7C06F16A41C for ; Wed, 15 Jun 2005 11:07:54 +0000 (GMT) (envelope-from snort_sam@yahoo.com) Received: from web54408.mail.yahoo.com (web54408.mail.yahoo.com [68.142.225.164]) by mx1.FreeBSD.org (Postfix) with SMTP id 1799543D49 for ; Wed, 15 Jun 2005 11:07:53 +0000 (GMT) (envelope-from snort_sam@yahoo.com) Received: (qmail 11530 invoked by uid 60001); 15 Jun 2005 11:07:53 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Iss2cdRjXIdtcn5T1NdTLswk08AdTkUNfmhwzXbaTKswHizFGhbA5ZAEgL+3C1v7nA4sQ/P8i4jv0muFRq52hxoLeZzmO8o/Z2eIN/xT7mKErE6g8OSGZIxDIvtNp9XzCrbllIoj7M4f+j0S59Z+oZdrXAkgpouwokujDYkWBz0= ; Message-ID: <20050615110753.11528.qmail@web54408.mail.yahoo.com> Received: from [139.168.39.63] by web54408.mail.yahoo.com via HTTP; Wed, 15 Jun 2005 04:07:53 PDT Date: Wed, 15 Jun 2005 04:07:53 -0700 (PDT) From: snort Snort To: freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: ttys0 code freezes 5.4 release-p1 badly X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jun 2005 11:07:54 -0000 Hi, The following ttys0 code freezes 5.4 release-p1 badly: #include /* Standard input/output definitions */ #include /* String function definitions */ #include /* UNIX standard function definitions */ #include /* File control definitions */ #include /* Error number definitions */ #include /* POSIX terminal control definitions */ /* * 'open_port()' - Open serial port 1. * * Returns the file descriptor on success or -1 on error. */ int open_port(void) { int fd; /* File descriptor for the port */ fd = open("/dev/ttyd0", O_RDWR | O_NOCTTY | O_NDELAY); if (fd == -1) { /* could not open the port. */ perror("open_port: Unable to open /dev/ttyS0 - "); } else fcntl(fd, F_SETFL, 0); return (fd); } int write_port(int fd) { int n = write(fd, "ATZ\r", 4); if (n < 0) { fputs("write() of 4 bytes failed!\n", stderr); return 0; } return n; } void read_port(int fd) { fcntl(fd, F_SETFL, FNDELAY); //fcntl(fd, F_SETFL, 0); } void close_port(int fd) { close(fd); } int main() { int fd = open_port(); if (write_port(fd) < 0) return 1; read_port(fd); close_port(fd); } Dose anyone know what is problem and how to fix it? Thanks Sam __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com