I'm going to preemptively state that CTLTYPE_QUAD now implies int64_t instead of quad_t.
So, with that understood, the diff below should make sense. Note that the variable quadval is actually of type int64_t. Oh, and use memcpy() instead of up-casting from char* to (long long*). ok? Index: sbin/sysctl/sysctl.c =================================================================== RCS file: /cvs/src/sbin/sysctl/sysctl.c,v retrieving revision 1.216 diff -u -p -r1.216 sysctl.c --- sbin/sysctl/sysctl.c 27 Jul 2016 14:44:59 -0000 1.216 +++ sbin/sysctl/sysctl.c 14 Aug 2016 21:56:48 -0000 @@ -710,8 +710,7 @@ parse(char *string, int flags) break; case CTLTYPE_QUAD: - /* XXX - assumes sizeof(long long) == sizeof(quad_t) */ - (void)sscanf(newval, "%lld", (long long *)&quadval); + (void)sscanf(newval, "%lld", &quadval); newval = &quadval; newsize = sizeof(quadval); break; @@ -940,20 +939,22 @@ parse(char *string, int flags) case CTLTYPE_QUAD: if (newsize == 0) { - long long tmp = *(quad_t *)buf; + int64_t tmp; + memcpy(&tmp, buf, sizeof tmp); if (!nflag) (void)printf("%s%s", string, equ); (void)printf("%lld\n", tmp); } else { - long long tmp = *(quad_t *)buf; + int64_t tmp; + memcpy(&tmp, buf, sizeof tmp); if (!qflag) { if (!nflag) (void)printf("%s: %lld -> ", string, tmp); - tmp = *(quad_t *)newval; - (void)printf("%qd\n", tmp); + memcpy(&tmp, newval, sizeof tmp); + (void)printf("%lld\n", tmp); } } return;