From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1850 invoked by alias); 10 Mar 2010 21:25:08 -0000 Received: (qmail 1752 invoked by uid 22791); 10 Mar 2010 21:25:06 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Mar 2010 21:25:01 +0000 Received: from mailhost2.vmware.com (mailhost2.vmware.com [10.16.67.167]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 4B7A45C00D; Wed, 10 Mar 2010 13:24:58 -0800 (PST) Received: from [10.20.124.100] (promd-2s-dhcp100.eng.vmware.com [10.20.124.100]) by mailhost2.vmware.com (Postfix) with ESMTP id 35BDE8E8F0; Wed, 10 Mar 2010 13:24:58 -0800 (PST) Message-ID: <4B980E29.5090208@vmware.com> Date: Wed, 10 Mar 2010 21:25:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.22 (X11/20090609) MIME-Version: 1.0 To: "gdb-patches@sourceware.org" , Doug Evans , dan@codesourcery.com Subject: [RFA] gdbserver, errno handling in my_waitpid Content-Type: multipart/mixed; boundary="------------040405010908070705030507" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00396.txt.bz2 This is a multi-part message in MIME format. --------------040405010908070705030507 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 233 This is not really my most familiar bit of the code, so you gdbserver guys check me, ok? It seems to me that we need to set errno to zero before calling waitpid, if we're going to check it right after. Especially the second time. --------------040405010908070705030507 Content-Type: text/plain; name="errno.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="errno.txt" Content-length: 825 2010-03-10 Michael Snyder * linux-low.c (my_waitpid): Set errno to 0 before waitpid. Index: linux-low.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v retrieving revision 1.130 diff -u -p -r1.130 linux-low.c --- linux-low.c 6 Mar 2010 00:11:42 -0000 1.130 +++ linux-low.c 10 Mar 2010 21:20:14 -0000 @@ -309,6 +309,7 @@ my_waitpid (int pid, int *status, int fl { /* Since all signals are blocked, there's no need to check for EINTR here. */ + errno = 0; ret = waitpid (pid, status, flags); out_errno = errno; @@ -338,6 +339,7 @@ my_waitpid (int pid, int *status, int fl } else { + errno = 0; do ret = waitpid (pid, status, flags); while (ret == -1 && errno == EINTR); --------------040405010908070705030507--