summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2016-04-11 15:24:59 +0000
committergjb <gjb@FreeBSD.org>2016-04-11 15:24:59 +0000
commite0e3598ce13850597a66fd28d102b36881f7d610 (patch)
treef5194d1ce3fa45b67cf63080fc519fec83abc57a /lib
parentcbc3bd9845ba5fd58e8132f9565cfbc41433938d (diff)
parent26836fccd261358467b3d92e77ff4695af286de9 (diff)
downloadFreeBSD-src-e0e3598ce13850597a66fd28d102b36881f7d610.zip
FreeBSD-src-e0e3598ce13850597a66fd28d102b36881f7d610.tar.gz
MFH
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/aarch64/gen/Makefile.inc2
-rw-r--r--lib/libc/aarch64/sys/Makefile.inc2
-rw-r--r--lib/libc/db/hash/hash.c5
-rw-r--r--lib/libc/db/hash/hash_buf.c4
-rw-r--r--lib/libc/gen/err.c8
-rw-r--r--lib/libc/gen/getmntinfo.c2
-rw-r--r--lib/libc/gen/opendir.c2
-rw-r--r--lib/libc/gen/semctl.c6
-rw-r--r--lib/libc/gen/tls.c4
-rw-r--r--lib/libc/include/compat.h2
-rw-r--r--lib/libc/locale/xlocale_private.h11
-rw-r--r--lib/libc/net/base64.c2
-rw-r--r--lib/libc/net/getifaddrs.c3
-rw-r--r--lib/libc/net/getservent.c4
-rw-r--r--lib/libc/net/rcmd.c2
-rw-r--r--lib/libc/posix1e/acl_support_nfs4.c2
-rw-r--r--lib/libc/resolv/mtctxres.c11
-rw-r--r--lib/libc/resolv/res_init.c4
-rw-r--r--lib/libc/resolv/res_mkupdate.c4
-rw-r--r--lib/libc/rpc/auth_none.c6
-rw-r--r--lib/libc/rpc/clnt_perror.c8
-rw-r--r--lib/libc/rpc/mt_misc.c2
-rw-r--r--lib/libc/rpc/rpcdname.c10
-rw-r--r--lib/libc/softfloat/timesoftfloat.c6
-rw-r--r--lib/libc/uuid/uuid_to_string.c2
-rw-r--r--lib/libc/xdr/xdr_mem.c2
-rw-r--r--lib/libedit/filecomplete.c4
-rw-r--r--lib/libedit/vi.c4
-rw-r--r--lib/libfetch/ftp.c2
-rw-r--r--lib/libpam/modules/pam_krb5/pam_krb5.c2
-rw-r--r--lib/libpam/modules/pam_login_access/login_access.c4
-rw-r--r--lib/libthr/thread/thr_affinity.c6
-rw-r--r--lib/libthr/thread/thr_attr.c5
-rw-r--r--lib/libthr/thread/thr_autoinit.c5
-rw-r--r--lib/libthr/thread/thr_barrier.c8
-rw-r--r--lib/libthr/thread/thr_barrierattr.c5
-rw-r--r--lib/libthr/thread/thr_cancel.c6
-rw-r--r--lib/libthr/thread/thr_clean.c5
-rw-r--r--lib/libthr/thread/thr_concurrency.c5
-rw-r--r--lib/libthr/thread/thr_cond.c8
-rw-r--r--lib/libthr/thread/thr_condattr.c5
-rw-r--r--lib/libthr/thread/thr_create.c5
-rw-r--r--lib/libthr/thread/thr_detach.c6
-rw-r--r--lib/libthr/thread/thr_equal.c6
-rw-r--r--lib/libthr/thread/thr_event.c5
-rw-r--r--lib/libthr/thread/thr_exit.c5
-rw-r--r--lib/libthr/thread/thr_fork.c5
-rw-r--r--lib/libthr/thread/thr_getcpuclockid.c5
-rw-r--r--lib/libthr/thread/thr_getprio.c6
-rw-r--r--lib/libthr/thread/thr_getschedparam.c5
-rw-r--r--lib/libthr/thread/thr_getthreadid_np.c5
-rw-r--r--lib/libthr/thread/thr_info.c5
-rw-r--r--lib/libthr/thread/thr_init.c5
-rw-r--r--lib/libthr/thread/thr_join.c6
-rw-r--r--lib/libthr/thread/thr_kern.c5
-rw-r--r--lib/libthr/thread/thr_kill.c5
-rw-r--r--lib/libthr/thread/thr_list.c5
-rw-r--r--lib/libthr/thread/thr_main_np.c9
-rw-r--r--lib/libthr/thread/thr_multi_np.c7
-rw-r--r--lib/libthr/thread/thr_mutex.c8
-rw-r--r--lib/libthr/thread/thr_mutexattr.c5
-rw-r--r--lib/libthr/thread/thr_once.c6
-rw-r--r--lib/libthr/thread/thr_printf.c5
-rw-r--r--lib/libthr/thread/thr_pspinlock.c8
-rw-r--r--lib/libthr/thread/thr_resume_np.c5
-rw-r--r--lib/libthr/thread/thr_rtld.c6
-rw-r--r--lib/libthr/thread/thr_rwlock.c8
-rw-r--r--lib/libthr/thread/thr_rwlockattr.c5
-rw-r--r--lib/libthr/thread/thr_self.c5
-rw-r--r--lib/libthr/thread/thr_sem.c5
-rw-r--r--lib/libthr/thread/thr_setprio.c5
-rw-r--r--lib/libthr/thread/thr_setschedparam.c5
-rw-r--r--lib/libthr/thread/thr_sig.c5
-rw-r--r--lib/libthr/thread/thr_single_np.c8
-rw-r--r--lib/libthr/thread/thr_sleepq.c5
-rw-r--r--lib/libthr/thread/thr_spec.c5
-rw-r--r--lib/libthr/thread/thr_spinlock.c6
-rw-r--r--lib/libthr/thread/thr_stack.c5
-rw-r--r--lib/libthr/thread/thr_suspend_np.c5
-rw-r--r--lib/libthr/thread/thr_switch_np.c5
-rw-r--r--lib/libthr/thread/thr_symbols.c5
-rw-r--r--lib/libthr/thread/thr_umtx.c6
-rw-r--r--lib/libthr/thread/thr_yield.c5
-rw-r--r--lib/libusb/libusb20.c4
-rw-r--r--lib/libusbhid/descr.c2
-rw-r--r--lib/libusbhid/usage.c6
86 files changed, 255 insertions, 183 deletions
diff --git a/lib/libc/aarch64/gen/Makefile.inc b/lib/libc/aarch64/gen/Makefile.inc
index f138008..fe39136 100644
--- a/lib/libc/aarch64/gen/Makefile.inc
+++ b/lib/libc/aarch64/gen/Makefile.inc
@@ -1,5 +1,7 @@
# $FreeBSD$
+CFLAGS+= -DNO_COMPAT7
+
SRCS+= _ctx_start.S \
fabs.S \
flt_rounds.c \
diff --git a/lib/libc/aarch64/sys/Makefile.inc b/lib/libc/aarch64/sys/Makefile.inc
index b33b568..5a8c595 100644
--- a/lib/libc/aarch64/sys/Makefile.inc
+++ b/lib/libc/aarch64/sys/Makefile.inc
@@ -1,5 +1,7 @@
# $FreeBSD$
+MIASM:= ${MIASM:Nfreebsd[467]_*}
+
SRCS+= __vdso_gettc.c
#MDASM= ptrace.S
diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c
index 02503ee..f7b1427 100644
--- a/lib/libc/db/hash/hash.c
+++ b/lib/libc/db/hash/hash.c
@@ -423,7 +423,8 @@ hdestroy(HTAB *hashp)
free(hashp->tmp_buf);
if (hashp->fp != -1) {
- (void)_fsync(hashp->fp);
+ if (hashp->save_file)
+ (void)_fsync(hashp->fp);
(void)_close(hashp->fp);
}
@@ -770,7 +771,7 @@ next_bucket:
if (__big_keydata(hashp, bufp, key, data, 1))
return (ERROR);
} else {
- if (hashp->cpage == 0)
+ if (hashp->cpage == NULL)
return (ERROR);
key->data = (u_char *)hashp->cpage->page + bp[ndx];
key->size = (ndx > 1 ? bp[ndx - 1] : hashp->BSIZE) - bp[ndx];
diff --git a/lib/libc/db/hash/hash_buf.c b/lib/libc/db/hash/hash_buf.c
index e79e7b3..5c62a2c 100644
--- a/lib/libc/db/hash/hash_buf.c
+++ b/lib/libc/db/hash/hash_buf.c
@@ -245,7 +245,7 @@ newbuf(HTAB *hashp, u_int32_t addr, BUFHEAD *prev_bp)
*/
for (xbp = bp; xbp->ovfl;) {
next_xbp = xbp->ovfl;
- xbp->ovfl = 0;
+ xbp->ovfl = NULL;
xbp = next_xbp;
/* Check that ovfl pointer is up date. */
@@ -350,7 +350,7 @@ __buf_free(HTAB *hashp, int do_free, int to_disk)
void
__reclaim_buf(HTAB *hashp, BUFHEAD *bp)
{
- bp->ovfl = 0;
+ bp->ovfl = NULL;
bp->addr = 0;
bp->flags = 0;
BUF_REMOVE(bp);
diff --git a/lib/libc/gen/err.c b/lib/libc/gen/err.c
index a536e5a..3b32c3d 100644
--- a/lib/libc/gen/err.c
+++ b/lib/libc/gen/err.c
@@ -96,7 +96,7 @@ errc(int eval, int code, const char *fmt, ...)
void
verrc(int eval, int code, const char *fmt, va_list ap)
{
- if (err_file == 0)
+ if (err_file == NULL)
err_set_file((FILE *)0);
fprintf(err_file, "%s: ", _getprogname());
if (fmt != NULL) {
@@ -121,7 +121,7 @@ errx(int eval, const char *fmt, ...)
void
verrx(int eval, const char *fmt, va_list ap)
{
- if (err_file == 0)
+ if (err_file == NULL)
err_set_file((FILE *)0);
fprintf(err_file, "%s: ", _getprogname());
if (fmt != NULL)
@@ -161,7 +161,7 @@ warnc(int code, const char *fmt, ...)
void
vwarnc(int code, const char *fmt, va_list ap)
{
- if (err_file == 0)
+ if (err_file == NULL)
err_set_file((FILE *)0);
fprintf(err_file, "%s: ", _getprogname());
if (fmt != NULL) {
@@ -183,7 +183,7 @@ warnx(const char *fmt, ...)
void
vwarnx(const char *fmt, va_list ap)
{
- if (err_file == 0)
+ if (err_file == NULL)
err_set_file((FILE *)0);
fprintf(err_file, "%s: ", _getprogname());
if (fmt != NULL)
diff --git a/lib/libc/gen/getmntinfo.c b/lib/libc/gen/getmntinfo.c
index 99f82aa..606fea7 100644
--- a/lib/libc/gen/getmntinfo.c
+++ b/lib/libc/gen/getmntinfo.c
@@ -56,7 +56,7 @@ getmntinfo(struct statfs **mntbufp, int flags)
if (mntbuf)
free(mntbuf);
bufsize = (mntsize + 1) * sizeof(struct statfs);
- if ((mntbuf = (struct statfs *)malloc(bufsize)) == 0)
+ if ((mntbuf = malloc(bufsize)) == NULL)
return (0);
if ((mntsize = getfsstat(mntbuf, bufsize, flags)) < 0)
return (0);
diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c
index 54928e7..bf4dea3 100644
--- a/lib/libc/gen/opendir.c
+++ b/lib/libc/gen/opendir.c
@@ -209,7 +209,7 @@ _filldir(DIR *dirp, bool use_current_pos)
* On the second pass, save pointers to each one.
* Then sort the pointers and remove duplicate names.
*/
- for (dpv = 0;;) {
+ for (dpv = NULL;;) {
n = 0;
ddptr = buf;
while (ddptr < ddeptr) {
diff --git a/lib/libc/gen/semctl.c b/lib/libc/gen/semctl.c
index c68734d..0e418f6 100644
--- a/lib/libc/gen/semctl.c
+++ b/lib/libc/gen/semctl.c
@@ -29,7 +29,9 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#ifndef NO_COMPAT7
#define _WANT_SEMUN_OLD
+#endif
#include <sys/types.h>
#include <sys/ipc.h>
@@ -38,8 +40,10 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
int __semctl(int semid, int semnum, int cmd, union semun *arg);
+#ifndef NO_COMPAT7
int freebsd7___semctl(int semid, int semnum, int cmd, union semun_old *arg);
int freebsd7_semctl(int semid, int semnum, int cmd, ...);
+#endif
int
semctl(int semid, int semnum, int cmd, ...)
@@ -61,6 +65,7 @@ semctl(int semid, int semnum, int cmd, ...)
return (__semctl(semid, semnum, cmd, semun_ptr));
}
+#ifndef NO_COMPAT7
int
freebsd7_semctl(int semid, int semnum, int cmd, ...)
{
@@ -82,3 +87,4 @@ freebsd7_semctl(int semid, int semnum, int cmd, ...)
}
__sym_compat(semctl, freebsd7_semctl, FBSD_1.0);
+#endif
diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c
index 7932055..dd1e7df 100644
--- a/lib/libc/gen/tls.c
+++ b/lib/libc/gen/tls.c
@@ -285,7 +285,7 @@ _init_tls(void)
while (*sp++ != 0)
;
aux = (Elf_Auxinfo *) sp;
- phdr = 0;
+ phdr = NULL;
phent = phnum = 0;
for (auxp = aux; auxp->a_type != AT_NULL; auxp++) {
switch (auxp->a_type) {
@@ -302,7 +302,7 @@ _init_tls(void)
break;
}
}
- if (phdr == 0 || phent != sizeof(Elf_Phdr) || phnum == 0)
+ if (phdr == NULL || phent != sizeof(Elf_Phdr) || phnum == 0)
return;
for (i = 0; (unsigned) i < phnum; i++) {
diff --git a/lib/libc/include/compat.h b/lib/libc/include/compat.h
index b20fac5..e83d13c 100644
--- a/lib/libc/include/compat.h
+++ b/lib/libc/include/compat.h
@@ -38,9 +38,11 @@
#define __sym_compat(sym,impl,verid) \
.symver impl, sym@verid
+#ifndef NO_COMPAT7
__sym_compat(__semctl, freebsd7___semctl, FBSD_1.0);
__sym_compat(msgctl, freebsd7_msgctl, FBSD_1.0);
__sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0);
+#endif
#undef __sym_compat
diff --git a/lib/libc/locale/xlocale_private.h b/lib/libc/locale/xlocale_private.h
index 502b548..77b9ff4 100644
--- a/lib/libc/locale/xlocale_private.h
+++ b/lib/libc/locale/xlocale_private.h
@@ -155,12 +155,11 @@ __attribute__((unused)) static void
xlocale_release(void *val)
{
struct xlocale_refcounted *obj = val;
- long count = atomic_fetchadd_long(&(obj->retain_count), -1) - 1;
- if (count < 0) {
- if (0 != obj->destructor) {
- obj->destructor(obj);
- }
- }
+ long count;
+
+ count = atomic_fetchadd_long(&(obj->retain_count), -1) - 1;
+ if (count < 0 && obj->destructor != NULL)
+ obj->destructor(obj);
}
/**
diff --git a/lib/libc/net/base64.c b/lib/libc/net/base64.c
index 8a9c59e..2c4cfe3 100644
--- a/lib/libc/net/base64.c
+++ b/lib/libc/net/base64.c
@@ -210,7 +210,7 @@ b64_pton(const char *src, u_char *target, size_t targsize)
break;
pos = strchr(Base64, ch);
- if (pos == 0) /* A non-base64 character. */
+ if (pos == NULL) /* A non-base64 character. */
return (-1);
switch (state) {
diff --git a/lib/libc/net/getifaddrs.c b/lib/libc/net/getifaddrs.c
index f8633d5..4c04e9e 100644
--- a/lib/libc/net/getifaddrs.c
+++ b/lib/libc/net/getifaddrs.c
@@ -85,7 +85,7 @@ getifaddrs(struct ifaddrs **pif)
size_t needed;
char *buf;
char *next;
- struct ifaddrs *cif = 0;
+ struct ifaddrs *cif;
char *p, *p0;
struct rt_msghdr *rtm;
struct if_msghdrl *ifm;
@@ -214,6 +214,7 @@ getifaddrs(struct ifaddrs **pif)
ift = ifa;
idx = 0;
+ cif = NULL;
for (next = buf; next < buf + needed; next += rtm->rtm_msglen) {
rtm = (struct rt_msghdr *)(void *)next;
if (rtm->rtm_version != RTM_VERSION)
diff --git a/lib/libc/net/getservent.c b/lib/libc/net/getservent.c
index 6a68ef5..45a5355 100644
--- a/lib/libc/net/getservent.c
+++ b/lib/libc/net/getservent.c
@@ -406,14 +406,14 @@ files_servent(void *retval, void *mdata, va_list ap)
continue;
gotname:
- if (proto == 0 || strcmp(serv->s_proto, proto) == 0)
+ if (proto == NULL || strcmp(serv->s_proto, proto) == 0)
rv = NS_SUCCESS;
break;
case nss_lt_id:
if (port != serv->s_port)
continue;
- if (proto == 0 || strcmp(serv->s_proto, proto) == 0)
+ if (proto == NULL || strcmp(serv->s_proto, proto) == 0)
rv = NS_SUCCESS;
break;
case nss_lt_all:
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c
index c7ca870..7b92f08 100644
--- a/lib/libc/net/rcmd.c
+++ b/lib/libc/net/rcmd.c
@@ -207,7 +207,7 @@ rcmd_af(char **ahost, int rport, const char *locuser, const char *remuser,
}
}
lport--;
- if (fd2p == 0) {
+ if (fd2p == NULL) {
_write(s, "", 1);
lport = 0;
} else {
diff --git a/lib/libc/posix1e/acl_support_nfs4.c b/lib/libc/posix1e/acl_support_nfs4.c
index 1eece98..7dd7f04 100644
--- a/lib/libc/posix1e/acl_support_nfs4.c
+++ b/lib/libc/posix1e/acl_support_nfs4.c
@@ -81,7 +81,7 @@ static const char *
format_flag(uint32_t *var, const struct flagnames_struct *flags)
{
- for (; flags->name != 0; flags++) {
+ for (; flags->name != NULL; flags++) {
if ((flags->flag & *var) == 0)
continue;
diff --git a/lib/libc/resolv/mtctxres.c b/lib/libc/resolv/mtctxres.c
index f02a7f5..c2aea38 100644
--- a/lib/libc/resolv/mtctxres.c
+++ b/lib/libc/resolv/mtctxres.c
@@ -75,7 +75,7 @@ __res_init_ctx(void) {
return (0);
}
- if ((mt = malloc(sizeof (mtctxres_t))) == 0) {
+ if ((mt = malloc(sizeof(mtctxres_t))) == NULL) {
errno = ENOMEM;
return (-1);
}
@@ -94,10 +94,7 @@ __res_init_ctx(void) {
static void
__res_destroy_ctx(void *value) {
- mtctxres_t *mt = (mtctxres_t *)value;
-
- if (mt != 0)
- free(mt);
+ free(value);
}
#endif
@@ -130,9 +127,9 @@ ___mtctxres(void) {
* that fails return a global context.
*/
if (mt_key_initialized) {
- if (((mt = pthread_getspecific(key)) != 0) ||
+ if (((mt = pthread_getspecific(key)) != NULL) ||
(__res_init_ctx() == 0 &&
- (mt = pthread_getspecific(key)) != 0)) {
+ (mt = pthread_getspecific(key)) != NULL)) {
return (mt);
}
}
diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c
index 8832342..9856322 100644
--- a/lib/libc/resolv/res_init.c
+++ b/lib/libc/resolv/res_init.c
@@ -315,7 +315,7 @@ __res_vinit(res_state statp, int preinit) {
while (*cp != '\0' && *cp != ' ' && *cp != '\t' && *cp != '\n')
cp++;
*cp = '\0';
- *pp++ = 0;
+ *pp++ = NULL;
}
#define MATCH(line, name) \
@@ -391,7 +391,7 @@ __res_vinit(res_state statp, int preinit) {
while (*cp != '\0' && *cp != ' ' && *cp != '\t')
cp++;
*cp = '\0';
- *pp++ = 0;
+ *pp++ = NULL;
havesearch = 1;
continue;
}
diff --git a/lib/libc/resolv/res_mkupdate.c b/lib/libc/resolv/res_mkupdate.c
index c076c1e5..3ebb242 100644
--- a/lib/libc/resolv/res_mkupdate.c
+++ b/lib/libc/resolv/res_mkupdate.c
@@ -1175,7 +1175,7 @@ res_protocolname(int num) {
if (protolist == (struct valuelist *)0)
res_buildprotolist();
pp = cgetprotobynumber(num);
- if (pp == 0) {
+ if (pp == NULL) {
(void) sprintf(number, "%d", num);
return (number);
}
@@ -1190,7 +1190,7 @@ res_servicename(u_int16_t port, const char *proto) { /*%< Host byte order. */
if (servicelist == (struct valuelist *)0)
res_buildservicelist();
ss = cgetservbyport(htons(port), proto);
- if (ss == 0) {
+ if (ss == NULL) {
(void) sprintf(number, "%d", port);
return (number);
}
diff --git a/lib/libc/rpc/auth_none.c b/lib/libc/rpc/auth_none.c
index 0b846eb..32bebeb 100644
--- a/lib/libc/rpc/auth_none.c
+++ b/lib/libc/rpc/auth_none.c
@@ -83,9 +83,9 @@ authnone_create(void)
XDR *xdrs;
mutex_lock(&authnone_lock);
- if (ap == 0) {
- ap = (struct authnone_private *)calloc(1, sizeof (*ap));
- if (ap == 0) {
+ if (ap == NULL) {
+ ap = calloc(1, sizeof (*ap));
+ if (ap == NULL) {
mutex_unlock(&authnone_lock);
return (0);
}
diff --git a/lib/libc/rpc/clnt_perror.c b/lib/libc/rpc/clnt_perror.c
index 15d7280..d674fbb 100644
--- a/lib/libc/rpc/clnt_perror.c
+++ b/lib/libc/rpc/clnt_perror.c
@@ -64,8 +64,8 @@ static char *
_buf(void)
{
- if (buf == 0)
- buf = (char *)malloc(CLNT_PERROR_BUFLEN);
+ if (buf == NULL)
+ buf = malloc(CLNT_PERROR_BUFLEN);
return (buf);
}
@@ -85,7 +85,7 @@ clnt_sperror(CLIENT *rpch, const char *s)
assert(s != NULL);
str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */
- if (str == 0)
+ if (str == NULL)
return (0);
len = CLNT_PERROR_BUFLEN;
strstart = str;
@@ -240,7 +240,7 @@ clnt_spcreateerror(const char *s)
assert(s != NULL);
str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */
- if (str == 0)
+ if (str == NULL)
return(0);
len = CLNT_PERROR_BUFLEN;
i = snprintf(str, len, "%s: ", s);
diff --git a/lib/libc/rpc/mt_misc.c b/lib/libc/rpc/mt_misc.c
index 0ec4d8a..a1b8057 100644
--- a/lib/libc/rpc/mt_misc.c
+++ b/lib/libc/rpc/mt_misc.c
@@ -95,7 +95,7 @@ rce_key_init(void)
struct rpc_createerr *
__rpc_createerr(void)
{
- struct rpc_createerr *rce_addr = 0;
+ struct rpc_createerr *rce_addr = NULL;
if (thr_main())
return (&rpc_createerr);
diff --git a/lib/libc/rpc/rpcdname.c b/lib/libc/rpc/rpcdname.c
index f214b21..08b5d7d 100644
--- a/lib/libc/rpc/rpcdname.c
+++ b/lib/libc/rpc/rpcdname.c
@@ -43,20 +43,20 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include "un-namespace.h"
-static char *default_domain = 0;
+static char *default_domain;
static char *
get_default_domain(void)
{
char temp[256];
- if (default_domain)
+ if (default_domain != NULL)
return (default_domain);
if (getdomainname(temp, sizeof(temp)) < 0)
return (0);
if ((int) strlen(temp) > 0) {
- default_domain = (char *)malloc((strlen(temp)+(unsigned)1));
- if (default_domain == 0)
+ default_domain = malloc((strlen(temp) + (unsigned)1));
+ if (default_domain == NULL)
return (0);
(void) strcpy(default_domain, temp);
return (default_domain);
@@ -73,7 +73,7 @@ get_default_domain(void)
int
__rpc_get_default_domain(char **domain)
{
- if ((*domain = get_default_domain()) != 0)
+ if ((*domain = get_default_domain()) != NULL)
return (0);
return (-1);
}
diff --git a/lib/libc/softfloat/timesoftfloat.c b/lib/libc/softfloat/timesoftfloat.c
index 98b6ba2..b97c8b0 100644
--- a/lib/libc/softfloat/timesoftfloat.c
+++ b/lib/libc/softfloat/timesoftfloat.c
@@ -2068,14 +2068,14 @@ static void
roundingPrecisionName = "80";
}
else {
- roundingPrecisionName = 0;
+ roundingPrecisionName = NULL;
}
#ifdef FLOATX80
floatx80_rounding_precision = roundingPrecision;
#endif
switch ( roundingMode ) {
case 0:
- roundingModeName = 0;
+ roundingModeName = NULL;
roundingCode = float_round_nearest_even;
break;
case ROUND_NEAREST_EVEN:
@@ -2098,7 +2098,7 @@ static void
float_rounding_mode = roundingCode;
switch ( tininessMode ) {
case 0:
- tininessModeName = 0;
+ tininessModeName = NULL;
tininessCode = float_tininess_after_rounding;
break;
case TININESS_BEFORE_ROUNDING:
diff --git a/lib/libc/uuid/uuid_to_string.c b/lib/libc/uuid/uuid_to_string.c
index f816391..35f8581 100644
--- a/lib/libc/uuid/uuid_to_string.c
+++ b/lib/libc/uuid/uuid_to_string.c
@@ -49,7 +49,7 @@ uuid_to_string(const uuid_t *u, char **s, uint32_t *status)
*status = uuid_s_ok;
/* Why allow a NULL-pointer here? */
- if (s == 0)
+ if (s == NULL)
return;
if (u == NULL) {
diff --git a/lib/libc/xdr/xdr_mem.c b/lib/libc/xdr/xdr_mem.c
index 0455a5a..ecefb2e 100644
--- a/lib/libc/xdr/xdr_mem.c
+++ b/lib/libc/xdr/xdr_mem.c
@@ -215,7 +215,7 @@ xdrmem_setpos(XDR *xdrs, u_int pos)
static int32_t *
xdrmem_inline_aligned(XDR *xdrs, u_int len)
{
- int32_t *buf = 0;
+ int32_t *buf = NULL;
if (xdrs->x_handy >= len) {
xdrs->x_handy -= len;
diff --git a/lib/libedit/filecomplete.c b/lib/libedit/filecomplete.c
index 10d44e4..4527302 100644
--- a/lib/libedit/filecomplete.c
+++ b/lib/libedit/filecomplete.c
@@ -471,7 +471,7 @@ fn_complete(EditLine *el,
/* these can be used by function called in completion_matches() */
/* or (*attempted_completion_function)() */
- if (point != 0)
+ if (point != NULL)
*point = (int)(li->cursor - li->buffer);
if (end != NULL)
*end = (int)(li->lastchar - li->buffer);
@@ -483,7 +483,7 @@ fn_complete(EditLine *el,
&el->el_scratch),
cur_off - (int)len, cur_off);
} else
- matches = 0;
+ matches = NULL;
if (!attempted_completion_function ||
(over != NULL && !*over && !matches))
matches = completion_matches(
diff --git a/lib/libedit/vi.c b/lib/libedit/vi.c
index 0a426fd..6b0a775 100644
--- a/lib/libedit/vi.c
+++ b/lib/libedit/vi.c
@@ -1088,7 +1088,7 @@ vi_history_word(EditLine *el, Int c __attribute__((__unused__)))
if (wp == NULL)
return CC_ERROR;
- wep = wsp = 0;
+ wep = wsp = NULL;
do {
while (Isspace(*wp))
wp++;
@@ -1101,7 +1101,7 @@ vi_history_word(EditLine *el, Int c __attribute__((__unused__)))
} while ((!el->el_state.doingarg || --el->el_state.argument > 0)
&& *wp != 0);
- if (wsp == 0 || (el->el_state.doingarg && el->el_state.argument != 0))
+ if (wsp == NULL || (el->el_state.doingarg && el->el_state.argument != 0))
return CC_ERROR;
cv_undo(el);
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c
index 4e650b9..dd58c0d 100644
--- a/lib/libfetch/ftp.c
+++ b/lib/libfetch/ftp.c
@@ -929,7 +929,7 @@ ftp_authenticate(conn_t *conn, struct url *url, struct url *purl)
if (*pwd == '\0')
pwd = getenv("FTP_PASSWORD");
if (pwd == NULL || *pwd == '\0') {
- if ((logname = getlogin()) == 0)
+ if ((logname = getlogin()) == NULL)
logname = FTP_ANONYMOUS_USER;
if ((len = snprintf(pbuf, MAXLOGNAME + 1, "%s@", logname)) < 0)
len = 0;
diff --git a/lib/libpam/modules/pam_krb5/pam_krb5.c b/lib/libpam/modules/pam_krb5/pam_krb5.c
index 19592e3..8c72e28 100644
--- a/lib/libpam/modules/pam_krb5/pam_krb5.c
+++ b/lib/libpam/modules/pam_krb5/pam_krb5.c
@@ -860,7 +860,7 @@ verify_krb_v5_tgt(krb5_context context, krb5_ccache ccache,
services[0] = "host";
services[1] = pam_service;
services[2] = NULL;
- keyblock = 0;
+ keyblock = NULL;
retval = -1;
for (service = &services[0]; *service != NULL; service++) {
retval = krb5_sname_to_principal(context, NULL, *service,
diff --git a/lib/libpam/modules/pam_login_access/login_access.c b/lib/libpam/modules/pam_login_access/login_access.c
index dacb9d7..9b6d257 100644
--- a/lib/libpam/modules/pam_login_access/login_access.c
+++ b/lib/libpam/modules/pam_login_access/login_access.c
@@ -124,7 +124,7 @@ list_match(char *list, const char *item,
* the match is affected by any exceptions.
*/
- for (tok = strtok(list, sep); tok != 0; tok = strtok((char *) 0, sep)) {
+ for (tok = strtok(list, sep); tok != NULL; tok = strtok((char *) 0, sep)) {
if (strcasecmp(tok, "EXCEPT") == 0) /* EXCEPT: give up */
break;
if ((match = (*match_fn)(tok, item)) != 0) /* YES */
@@ -135,7 +135,7 @@ list_match(char *list, const char *item,
if (match != NO) {
while ((tok = strtok((char *) 0, sep)) && strcasecmp(tok, "EXCEPT"))
/* VOID */ ;
- if (tok == 0 || list_match((char *) 0, item, match_fn) == NO)
+ if (tok == NULL || list_match((char *) 0, item, match_fn) == NO)
return (match);
}
return (NO);
diff --git a/lib/libthr/thread/thr_affinity.c b/lib/libthr/thread/thr_affinity.c
index 7e9b0f9..e76ca2a 100644
--- a/lib/libthr/thread/thr_affinity.c
+++ b/lib/libthr/thread/thr_affinity.c
@@ -22,11 +22,11 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- *
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <pthread_np.h>
#include <sys/param.h>
diff --git a/lib/libthr/thread/thr_attr.c b/lib/libthr/thread/thr_attr.c
index 0cac528..ff9eb2d5 100644
--- a/lib/libthr/thread/thr_attr.c
+++ b/lib/libthr/thread/thr_attr.c
@@ -89,10 +89,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <errno.h>
#include <pthread.h>
diff --git a/lib/libthr/thread/thr_autoinit.c b/lib/libthr/thread/thr_autoinit.c
index c425569..7d9e52c 100644
--- a/lib/libthr/thread/thr_autoinit.c
+++ b/lib/libthr/thread/thr_autoinit.c
@@ -29,10 +29,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <pthread.h>
#include "thr_private.h"
diff --git a/lib/libthr/thread/thr_barrier.c b/lib/libthr/thread/thr_barrier.c
index 45ca41a..dd8f48e 100644
--- a/lib/libthr/thread/thr_barrier.c
+++ b/lib/libthr/thread/thr_barrier.c
@@ -22,10 +22,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <errno.h>
#include <stdlib.h>
@@ -34,6 +35,9 @@
#include "thr_private.h"
+_Static_assert(sizeof(struct pthread_barrier) <= PAGE_SIZE,
+ "pthread_barrier is too large for off-page");
+
__weak_reference(_pthread_barrier_init, pthread_barrier_init);
__weak_reference(_pthread_barrier_wait, pthread_barrier_wait);
__weak_reference(_pthread_barrier_destroy, pthread_barrier_destroy);
diff --git a/lib/libthr/thread/thr_barrierattr.c b/lib/libthr/thread/thr_barrierattr.c
index e98a66f..acaa059 100644
--- a/lib/libthr/thread/thr_barrierattr.c
+++ b/lib/libthr/thread/thr_barrierattr.c
@@ -24,10 +24,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <errno.h>
#include <stdlib.h>
diff --git a/lib/libthr/thread/thr_cancel.c b/lib/libthr/thread/thr_cancel.c
index beae707..c080931 100644
--- a/lib/libthr/thread/thr_cancel.c
+++ b/lib/libthr/thread/thr_cancel.c
@@ -22,11 +22,11 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- *
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <pthread.h>
#include "un-namespace.h"
diff --git a/lib/libthr/thread/thr_clean.c b/lib/libthr/thread/thr_clean.c
index f200726..62e3db2 100644
--- a/lib/libthr/thread/thr_clean.c
+++ b/lib/libthr/thread/thr_clean.c
@@ -25,10 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <signal.h>
#include <errno.h>
diff --git a/lib/libthr/thread/thr_concurrency.c b/lib/libthr/thread/thr_concurrency.c
index 61f0c4a..24714e6 100644
--- a/lib/libthr/thread/thr_concurrency.c
+++ b/lib/libthr/thread/thr_concurrency.c
@@ -28,10 +28,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <errno.h>
#include <pthread.h>
diff --git a/lib/libthr/thread/thr_cond.c b/lib/libthr/thread/thr_cond.c
index 934f9a0..0e37b70 100644
--- a/lib/libthr/thread/thr_cond.c
+++ b/lib/libthr/thread/thr_cond.c
@@ -26,10 +26,11 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <stdlib.h>
#include <errno.h>
@@ -40,6 +41,9 @@
#include "thr_private.h"
+_Static_assert(sizeof(struct pthread_cond) <= PAGE_SIZE,
+ "pthread_cond too large");
+
/*
* Prototypes
*/
diff --git a/lib/libthr/thread/thr_condattr.c b/lib/libthr/thread/thr_condattr.c
index 7ce827b..906ea77 100644
--- a/lib/libthr/thread/thr_condattr.c
+++ b/lib/libthr/thread/thr_condattr.c
@@ -25,10 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libthr/thread/thr_create.c b/lib/libthr/thread/thr_create.c
index 81a95da..ee2c727 100644
--- a/lib/libthr/thread/thr_create.c
+++ b/lib/libthr/thread/thr_create.c
@@ -23,10 +23,11 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <sys/types.h>
#include <sys/rtprio.h>
diff --git a/lib/libthr/thread/thr_detach.c b/lib/libthr/thread/thr_detach.c
index c494f7c..f03731f 100644
--- a/lib/libthr/thread/thr_detach.c
+++ b/lib/libthr/thread/thr_detach.c
@@ -23,11 +23,11 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- *
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <sys/types.h>
#include <errno.h>
diff --git a/lib/libthr/thread/thr_equal.c b/lib/libthr/thread/thr_equal.c
index 2f602b5..a9eed8c 100644
--- a/lib/libthr/thread/thr_equal.c
+++ b/lib/libthr/thread/thr_equal.c
@@ -25,9 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <pthread.h>
#include "un-namespace.h"
diff --git a/lib/libthr/thread/thr_event.c b/lib/libthr/thread/thr_event.c
index 716d21e..982f86a 100644
--- a/lib/libthr/thread/thr_event.c
+++ b/lib/libthr/thread/thr_event.c
@@ -22,10 +22,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "thr_private.h"
void
diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c
index 7001311..e76623c 100644
--- a/lib/libthr/thread/thr_exit.c
+++ b/lib/libthr/thread/thr_exit.c
@@ -25,10 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <errno.h>
#ifdef _PTHREAD_FORCED_UNWIND
diff --git a/lib/libthr/thread/thr_fork.c b/lib/libthr/thread/thr_fork.c
index 531e09c..1a646b0 100644
--- a/lib/libthr/thread/thr_fork.c
+++ b/lib/libthr/thread/thr_fork.c
@@ -23,8 +23,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
/*
@@ -57,6 +55,9 @@
*
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <sys/syscall.h>
#include "namespace.h"
#include <errno.h>
diff --git a/lib/libthr/thread/thr_getcpuclockid.c b/lib/libthr/thread/thr_getcpuclockid.c
index b4ec666..1ad6a08 100644
--- a/lib/libthr/thread/thr_getcpuclockid.c
+++ b/lib/libthr/thread/thr_getcpuclockid.c
@@ -22,10 +22,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <errno.h>
#include <pthread.h>
diff --git a/lib/libthr/thread/thr_getprio.c b/lib/libthr/thread/thr_getprio.c
index f0d1a296..033f4f5 100644
--- a/lib/libthr/thread/thr_getprio.c
+++ b/lib/libthr/thread/thr_getprio.c
@@ -25,9 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <errno.h>
#include <pthread.h>
diff --git a/lib/libthr/thread/thr_getschedparam.c b/lib/libthr/thread/thr_getschedparam.c
index ff6c3ab..04ff399 100644
--- a/lib/libthr/thread/thr_getschedparam.c
+++ b/lib/libthr/thread/thr_getschedparam.c
@@ -28,10 +28,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <sys/types.h>
#include <sys/rtprio.h>
diff --git a/lib/libthr/thread/thr_getthreadid_np.c b/lib/libthr/thread/thr_getthreadid_np.c
index f963a56..e7b496e 100644
--- a/lib/libthr/thread/thr_getthreadid_np.c
+++ b/lib/libthr/thread/thr_getthreadid_np.c
@@ -21,10 +21,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <pthread.h>
#include <pthread_np.h>
diff --git a/lib/libthr/thread/thr_info.c b/lib/libthr/thread/thr_info.c
index 350c848..4e4f41e 100644
--- a/lib/libthr/thread/thr_info.c
+++ b/lib/libthr/thread/thr_info.c
@@ -25,10 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c
index c9f30ab..c852406 100644
--- a/lib/libthr/thread/thr_init.c
+++ b/lib/libthr/thread/thr_init.c
@@ -29,10 +29,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <sys/types.h>
#include <sys/signalvar.h>
diff --git a/lib/libthr/thread/thr_join.c b/lib/libthr/thread/thr_join.c
index a39ff67..42bd749 100644
--- a/lib/libthr/thread/thr_join.c
+++ b/lib/libthr/thread/thr_join.c
@@ -22,11 +22,11 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- *
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <errno.h>
#include <pthread.h>
diff --git a/lib/libthr/thread/thr_kern.c b/lib/libthr/thread/thr_kern.c
index b5a8358..6463f1d 100644
--- a/lib/libthr/thread/thr_kern.c
+++ b/lib/libthr/thread/thr_kern.c
@@ -23,10 +23,11 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <sys/types.h>
#include <sys/signalvar.h>
#include <sys/rtprio.h>
diff --git a/lib/libthr/thread/thr_kill.c b/lib/libthr/thread/thr_kill.c
index 8b0f683..15928b1 100644
--- a/lib/libthr/thread/thr_kill.c
+++ b/lib/libthr/thread/thr_kill.c
@@ -25,10 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <errno.h>
#include <signal.h>
diff --git a/lib/libthr/thread/thr_list.c b/lib/libthr/thread/thr_list.c
index d27d87d..ae1f124 100644
--- a/lib/libthr/thread/thr_list.c
+++ b/lib/libthr/thread/thr_list.c
@@ -23,10 +23,11 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <sys/types.h>
#include <sys/queue.h>
diff --git a/lib/libthr/thread/thr_main_np.c b/lib/libthr/thread/thr_main_np.c
index bfa8b87..9558adf 100644
--- a/lib/libthr/thread/thr_main_np.c
+++ b/lib/libthr/thread/thr_main_np.c
@@ -23,10 +23,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <pthread.h>
#include <pthread_np.h>
@@ -37,10 +38,10 @@
__weak_reference(_pthread_main_np, pthread_main_np);
/*
- * Provide the equivelant to Solaris thr_main() function
+ * Provide the equivalent to Solaris thr_main() function.
*/
int
-_pthread_main_np()
+_pthread_main_np(void)
{
if (!_thr_initial)
diff --git a/lib/libthr/thread/thr_multi_np.c b/lib/libthr/thread/thr_multi_np.c
index 339a21d..74379f5 100644
--- a/lib/libthr/thread/thr_multi_np.c
+++ b/lib/libthr/thread/thr_multi_np.c
@@ -25,10 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <pthread.h>
#include <pthread_np.h>
@@ -37,7 +38,7 @@
__weak_reference(_pthread_multi_np, pthread_multi_np);
int
-_pthread_multi_np()
+_pthread_multi_np(void)
{
/* Return to multi-threaded scheduling mode: */
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index 865e4cf..28fd9ee 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -34,10 +34,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <stdbool.h>
#include "namespace.h"
#include <stdlib.h>
@@ -51,6 +52,9 @@
#include "thr_private.h"
+_Static_assert(sizeof(struct pthread_mutex) <= PAGE_SIZE,
+ "pthread_mutex is too large for off-page");
+
/*
* For adaptive mutexes, how many times to spin doing trylock2
* before entering the kernel to block
diff --git a/lib/libthr/thread/thr_mutexattr.c b/lib/libthr/thread/thr_mutexattr.c
index fa349cf..a9e07c2 100644
--- a/lib/libthr/thread/thr_mutexattr.c
+++ b/lib/libthr/thread/thr_mutexattr.c
@@ -25,8 +25,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
/*
@@ -59,6 +57,9 @@
*
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <string.h>
#include <stdlib.h>
diff --git a/lib/libthr/thread/thr_once.c b/lib/libthr/thread/thr_once.c
index 208b703..80739da 100644
--- a/lib/libthr/thread/thr_once.c
+++ b/lib/libthr/thread/thr_once.c
@@ -22,11 +22,11 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- *
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <pthread.h>
#include "un-namespace.h"
diff --git a/lib/libthr/thread/thr_printf.c b/lib/libthr/thread/thr_printf.c
index a64b446..ed94287 100644
--- a/lib/libthr/thread/thr_printf.c
+++ b/lib/libthr/thread/thr_printf.c
@@ -22,10 +22,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
diff --git a/lib/libthr/thread/thr_pspinlock.c b/lib/libthr/thread/thr_pspinlock.c
index 1c9b412..1c83b25 100644
--- a/lib/libthr/thread/thr_pspinlock.c
+++ b/lib/libthr/thread/thr_pspinlock.c
@@ -26,10 +26,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <errno.h>
#include <stdlib.h>
@@ -38,6 +39,9 @@
#include "thr_private.h"
+_Static_assert(sizeof(struct pthread_spinlock) <= PAGE_SIZE,
+ "pthread_spinlock is too large for off-page");
+
#define SPIN_COUNT 100000
__weak_reference(_pthread_spin_init, pthread_spin_init);
diff --git a/lib/libthr/thread/thr_resume_np.c b/lib/libthr/thread/thr_resume_np.c
index 53377da..d11e328 100644
--- a/lib/libthr/thread/thr_resume_np.c
+++ b/lib/libthr/thread/thr_resume_np.c
@@ -25,10 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <errno.h>
#include <pthread.h>
diff --git a/lib/libthr/thread/thr_rtld.c b/lib/libthr/thread/thr_rtld.c
index 6c407d1..6f5347d 100644
--- a/lib/libthr/thread/thr_rtld.c
+++ b/lib/libthr/thread/thr_rtld.c
@@ -22,11 +22,11 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- *
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
/*
* A lockless rwlock for rtld.
*/
diff --git a/lib/libthr/thread/thr_rwlock.c b/lib/libthr/thread/thr_rwlock.c
index aadd0e9..748eb52 100644
--- a/lib/libthr/thread/thr_rwlock.c
+++ b/lib/libthr/thread/thr_rwlock.c
@@ -22,10 +22,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
@@ -35,6 +36,9 @@
#include "un-namespace.h"
#include "thr_private.h"
+_Static_assert(sizeof(struct pthread_rwlock) <= PAGE_SIZE,
+ "pthread_rwlock is too large for off-page");
+
__weak_reference(_pthread_rwlock_destroy, pthread_rwlock_destroy);
__weak_reference(_pthread_rwlock_init, pthread_rwlock_init);
__weak_reference(_pthread_rwlock_rdlock, pthread_rwlock_rdlock);
diff --git a/lib/libthr/thread/thr_rwlockattr.c b/lib/libthr/thread/thr_rwlockattr.c
index b9e442e..56174ed 100644
--- a/lib/libthr/thread/thr_rwlockattr.c
+++ b/lib/libthr/thread/thr_rwlockattr.c
@@ -22,10 +22,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <errno.h>
#include <stdlib.h>
diff --git a/lib/libthr/thread/thr_self.c b/lib/libthr/thread/thr_self.c
index 72cda7e..65ad631 100644
--- a/lib/libthr/thread/thr_self.c
+++ b/lib/libthr/thread/thr_self.c
@@ -25,10 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <pthread.h>
#include "un-namespace.h"
diff --git a/lib/libthr/thread/thr_sem.c b/lib/libthr/thread/thr_sem.c
index f20bde3..a8b02ac 100644
--- a/lib/libthr/thread/thr_sem.c
+++ b/lib/libthr/thread/thr_sem.c
@@ -26,10 +26,11 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <sys/types.h>
#include <sys/queue.h>
diff --git a/lib/libthr/thread/thr_setprio.c b/lib/libthr/thread/thr_setprio.c
index 4b7d2c0..6f8a009 100644
--- a/lib/libthr/thread/thr_setprio.c
+++ b/lib/libthr/thread/thr_setprio.c
@@ -25,10 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <pthread.h>
#include "un-namespace.h"
diff --git a/lib/libthr/thread/thr_setschedparam.c b/lib/libthr/thread/thr_setschedparam.c
index 6e98fb4..4db09e7 100644
--- a/lib/libthr/thread/thr_setschedparam.c
+++ b/lib/libthr/thread/thr_setschedparam.c
@@ -28,10 +28,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <sys/param.h>
#include <errno.h>
diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c
index ebb6c58..ce7e70b 100644
--- a/lib/libthr/thread/thr_sig.c
+++ b/lib/libthr/thread/thr_sig.c
@@ -22,10 +22,11 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <sys/param.h>
#include <sys/types.h>
diff --git a/lib/libthr/thread/thr_single_np.c b/lib/libthr/thread/thr_single_np.c
index 81bdf8c..32bc586 100644
--- a/lib/libthr/thread/thr_single_np.c
+++ b/lib/libthr/thread/thr_single_np.c
@@ -25,10 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <pthread.h>
#include <pthread_np.h>
@@ -36,7 +37,8 @@
__weak_reference(_pthread_single_np, pthread_single_np);
-int _pthread_single_np()
+int
+_pthread_single_np(void)
{
/* Enter single-threaded (non-POSIX) scheduling mode: */
diff --git a/lib/libthr/thread/thr_sleepq.c b/lib/libthr/thread/thr_sleepq.c
index c5dcac5..5ecd6f9 100644
--- a/lib/libthr/thread/thr_sleepq.c
+++ b/lib/libthr/thread/thr_sleepq.c
@@ -22,10 +22,11 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <stdlib.h>
#include "thr_private.h"
diff --git a/lib/libthr/thread/thr_spec.c b/lib/libthr/thread/thr_spec.c
index b53c4b7..46d4ddf 100644
--- a/lib/libthr/thread/thr_spec.c
+++ b/lib/libthr/thread/thr_spec.c
@@ -25,10 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <sys/mman.h>
#include <signal.h>
diff --git a/lib/libthr/thread/thr_spinlock.c b/lib/libthr/thread/thr_spinlock.c
index 380d10d..6639612 100644
--- a/lib/libthr/thread/thr_spinlock.c
+++ b/lib/libthr/thread/thr_spinlock.c
@@ -25,11 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
- *
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <sys/types.h>
#include <pthread.h>
#include <libc_private.h>
diff --git a/lib/libthr/thread/thr_stack.c b/lib/libthr/thread/thr_stack.c
index 74e1329..3510a74 100644
--- a/lib/libthr/thread/thr_stack.c
+++ b/lib/libthr/thread/thr_stack.c
@@ -23,10 +23,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/queue.h>
diff --git a/lib/libthr/thread/thr_suspend_np.c b/lib/libthr/thread/thr_suspend_np.c
index 284619d..48d4bc1 100644
--- a/lib/libthr/thread/thr_suspend_np.c
+++ b/lib/libthr/thread/thr_suspend_np.c
@@ -25,10 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <errno.h>
#include <pthread.h>
diff --git a/lib/libthr/thread/thr_switch_np.c b/lib/libthr/thread/thr_switch_np.c
index f6ffb07..4380386 100644
--- a/lib/libthr/thread/thr_switch_np.c
+++ b/lib/libthr/thread/thr_switch_np.c
@@ -28,10 +28,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <errno.h>
#include <pthread.h>
diff --git a/lib/libthr/thread/thr_symbols.c b/lib/libthr/thread/thr_symbols.c
index ea323c5..9eef8db 100644
--- a/lib/libthr/thread/thr_symbols.c
+++ b/lib/libthr/thread/thr_symbols.c
@@ -25,10 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <sys/types.h>
#include <stddef.h>
#include <pthread.h>
diff --git a/lib/libthr/thread/thr_umtx.c b/lib/libthr/thread/thr_umtx.c
index 37e5df1..ebf344b 100644
--- a/lib/libthr/thread/thr_umtx.c
+++ b/lib/libthr/thread/thr_umtx.c
@@ -22,11 +22,11 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- *
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "thr_private.h"
#include "thr_umtx.h"
diff --git a/lib/libthr/thread/thr_yield.c b/lib/libthr/thread/thr_yield.c
index c3f68f2..1739495 100644
--- a/lib/libthr/thread/thr_yield.c
+++ b/lib/libthr/thread/thr_yield.c
@@ -25,10 +25,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include "namespace.h"
#include <pthread.h>
#include <sched.h>
diff --git a/lib/libusb/libusb20.c b/lib/libusb/libusb20.c
index 1de3a26..2eb75f1 100644
--- a/lib/libusb/libusb20.c
+++ b/lib/libusb/libusb20.c
@@ -139,8 +139,8 @@ libusb20_tr_close(struct libusb20_transfer *xfer)
free(xfer->ppBuffer);
}
/* reset variable fields in case the transfer is opened again */
- xfer->priv_sc0 = 0;
- xfer->priv_sc1 = 0;
+ xfer->priv_sc0 = NULL;
+ xfer->priv_sc1 = NULL;
xfer->is_opened = 0;
xfer->is_pending = 0;
xfer->is_cancel = 0;
diff --git a/lib/libusbhid/descr.c b/lib/libusbhid/descr.c
index 0c66342..4ca9dd7 100644
--- a/lib/libusbhid/descr.c
+++ b/lib/libusbhid/descr.c
@@ -159,7 +159,7 @@ hid_use_report_desc(unsigned char *data, unsigned int size)
report_desc_t r;
r = malloc(sizeof(*r) + size);
- if (r == 0) {
+ if (r == NULL) {
errno = ENOMEM;
return (NULL);
}
diff --git a/lib/libusbhid/usage.c b/lib/libusbhid/usage.c
index eeff818..3960dad 100644
--- a/lib/libusbhid/usage.c
+++ b/lib/libusbhid/usage.c
@@ -77,9 +77,9 @@ hid_init(const char *hidname)
char line[100], name[100], *p, *n;
int no;
int lineno;
- struct usage_page *curpage = 0;
+ struct usage_page *curpage = NULL;
- if (hidname == 0)
+ if (hidname == NULL)
hidname = _PATH_HIDTABLE;
f = fopen(hidname, "r");
@@ -124,7 +124,7 @@ hid_init(const char *hidname)
curpage->pagesize++;
} else {
if (npages >= npagesmax) {
- if (pages == 0) {
+ if (pages == NULL) {
npagesmax = 5;
pages = malloc(npagesmax *
sizeof (struct usage_page));
OpenPOWER on IntegriCloud