This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.14-552-gcaafb2b


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  caafb2b06bb5ae71e1de719292a0b8a233a21757 (commit)
      from  e988dba98d852d08707d00eec0072548fdf2eb24 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=caafb2b06bb5ae71e1de719292a0b8a233a21757

commit caafb2b06bb5ae71e1de719292a0b8a233a21757
Author: Carlos O'Donell <carlos@codesourcery.com>
Date:   Wed Dec 14 21:32:11 2011 -0500

    Return errno on failure in allocate_stack
    
    In cases where a function call fails return
    errno and allow the caller to fixup the return
    code as required by their API.

diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index bdf6129..b622fe7 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,7 @@
+2011-12-14  Carlos O'Donell  <carlos@systemhalted.org>
+
+	* allocatestack.c (allocate_stack): Return errno on failure.
+
 2011-12-14  Jeff Law  <law@redhat.com>
 
 	[BZ #5245]
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 36b4aa1..b1b17ce 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -435,7 +435,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 	{
 	  /* Something went wrong.  */
 	  assert (errno == ENOMEM);
-	  return EAGAIN;
+	  return errno;
 	}
 
 
@@ -496,12 +496,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 		      MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0);
 
 	  if (__builtin_expect (mem == MAP_FAILED, 0))
-	    {
-	      if (errno == ENOMEM)
-		__set_errno (EAGAIN);
-
-	       return errno;
-	    }
+	    return errno;
 
 	  /* SIZE is guaranteed to be greater than zero.
 	     So we can never get a null pointer back from mmap.  */
@@ -581,7 +576,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 	      /* Free the stack memory we just allocated.  */
 	      (void) munmap (mem, size);
 
-	      return EAGAIN;
+	      return errno;
 	    }
 
 
@@ -636,10 +631,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 #endif
 	  if (mprotect (guard, guardsize, PROT_NONE) != 0)
 	    {
-	      int err;
 	    mprot_error:
-	      err = errno == ENOMEM ? EAGAIN : errno;
-
 	      lll_lock (stack_cache_lock, LLL_PRIVATE);
 
 	      /* Remove the thread from the list.  */
@@ -657,7 +649,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 		 is nothing we could do.  */
 	      (void) munmap (mem, size);
 
-	      return err;
+	      return errno;
 	    }
 
 	  pd->guardsize = guardsize;

-----------------------------------------------------------------------

Summary of changes:
 nptl/ChangeLog       |    4 ++++
 nptl/allocatestack.c |   16 ++++------------
 2 files changed, 8 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]