Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpthread pthread__attr_init_private:



details:   https://anonhg.NetBSD.org/src/rev/dff407cbcdf6
branches:  trunk
changeset: 825823:dff407cbcdf6
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Aug 01 12:31:45 2017 +0000

description:
pthread__attr_init_private:
malloc+memset -> calloc. Also initialize all values to the proper
defaults.
This fixes the "rustc panic" discussed on pkgsrc-users.
OK: joerg

diffstat:

 lib/libpthread/pthread_attr.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 32623120b253 -r dff407cbcdf6 lib/libpthread/pthread_attr.c
--- a/lib/libpthread/pthread_attr.c     Tue Aug 01 12:15:21 2017 +0000
+++ b/lib/libpthread/pthread_attr.c     Tue Aug 01 12:31:45 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_attr.c,v 1.17 2017/07/02 16:41:32 joerg Exp $  */
+/*     $NetBSD: pthread_attr.c,v 1.18 2017/08/01 12:31:45 martin Exp $ */
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_attr.c,v 1.17 2017/07/02 16:41:32 joerg Exp $");
+__RCSID("$NetBSD: pthread_attr.c,v 1.18 2017/08/01 12:31:45 martin Exp $");
 
 #include <errno.h>
 #include <stdio.h>
@@ -58,11 +58,12 @@
        if ((p = attr->pta_private) != NULL)
                return p;
 
-       p = malloc(sizeof(*p));
+       p = calloc(1, sizeof(*p));
        if (p != NULL) {
-               memset(p, 0, sizeof(*p));
                attr->pta_private = p;
                p->ptap_policy = SCHED_OTHER;
+               p->ptap_stacksize = pthread__stacksize;
+               p->ptap_guardsize = pthread__guardsize;
        }
        return p;
 }



Home | Main Index | Thread Index | Old Index