Deleted Added
full compact
thr_attr.c (214413) thr_attr.c (214653)
1/*
2 * Copyright (c) 2003 Craig Rodrigues <rodrigc@attbi.com>.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 76 unchanged lines hidden (view full) ---

85 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
86 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
87 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
88 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
89 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
90 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
91 * SUCH DAMAGE.
92 *
1/*
2 * Copyright (c) 2003 Craig Rodrigues <rodrigc@attbi.com>.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 76 unchanged lines hidden (view full) ---

85 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
86 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
87 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
88 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
89 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
90 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
91 * SUCH DAMAGE.
92 *
93 * $FreeBSD: head/lib/libthr/thread/thr_attr.c 214413 2010-10-27 09:59:43Z davidxu $
93 * $FreeBSD: head/lib/libthr/thread/thr_attr.c 214653 2010-11-02 02:13:13Z davidxu $
94 */
95
96#include "namespace.h"
97#include <errno.h>
98#include <pthread.h>
99#include <stdlib.h>
100#include <string.h>
101#include <pthread_np.h>

--- 462 unchanged lines hidden (view full) ---

564
565static size_t
566_get_kern_cpuset_size(void)
567{
568 static int kern_cpuset_size = 0;
569
570 if (kern_cpuset_size == 0) {
571 size_t len;
94 */
95
96#include "namespace.h"
97#include <errno.h>
98#include <pthread.h>
99#include <stdlib.h>
100#include <string.h>
101#include <pthread_np.h>

--- 462 unchanged lines hidden (view full) ---

564
565static size_t
566_get_kern_cpuset_size(void)
567{
568 static int kern_cpuset_size = 0;
569
570 if (kern_cpuset_size == 0) {
571 size_t len;
572 int maxcpus;
573
572
574 len = sizeof(maxcpus);
575 if (sysctlbyname("kern.smp.maxcpus", &maxcpus, &len, NULL, 0))
576 PANIC("failed to get sysctl kern.smp.maxcpus");
577 int nbits_long = sizeof(long) * NBBY;
578 int num_long = (maxcpus + nbits_long - 1) / nbits_long;
579 kern_cpuset_size = num_long * sizeof(long);
573 len = sizeof(kern_cpuset_size);
574 if (sysctlbyname("kern.sched.cpusetsize", &kern_cpuset_size,
575 &len, NULL, 0))
576 PANIC("failed to get sysctl kern.sched.cpusetsize");
580 }
581
582 return (kern_cpuset_size);
583}
584
585__weak_reference(_pthread_attr_setaffinity_np, pthread_attr_setaffinity_np);
586int
587_pthread_attr_setaffinity_np(pthread_attr_t *pattr, size_t cpusetsize,

--- 66 unchanged lines hidden ---
577 }
578
579 return (kern_cpuset_size);
580}
581
582__weak_reference(_pthread_attr_setaffinity_np, pthread_attr_setaffinity_np);
583int
584_pthread_attr_setaffinity_np(pthread_attr_t *pattr, size_t cpusetsize,

--- 66 unchanged lines hidden ---