Compile libthr with warnings.

This commit is contained in:
Ruslan Ermilov 2008-03-25 13:28:12 +00:00
parent d7a38db650
commit e03efb02bc
4 changed files with 12 additions and 6 deletions

View File

@ -65,6 +65,7 @@
#undef pthread_atfork
#undef pthread_attr_destroy
#undef pthread_attr_get_np
#undef pthread_attr_getaffinity_np
#undef pthread_attr_getdetachstate
#undef pthread_attr_getguardsize
#undef pthread_attr_getinheritsched
@ -75,6 +76,7 @@
#undef pthread_attr_getstackaddr
#undef pthread_attr_getstacksize
#undef pthread_attr_init
#undef pthread_attr_setaffinity_np
#undef pthread_attr_setcreatesuspend_np
#undef pthread_attr_setdetachstate
#undef pthread_attr_setguardsize
@ -112,6 +114,7 @@
#undef pthread_equal
#undef pthread_exit
#undef pthread_getconcurrency
#undef pthread_getcpuclockid
#undef pthread_getprio
#undef pthread_getschedparam
#undef pthread_getspecific

View File

@ -17,6 +17,7 @@ SHLIBDIR= /lib
LIB=thr
SHLIB_MAJOR= 3
WARNS?= 3
CFLAGS+=-DPTHREAD_KERNEL
CFLAGS+=-I${.CURDIR}/../libc/include -I${.CURDIR}/thread \
-I${.CURDIR}/../../include

View File

@ -547,13 +547,13 @@ _pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
return(ret);
}
static int
_get_kern_cpuset_size()
static size_t
_get_kern_cpuset_size(void)
{
static int kern_cpuset_size = 0;
if (kern_cpuset_size == 0) {
int len;
size_t len;
len = sizeof(kern_cpuset_size);
if (sysctlbyname("kern.smp.maxcpus", &kern_cpuset_size,
@ -587,9 +587,9 @@ _pthread_attr_setaffinity_np(pthread_attr_t *pattr, size_t cpusetsize,
}
if (cpusetsize > attr->cpusetsize) {
int kern_size = _get_kern_cpuset_size();
size_t kern_size = _get_kern_cpuset_size();
if (cpusetsize > kern_size) {
int i;
size_t i;
for (i = kern_size; i < cpusetsize; ++i) {
if (((char *)cpuset)[i])
return (EINVAL);
@ -627,7 +627,7 @@ _pthread_attr_getaffinity_np(const pthread_attr_t *pattr, size_t cpusetsize,
memset(((char *)cpuset) + attr->cpusetsize, 0,
cpusetsize - attr->cpusetsize);
} else {
int kern_size = _get_kern_cpuset_size();
size_t kern_size = _get_kern_cpuset_size();
memset(cpuset, -1, MIN(cpusetsize, kern_size));
if (cpusetsize > kern_size)
memset(((char *)cpuset) + kern_size, 0,

View File

@ -29,10 +29,12 @@
* $FreeBSD$
*/
#include "namespace.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include "un-namespace.h"
#include "thr_private.h"