Return-Path: X-Original-To: apmail-apr-commits-archive@www.apache.org Delivered-To: apmail-apr-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3095011771 for ; Wed, 16 Jul 2014 13:26:40 +0000 (UTC) Received: (qmail 46891 invoked by uid 500); 16 Jul 2014 13:26:40 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 46844 invoked by uid 500); 16 Jul 2014 13:26:40 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 46835 invoked by uid 99); 16 Jul 2014 13:26:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jul 2014 13:26:40 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jul 2014 13:26:38 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8E24F238896F; Wed, 16 Jul 2014 13:26:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1611000 - in /apr/apr/branches/1.5.x: ./ CHANGES locks/unix/proc_mutex.c Date: Wed, 16 Jul 2014 13:26:18 -0000 To: commits@apr.apache.org From: trawick@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140716132618.8E24F238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: trawick Date: Wed Jul 16 13:26:17 2014 New Revision: 1611000 URL: http://svn.apache.org/r1611000 Log: Merge r1610854 from trunk: Resolve failures with the POSIX sem implementation of APR process mutexes (and thus global mutexes) in environments which receive signals. EINTR is now handled on the sem_* calls that are documented as exposing EINTR in the Linux, FreeBSD, and/or Solaris docs. There are a few other calls that haven't been updated: sem_unlink(), sem_post(), and sem_close(). Modified: apr/apr/branches/1.5.x/ (props changed) apr/apr/branches/1.5.x/CHANGES apr/apr/branches/1.5.x/locks/unix/proc_mutex.c Propchange: apr/apr/branches/1.5.x/ ------------------------------------------------------------------------------ Merged /apr/apr/trunk:r1610854 Modified: apr/apr/branches/1.5.x/CHANGES URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/CHANGES?rev=1611000&r1=1610999&r2=1611000&view=diff ============================================================================== --- apr/apr/branches/1.5.x/CHANGES [utf-8] (original) +++ apr/apr/branches/1.5.x/CHANGES [utf-8] Wed Jul 16 13:26:17 2014 @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes for APR 1.5.2 + *) apr_global_mutex/apr_proc_mutex: Resolve failures with the + POSIX sem implementation in environments which receive signals. + [Jeff Trawick] + *) apr_skiplist: Fix potential corruption of skiplists leading to results or crashes. [Takashi Sato , Eric Covener] PR 56654. Modified: apr/apr/branches/1.5.x/locks/unix/proc_mutex.c URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/locks/unix/proc_mutex.c?rev=1611000&r1=1610999&r2=1611000&view=diff ============================================================================== --- apr/apr/branches/1.5.x/locks/unix/proc_mutex.c (original) +++ apr/apr/branches/1.5.x/locks/unix/proc_mutex.c Wed Jul 16 13:26:17 2014 @@ -114,7 +114,9 @@ static apr_status_t proc_mutex_posix_cre usec = apr_time_usec(now); apr_snprintf(semname, sizeof(semname), "/ApR.%lxZ%lx", sec, usec); } - psem = sem_open(semname, O_CREAT | O_EXCL, 0644, 1); + do { + psem = sem_open(semname, O_CREAT | O_EXCL, 0644, 1); + } while (psem == (sem_t *)SEM_FAILED && errno == EINTR); if (psem == (sem_t *)SEM_FAILED) { if (errno == ENAMETOOLONG) { /* Oh well, good try */ @@ -122,7 +124,9 @@ static apr_status_t proc_mutex_posix_cre } else { return errno; } - psem = sem_open(semname, O_CREAT | O_EXCL, 0644, 1); + do { + psem = sem_open(semname, O_CREAT | O_EXCL, 0644, 1); + } while (psem == (sem_t *)SEM_FAILED && errno == EINTR); } if (psem == (sem_t *)SEM_FAILED) { @@ -140,7 +144,12 @@ static apr_status_t proc_mutex_posix_cre static apr_status_t proc_mutex_posix_acquire(apr_proc_mutex_t *mutex) { - if (sem_wait(mutex->psem_interproc) < 0) { + int rc; + + do { + rc = sem_wait(mutex->psem_interproc); + } while (rc < 0 && errno == EINTR); + if (rc < 0) { return errno; } mutex->curr_locked = 1; @@ -149,7 +158,12 @@ static apr_status_t proc_mutex_posix_acq static apr_status_t proc_mutex_posix_tryacquire(apr_proc_mutex_t *mutex) { - if (sem_trywait(mutex->psem_interproc) < 0) { + int rc; + + do { + rc = sem_trywait(mutex->psem_interproc); + } while (rc < 0 && errno == EINTR); + if (rc < 0) { if (errno == EAGAIN) { return APR_EBUSY; }