From patchwork Fri Sep 19 13:21:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 2926 Received: (qmail 11534 invoked by alias); 19 Sep 2014 13:21:47 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 11486 invoked by uid 89); 19 Sep 2014 13:21:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e24smtp03.br.ibm.com Message-ID: <541C2DE0.80100@linux.vnet.ibm.com> Date: Fri, 19 Sep 2014 10:21:36 -0300 From: Adhemerval Zanella User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: "GNU C. Library" Subject: [PATCH 4/4] nptl: Add default cancellable futex calls References: <541C2901.1050609@linux.vnet.ibm.com> <541C2B18.4090107@linux.vnet.ibm.com> In-Reply-To: <541C2B18.4090107@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14091913-0009-0000-0000-000001D15C08 This patch adds default cancellable futex calls used in cancellation entrypoints in NPTL code. --- * sysdeps/unix/sysv/linux/lowlevellock-futex.h (lll_futex_wait_cancel): New define: cancellable wait futex call. (lll_futex_timed_wait_cancel): New define: cancellable timed wait futex call. (lll_futex_timed_wait_bitset_cancel): New define: cancellable timed wait bitsel futex call. (lll_futex_wait_requeue_pi_cancel): New define: cancellable wait requeue PI futex call. (lll_futex_timed_wait_requeue_pi_cancel): New define: cancellable timed wait requeue PI futex call. --- diff --git a/sysdeps/unix/sysv/linux/lowlevellock-futex.h b/sysdeps/unix/sysv/linux/lowlevellock-futex.h index 343afd6..2967ebb 100644 --- a/sysdeps/unix/sysv/linux/lowlevellock-futex.h +++ b/sysdeps/unix/sysv/linux/lowlevellock-futex.h @@ -97,6 +97,49 @@ val, timeout, NULL /* Unused. */, \ FUTEX_BITSET_MATCH_ANY) +#define lll_futex_wait_cancel(futexp, val, private) \ + lll_futex_timed_wait_cancel (futexp, val, NULL, private) + +#define lll_futex_timed_wait_cancel(futexp, val, timespec, private) \ + ({ \ + long int __ret; \ + int __op = FUTEX_WAIT; \ + \ + __ret = __syscall_cancel (__NR_futex, (long int) (futexp), \ + (long int)__lll_private_flag (__op, private), \ + (long int)(val), (long int)(timespec), 0, 0); \ + __ret; \ + }) + +#define lll_futex_timed_wait_bitset_cancel(futexp, val, timespec, clockbit, \ + private) \ + ({ \ + long int __ret; \ + int __op = FUTEX_WAIT_BITSET | clockbit; \ + \ + __ret = __syscall_cancel (__NR_futex, (long int) (futexp), \ + (long int)__lll_private_flag (__op, private), \ + (long int)(val), (long int)(timespec), 0, \ + FUTEX_BITSET_MATCH_ANY); \ + __ret; \ + }) + +#define lll_futex_wait_requeue_pi_cancel(futexp, val, mutex, private) \ + lll_futex_timed_wait_requeue_pi_cancel (futexp, val, NULL, 0, mutex, private) + +#define lll_futex_timed_wait_requeue_pi_cancel(futexp, val, timespec, \ + clockbit, mutex, private) \ + ({ \ + long int __ret; \ + int __op = FUTEX_WAIT_REQUEUE_PI | clockbit; \ + \ + __ret = __syscall_cancel (__NR_futex, (long int) (futexp), \ + (long int) __lll_private_flag (__op, private), \ + (long int )(val), (long int) (timespec), \ + (long int ) mutex, 0); \ + __ret; \ + }) + #define lll_futex_wake(futexp, nr, private) \ lll_futex_syscall (4, futexp, \ __lll_private_flag (FUTEX_WAKE, private), nr, 0)