mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 07:15:58 +08:00
Update to FreeBSD head 2016-12-10
Git mirror commit 80c55f08a05ab3b26a73b226ccb56adc3122a55c.
This commit is contained in:
@@ -136,7 +136,8 @@ __bt_sync(const DB *dbp, u_int flags)
|
||||
return (RET_ERROR);
|
||||
}
|
||||
|
||||
if (F_ISSET(t, B_INMEM | B_RDONLY) || !F_ISSET(t, B_MODIFIED))
|
||||
if (F_ISSET(t, B_INMEM | B_RDONLY) ||
|
||||
!F_ISSET(t, B_MODIFIED | B_METADIRTY))
|
||||
return (RET_SUCCESS);
|
||||
|
||||
if (F_ISSET(t, B_METADIRTY) && bt_meta(t) == RET_ERROR)
|
||||
|
@@ -339,6 +339,7 @@ int __sys_openat(int, const char *, int, ...);
|
||||
int __sys_pselect(int, struct fd_set *, struct fd_set *,
|
||||
struct fd_set *, const struct timespec *,
|
||||
const __sigset_t *);
|
||||
int __sys_ptrace(int, __pid_t, char *, int);
|
||||
int __sys_poll(struct pollfd *, unsigned, int);
|
||||
int __sys_ppoll(struct pollfd *, unsigned, const struct timespec *,
|
||||
const __sigset_t *);
|
||||
|
@@ -226,6 +226,7 @@ struct ai_order {
|
||||
struct policyqueue *aio_dstpolicy;
|
||||
struct addrinfo *aio_ai;
|
||||
int aio_matchlen;
|
||||
int aio_initial_sequence;
|
||||
};
|
||||
|
||||
static const ns_src default_dns_files[] = {
|
||||
@@ -710,6 +711,7 @@ reorder(struct addrinfo *sentinel)
|
||||
aio[i].aio_dstpolicy = match_addrselectpolicy(ai->ai_addr,
|
||||
&policyhead);
|
||||
set_source(&aio[i], &policyhead);
|
||||
aio[i].aio_initial_sequence = i;
|
||||
}
|
||||
|
||||
/* perform sorting. */
|
||||
@@ -949,7 +951,7 @@ matchlen(struct sockaddr *src, struct sockaddr *dst)
|
||||
|
||||
while (s < lim)
|
||||
if ((r = (*d++ ^ *s++)) != 0) {
|
||||
while (r < addrlen * 8) {
|
||||
while ((r & 0x80) == 0) {
|
||||
match++;
|
||||
r <<= 1;
|
||||
}
|
||||
@@ -1068,6 +1070,23 @@ comp_dst(const void *arg1, const void *arg2)
|
||||
}
|
||||
|
||||
/* Rule 10: Otherwise, leave the order unchanged. */
|
||||
|
||||
/*
|
||||
* Note that qsort is unstable; so, we can't return zero and
|
||||
* expect the order to be unchanged.
|
||||
* That also means we can't depend on the current position of
|
||||
* dst2 being after dst1. We must enforce the initial order
|
||||
* with an explicit compare on the original position.
|
||||
* The qsort specification requires that "When the same objects
|
||||
* (consisting of width bytes, irrespective of their current
|
||||
* positions in the array) are passed more than once to the
|
||||
* comparison function, the results shall be consistent with one
|
||||
* another."
|
||||
* In other words, If A < B, then we must also return B > A.
|
||||
*/
|
||||
if (dst2->aio_initial_sequence < dst1->aio_initial_sequence)
|
||||
return(1);
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -124,31 +125,46 @@ char *
|
||||
link_ntoa(const struct sockaddr_dl *sdl)
|
||||
{
|
||||
static char obuf[64];
|
||||
char *out = obuf;
|
||||
int i;
|
||||
u_char *in = (u_char *)LLADDR(sdl);
|
||||
u_char *inlim = in + sdl->sdl_alen;
|
||||
int firsttime = 1;
|
||||
_Static_assert(sizeof(obuf) >= IFNAMSIZ + 20, "obuf is too small");
|
||||
char *out;
|
||||
const u_char *in, *inlim;
|
||||
int namelen, i, rem;
|
||||
|
||||
if (sdl->sdl_nlen) {
|
||||
bcopy(sdl->sdl_data, obuf, sdl->sdl_nlen);
|
||||
out += sdl->sdl_nlen;
|
||||
if (sdl->sdl_alen)
|
||||
namelen = (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ;
|
||||
|
||||
out = obuf;
|
||||
rem = sizeof(obuf);
|
||||
if (namelen > 0) {
|
||||
bcopy(sdl->sdl_data, out, namelen);
|
||||
out += namelen;
|
||||
rem -= namelen;
|
||||
if (sdl->sdl_alen > 0) {
|
||||
*out++ = ':';
|
||||
rem--;
|
||||
}
|
||||
}
|
||||
while (in < inlim) {
|
||||
if (firsttime)
|
||||
firsttime = 0;
|
||||
else
|
||||
|
||||
in = (const u_char *)sdl->sdl_data + sdl->sdl_nlen;
|
||||
inlim = in + sdl->sdl_alen;
|
||||
|
||||
while (in < inlim && rem > 1) {
|
||||
if (in != (const u_char *)sdl->sdl_data + sdl->sdl_nlen) {
|
||||
*out++ = '.';
|
||||
rem--;
|
||||
}
|
||||
i = *in++;
|
||||
if (i > 0xf) {
|
||||
out[1] = hexlist[i & 0xf];
|
||||
i >>= 4;
|
||||
out[0] = hexlist[i];
|
||||
out += 2;
|
||||
} else
|
||||
if (rem < 3)
|
||||
break;
|
||||
*out++ = hexlist[i >> 4];
|
||||
*out++ = hexlist[i & 0xf];
|
||||
rem -= 2;
|
||||
} else {
|
||||
if (rem < 2)
|
||||
break;
|
||||
*out++ = hexlist[i];
|
||||
rem--;
|
||||
}
|
||||
}
|
||||
*out = 0;
|
||||
return (obuf);
|
||||
|
@@ -187,6 +187,7 @@ struct hp_order {
|
||||
#define aio_sa aio_un.aiou_sa
|
||||
int aio_matchlen;
|
||||
char *aio_h_addr;
|
||||
int aio_initial_sequence;
|
||||
};
|
||||
|
||||
static struct hostent *_hpcopy(struct hostent *, int *);
|
||||
@@ -713,6 +714,7 @@ _hpreorder(struct hostent *hp)
|
||||
aio[i].aio_dstscope = gai_addr2scopetype(sa);
|
||||
aio[i].aio_dstpolicy = match_addrselectpolicy(sa, &policyhead);
|
||||
set_source(&aio[i], &policyhead);
|
||||
aio[i].aio_initial_sequence = i;
|
||||
}
|
||||
|
||||
/* perform sorting. */
|
||||
@@ -930,7 +932,7 @@ matchlen(struct sockaddr *src, struct sockaddr *dst)
|
||||
|
||||
while (s < lim)
|
||||
if ((r = (*d++ ^ *s++)) != 0) {
|
||||
while (r < addrlen * 8) {
|
||||
while ((r & 0x80) == 0) {
|
||||
match++;
|
||||
r <<= 1;
|
||||
}
|
||||
@@ -1047,6 +1049,23 @@ comp_dst(const void *arg1, const void *arg2)
|
||||
}
|
||||
|
||||
/* Rule 10: Otherwise, leave the order unchanged. */
|
||||
|
||||
/*
|
||||
* Note that qsort is unstable; so, we can't return zero and
|
||||
* expect the order to be unchanged.
|
||||
* That also means we can't depend on the current position of
|
||||
* dst2 being after dst1. We must enforce the initial order
|
||||
* with an explicit compare on the original position.
|
||||
* The qsort specification requires that "When the same objects
|
||||
* (consisting of width bytes, irrespective of their current
|
||||
* positions in the array) are passed more than once to the
|
||||
* comparison function, the results shall be consistent with one
|
||||
* another."
|
||||
* In other words, If A < B, then we must also return B > A.
|
||||
*/
|
||||
if (dst2->aio_initial_sequence < dst1->aio_initial_sequence)
|
||||
return(1);
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
@@ -143,8 +143,11 @@ fgetln(FILE *fp, size_t *lenp)
|
||||
(void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p,
|
||||
len - off);
|
||||
off = len;
|
||||
if (__srefill(fp))
|
||||
break; /* EOF or error: return partial line */
|
||||
if (__srefill(fp)) {
|
||||
if (__sfeof(fp))
|
||||
break;
|
||||
goto error;
|
||||
}
|
||||
if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) == NULL)
|
||||
continue;
|
||||
|
||||
|
@@ -1778,6 +1778,7 @@ pfkey_align(msg, mhp)
|
||||
case SADB_EXT_SPIRANGE:
|
||||
case SADB_X_EXT_POLICY:
|
||||
case SADB_X_EXT_SA2:
|
||||
case SADB_X_EXT_SA_REPLAY:
|
||||
mhp[ext->sadb_ext_type] = (caddr_t)ext;
|
||||
break;
|
||||
case SADB_X_EXT_NAT_T_TYPE:
|
||||
|
@@ -221,6 +221,7 @@ pfkey_sadump(m)
|
||||
struct sadb_key *m_auth, *m_enc;
|
||||
struct sadb_ident *m_sid, *m_did;
|
||||
struct sadb_sens *m_sens;
|
||||
struct sadb_x_sa_replay *m_sa_replay;
|
||||
|
||||
/* check pfkey message. */
|
||||
if (pfkey_align(m, mhp)) {
|
||||
@@ -245,6 +246,7 @@ pfkey_sadump(m)
|
||||
m_sid = (struct sadb_ident *)mhp[SADB_EXT_IDENTITY_SRC];
|
||||
m_did = (struct sadb_ident *)mhp[SADB_EXT_IDENTITY_DST];
|
||||
m_sens = (struct sadb_sens *)mhp[SADB_EXT_SENSITIVITY];
|
||||
m_sa_replay = (struct sadb_x_sa_replay *)mhp[SADB_X_EXT_SA_REPLAY];
|
||||
|
||||
/* source address */
|
||||
if (m_saddr == NULL) {
|
||||
@@ -308,7 +310,8 @@ pfkey_sadump(m)
|
||||
/* replay windoe size & flags */
|
||||
printf("\tseq=0x%08x replay=%u flags=0x%08x ",
|
||||
m_sa2->sadb_x_sa2_sequence,
|
||||
m_sa->sadb_sa_replay,
|
||||
m_sa_replay ? (m_sa_replay->sadb_x_sa_replay_replay >> 3) :
|
||||
m_sa->sadb_sa_replay,
|
||||
m_sa->sadb_sa_flags);
|
||||
|
||||
/* state */
|
||||
|
@@ -32,9 +32,6 @@
|
||||
#include <rtems/bsd/sys/cpuset.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_page.h>
|
||||
|
||||
#include <vm/uma.h>
|
||||
#include <vm/uma_int.h>
|
||||
|
||||
|
Reference in New Issue
Block a user