From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 82537 invoked by alias); 10 Dec 2015 15:04:44 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 82490 invoked by uid 89); 10 Dec 2015 15:04:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 10 Dec 2015 15:04:38 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 7E551C105B3F for ; Thu, 10 Dec 2015 15:04:37 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBAF4aoa022677 for ; Thu, 10 Dec 2015 10:04:37 -0500 Message-ID: <56699484.3040103@redhat.com> Date: Thu, 10 Dec 2015 15:04:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: GDB Patches Subject: [Linux] Assume waitpid/__WALL is available Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-12/txt/msg00009.txt.bz2 As next step in the spring^W cleaning, since we now assume that PTRACE_O_TRACECLONE is available, we should be able to assume that everything that predates it is available as well. __WALL immediately comes to mind. man ptrace says: PTRACE_O_TRACECLONE (since Linux 2.5.46) and man waitpid says: __WALL (since Linux 2.4) Wait for all children, regardless of type ("clone" or "non-clone"). Making use of __WALL should simplify linux-nat.c, in all the places that first check __WCLONE then !__WCLONE. See comments at top of linux-nat.c. E.g.: new_pid = my_waitpid (lwpid, &status, WNOHANG); if (new_pid == -1 && errno == ECHILD) new_pid = my_waitpid (lwpid, &status, __WCLONE | WNOHANG); if (new_pid != -1) gdbserver's linux-low.c uses __WALL, but note that in reality that doesn't reach the kernel, because nat/linux-waitpid.c:my_waitpid actually emulates __WALL. We should be able to simplify that too now. Thanks, Pedro Alves