Deleted Added
full compact
thr_attr.c (178446) thr_attr.c (212536)
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 178446 2008-04-23 21:06:51Z delphij $
93 * $FreeBSD: head/lib/libthr/thread/thr_attr.c 212536 2010-09-13 07:03:01Z 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>

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

127 ret = 0;
128 }
129 return(ret);
130}
131
132__weak_reference(_pthread_attr_get_np, pthread_attr_get_np);
133
134int
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>

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

127 ret = 0;
128 }
129 return(ret);
130}
131
132__weak_reference(_pthread_attr_get_np, pthread_attr_get_np);
133
134int
135_pthread_attr_get_np(pthread_t pid, pthread_attr_t *dst)
135_pthread_attr_get_np(pthread_t pthread, pthread_attr_t *dst)
136{
137 struct pthread *curthread;
138 struct pthread_attr attr;
139 int ret;
140
136{
137 struct pthread *curthread;
138 struct pthread_attr attr;
139 int ret;
140
141 if (pid == NULL || dst == NULL || *dst == NULL)
141 if (pthread == NULL || dst == NULL || *dst == NULL)
142 return (EINVAL);
143
144 curthread = _get_curthread();
142 return (EINVAL);
143
144 curthread = _get_curthread();
145 if ((ret = _thr_ref_add(curthread, pid, /*include dead*/0)) != 0)
145 if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0)) != 0)
146 return (ret);
146 return (ret);
147 attr = pid->attr;
148 if (pid->tlflags & TLFLAGS_DETACHED)
147 attr = pthread->attr;
148 if (pthread->flags & THR_FLAGS_DETACHED)
149 attr.flags |= PTHREAD_DETACHED;
149 attr.flags |= PTHREAD_DETACHED;
150 _thr_ref_delete(curthread, pid);
150 THR_THREAD_UNLOCK(curthread, pthread);
151
151 memcpy(*dst, &attr, sizeof(struct pthread_attr));
152 /* XXX */
153 (*dst)->cpuset = NULL;
154 (*dst)->cpusetsize = 0;
155 return (0);
156}
157
158__weak_reference(_pthread_attr_getdetachstate, pthread_attr_getdetachstate);

--- 479 unchanged lines hidden ---
152 memcpy(*dst, &attr, sizeof(struct pthread_attr));
153 /* XXX */
154 (*dst)->cpuset = NULL;
155 (*dst)->cpusetsize = 0;
156 return (0);
157}
158
159__weak_reference(_pthread_attr_getdetachstate, pthread_attr_getdetachstate);

--- 479 unchanged lines hidden ---