summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/bind/config.h20
-rw-r--r--lib/bind/isc/isc/platform.h7
-rw-r--r--lib/clang/Makefile8
-rw-r--r--lib/libc/gen/sysconf.c9
-rw-r--r--lib/libc/sys/chflags.210
-rw-r--r--lib/libjail/jail.c14
-rw-r--r--lib/libpcap/Makefile4
-rw-r--r--lib/libpcap/config.h82
-rw-r--r--lib/libthr/thread/thr_attr.c80
-rw-r--r--lib/libthr/thread/thr_mutex.c27
-rw-r--r--lib/libthr/thread/thr_sig.c10
11 files changed, 150 insertions, 121 deletions
diff --git a/lib/bind/config.h b/lib/bind/config.h
index 3038b5b..5df58ae 100644
--- a/lib/bind/config.h
+++ b/lib/bind/config.h
@@ -147,6 +147,9 @@ int sigwait(const unsigned int *set, int *sig);
/* Define if threads need PTHREAD_SCOPE_SYSTEM */
/* #undef NEED_PTHREAD_SCOPE_SYSTEM */
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
/* Define if recvmsg() does not meet all of the BSD socket API specifications.
*/
/* #undef BROKEN_RECVMSG */
@@ -306,6 +309,9 @@ int sigwait(const unsigned int *set, int *sig);
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
@@ -327,11 +333,15 @@ int sigwait(const unsigned int *set, int *sig);
/* #undef WITH_IDN */
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
- significant byte first (like Motorola and SPARC, unlike Intel and VAX). */
-#if defined __BIG_ENDIAN__
-# define WORDS_BIGENDIAN 1
-#elif ! defined __LITTLE_ENDIAN__
-/* # undef WORDS_BIGENDIAN */
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* # undef WORDS_BIGENDIAN */
+# endif
#endif
/* Define to empty if `const' does not conform to ANSI C. */
diff --git a/lib/bind/isc/isc/platform.h b/lib/bind/isc/isc/platform.h
index 197a2bc..7cb7f34 100644
--- a/lib/bind/isc/isc/platform.h
+++ b/lib/bind/isc/isc/platform.h
@@ -252,7 +252,14 @@
* If the "xaddq" operation (64bit xadd) is available on this architecture,
* ISC_PLATFORM_HAVEXADDQ will be defined.
*/
+/*
+ * FreeBSD local modification, preserve this over upgrades
+ */
+#ifdef __amd64__
+#define ISC_PLATFORM_HAVEXADDQ 1
+#else
#undef ISC_PLATFORM_HAVEXADDQ
+#endif
/*
* If the "atomic swap" operation is available on this architecture,
diff --git a/lib/clang/Makefile b/lib/clang/Makefile
index 39bd4c7..bd6ece6 100644
--- a/lib/clang/Makefile
+++ b/lib/clang/Makefile
@@ -1,5 +1,6 @@
# $FreeBSD$
+.if !make(install)
SUBDIR= libclanganalysis \
libclangast \
libclangbasic \
@@ -48,8 +49,9 @@ SUBDIR= libclanganalysis \
libllvmx86asmprinter \
libllvmx86codegen \
libllvmx86disassembler \
- libllvmx86info \
- \
- include
+ libllvmx86info
+.endif
+
+SUBDIR+= include
.include <bsd.subdir.mk>
diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c
index 4618f32..7539d61 100644
--- a/lib/libc/gen/sysconf.c
+++ b/lib/libc/gen/sysconf.c
@@ -597,6 +597,15 @@ yesno:
return (lvalue);
#endif
+#ifdef _SC_CPUSET_SIZE
+ case _SC_CPUSET_SIZE:
+ len = sizeof(lvalue);
+ if (sysctlbyname("kern.sched.cpusetsize", &lvalue, &len, NULL,
+ 0) == -1)
+ return (-1);
+ return (lvalue);
+#endif
+
default:
errno = EINVAL;
return (-1);
diff --git a/lib/libc/sys/chflags.2 b/lib/libc/sys/chflags.2
index 7780427..79f2fe0 100644
--- a/lib/libc/sys/chflags.2
+++ b/lib/libc/sys/chflags.2
@@ -28,7 +28,7 @@
.\" @(#)chflags.2 8.3 (Berkeley) 5/2/95
.\" $FreeBSD$
.\"
-.Dd May 16, 2006
+.Dd Oct 29, 2010
.Dt CHFLAGS 2
.Os
.Sh NAME
@@ -155,7 +155,7 @@ is set and the user is either not the super-user or
securelevel is greater than 0.
.It Bq Er EPERM
A non-super-user tries to set one of
-.Dv SF_IMMUTABLE , SF_APPEND ,
+.Dv SF_ARCHIVED , SF_IMMUTABLE , SF_APPEND ,
or
.Dv SF_NOUNLINK .
.It Bq Er EPERM
@@ -200,9 +200,13 @@ is set and the user is either not the super-user or
securelevel is greater than 0.
.It Bq Er EPERM
A non-super-user tries to set one of
-.Dv SF_IMMUTABLE , SF_APPEND ,
+.Dv SF_ARCHIVED , SF_IMMUTABLE , SF_APPEND ,
or
.Dv SF_NOUNLINK .
+.It Bq Er EPERM
+User tries to set or remove the
+.Dv SF_SNAPSHOT
+flag.
.It Bq Er EROFS
The file resides on a read-only file system.
.It Bq Er EIO
diff --git a/lib/libjail/jail.c b/lib/libjail/jail.c
index 1be8358..99bd970 100644
--- a/lib/libjail/jail.c
+++ b/lib/libjail/jail.c
@@ -250,10 +250,6 @@ jailparam_all(struct jailparam **jpp)
}
if (jailparam_init(jp + njp, buf + sizeof(SJPARAM)) < 0)
goto error;
- if (jailparam_type(jp + njp) < 0) {
- njp++;
- goto error;
- }
mib1[1] = 2;
}
jp = realloc(jp, njp * sizeof(*jp));
@@ -279,6 +275,10 @@ jailparam_init(struct jailparam *jp, const char *name)
strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN);
return (-1);
}
+ if (jailparam_type(jp) < 0) {
+ jailparam_free(jp, 1);
+ return (-1);
+ }
return (0);
}
@@ -293,8 +293,6 @@ jailparam_import(struct jailparam *jp, const char *value)
const char *avalue;
int i, nval, fw;
- if (!jp->jp_ctltype && jailparam_type(jp) < 0)
- return (-1);
if (value == NULL)
return (0);
if ((jp->jp_ctltype & CTLTYPE) == CTLTYPE_STRING) {
@@ -563,8 +561,6 @@ jailparam_get(struct jailparam *jp, unsigned njp, int flags)
jp_lastjid = jp_jid = jp_name = NULL;
arrays = 0;
for (ai = j = 0; j < njp; j++) {
- if (!jp[j].jp_ctltype && jailparam_type(jp + j) < 0)
- return (-1);
if (!strcmp(jp[j].jp_name, "lastjid"))
jp_lastjid = jp + j;
else if (!strcmp(jp[j].jp_name, "jid"))
@@ -725,8 +721,6 @@ jailparam_export(struct jailparam *jp)
int i, nval, ival;
char valbuf[INET6_ADDRSTRLEN];
- if (!jp->jp_ctltype && jailparam_type(jp) < 0)
- return (NULL);
if ((jp->jp_ctltype & CTLTYPE) == CTLTYPE_STRING) {
value = strdup(jp->jp_value);
if (value == NULL)
diff --git a/lib/libpcap/Makefile b/lib/libpcap/Makefile
index 42540f5..80c61d80 100644
--- a/lib/libpcap/Makefile
+++ b/lib/libpcap/Makefile
@@ -7,9 +7,9 @@ SHLIBDIR?= /lib
LIB= pcap
SRCS= grammar.y tokdefs.h version.h pcap-bpf.c \
- pcap.c inet.c fad-getad.c gencode.c optimize.c nametoaddr.c \
+ pcap.c pcap-common.c inet.c fad-getad.c gencode.c optimize.c nametoaddr.c \
etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c \
- scanner.l version.c
+ scanner.l sf-pcap.c sf-pcap-ng.c version.c
# Old compatibility headers
INCS= pcap.h pcap-int.h pcap-namedb.h pcap-bpf.h
diff --git a/lib/libpcap/config.h b/lib/libpcap/config.h
index f4dec9c..d3d4a9a 100644
--- a/lib/libpcap/config.h
+++ b/lib/libpcap/config.h
@@ -1,15 +1,8 @@
/* $FreeBSD$ */
/* This is an edited copy of the config.h generated by configure. */
-/* config.h. Generated by configure. */
+/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.in by autoheader. */
-/* Long story short: aclocal.m4 depends on autoconf 2.13
- * implementation details wrt "const"; newer versions
- * have different implementation details so for now we
- * put "const" here. This may cause duplicate definitions
- * in config.h but that should be OK since they're the same.
- */
-/* #undef const */
/* Enable optimizer debugging */
/* #undef BDEBUG */
@@ -17,15 +10,15 @@
/* define if you have a cloning BPF device */
#define HAVE_CLONING_BPF 1
-/* define if you have dag_get_stream_erf_types() */
-/* #undef HAVE_DAG_GET_STREAM_ERF_TYPES */
-
/* define if you have the DAG API */
/* #undef HAVE_DAG_API */
/* define if you have dag_get_erf_types() */
/* #undef HAVE_DAG_GET_ERF_TYPES */
+/* define if you have dag_get_stream_erf_types() */
+/* #undef HAVE_DAG_GET_STREAM_ERF_TYPES */
+
/* define if you have streams capable DAG API */
/* #undef HAVE_DAG_STREAMS_API */
@@ -33,12 +26,12 @@
don't. */
#define HAVE_DECL_ETHER_HOSTTON 1
-/* if passive_req_t primitive exists */
-/* #undef HAVE_DLPI_PASSIVE */
-
/* define if you have a /dev/dlpi */
/* #undef HAVE_DEV_DLPI */
+/* if passive_req_t primitive exists */
+/* #undef HAVE_DLPI_PASSIVE */
+
/* Define to 1 if you have the `ether_hostton' function. */
#define HAVE_ETHER_HOSTTON 1
@@ -60,12 +53,18 @@
/* if libdlpi exists */
/* #undef HAVE_LIBDLPI */
+/* if libnl exists */
+/* #undef HAVE_LIBNL */
+
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* if tp_vlan_tci exists */
/* #undef HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI */
+/* Define to 1 if you have the <linux/usbdevice_fs.h> header file. */
+/* #undef HAVE_LINUX_USBDEVICE_FS_H */
+
/* Define to 1 if you have the <linux/wireless.h> header file. */
/* #undef HAVE_LINUX_WIRELESS_H */
@@ -85,27 +84,30 @@
/* See Makefile */
/* #undef HAVE_NET_PFVAR_H */
-/* if there's an os_proto.h */
+/* if there's an os_proto.h for this platform, to use additional prototypes */
/* #undef HAVE_OS_PROTO_H */
/* Define to 1 if you have the <paths.h> header file. */
#define HAVE_PATHS_H 1
-/* define if you have a /proc/net/dev */
-/* #undef HAVE_PROC_NET_DEV */
+/* define if net/pfvar.h defines PF_NAT through PF_NORDR */
+#define HAVE_PF_NAT_THROUGH_PF_NORDR 1
/* define if you have a Septel API */
/* #undef HAVE_SEPTEL_API */
+/* define if you have Myricom SNF API */
+/* #undef HAVE_SNF_API */
+
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
-/* if struct sockaddr has sa_len */
+/* if struct sockaddr has the sa_len member */
#define HAVE_SOCKADDR_SA_LEN 1
/* if struct sockaddr_storage exists */
#define HAVE_SOCKADDR_STORAGE 1
-
+
/* define if socklen_t is defined */
#define HAVE_SOCKLEN_T 1
@@ -130,9 +132,15 @@
/* Define to 1 if you have the `strlcpy' function. */
#define HAVE_STRLCPY 1
+/* Define to 1 if the system has the type `struct BPF_TIMEVAL'. */
+/* #undef HAVE_STRUCT_BPF_TIMEVAL */
+
/* Define to 1 if the system has the type `struct ether_addr'. */
/* #undef HAVE_STRUCT_ETHER_ADDR */
+/* Define to 1 if you have the <sys/bitypes.h> header file. */
+/* #undef HAVE_SYS_BITYPES_H */
+
/* Define to 1 if you have the <sys/bufmod.h> header file. */
/* #undef HAVE_SYS_BUFMOD_H */
@@ -157,6 +165,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
+/* if struct usbdevfs_ctrltransfer has bRequestType */
+/* #undef HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE */
+
/* define if version.h is generated in the build procedure */
#define HAVE_VERSION_H 1
@@ -170,6 +181,7 @@
#define HAVE___ATTRIBUTE__ 1
/* IPv6 */
+/* See Makefile */
/* #undef INET6 */
/* if unaligned access fails */
@@ -208,6 +220,9 @@
/* target host supports Bluetooth sniffing */
/* #undef PCAP_SUPPORT_BT */
+/* target host supports CAN sniffing */
+/* #undef PCAP_SUPPORT_CAN */
+
/* target host supports USB sniffing */
/* #undef PCAP_SUPPORT_USB */
@@ -220,12 +235,12 @@
/* Enable parser debugging */
/* #undef YYDEBUG */
-/* needed on HP-UX */
-/* #undef _HPUX_SOURCE */
-
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
+/* needed on HP-UX */
+/* #undef _HPUX_SOURCE */
+
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
/* #undef _LARGEFILE_SOURCE */
@@ -235,20 +250,35 @@
/* define on AIX to get certain functions */
/* #undef _SUN */
+/* to handle Ultrix compilers that don't support const in prototypes */
+/* #undef const */
+
/* Define as token for inline if inlining supported */
#define inline inline
+/* Define to `short' if int16_t not defined. */
+/* #undef int16_t */
+
+/* Define to `int' if int32_t not defined. */
+/* #undef int32_t */
+
+/* Define to `long long' if int64_t not defined. */
+/* #undef int64_t */
+
+/* Define to `signed char' if int8_t not defined. */
+/* #undef int8_t */
+
/* on sinix */
/* #undef sinix */
-/* if we have u_int16_t */
+/* Define to `unsigned short' if u_int16_t not defined. */
/* #undef u_int16_t */
-/* if we have u_int32_t */
+/* Define to `unsigned int' if u_int32_t not defined. */
/* #undef u_int32_t */
-/* if we have u_int64_t */
+/* Define to `unsigned long long' if u_int64_t not defined. */
/* #undef u_int64_t */
-/* if we have u_int8_t */
+/* Define to `unsigned char' if u_int8_t not defined. */
/* #undef u_int8_t */
diff --git a/lib/libthr/thread/thr_attr.c b/lib/libthr/thread/thr_attr.c
index 7fe50034..c2969e7 100644
--- a/lib/libthr/thread/thr_attr.c
+++ b/lib/libthr/thread/thr_attr.c
@@ -141,19 +141,14 @@ _pthread_attr_get_np(pthread_t pthread, pthread_attr_t *dstattr)
struct pthread *curthread;
struct pthread_attr attr, *dst;
int ret;
- size_t cpusetsize;
+ size_t kern_size;
if (pthread == NULL || dstattr == NULL || (dst = *dstattr) == NULL)
return (EINVAL);
- cpusetsize = _get_kern_cpuset_size();
- if (dst->cpusetsize < cpusetsize) {
- char *newset = realloc(dst->cpuset, cpusetsize);
- if (newset == NULL)
- return (errno);
- memset(newset + dst->cpusetsize, 0, cpusetsize -
- dst->cpusetsize);
- dst->cpuset = (cpuset_t *)newset;
- dst->cpusetsize = cpusetsize;
+ kern_size = _get_kern_cpuset_size();
+ if (dst->cpuset == NULL) {
+ dst->cpuset = calloc(1, kern_size);
+ dst->cpusetsize = kern_size;
}
curthread = _get_curthread();
if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0)) != 0)
@@ -574,13 +569,14 @@ _get_kern_cpuset_size(void)
if (kern_cpuset_size == 0) {
size_t len;
+ int maxcpus;
- len = sizeof(kern_cpuset_size);
- if (sysctlbyname("kern.smp.maxcpus", &kern_cpuset_size,
- &len, NULL, 0))
+ len = sizeof(maxcpus);
+ if (sysctlbyname("kern.smp.maxcpus", &maxcpus, &len, NULL, 0))
PANIC("failed to get sysctl kern.smp.maxcpus");
-
- kern_cpuset_size = (kern_cpuset_size + 7) / 8;
+ int nbits_long = sizeof(long) * NBBY;
+ int num_long = (maxcpus + nbits_long - 1) / nbits_long;
+ kern_cpuset_size = num_long * sizeof(long);
}
return (kern_cpuset_size);
@@ -605,27 +601,25 @@ _pthread_attr_setaffinity_np(pthread_attr_t *pattr, size_t cpusetsize,
}
return (0);
}
-
- if (cpusetsize > attr->cpusetsize) {
- size_t kern_size = _get_kern_cpuset_size();
- if (cpusetsize > kern_size) {
- size_t i;
- for (i = kern_size; i < cpusetsize; ++i) {
- if (((char *)cpusetp)[i])
- return (EINVAL);
- }
+ size_t kern_size = _get_kern_cpuset_size();
+ /* Kernel rejects small set, we check it here too. */
+ if (cpusetsize < kern_size)
+ return (ERANGE);
+ if (cpusetsize > kern_size) {
+ /* Kernel checks invalid bits, we check it here too. */
+ size_t i;
+ for (i = kern_size; i < cpusetsize; ++i) {
+ if (((char *)cpusetp)[i])
+ return (EINVAL);
}
- void *newset = realloc(attr->cpuset, cpusetsize);
- if (newset == NULL)
- return (ENOMEM);
- attr->cpuset = newset;
- attr->cpusetsize = cpusetsize;
- } else {
- memset(((char *)attr->cpuset) + cpusetsize, 0,
- attr->cpusetsize - cpusetsize);
- attr->cpusetsize = cpusetsize;
}
- memcpy(attr->cpuset, cpusetp, cpusetsize);
+ if (attr->cpuset == NULL) {
+ attr->cpuset = calloc(1, kern_size);
+ if (attr->cpuset == NULL)
+ return (errno);
+ attr->cpusetsize = kern_size;
+ }
+ memcpy(attr->cpuset, cpusetp, kern_size);
ret = 0;
}
return (ret);
@@ -641,16 +635,18 @@ _pthread_attr_getaffinity_np(const pthread_attr_t *pattr, size_t cpusetsize,
if (pattr == NULL || (attr = (*pattr)) == NULL)
ret = EINVAL;
- else if (attr->cpuset != NULL) {
- memcpy(cpusetp, attr->cpuset, MIN(cpusetsize, attr->cpusetsize));
- if (cpusetsize > attr->cpusetsize)
- memset(((char *)cpusetp) + attr->cpusetsize, 0,
- cpusetsize - attr->cpusetsize);
- } else {
+ else {
+ /* Kernel rejects small set, we check it here too. */
size_t kern_size = _get_kern_cpuset_size();
- memset(cpusetp, -1, MIN(cpusetsize, kern_size));
+ if (cpusetsize < kern_size)
+ return (ERANGE);
+ if (attr->cpuset != NULL)
+ memcpy(cpusetp, attr->cpuset, MIN(cpusetsize,
+ attr->cpusetsize));
+ else
+ memset(cpusetp, -1, kern_size);
if (cpusetsize > kern_size)
- memset(((char *)cpusetp) + kern_size, 0,
+ memset(((char *)cpusetp) + kern_size, 0,
cpusetsize - kern_size);
}
return (ret);
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index a83454a..29f91ec 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -257,10 +257,8 @@ _mutex_fork(struct pthread *curthread)
int
_pthread_mutex_destroy(pthread_mutex_t *mutex)
{
- struct pthread *curthread = _get_curthread();
pthread_mutex_t m;
- uint32_t id;
- int ret = 0;
+ int ret;
m = *mutex;
if (m < THR_MUTEX_DESTROYED) {
@@ -268,34 +266,13 @@ _pthread_mutex_destroy(pthread_mutex_t *mutex)
} else if (m == THR_MUTEX_DESTROYED) {
ret = EINVAL;
} else {
- id = TID(curthread);
-
- /*
- * Try to lock the mutex structure, we only need to
- * try once, if failed, the mutex is in used.
- */
- ret = _thr_umutex_trylock(&m->m_lock, id);
- if (ret)
- return (ret);
- /*
- * Check mutex other fields to see if this mutex is
- * in use. Mostly for prority mutex types, or there
- * are condition variables referencing it.
- */
if (m->m_owner != NULL || m->m_refcount != 0) {
- if (m->m_lock.m_flags & UMUTEX_PRIO_PROTECT)
- set_inherited_priority(curthread, m);
- _thr_umutex_unlock(&m->m_lock, id);
ret = EBUSY;
} else {
*mutex = THR_MUTEX_DESTROYED;
-
- if (m->m_lock.m_flags & UMUTEX_PRIO_PROTECT)
- set_inherited_priority(curthread, m);
- _thr_umutex_unlock(&m->m_lock, id);
-
MUTEX_ASSERT_NOT_OWNED(m);
free(m);
+ ret = 0;
}
}
diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c
index a2c1e53..4acfe40 100644
--- a/lib/libthr/thread/thr_sig.c
+++ b/lib/libthr/thread/thr_sig.c
@@ -317,14 +317,11 @@ check_deferred_signal(struct pthread *curthread)
ucontext_t uc;
struct sigaction act;
siginfo_t info;
- volatile int first;
if (__predict_true(curthread->deferred_siginfo.si_signo == 0))
return;
- first = 1;
getcontext(&uc);
- if (first) {
- first = 0;
+ if (curthread->deferred_siginfo.si_signo == 0) {
act = curthread->deferred_sigact;
uc.uc_sigmask = curthread->deferred_sigmask;
memcpy(&info, &curthread->deferred_siginfo, sizeof(siginfo_t));
@@ -550,7 +547,10 @@ _sigaction(int sig, const struct sigaction * act, struct sigaction * oact)
if (oldact.sa_handler != SIG_DFL &&
oldact.sa_handler != SIG_IGN) {
- oldact = _thr_sigact[sig-1].sigact;
+ if (act != NULL)
+ oldact = oldact2;
+ else if (oact != NULL)
+ oldact = _thr_sigact[sig-1].sigact;
}
_thr_rwl_unlock(&_thr_sigact[sig-1].lock);
OpenPOWER on IntegriCloud