summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/defaults/periodic.conf6
-rw-r--r--lib/libc/sys/stack_protector.c13
-rw-r--r--sys/kern/kern_racct.c24
-rw-r--r--sys/kern/vfs_hash.c4
4 files changed, 24 insertions, 23 deletions
diff --git a/etc/defaults/periodic.conf b/etc/defaults/periodic.conf
index 3cde9b5..14f1a08 100644
--- a/etc/defaults/periodic.conf
+++ b/etc/defaults/periodic.conf
@@ -365,8 +365,12 @@ if [ -z "${source_periodic_confs_defined}" ]; then
*) return 0 ;;
esac
;;
+ '')
+ # Script run manually.
+ return 0
+ ;;
*)
- echo "ASSERTION FAILED: Unexpected value for " \
+ echo "ASSERTION FAILED: Unexpected value for" \
"\$PERIODIC: '$PERIODIC'" >&2
exit 127
;;
diff --git a/lib/libc/sys/stack_protector.c b/lib/libc/sys/stack_protector.c
index ed7d635..cd5f166 100644
--- a/lib/libc/sys/stack_protector.c
+++ b/lib/libc/sys/stack_protector.c
@@ -41,8 +41,8 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include "libc_private.h"
-extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
- void *newp, size_t newlen);
+extern int __sysctl(const int *name, u_int namelen, void *oldp,
+ size_t *oldlenp, void *newp, size_t newlen);
long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0};
static void __guard_setup(void) __attribute__((__constructor__, __used__));
@@ -54,7 +54,7 @@ void __chk_fail(void);
static void
__guard_setup(void)
{
- int mib[2];
+ static const int mib[2] = { CTL_KERN, KERN_ARND };
size_t len;
int error;
@@ -65,12 +65,9 @@ __guard_setup(void)
if (error == 0 && __stack_chk_guard[0] != 0)
return;
- mib[0] = CTL_KERN;
- mib[1] = KERN_ARND;
-
len = sizeof(__stack_chk_guard);
- if (__sysctl(mib, 2, __stack_chk_guard, &len, NULL, 0) == -1 ||
- len != sizeof(__stack_chk_guard)) {
+ if (__sysctl(mib, nitems(mib), __stack_chk_guard, &len, NULL, 0) ==
+ -1 || len != sizeof(__stack_chk_guard)) {
/* If sysctl was unsuccessful, use the "terminator canary". */
((unsigned char *)(void *)__stack_chk_guard)[0] = 0;
((unsigned char *)(void *)__stack_chk_guard)[1] = 0;
diff --git a/sys/kern/kern_racct.c b/sys/kern/kern_racct.c
index 1f86a8b..9a59513 100644
--- a/sys/kern/kern_racct.c
+++ b/sys/kern/kern_racct.c
@@ -502,7 +502,7 @@ racct_destroy(struct racct **racct)
* may be less than zero.
*/
static void
-racct_alloc_resource(struct racct *racct, int resource,
+racct_adjust_resource(struct racct *racct, int resource,
uint64_t amount)
{
@@ -555,7 +555,7 @@ racct_add_locked(struct proc *p, int resource, uint64_t amount)
return (error);
}
#endif
- racct_alloc_resource(p->p_racct, resource, amount);
+ racct_adjust_resource(p->p_racct, resource, amount);
racct_add_cred_locked(p->p_ucred, resource, amount);
return (0);
@@ -589,11 +589,11 @@ racct_add_cred_locked(struct ucred *cred, int resource, uint64_t amount)
SDT_PROBE(racct, kernel, rusage, add__cred, cred, resource, amount,
0, 0);
- racct_alloc_resource(cred->cr_ruidinfo->ui_racct, resource, amount);
+ racct_adjust_resource(cred->cr_ruidinfo->ui_racct, resource, amount);
for (pr = cred->cr_prison; pr != NULL; pr = pr->pr_parent)
- racct_alloc_resource(pr->pr_prison_racct->prr_racct, resource,
+ racct_adjust_resource(pr->pr_prison_racct->prr_racct, resource,
amount);
- racct_alloc_resource(cred->cr_loginclass->lc_racct, resource, amount);
+ racct_adjust_resource(cred->cr_loginclass->lc_racct, resource, amount);
}
/*
@@ -633,7 +633,7 @@ racct_add_force(struct proc *p, int resource, uint64_t amount)
PROC_LOCK_ASSERT(p, MA_OWNED);
mtx_lock(&racct_lock);
- racct_alloc_resource(p->p_racct, resource, amount);
+ racct_adjust_resource(p->p_racct, resource, amount);
mtx_unlock(&racct_lock);
racct_add_cred(p->p_ucred, resource, amount);
}
@@ -687,7 +687,7 @@ racct_set_locked(struct proc *p, int resource, uint64_t amount)
}
}
#endif
- racct_alloc_resource(p->p_racct, resource, diff_proc);
+ racct_adjust_resource(p->p_racct, resource, diff_proc);
if (diff_cred > 0)
racct_add_cred_locked(p->p_ucred, resource, diff_cred);
else if (diff_cred < 0)
@@ -749,7 +749,7 @@ racct_set_force_locked(struct proc *p, int resource, uint64_t amount)
} else
diff_cred = diff_proc;
- racct_alloc_resource(p->p_racct, resource, diff_proc);
+ racct_adjust_resource(p->p_racct, resource, diff_proc);
if (diff_cred > 0)
racct_add_cred_locked(p->p_ucred, resource, diff_cred);
else if (diff_cred < 0)
@@ -851,7 +851,7 @@ racct_sub(struct proc *p, int resource, uint64_t amount)
"than allocated %jd for %s (pid %d)", __func__, amount, resource,
(intmax_t)p->p_racct->r_resources[resource], p->p_comm, p->p_pid));
- racct_alloc_resource(p->p_racct, resource, -amount);
+ racct_adjust_resource(p->p_racct, resource, -amount);
racct_sub_cred_locked(p->p_ucred, resource, amount);
mtx_unlock(&racct_lock);
}
@@ -872,11 +872,11 @@ racct_sub_cred_locked(struct ucred *cred, int resource, uint64_t amount)
resource));
#endif
- racct_alloc_resource(cred->cr_ruidinfo->ui_racct, resource, -amount);
+ racct_adjust_resource(cred->cr_ruidinfo->ui_racct, resource, -amount);
for (pr = cred->cr_prison; pr != NULL; pr = pr->pr_parent)
- racct_alloc_resource(pr->pr_prison_racct->prr_racct, resource,
+ racct_adjust_resource(pr->pr_prison_racct->prr_racct, resource,
-amount);
- racct_alloc_resource(cred->cr_loginclass->lc_racct, resource, -amount);
+ racct_adjust_resource(cred->cr_loginclass->lc_racct, resource, -amount);
}
/*
diff --git a/sys/kern/vfs_hash.c b/sys/kern/vfs_hash.c
index 1398a47..edcda6b 100644
--- a/sys/kern/vfs_hash.c
+++ b/sys/kern/vfs_hash.c
@@ -181,7 +181,7 @@ vfs_hash_changesize(int newmaxvnodes)
* None of the vnodes in the table can be recycled because to
* do so, they have to be removed from the hash table.
*/
- rw_wlock(&vfs_hash_lock);
+ mtx_lock(&vfs_hash_mtx);
vfs_hash_oldtbl = vfs_hash_tbl;
vfs_hash_oldmask = vfs_hash_mask;
vfs_hash_tbl = vfs_hash_newtbl;
@@ -194,6 +194,6 @@ vfs_hash_changesize(int newmaxvnodes)
vp, v_hashlist);
}
}
- rw_wunlock(&vfs_hash_lock);
+ mtx_unlock(&vfs_hash_mtx);
free(vfs_hash_oldtbl, M_VFS_HASH);
}
OpenPOWER on IntegriCloud