CVS commit: src/sys/altq
Module Name:src Committed By: ozaki-r Date: Wed Jul 21 06:49:26 UTC 2021 Modified Files: src/sys/altq: altq_rmclass.c Log Message: altq, cbq: apply tweaks for PPP to only PPP interfaces To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/altq/altq_rmclass.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/altq/altq_rmclass.c diff -u src/sys/altq/altq_rmclass.c:1.27 src/sys/altq/altq_rmclass.c:1.28 --- src/sys/altq/altq_rmclass.c:1.27 Wed Jul 21 06:47:33 2021 +++ src/sys/altq/altq_rmclass.c Wed Jul 21 06:49:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: altq_rmclass.c,v 1.27 2021/07/21 06:47:33 ozaki-r Exp $ */ +/* $NetBSD: altq_rmclass.c,v 1.28 2021/07/21 06:49:25 ozaki-r Exp $ */ /* $KAME: altq_rmclass.c,v 1.19 2005/04/13 03:44:25 suz Exp $ */ /* @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: altq_rmclass.c,v 1.27 2021/07/21 06:47:33 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: altq_rmclass.c,v 1.28 2021/07/21 06:49:25 ozaki-r Exp $"); /* #ident "@(#)rm_class.c 1.48 97/12/05 SMI" */ @@ -62,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: altq_rmclass #include #include +#include #ifdef ALTQ3_COMPAT #include #include @@ -1291,32 +1292,32 @@ rmc_update_class_util(struct rm_ifdat *i #else pkt_time = ifd->curlen_[ifd->qo_] * ifd->ns_per_byte_ / 1000; #endif -#if 1 /* ALTQ4PPP */ - if (TS_LT(nowp, &ifd->ifnow_)) { - int iftime; + if (ifd->ifq_->altq_ifp->if_type == IFT_PPP) { + if (TS_LT(nowp, &ifd->ifnow_)) { + int iftime; - /* - * make sure the estimated completion time does not go - * too far. it can happen when the link layer supports - * data compression or the interface speed is set to - * a much lower value. - */ - TS_DELTA(&ifd->ifnow_, nowp, iftime); - if (iftime+pkt_time < ifd->maxiftime_) { - TS_ADD_DELTA(&ifd->ifnow_, pkt_time, &ifd->ifnow_); + /* + * make sure the estimated completion time does not go + * too far. it can happen when the link layer supports + * data compression or the interface speed is set to + * a much lower value. + */ + TS_DELTA(&ifd->ifnow_, nowp, iftime); + if (iftime+pkt_time < ifd->maxiftime_) { +TS_ADD_DELTA(&ifd->ifnow_, pkt_time, &ifd->ifnow_); + } else { +TS_ADD_DELTA(nowp, ifd->maxiftime_, &ifd->ifnow_); + } } else { - TS_ADD_DELTA(nowp, ifd->maxiftime_, &ifd->ifnow_); + TS_ADD_DELTA(nowp, pkt_time, &ifd->ifnow_); } } else { - TS_ADD_DELTA(nowp, pkt_time, &ifd->ifnow_); - } -#else - if (TS_LT(nowp, &ifd->ifnow_)) { - TS_ADD_DELTA(&ifd->ifnow_, pkt_time, &ifd->ifnow_); - } else { - TS_ADD_DELTA(nowp, pkt_time, &ifd->ifnow_); + if (TS_LT(nowp, &ifd->ifnow_)) { + TS_ADD_DELTA(&ifd->ifnow_, pkt_time, &ifd->ifnow_); + } else { + TS_ADD_DELTA(nowp, pkt_time, &ifd->ifnow_); + } } -#endif while (cl != NULL) { TS_DELTA(&ifd->ifnow_, &cl->last_, idle);
CVS commit: src/usr.sbin/altq/altqstat
Module Name:src Committed By: ozaki-r Date: Wed Jul 21 06:48:28 UTC 2021 Modified Files: src/usr.sbin/altq/altqstat: qdisc_cbq.c Log Message: altqstat, cbq: follow uint64_t changes PR kern/56319 To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/altq/altqstat/qdisc_cbq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/altq/altqstat/qdisc_cbq.c diff -u src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.10 src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.11 --- src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.10 Wed Jul 21 06:45:10 2021 +++ src/usr.sbin/altq/altqstat/qdisc_cbq.c Wed Jul 21 06:48:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: qdisc_cbq.c,v 1.10 2021/07/21 06:45:10 ozaki-r Exp $ */ +/* $NetBSD: qdisc_cbq.c,v 1.11 2021/07/21 06:48:28 ozaki-r Exp $ */ /* $KAME: qdisc_cbq.c,v 1.7 2003/09/17 14:27:37 kjc Exp $ */ /* * Copyright (C) 1999-2000 @@ -105,9 +105,9 @@ cbq_stat_loop(int fd, const char *ifname printf("\tpriority: %d depth: %d", sp->priority, sp->depth); - printf(" offtime: %ld [ns] wrr_allot: %d bytes\n", + printf(" offtime: %"PRIi64" [ns] wrr_allot: %d bytes\n", sp->offtime, sp->wrr_allot); - printf("\tpsPerByte: %ld", sp->ps_per_byte); + printf("\tpsPerByte: %"PRIu64, sp->ps_per_byte); printf("\t(%sbps)", rate2str(flow_bps)); if (lp->handle != NULL_CLASS_HANDLE) { printf(",\tMeasured: %s [bps]\n", @@ -139,7 +139,7 @@ cbq_stat_loop(int fd, const char *ifname sp->maxidle >> RM_FILTER_GAIN, sp->minidle / RM_POWER); #else - printf("\tAvgIdle: %ld [ns],\t(maxidle: %ld minidle: %ld [ns])\n", + printf("\tAvgIdle: %"PRIi64" [ns],\t(maxidle: %"PRIi64" minidle: %"PRIi64" [ns])\n", sp->avgidle, sp->maxidle, sp->minidle); #endif }
CVS commit: src/sys/altq
Module Name:src Committed By: ozaki-r Date: Wed Jul 21 06:47:33 UTC 2021 Modified Files: src/sys/altq: altq_cbq.h altq_rmclass.c altq_rmclass.h Log Message: altq, cbq: change long to uint64_t for ILP32 archs PR kern/56319 To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/altq/altq_cbq.h cvs rdiff -u -r1.26 -r1.27 src/sys/altq/altq_rmclass.c cvs rdiff -u -r1.11 -r1.12 src/sys/altq/altq_rmclass.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/altq/altq_cbq.h diff -u src/sys/altq/altq_cbq.h:1.10 src/sys/altq/altq_cbq.h:1.11 --- src/sys/altq/altq_cbq.h:1.10 Wed Jul 21 06:41:22 2021 +++ src/sys/altq/altq_cbq.h Wed Jul 21 06:47:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: altq_cbq.h,v 1.10 2021/07/21 06:41:22 ozaki-r Exp $ */ +/* $NetBSD: altq_cbq.h,v 1.11 2021/07/21 06:47:33 ozaki-r Exp $ */ /* $KAME: altq_cbq.h,v 1.12 2003/10/03 05:05:15 kjc Exp $ */ /* @@ -81,15 +81,15 @@ typedef struct _cbq_class_stats_ { /* other static class parameters useful for debugging */ int priority; - long maxidle; - long minidle; - long offtime; + int64_t maxidle; + int64_t minidle; + int64_t offtime; int qmax; - u_long ps_per_byte; + uint64_t ps_per_byte; int wrr_allot; int qcnt; /* # packets in queue */ - long avgidle; + int64_t avgidle; /* red and rio related info */ int qtype; @@ -112,7 +112,7 @@ struct cbq_interface { typedef struct cbq_class_spec { u_int priority; - u_long pico_sec_per_byte; + uint64_t pico_sec_per_byte; u_int maxq; u_int maxidle; int minidle; Index: src/sys/altq/altq_rmclass.c diff -u src/sys/altq/altq_rmclass.c:1.26 src/sys/altq/altq_rmclass.c:1.27 --- src/sys/altq/altq_rmclass.c:1.26 Wed Jul 21 06:41:22 2021 +++ src/sys/altq/altq_rmclass.c Wed Jul 21 06:47:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: altq_rmclass.c,v 1.26 2021/07/21 06:41:22 ozaki-r Exp $ */ +/* $NetBSD: altq_rmclass.c,v 1.27 2021/07/21 06:47:33 ozaki-r Exp $ */ /* $KAME: altq_rmclass.c,v 1.19 2005/04/13 03:44:25 suz Exp $ */ /* @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: altq_rmclass.c,v 1.26 2021/07/21 06:41:22 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: altq_rmclass.c,v 1.27 2021/07/21 06:47:33 ozaki-r Exp $"); /* #ident "@(#)rm_class.c 1.48 97/12/05 SMI" */ @@ -194,7 +194,7 @@ static void rmc_root_overlimit(struct rm * offtime = offtime * (8.0 / nsecPerByte); */ struct rm_class * -rmc_newclass(int pri, struct rm_ifdat *ifd, u_long psecPerByte, +rmc_newclass(int pri, struct rm_ifdat *ifd, uint64_t psecPerByte, void (*action)(rm_class_t *, rm_class_t *), int maxq, struct rm_class *parent, struct rm_class *borrow, u_int maxidle, int minidle, u_int offtime, int pktsize, int flags) @@ -253,18 +253,18 @@ rmc_newclass(int pri, struct rm_ifdat *i cl->flags_ = flags; #if 1 /* minidle is also scaled in ALTQ */ - cl->minidle_ = ((long)minidle * (long)psecPerByte) / 8; + cl->minidle_ = ((int64_t)minidle * (int64_t)psecPerByte) / 8; if (cl->minidle_ > 0) cl->minidle_ = 0; #else cl->minidle_ = minidle; #endif - cl->maxidle_ = ((long)maxidle * (long)psecPerByte) / 8; + cl->maxidle_ = ((int64_t)maxidle * (int64_t)psecPerByte) / 8; if (cl->maxidle_ == 0) cl->maxidle_ = 1; #if 1 /* offtime is also scaled in ALTQ */ cl->avgidle_ = cl->maxidle_; - cl->offtime_ = (((long)offtime * (long)psecPerByte) / 8) >> RM_FILTER_GAIN; + cl->offtime_ = (((int64_t)offtime * (int64_t)psecPerByte) / 8) >> RM_FILTER_GAIN; if (cl->offtime_ == 0) cl->offtime_ = 1; #else @@ -347,7 +347,7 @@ rmc_newclass(int pri, struct rm_ifdat *i } int -rmc_modclass(struct rm_class *cl, u_long psecPerByte, int maxq, u_int maxidle, +rmc_modclass(struct rm_class *cl, uint64_t psecPerByte, int maxq, u_int maxidle, int minidle, u_int offtime, int pktsize) { struct rm_ifdat *ifd; @@ -365,18 +365,18 @@ rmc_modclass(struct rm_class *cl, u_long qlimit(cl->q_) = maxq; #if 1 /* minidle is also scaled in ALTQ */ - cl->minidle_ = ((long)minidle * (long)psecPerByte) / 8; + cl->minidle_ = ((int64_t)minidle * (int64_t)psecPerByte) / 8; if (cl->minidle_ > 0) cl->minidle_ = 0; #else cl->minidle_ = minidle; #endif - cl->maxidle_ = ((long)maxidle * (long)psecPerByte) / 8; + cl->maxidle_ = ((int64_t)maxidle * (int64_t)psecPerByte) / 8; if (cl->maxidle_ == 0) cl->maxidle_ = 1; #if 1 /* offtime is also scaled in ALTQ */ cl->avgidle_ = cl->maxidle_; - cl->offtime_ = (((long)offtime * (long)psecPerByte) / 8) >> RM_FILTER_GAIN; + cl->offtime_ = (((int64_t)offtime * (int64_t)psecPerByte) / 8) >> RM_FILTER_GAIN; if (cl->offtime_ == 0) cl->offtime_ = 1; #else @@ -661,7 +661,7 @@ rmc_delete_class(struct rm_ifdat *ifd, s */ int -rmc_init(struct ifaltq *ifq, struct rm_ifdat *ifd, u_long psecPerByte, +rmc_init(struct ifaltq *ifq, struct rm_ifdat *ifd, uint64_t psecPerByte, void (*restart)(struct ifaltq *),
CVS commit: src/usr.sbin/altq/altqstat
Module Name:src Committed By: ozaki-r Date: Wed Jul 21 06:45:10 UTC 2021 Modified Files: src/usr.sbin/altq/altqstat: qdisc_cbq.c Log Message: altqstat: follow changes of types of variables PR kern/56319 To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/altq/altqstat/qdisc_cbq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/altq/altqstat/qdisc_cbq.c diff -u src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.9 src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.10 --- src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.9 Wed Jul 21 06:42:07 2021 +++ src/usr.sbin/altq/altqstat/qdisc_cbq.c Wed Jul 21 06:45:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: qdisc_cbq.c,v 1.9 2021/07/21 06:42:07 ozaki-r Exp $ */ +/* $NetBSD: qdisc_cbq.c,v 1.10 2021/07/21 06:45:10 ozaki-r Exp $ */ /* $KAME: qdisc_cbq.c,v 1.7 2003/09/17 14:27:37 kjc Exp $ */ /* * Copyright (C) 1999-2000 @@ -105,7 +105,7 @@ cbq_stat_loop(int fd, const char *ifname printf("\tpriority: %d depth: %d", sp->priority, sp->depth); - printf(" offtime: %d [us] wrr_allot: %d bytes\n", + printf(" offtime: %ld [ns] wrr_allot: %d bytes\n", sp->offtime, sp->wrr_allot); printf("\tpsPerByte: %ld", sp->ps_per_byte); printf("\t(%sbps)", rate2str(flow_bps)); @@ -139,7 +139,7 @@ cbq_stat_loop(int fd, const char *ifname sp->maxidle >> RM_FILTER_GAIN, sp->minidle / RM_POWER); #else - printf("\tAvgIdle: %d [us],\t(maxidle: %d minidle: %d [us])\n", + printf("\tAvgIdle: %ld [ns],\t(maxidle: %ld minidle: %ld [ns])\n", sp->avgidle, sp->maxidle, sp->minidle); #endif }
CVS commit: src/usr.sbin/altq/altqstat
Module Name:src Committed By: ozaki-r Date: Wed Jul 21 06:42:07 UTC 2021 Modified Files: src/usr.sbin/altq/altqstat: qdisc_cbq.c Log Message: altqstat: show raw values of avgidle, maxidle and minidle The values are sometimes small and cooked values of them can be less informative such as 0 or -1. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/altq/altqstat/qdisc_cbq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/altq/altqstat/qdisc_cbq.c diff -u src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.8 src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.9 --- src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.8 Wed Jul 21 06:38:57 2021 +++ src/usr.sbin/altq/altqstat/qdisc_cbq.c Wed Jul 21 06:42:07 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: qdisc_cbq.c,v 1.8 2021/07/21 06:38:57 ozaki-r Exp $ */ +/* $NetBSD: qdisc_cbq.c,v 1.9 2021/07/21 06:42:07 ozaki-r Exp $ */ /* $KAME: qdisc_cbq.c,v 1.7 2003/09/17 14:27:37 kjc Exp $ */ /* * Copyright (C) 1999-2000 @@ -133,10 +133,15 @@ cbq_stat_loop(int fd, const char *ifname printf("\tQCount: %d,\t(qmax: %d)\n", sp->qcnt, sp->qmax); +#if 0 printf("\tAvgIdle: %d [us],\t(maxidle: %d minidle: %d [us])\n", sp->avgidle >> RM_FILTER_GAIN, sp->maxidle >> RM_FILTER_GAIN, sp->minidle / RM_POWER); +#else + printf("\tAvgIdle: %d [us],\t(maxidle: %d minidle: %d [us])\n", + sp->avgidle, sp->maxidle, sp->minidle); +#endif } /* swap the buffer pointers */
CVS commit: src/sys/altq
Module Name:src Committed By: ozaki-r Date: Wed Jul 21 06:41:22 UTC 2021 Modified Files: src/sys/altq: altq_cbq.h altq_rmclass.c altq_rmclass.h Log Message: altq, cbq: treat time in nanoseconds Time granularity in microseconds is sometimes not enough to provide accurate bandwidth control; actual bandwidth on a capped class can exceed its limit considerably in some cases. Treating time in nanoseconds requires the following changes: - Use timespec instead of timeval - Use nanotime(9) instead of microtime(9) - Change the type of some variables, especially *idle, to long To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/altq/altq_cbq.h cvs rdiff -u -r1.25 -r1.26 src/sys/altq/altq_rmclass.c cvs rdiff -u -r1.10 -r1.11 src/sys/altq/altq_rmclass.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/altq/altq_cbq.h diff -u src/sys/altq/altq_cbq.h:1.9 src/sys/altq/altq_cbq.h:1.10 --- src/sys/altq/altq_cbq.h:1.9 Wed Jul 21 06:33:30 2021 +++ src/sys/altq/altq_cbq.h Wed Jul 21 06:41:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: altq_cbq.h,v 1.9 2021/07/21 06:33:30 ozaki-r Exp $ */ +/* $NetBSD: altq_cbq.h,v 1.10 2021/07/21 06:41:22 ozaki-r Exp $ */ /* $KAME: altq_cbq.h,v 1.12 2003/10/03 05:05:15 kjc Exp $ */ /* @@ -81,15 +81,15 @@ typedef struct _cbq_class_stats_ { /* other static class parameters useful for debugging */ int priority; - int maxidle; - int minidle; - int offtime; + long maxidle; + long minidle; + long offtime; int qmax; u_long ps_per_byte; int wrr_allot; int qcnt; /* # packets in queue */ - int avgidle; + long avgidle; /* red and rio related info */ int qtype; Index: src/sys/altq/altq_rmclass.c diff -u src/sys/altq/altq_rmclass.c:1.25 src/sys/altq/altq_rmclass.c:1.26 --- src/sys/altq/altq_rmclass.c:1.25 Wed Jul 21 06:33:30 2021 +++ src/sys/altq/altq_rmclass.c Wed Jul 21 06:41:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: altq_rmclass.c,v 1.25 2021/07/21 06:33:30 ozaki-r Exp $ */ +/* $NetBSD: altq_rmclass.c,v 1.26 2021/07/21 06:41:22 ozaki-r Exp $ */ /* $KAME: altq_rmclass.c,v 1.19 2005/04/13 03:44:25 suz Exp $ */ /* @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: altq_rmclass.c,v 1.25 2021/07/21 06:33:30 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: altq_rmclass.c,v 1.26 2021/07/21 06:41:22 ozaki-r Exp $"); /* #ident "@(#)rm_class.c 1.48 97/12/05 SMI" */ @@ -86,7 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: altq_rmclass * Local routines. */ -static int rmc_satisfied(struct rm_class *, struct timeval *); +static int rmc_satisfied(struct rm_class *, struct timespec *); static void rmc_wrr_set_weights(struct rm_ifdat *); static void rmc_depth_compute(struct rm_class *); static void rmc_depth_recompute(rm_class_t *); @@ -99,8 +99,8 @@ static void _rmc_dropq(rm_class_t *); static mbuf_t *_rmc_getq(rm_class_t *); static mbuf_t *_rmc_pollq(rm_class_t *); -static int rmc_under_limit(struct rm_class *, struct timeval *); -static void rmc_tl_satisfied(struct rm_ifdat *, struct timeval *); +static int rmc_under_limit(struct rm_class *, struct timespec *); +static void rmc_tl_satisfied(struct rm_ifdat *, struct timespec *); static void rmc_drop_action(struct rm_class *); static void rmc_restart(struct rm_class *); static void rmc_root_overlimit(struct rm_class *, struct rm_class *); @@ -253,18 +253,18 @@ rmc_newclass(int pri, struct rm_ifdat *i cl->flags_ = flags; #if 1 /* minidle is also scaled in ALTQ */ - cl->minidle_ = (minidle * (int)PSEC_TO_NSEC(psecPerByte)) / 8; + cl->minidle_ = ((long)minidle * (long)psecPerByte) / 8; if (cl->minidle_ > 0) cl->minidle_ = 0; #else cl->minidle_ = minidle; #endif - cl->maxidle_ = (maxidle * PSEC_TO_NSEC(psecPerByte)) / 8; + cl->maxidle_ = ((long)maxidle * (long)psecPerByte) / 8; if (cl->maxidle_ == 0) cl->maxidle_ = 1; #if 1 /* offtime is also scaled in ALTQ */ cl->avgidle_ = cl->maxidle_; - cl->offtime_ = ((offtime * PSEC_TO_NSEC(psecPerByte)) / 8) >> RM_FILTER_GAIN; + cl->offtime_ = (((long)offtime * (long)psecPerByte) / 8) >> RM_FILTER_GAIN; if (cl->offtime_ == 0) cl->offtime_ = 1; #else @@ -365,18 +365,18 @@ rmc_modclass(struct rm_class *cl, u_long qlimit(cl->q_) = maxq; #if 1 /* minidle is also scaled in ALTQ */ - cl->minidle_ = (minidle * PSEC_TO_NSEC(psecPerByte)) / 8; + cl->minidle_ = ((long)minidle * (long)psecPerByte) / 8; if (cl->minidle_ > 0) cl->minidle_ = 0; #else cl->minidle_ = minidle; #endif - cl->maxidle_ = (maxidle * PSEC_TO_NSEC(psecPerByte)) / 8; + cl->maxidle_ = ((long)maxidle * (long)psecPerByte) / 8; if (cl->maxidle_ == 0) cl->maxidle_ = 1; #if 1 /* offtime is also scaled in ALTQ */ cl->avgidle_ = cl->maxidle_; - cl->offtime_ = ((offtime * PSEC_TO_NSEC(psecPerByte)) / 8) >> RM_FILTER_GAIN; + cl->offtime_ = (((long)offtime * (long)psecPerByte) / 8) >> RM_FILTER_GAIN; if (cl->offtime_ == 0) cl->offti
CVS commit: src/usr.sbin/altq/altqstat
Module Name:src Committed By: ozaki-r Date: Wed Jul 21 06:38:57 UTC 2021 Modified Files: src/usr.sbin/altq/altqstat: qdisc_cbq.c Log Message: altqstat: adopt ps_per_byte PR kern/56319 To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/altq/altqstat/qdisc_cbq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/altq/altqstat/qdisc_cbq.c diff -u src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.7 src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.8 --- src/usr.sbin/altq/altqstat/qdisc_cbq.c:1.7 Sat Oct 28 11:43:02 2006 +++ src/usr.sbin/altq/altqstat/qdisc_cbq.c Wed Jul 21 06:38:57 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: qdisc_cbq.c,v 1.7 2006/10/28 11:43:02 peter Exp $ */ +/* $NetBSD: qdisc_cbq.c,v 1.8 2021/07/21 06:38:57 ozaki-r Exp $ */ /* $KAME: qdisc_cbq.c,v 1.7 2003/09/17 14:27:37 kjc Exp $ */ /* * Copyright (C) 1999-2000 @@ -100,14 +100,14 @@ cbq_stat_loop(int fd, const char *ifname printf("Class %d on Interface %s: %s\n", sp->handle, ifname, clnames[i]); - flow_bps = 8.0 / (double)sp->ns_per_byte - * 1000*1000*1000; + flow_bps = 8.0 / (double)sp->ps_per_byte + * 1000*1000*1000*1000; printf("\tpriority: %d depth: %d", sp->priority, sp->depth); printf(" offtime: %d [us] wrr_allot: %d bytes\n", sp->offtime, sp->wrr_allot); - printf("\tnsPerByte: %d", sp->ns_per_byte); + printf("\tpsPerByte: %ld", sp->ps_per_byte); printf("\t(%sbps)", rate2str(flow_bps)); if (lp->handle != NULL_CLASS_HANDLE) { printf(",\tMeasured: %s [bps]\n",
CVS commit: src/usr.sbin/altq/libaltq
Module Name:src Committed By: ozaki-r Date: Wed Jul 21 06:36:33 UTC 2021 Modified Files: src/usr.sbin/altq/libaltq: qop_cbq.c qop_cbq.h Log Message: libaltq, cbq: convert ns_per_byte to ps_per_byte PR kern/56319 To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/altq/libaltq/qop_cbq.c cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/altq/libaltq/qop_cbq.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/altq/libaltq/qop_cbq.c diff -u src/usr.sbin/altq/libaltq/qop_cbq.c:1.11 src/usr.sbin/altq/libaltq/qop_cbq.c:1.12 --- src/usr.sbin/altq/libaltq/qop_cbq.c:1.11 Wed Jul 14 08:32:13 2021 +++ src/usr.sbin/altq/libaltq/qop_cbq.c Wed Jul 21 06:36:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: qop_cbq.c,v 1.11 2021/07/14 08:32:13 ozaki-r Exp $ */ +/* $NetBSD: qop_cbq.c,v 1.12 2021/07/21 06:36:33 ozaki-r Exp $ */ /* $KAME: qop_cbq.c,v 1.7 2002/05/31 06:03:35 kjc Exp $ */ /* * Copyright (c) Sun Microsystems, Inc. 1993-1998 All rights reserved. @@ -78,8 +78,12 @@ static int cbq_delete_filter(struct fltr #define CTL_PBANDWIDTH 2 #define NS_PER_MS (100.0) #define NS_PER_SEC (NS_PER_MS*1000.0) +#define PS_PER_MS (10.0) +#define PS_PER_SEC (PS_PER_MS*1000.0) #define RM_FILTER_GAIN 5 +#define PSEC_TO_USEC(ps) ((ps) / 1000.0 / 1000.0) + #define CBQ_DEVICE "/dev/altq/cbq" static int cbq_fd = -1; @@ -484,8 +488,8 @@ qop_cbq_add_if(struct ifinfo **rp, const if ((cbq_ifinfo = calloc(1, sizeof(*cbq_ifinfo))) == NULL) return (QOPERR_NOMEM); - cbq_ifinfo->nsPerByte = - (1.0 / (double)bandwidth) * NS_PER_SEC * 8; + cbq_ifinfo->psPerByte = + (1.0 / (double)bandwidth) * PS_PER_SEC * 8; cbq_ifinfo->is_wrr = is_wrr; cbq_ifinfo->is_efficient = efficient; cbq_ifinfo->no_control = no_control; @@ -768,7 +772,7 @@ cbq_class_spec(struct ifinfo *ifinfo, u_ { struct cbq_ifinfo *cbq_ifinfo = ifinfo->private; double maxq, maxidle_s, maxidle, minidle, - lofftime, nsPerByte, ptime, cptime; + lofftime, psPerByte, ptime, cptime; double z = (double)(1 << RM_FILTER_GAIN); double g = (1.0 - 1.0 / z); double f; @@ -792,22 +796,12 @@ cbq_class_spec(struct ifinfo *ifinfo, u_ else if (max_pkt_size > ifinfo->ifmtu) max_pkt_size = ifinfo->ifmtu; -nsPerByte = cbq_ifinfo->nsPerByte / f; - ptime = (double) av_pkt_size * (double)cbq_ifinfo->nsPerByte; +psPerByte = cbq_ifinfo->psPerByte / f; + ptime = (double) av_pkt_size * (double)cbq_ifinfo->psPerByte; cptime = ptime * (1.0 - f) / f; -#if 1 /* ALTQ */ - if (nsPerByte * (double)max_pkt_size > (double)INT_MAX) { - /* - * this causes integer overflow in kernel! - * (bandwidth < 6Kbps when max_pkt_size=1500) - */ - if (bandwidth != 0) - LOG(LOG_WARNING, 0, "warning: class is too slow!!"); - nsPerByte = (double)(INT_MAX / max_pkt_size); - } -#endif + if (maxburst == 0) { /* use default */ - if (cptime > 10.0 * NS_PER_MS) + if (cptime > 10.0 * PS_PER_MS) maxburst = 4; else maxburst = 16; @@ -823,9 +817,9 @@ cbq_class_spec(struct ifinfo *ifinfo, u_ "cbq_flowspec: maxburst=%d,minburst=%d,pkt_size=%d", maxburst, minburst, av_pkt_size); LOG(LOG_DEBUG, 0, - " nsPerByte=%.2f ns, link's nsPerByte=%.2f, f=%.3f", - nsPerByte, cbq_ifinfo->nsPerByte, f); - packet_time = av_pkt_size * (int)nsPerByte / 1000; + " psPerByte=%.2f ps, link's psPerByte=%.2f, f=%.3f", + psPerByte, cbq_ifinfo->psPerByte, f); + packet_time = av_pkt_size * (int)PSEC_TO_USEC(psPerByte); LOG(LOG_DEBUG, 0, " packet time=%d [us]\n", packet_time); if (maxburst * packet_time < 2) { @@ -845,21 +839,21 @@ cbq_class_spec(struct ifinfo *ifinfo, u_ else maxidle = ptime * maxidle_s; if (IsDebug(DEBUG_ALTQ)) - LOG(LOG_DEBUG, 0, " maxidle=%.2f us", maxidle/1000.0); + LOG(LOG_DEBUG, 0, " maxidle=%.2f us", PSEC_TO_USEC(maxidle)); if (minburst) lofftime = cptime * (1.0 + 1.0/(1.0 - g) * (1.0 - gtom) / gtom); else lofftime = cptime; - minidle = -((double)max_pkt_size * (double)nsPerByte); + minidle = -((double)max_pkt_size * (double)psPerByte); if (IsDebug(DEBUG_ALTQ)) LOG(LOG_DEBUG, 0, " lofftime=%.2f us minidle=%.2f us", - lofftime/1000.0, minidle/1000.0); + PSEC_TO_USEC(lofftime), PSEC_TO_USEC(minidle)); - maxidle = ((maxidle * 8.0) / nsPerByte) * pow(2, RM_FILTER_GAIN); + maxidle = ((maxidle * 8.0) / psPerByte) * pow(2, RM_FILTER_GAIN); #if 1 /* ALTQ */ /* also scale lofftime and minidle */ - lofftime = (lofftime * 8.0) / nsPerByte * pow(2, RM_FILTER_GAIN); - minidle = ((minidle * 8.0) / nsPerByte) * pow(2, RM_FILTER_GAIN); + lofftime = (lofftime * 8.0) / psPerByte * pow(2, RM_FILTER_GAIN); + minidle = ((minidle * 8.0) / psPerByte) * pow(2, RM_FILTER_GAIN); #endif maxidle = maxidle / 1000.0; lofftime = lofftime / 1000.0; @@ -872,7 +866,7 @@ cbq_class_spec(struct ifinfo *ifinfo, u_ else maxq =
CVS commit: src/sys
Module Name:src Committed By: skrll Date: Wed Jul 21 06:35:46 UTC 2021 Modified Files: src/sys/compat/common: tty_60.c src/sys/dev/audio: alaw.c audiobell.c linear.c mulaw.c src/sys/dev/hid: hidkbdmap.c src/sys/dev/usb: usbroothub.c src/sys/kern: subr_cprng.c subr_psref.c sys_futex.c vfs_cache.c src/sys/netatalk: at_print.c src/sys/uvm: uvm_mmap.c src/sys/uvm/pmap: pmap_pvt.c Log Message: need for COHERENCY_UNIT Minor KNF along the way. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/compat/common/tty_60.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/audio/alaw.c src/sys/dev/audio/linear.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/audio/audiobell.c \ src/sys/dev/audio/mulaw.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/hid/hidkbdmap.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/usb/usbroothub.c cvs rdiff -u -r1.40 -r1.41 src/sys/kern/subr_cprng.c cvs rdiff -u -r1.14 -r1.15 src/sys/kern/subr_psref.c cvs rdiff -u -r1.11 -r1.12 src/sys/kern/sys_futex.c cvs rdiff -u -r1.149 -r1.150 src/sys/kern/vfs_cache.c cvs rdiff -u -r1.1 -r1.2 src/sys/netatalk/at_print.c cvs rdiff -u -r1.175 -r1.176 src/sys/uvm/uvm_mmap.c cvs rdiff -u -r1.10 -r1.11 src/sys/uvm/pmap/pmap_pvt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/common/tty_60.c diff -u src/sys/compat/common/tty_60.c:1.10 src/sys/compat/common/tty_60.c:1.11 --- src/sys/compat/common/tty_60.c:1.10 Wed Jun 24 17:47:52 2020 +++ src/sys/compat/common/tty_60.c Wed Jul 21 06:35:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tty_60.c,v 1.10 2020/06/24 17:47:52 jdolecek Exp $ */ +/* $NetBSD: tty_60.c,v 1.11 2021/07/21 06:35:44 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,12 +30,13 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1.10 2020/06/24 17:47:52 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tty_60.c,v 1.11 2021/07/21 06:35:44 skrll Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" #endif +#include #include #include Index: src/sys/dev/audio/alaw.c diff -u src/sys/dev/audio/alaw.c:1.3 src/sys/dev/audio/alaw.c:1.4 --- src/sys/dev/audio/alaw.c:1.3 Sat Jan 11 04:06:13 2020 +++ src/sys/dev/audio/alaw.c Wed Jul 21 06:35:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: alaw.c,v 1.3 2020/01/11 04:06:13 isaki Exp $ */ +/* $NetBSD: alaw.c,v 1.4 2021/07/21 06:35:44 skrll Exp $ */ /* * Copyright (C) 2018 Tetsuya Isaki. All rights reserved. @@ -26,8 +26,9 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: alaw.c,v 1.3 2020/01/11 04:06:13 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: alaw.c,v 1.4 2021/07/21 06:35:44 skrll Exp $"); +#include #include #include #include Index: src/sys/dev/audio/linear.c diff -u src/sys/dev/audio/linear.c:1.3 src/sys/dev/audio/linear.c:1.4 --- src/sys/dev/audio/linear.c:1.3 Sat Jan 11 04:06:13 2020 +++ src/sys/dev/audio/linear.c Wed Jul 21 06:35:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: linear.c,v 1.3 2020/01/11 04:06:13 isaki Exp $ */ +/* $NetBSD: linear.c,v 1.4 2021/07/21 06:35:44 skrll Exp $ */ /* * Copyright (C) 2017 Tetsuya Isaki. All rights reserved. @@ -27,8 +27,9 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linear.c,v 1.3 2020/01/11 04:06:13 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linear.c,v 1.4 2021/07/21 06:35:44 skrll Exp $"); +#include #include #include #include Index: src/sys/dev/audio/audiobell.c diff -u src/sys/dev/audio/audiobell.c:1.4 src/sys/dev/audio/audiobell.c:1.5 --- src/sys/dev/audio/audiobell.c:1.4 Sat Mar 20 04:56:52 2021 +++ src/sys/dev/audio/audiobell.c Wed Jul 21 06:35:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: audiobell.c,v 1.4 2021/03/20 04:56:52 isaki Exp $ */ +/* $NetBSD: audiobell.c,v 1.5 2021/07/21 06:35:44 skrll Exp $ */ /* * Copyright (c) 1999 Richard Earnshaw @@ -30,9 +30,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.4 2021/03/20 04:56:52 isaki Exp $"); +#include +__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.5 2021/07/21 06:35:44 skrll Exp $"); +#include +#include #include #include #include Index: src/sys/dev/audio/mulaw.c diff -u src/sys/dev/audio/mulaw.c:1.4 src/sys/dev/audio/mulaw.c:1.5 --- src/sys/dev/audio/mulaw.c:1.4 Sat Sep 12 06:09:16 2020 +++ src/sys/dev/audio/mulaw.c Wed Jul 21 06:35:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mulaw.c,v 1.4 2020/09/12 06:09:16 isaki Exp $ */ +/* $NetBSD: mulaw.c,v 1.5 2021/07/21 06:35:44 skrll Exp $ */ /* * Copyright (C) 2017 Tetsuya Isaki. All rights reserved. @@ -27,8 +27,9 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mulaw.c,v 1.4 2020/09/12 06:09:16 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mulaw.c,v 1.5 2021/07/21 06:35:44 skrll Exp $"); +#include #include #include #include Index: src/sys/dev/hid/hidkbdmap.c diff -u src/sys/dev/hid/hidkbdmap.c:1.13 src/sys/dev/hid/hidkbdmap.c:
CVS commit: src/sys/external/bsd/drm2/linux
Module Name:src Committed By: skrll Date: Wed Jul 21 06:34:52 UTC 2021 Modified Files: src/sys/external/bsd/drm2/linux: linux_rcu.c Log Message: need for COHERENCY_UNIT To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/linux/linux_rcu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/linux/linux_rcu.c diff -u src/sys/external/bsd/drm2/linux/linux_rcu.c:1.4 src/sys/external/bsd/drm2/linux/linux_rcu.c:1.5 --- src/sys/external/bsd/drm2/linux/linux_rcu.c:1.4 Mon Aug 27 15:07:59 2018 +++ src/sys/external/bsd/drm2/linux/linux_rcu.c Wed Jul 21 06:34:52 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_rcu.c,v 1.4 2018/08/27 15:07:59 riastradh Exp $ */ +/* $NetBSD: linux_rcu.c,v 1.5 2021/07/21 06:34:52 skrll Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -30,8 +30,9 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_rcu.c,v 1.4 2018/08/27 15:07:59 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_rcu.c,v 1.5 2021/07/21 06:34:52 skrll Exp $"); +#include #include #include #include
CVS commit: src/sys/altq
Module Name:src Committed By: ozaki-r Date: Wed Jul 21 06:33:30 UTC 2021 Modified Files: src/sys/altq: altq_cbq.c altq_cbq.h altq_rmclass.c altq_rmclass.h Log Message: altq, cbq: convert ns_per_byte to ps_per_byte Also the type of variables of it is changed to u_long from int. This change provides fine-grain resolution of bandwidth. For example 750 Mbps was treated as 800 Mbps internally because bandwidth was represented as nanoseconds per byte. Converting the representation to picoseconds per byte enables to treat 750 Mbps as-is. PR kern/56319 To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/altq/altq_cbq.c cvs rdiff -u -r1.8 -r1.9 src/sys/altq/altq_cbq.h cvs rdiff -u -r1.24 -r1.25 src/sys/altq/altq_rmclass.c cvs rdiff -u -r1.9 -r1.10 src/sys/altq/altq_rmclass.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/altq/altq_cbq.c diff -u src/sys/altq/altq_cbq.c:1.34 src/sys/altq/altq_cbq.c:1.35 --- src/sys/altq/altq_cbq.c:1.34 Wed Jul 14 08:31:15 2021 +++ src/sys/altq/altq_cbq.c Wed Jul 21 06:33:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: altq_cbq.c,v 1.34 2021/07/14 08:31:15 ozaki-r Exp $ */ +/* $NetBSD: altq_cbq.c,v 1.35 2021/07/21 06:33:30 ozaki-r Exp $ */ /* $KAME: altq_cbq.c,v 1.21 2005/04/13 03:44:24 suz Exp $ */ /* @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.34 2021/07/14 08:31:15 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: altq_cbq.c,v 1.35 2021/07/21 06:33:30 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_altq.h" @@ -226,7 +226,7 @@ get_class_stats(class_stats_t *statsp, s statsp->minidle = cl->minidle_; statsp->offtime = cl->offtime_; statsp->qmax = qlimit(cl->q_); - statsp->ns_per_byte = cl->ns_per_byte_; + statsp->ps_per_byte = cl->ps_per_byte_; statsp->wrr_allot = cl->w_allotment_; statsp->qcnt = qlen(cl->q_); statsp->avgidle = cl->avgidle_; @@ -384,7 +384,7 @@ cbq_add_queue(struct pf_altq *a) */ if ((opts->flags & CBQCLF_ROOTCLASS) != 0) { error = rmc_init(cbqp->ifnp.ifq_, &cbqp->ifnp, - opts->ns_per_byte, cbqrestart, a->qlimit, RM_MAXQUEUED, + opts->ps_per_byte, cbqrestart, a->qlimit, RM_MAXQUEUED, opts->maxidle, opts->minidle, opts->offtime, opts->flags); if (error != 0) @@ -392,7 +392,7 @@ cbq_add_queue(struct pf_altq *a) cl = cbqp->ifnp.root_; } else { cl = rmc_newclass(a->priority, - &cbqp->ifnp, opts->ns_per_byte, + &cbqp->ifnp, opts->ps_per_byte, rmc_delay_action, a->qlimit, parent, borrow, opts->maxidle, opts->minidle, opts->offtime, opts->pktsize, opts->flags); @@ -681,7 +681,7 @@ cbq_modify_class(struct cbq_modify_class if ((cl = clh_to_clp(cbqp, acp->cbq_class_handle)) == NULL) return (EINVAL); - if (rmc_modclass(cl, acp->cbq_class.nano_sec_per_byte, + if (rmc_modclass(cl, acp->cbq_class.pico_sec_per_byte, acp->cbq_class.maxq, acp->cbq_class.maxidle, acp->cbq_class.minidle, acp->cbq_class.offtime, acp->cbq_class.pktsize) < 0) @@ -724,7 +724,7 @@ cbq_class_create(cbq_state_t *cbqp, stru */ if ((spec->flags & CBQCLF_ROOTCLASS) != 0) { error = rmc_init(cbqp->ifnp.ifq_, &cbqp->ifnp, - spec->nano_sec_per_byte, cbqrestart, spec->maxq, + spec->pico_sec_per_byte, cbqrestart, spec->maxq, RM_MAXQUEUED, spec->maxidle, spec->minidle, spec->offtime, spec->flags); if (error) @@ -732,7 +732,7 @@ cbq_class_create(cbq_state_t *cbqp, stru cl = cbqp->ifnp.root_; } else { cl = rmc_newclass(spec->priority, - &cbqp->ifnp, spec->nano_sec_per_byte, + &cbqp->ifnp, spec->pico_sec_per_byte, rmc_delay_action, spec->maxq, parent, borrow, spec->maxidle, spec->minidle, spec->offtime, spec->pktsize, spec->flags); Index: src/sys/altq/altq_cbq.h diff -u src/sys/altq/altq_cbq.h:1.8 src/sys/altq/altq_cbq.h:1.9 --- src/sys/altq/altq_cbq.h:1.8 Thu Oct 12 19:59:08 2006 +++ src/sys/altq/altq_cbq.h Wed Jul 21 06:33:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: altq_cbq.h,v 1.8 2006/10/12 19:59:08 peter Exp $ */ +/* $NetBSD: altq_cbq.h,v 1.9 2021/07/21 06:33:30 ozaki-r Exp $ */ /* $KAME: altq_cbq.h,v 1.12 2003/10/03 05:05:15 kjc Exp $ */ /* @@ -85,7 +85,7 @@ typedef struct _cbq_class_stats_ { int minidle; int offtime; int qmax; - int ns_per_byte; + u_long ps_per_byte; int wrr_allot; int qcnt; /* # packets in queue */ @@ -112,7 +112,7 @@ struct cbq_interface { typedef struct cbq_class_spec { u_int priority; - u_int nano_sec_per_byte; + u_long pico_sec_per_byte; u_int maxq; u_int maxidle; int minidle; Index: src/sys/altq/altq_rmclass.c diff -u src/sys/altq/altq_rmclass.c:1.24 src/sys/altq/altq_rmclass.c:1.25 --- src/sys/altq/altq_rmclass.c:1.24 Tue Jul 13 08:23:39 2021 +++ src/sys/altq/altq_rmclass.c Wed Jul 21 06:33:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: altq_rmclass.c,v 1.24 2021/07/13 08:23:39 ozaki-r Exp $ */ +/* $NetBSD
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Wed Jul 21 06:18:32 UTC 2021 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Add AUDIO_SETINFO_gain_balance test. The test checks whether AUDIO_SETINFO can change the gain and the balance at the same time (if MD driver has the capability). See PR kern/56308. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.13 src/tests/dev/audio/audiotest.c:1.14 --- src/tests/dev/audio/audiotest.c:1.13 Tue Oct 13 09:00:17 2020 +++ src/tests/dev/audio/audiotest.c Wed Jul 21 06:18:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.13 2020/10/13 09:00:17 rin Exp $ */ +/* $NetBSD: audiotest.c,v 1.14 2021/07/21 06:18:32 isaki Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.13 2020/10/13 09:00:17 rin Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.14 2021/07/21 06:18:32 isaki Exp $"); #include #include @@ -5573,6 +5573,294 @@ DEF(AUDIO_SETINFO_gain) XP_SYS_EQ(0, r); } +/* + * Look if there are any (non-zero) gain values that can be changed. + * If any gain can be set, it is set to gain[0]. + * If another gain can be set, it is set to gain[1], otherwise gain[1] = -1. + * This is for AUDIO_SETINFO_gain_balance. + */ +static void +get_changeable_gain(int fd, int *gain, const char *dir, int offset) +{ + struct audio_info ai; + int *ai_gain; + int hi; + int lo; + int r; + + /* A hack to handle ai.{play,record}.gain in the same code.. */ + ai_gain = (int *)(((char *)&ai) + offset); + + /* Try to set the maximum gain */ + AUDIO_INITINFO(&ai); + *ai_gain = AUDIO_MAX_GAIN; + r = IOCTL(fd, AUDIO_SETINFO, &ai, "%s.gain=%d", dir, *ai_gain); + XP_SYS_EQ(0, r); + /* Get again. The value you set is not always used as is. */ + AUDIO_INITINFO(&ai); + r = IOCTL(fd, AUDIO_GETINFO, &ai, "&ai"); + XP_SYS_EQ(0, r); + hi = *ai_gain; + + /* Look for next configurable value. */ + for (lo = hi - 1; lo >= 0; lo--) { + AUDIO_INITINFO(&ai); + *ai_gain = lo; + r = IOCTL(fd, AUDIO_SETINFO, &ai, "%s.gain=%d", dir, *ai_gain); + XP_SYS_EQ(0, r); + /* Get again */ + r = IOCTL(fd, AUDIO_GETINFO, &ai, "&ai"); + XP_SYS_EQ(0, r); + if (*ai_gain != hi) { + lo = *ai_gain; + break; + } + } + + /* Now gain is lo(=gain[0]). */ + + /* + * hi lo + * --- --- + * <0 <0 : not available. + * >=0 <0 : available but not changeable. + * >=0 >=0 (hi!=lo) : available and changeable. + */ + if (hi < 0) { + gain[0] = -1; + gain[1] = -1; + DPRINTF(" > %s.gain cannot be set\n", dir); + } else if (lo < 0) { + gain[0] = hi; + gain[1] = -1; + DPRINTF(" > %s.gain can only be set %d\n", dir, gain[0]); + } else { + gain[0] = lo; + gain[1] = hi; + DPRINTF(" > %s.gain can be set %d, %d\n", + dir, gain[0], gain[1]); + } +} + +/* + * Look if there are any balance values that can be changed. + * If any balance value can be set, it is set to balance[0]. + * If another balance value can be set, it is set to balance[1], + * otherwise balance[1] = -1. + * This is for AUDIO_SETINFO_gain_balance. + */ +static void +get_changeable_balance(int fd, int *balance, const char *dir, int offset) +{ + struct audio_info ai; + u_char *ai_balance; + u_char left; + u_char right; + int r; + + /* A hack to handle ai.{play,record}.balance in the same code.. */ + ai_balance = ((u_char *)&ai) + offset; + + /* Look for the right side configurable value. */ + AUDIO_INITINFO(&ai); + *ai_balance = AUDIO_RIGHT_BALANCE; + r = IOCTL(fd, AUDIO_SETINFO, &ai, "%s.balance=%d", dir, *ai_balance); + XP_SYS_EQ(0, r); + /* Get again. The value you set is not always used as is. */ + r = IOCTL(fd, AUDIO_GETINFO, &ai, "&ai"); + XP_SYS_EQ(0, r); + right = *ai_balance; + + /* Look for the left side configurable value. */ + AUDIO_INITINFO(&ai); + *ai_balance = AUDIO_LEFT_BALANCE; + r = IOCTL(fd, AUDIO_SETINFO, &ai, "%s.balance=%d", dir, *ai_balance); + XP_SYS_EQ(0, r); + /* Get again */ + r = IOCTL(fd, AUDIO_GETINFO, &ai, "&ai"); + XP_SYS_EQ(0, r); + left = *ai_balance; + + /* Now balance is the left(=balance[0]). */ + + if (left == right) { + /* The driver has no balance feature. */ + balance[0] = left; + balance[1] = -1; + DPRINTF(" > %s.balance can only be set %d\n", + dir, balance[0]); + } else { + balance[0] = left; + balance[1] = right; + DPRINTF(" > %s.balance can be set %d, %d\n", + dir, balance[0], balance[1]); + } +} + +/* + * Check whether gain and balance can be set at the same time. + * PR kern/56308 + */ +DEF(AUDIO_SETINFO_gain_balance) +{ + struct audio_info oai; + struct audio_info ai; + int i; + int mode; + int fd; + int r; + int pgain[2]; + int pbalance[2]; + int rgain[2]; + int rbalance[2]; + bool ptest; +
CVS commit: src/sys/dev/audio
Module Name:src Committed By: isaki Date: Wed Jul 21 06:14:58 UTC 2021 Modified Files: src/sys/dev/audio: audio.c Log Message: AUDIO_SETINFO: fix a bug that the gain and the balance could not be set at the same time. Fix PR kern/56308. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/dev/audio/audio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/audio/audio.c diff -u src/sys/dev/audio/audio.c:1.104 src/sys/dev/audio/audio.c:1.105 --- src/sys/dev/audio/audio.c:1.104 Tue Jun 8 09:46:04 2021 +++ src/sys/dev/audio/audio.c Wed Jul 21 06:14:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.104 2021/06/08 09:46:04 riastradh Exp $ */ +/* $NetBSD: audio.c,v 1.105 2021/07/21 06:14:58 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -138,7 +138,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.104 2021/06/08 09:46:04 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.105 2021/07/21 06:14:58 isaki Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -7418,59 +7418,46 @@ audio_hw_setinfo(struct audio_softc *sc, } } - /* Backup play.{gain,balance} */ + /* play.{gain,balance} */ if (SPECIFIED(newpi->gain) || SPECIFIED_CH(newpi->balance)) { au_get_gain(sc, &sc->sc_outports, &pgain, &pbalance); if (oldai) { oldpi->gain = pgain; oldpi->balance = pbalance; } + + if (SPECIFIED(newpi->gain)) + pgain = newpi->gain; + if (SPECIFIED_CH(newpi->balance)) + pbalance = newpi->balance; + error = au_set_gain(sc, &sc->sc_outports, pgain, pbalance); + if (error) { + audio_printf(sc, + "setting play.gain=%d/balance=%d failed: " + "errno=%d\n", + pgain, pbalance, error); + goto abort; + } } - /* Backup record.{gain,balance} */ + + /* record.{gain,balance} */ if (SPECIFIED(newri->gain) || SPECIFIED_CH(newri->balance)) { au_get_gain(sc, &sc->sc_inports, &rgain, &rbalance); if (oldai) { oldri->gain = rgain; oldri->balance = rbalance; } - } - if (SPECIFIED(newpi->gain)) { - error = au_set_gain(sc, &sc->sc_outports, - newpi->gain, pbalance); - if (error) { - audio_printf(sc, - "setting play.gain=%d failed: errno=%d\n", - newpi->gain, error); - goto abort; - } - } - if (SPECIFIED(newri->gain)) { - error = au_set_gain(sc, &sc->sc_inports, - newri->gain, rbalance); - if (error) { - audio_printf(sc, - "setting record.gain=%d failed: errno=%d\n", - newri->gain, error); - goto abort; - } - } - if (SPECIFIED_CH(newpi->balance)) { - error = au_set_gain(sc, &sc->sc_outports, - pgain, newpi->balance); - if (error) { - audio_printf(sc, - "setting play.balance=%d failed: errno=%d\n", - newpi->balance, error); - goto abort; - } - } - if (SPECIFIED_CH(newri->balance)) { - error = au_set_gain(sc, &sc->sc_inports, - rgain, newri->balance); + + if (SPECIFIED(newri->gain)) + rgain = newri->gain; + if (SPECIFIED_CH(newri->balance)) + rbalance = newri->balance; + error = au_set_gain(sc, &sc->sc_inports, rgain, rbalance); if (error) { audio_printf(sc, - "setting record.balance=%d failed: errno=%d\n", - newri->balance, error); + "setting record.gain=%d/balance=%d failed: " + "errno=%d\n", + rgain, rbalance, error); goto abort; } }
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Tue Jul 20 19:44:36 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y externs1.h init.c tree.c Log Message: lint: use consistent naming scheme for functions that build nodes No functional change. To generate a diff of this commit: cvs rdiff -u -r1.329 -r1.330 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.119 -r1.120 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.202 -r1.203 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.317 -r1.318 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.329 src/usr.bin/xlint/lint1/cgram.y:1.330 --- src/usr.bin/xlint/lint1/cgram.y:1.329 Tue Jul 20 19:35:53 2021 +++ src/usr.bin/xlint/lint1/cgram.y Tue Jul 20 19:44:36 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.329 2021/07/20 19:35:53 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.330 2021/07/20 19:44:36 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.329 2021/07/20 19:35:53 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.330 2021/07/20 19:44:36 rillig Exp $"); #endif #include @@ -412,13 +412,13 @@ primary_expression: /* XXX really necessary? */ if (yychar < 0) yychar = yylex(); - $$ = new_name_node(getsym($1), yychar); + $$ = build_name(getsym($1), yychar); } | T_CON { - $$ = expr_new_constant(gettyp($1->v_tspec), $1); + $$ = build_constant(gettyp($1->v_tspec), $1); } | string { - $$ = new_string_node($1); + $$ = build_string($1); } | T_LPAREN expression T_RPAREN { if ($2 != NULL) @@ -473,10 +473,10 @@ postfix_expression: $$ = build_unary(INDIR, build_binary($1, PLUS, $3)); } | postfix_expression T_LPAREN T_RPAREN { - $$ = new_function_call_node($1, NULL); + $$ = build_function_call($1, NULL); } | postfix_expression T_LPAREN argument_expression_list T_RPAREN { - $$ = new_function_call_node($1, $3); + $$ = build_function_call($1, $3); } | postfix_expression point_or_arrow T_NAME { $$ = build_member_access($1, $2, $3); @@ -492,7 +492,7 @@ postfix_expression: if (!Sflag) /* compound literals are a C9X/GCC extension */ gnuism(319); - $$ = new_name_node(*current_initsym(), 0); + $$ = build_name(*current_initsym(), 0); end_initialization(); } | T_LPAREN compound_statement_lbrace gcc_statement_expr_list { @@ -504,7 +504,7 @@ postfix_expression: /* ({ }) is a GCC extension */ gnuism(320); } compound_statement_rbrace T_RPAREN { - $$ = new_name_node(*current_initsym(), 0); + $$ = build_name(*current_initsym(), 0); end_initialization(); } ; @@ -564,10 +564,10 @@ point_or_arrow: /* helper for 'postfix /* K&R 7.1, C90 ???, C99 6.5.2, C11 6.5.2 */ argument_expression_list: assignment_expression { - $$ = new_function_argument_node(NULL, $1); + $$ = build_function_argument(NULL, $1); } | argument_expression_list T_COMMA assignment_expression { - $$ = new_function_argument_node($1, $3); + $$ = build_function_argument($1, $3); } ; Index: src/usr.bin/xlint/lint1/externs1.h diff -u src/usr.bin/xlint/lint1/externs1.h:1.119 src/usr.bin/xlint/lint1/externs1.h:1.120 --- src/usr.bin/xlint/lint1/externs1.h:1.119 Tue Jul 20 19:35:53 2021 +++ src/usr.bin/xlint/lint1/externs1.h Tue Jul 20 19:44:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: externs1.h,v 1.119 2021/07/20 19:35:53 rillig Exp $ */ +/* $NetBSD: externs1.h,v 1.120 2021/07/20 19:44:36 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -204,9 +204,9 @@ extern int to_int_constant(tnode_t *, bo extern const tnode_t *before_conversion(const tnode_t *); extern type_t *derive_type(type_t *, tspec_t); extern type_t *expr_derive_type(type_t *, tspec_t); -extern tnode_t *expr_new_constant(type_t *, val_t *); -extern tnode_t *new_name_node(sym_t *, int); -extern tnode_t *new_string_node(strg_t *); +extern tnode_t *build_constant(type_t *, val_t *); +extern tnode_t *build_name(sym_t *, int); +extern tnode_t *build_string(strg_t *); extern sym_t *struct_or_union_member(tnode_t *, op_t, sym_t *); extern tnode_t *build_generic_selection(const tnode_t *, struct generic_association *); @@ -224,8 +224,8 @@ extern tnode_t *build_sizeof(const type_ extern tnode_t *build_offsetof(const type_t *, const sym_t *); extern tnode_t *build_alignof(const type_t *); extern tnode_t *cast(tnode_t *, type_t *); -extern tnode_t *new_function_argument_node(tnode_t *, tnode_t *); -extern tnode_t *new_function_call_node(tnode_t *, tnode_t *); +extern tnode_t *build_function_argument(tnode_t *, tnode_t *); +extern tnode_t *build_function_call(tnode_t *, tnode_t *); extern val_t *constant(tnode_t *, bool); extern void expr(tnode_t *, bool, bool, bool, bool
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Tue Jul 20 19:35:53 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y externs1.h func.c init.c tree.c Log Message: lint: split 'build' into build_binary and build_unary No functional change. To generate a diff of this commit: cvs rdiff -u -r1.328 -r1.329 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.118 -r1.119 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.113 -r1.114 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.201 -r1.202 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.316 -r1.317 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.328 src/usr.bin/xlint/lint1/cgram.y:1.329 --- src/usr.bin/xlint/lint1/cgram.y:1.328 Thu Jul 15 20:05:49 2021 +++ src/usr.bin/xlint/lint1/cgram.y Tue Jul 20 19:35:53 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.328 2021/07/15 20:05:49 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.329 2021/07/20 19:35:53 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.328 2021/07/15 20:05:49 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.329 2021/07/20 19:35:53 rillig Exp $"); #endif #include @@ -470,7 +470,7 @@ generic_association: postfix_expression: primary_expression | postfix_expression T_LBRACK expression T_RBRACK { - $$ = build(INDIR, build(PLUS, $1, $3), NULL); + $$ = build_unary(INDIR, build_binary($1, PLUS, $3)); } | postfix_expression T_LPAREN T_RPAREN { $$ = new_function_call_node($1, NULL); @@ -482,7 +482,7 @@ postfix_expression: $$ = build_member_access($1, $2, $3); } | postfix_expression T_INCDEC { - $$ = build($2 == INC ? INCAFT : DECAFT, $1, NULL); + $$ = build_unary($2 == INC ? INCAFT : DECAFT, $1); } | T_LPAREN type_name T_RPAREN { /* C99 6.5.2.5 "Compound literals" */ sym_t *tmp = mktempsym($2); @@ -575,32 +575,32 @@ argument_expression_list: unary_expression: postfix_expression | T_INCDEC unary_expression { - $$ = build($1 == INC ? INCBEF : DECBEF, $2, NULL); + $$ = build_unary($1 == INC ? INCBEF : DECBEF, $2); } | T_AMPER cast_expression { - $$ = build(ADDR, $2, NULL); + $$ = build_unary(ADDR, $2); } | T_ASTERISK cast_expression { - $$ = build(INDIR, $2, NULL); + $$ = build_unary(INDIR, $2); } | T_ADDITIVE cast_expression { if (tflag && $1 == PLUS) { /* unary + is illegal in traditional C */ warning(100); } - $$ = build($1 == PLUS ? UPLUS : UMINUS, $2, NULL); + $$ = build_unary($1 == PLUS ? UPLUS : UMINUS, $2); } | T_COMPLEMENT cast_expression { - $$ = build(COMPL, $2, NULL); + $$ = build_unary(COMPL, $2); } | T_LOGNOT cast_expression { - $$ = build(NOT, $2, NULL); + $$ = build_unary(NOT, $2); } | T_REAL cast_expression { /* GCC c_parser_unary_expression */ - $$ = build(REAL, $2, NULL); + $$ = build_unary(REAL, $2); } | T_IMAG cast_expression { /* GCC c_parser_unary_expression */ - $$ = build(IMAG, $2, NULL); + $$ = build_unary(IMAG, $2); } | T_EXTENSION cast_expression { /* GCC c_parser_unary_expression */ $$ = $2; @@ -649,41 +649,41 @@ expression_opt: /* K&R ???, C90 ???, C99 6.5.5 to 6.5.15, C11 6.5.5 to 6.5.15 */ conditional_expression: conditional_expression T_ASTERISK conditional_expression { - $$ = build(MULT, $1, $3); + $$ = build_binary($1, MULT, $3); } | conditional_expression T_MULTIPLICATIVE conditional_expression { - $$ = build($2, $1, $3); + $$ = build_binary($1, $2, $3); } | conditional_expression T_ADDITIVE conditional_expression { - $$ = build($2, $1, $3); + $$ = build_binary($1, $2, $3); } | conditional_expression T_SHIFT conditional_expression { - $$ = build($2, $1, $3); + $$ = build_binary($1, $2, $3); } | conditional_expression T_RELATIONAL conditional_expression { - $$ = build($2, $1, $3); + $$ = build_binary($1, $2, $3); } | conditional_expression T_EQUALITY conditional_expression { - $$ = build($2, $1, $3); + $$ = build_binary($1, $2, $3); } | conditional_expression T_AMPER conditional_expression { - $$ = build(BITAND, $1, $3); + $$ = build_binary($1, BITAND, $3); } | conditional_expression T_BITXOR conditional_expression { - $$ = build(BITXOR, $1, $3); + $$ = build_binary($1, BITXOR, $3); } | conditional_expression T_BITOR conditional_expression { - $$ = build(BITOR, $1, $3); + $$ = build_binary($1, BITOR, $3); } | conditional_expression T_LOGAND conditional_expression { - $$ = build(LOGAND, $1, $3); + $$ = build_binary($1, LOGAND, $3); } | conditional_expression T_LOGOR conditional_expression { - $$ = build(LOGOR, $1, $3); + $$ = build_binary($1, LOGOR, $3); } | conditional_expression T_QUEST conditional_ex
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: rhialto Date: Tue Jul 20 19:31:23 UTC 2021 Modified Files: src/distrib/utils/embedded/files: ec2_init Log Message: Extract just the random bits to feed to /dev/urandom. This makes no difference in the randomness of the pool, but it improves on the estimation (if any) of how many random bits were obtained. Also make the ftp -q time out a bit longer since I got some time outs. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/distrib/utils/embedded/files/ec2_init Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/ec2_init diff -u src/distrib/utils/embedded/files/ec2_init:1.3 src/distrib/utils/embedded/files/ec2_init:1.4 --- src/distrib/utils/embedded/files/ec2_init:1.3 Thu Jul 15 19:03:17 2021 +++ src/distrib/utils/embedded/files/ec2_init Tue Jul 20 19:31:23 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: ec2_init,v 1.3 2021/07/15 19:03:17 rhialto Exp $ +# $NetBSD: ec2_init,v 1.4 2021/07/20 19:31:23 rhialto Exp $ # # PROVIDE: ec2_init # REQUIRE: NETWORKING @@ -28,6 +28,11 @@ ec2_newuser() useradd -g users -G wheel,operator -m "${EC2_USER}" } +extract_random_seed() +{ + sed -n -e '/random_seed/s/.*"random_seed": *"\([A-Za-z0-9+/=]*\)".*/\1/p' +} + ec2_init() { ( @@ -38,7 +43,7 @@ ec2_init() try=0 while [ $((try++)) -lt 20 ] do - HOSTNAME=$(ftp -o - -q 1 "${METADATA_URL}${HOSTNAME_URL}") + HOSTNAME=$(ftp -o - -q 2 "${METADATA_URL}${HOSTNAME_URL}") if [ -n "$HOSTNAME" ]; then echo "Setting EC2 hostname: ${HOSTNAME}" echo "$HOSTNAME" > /etc/myname @@ -53,7 +58,7 @@ ec2_init() id "${EC2_USER}" >/dev/null 2>&1 || ec2_newuser # fetch the public key from Amazon Web Services - EC2_SSH_KEY=$(ftp -o - -q 1 "${METADATA_URL}${SSH_KEY_URL}") + EC2_SSH_KEY=$(ftp -o - -q 2 "${METADATA_URL}${SSH_KEY_URL}") if [ -n "$EC2_SSH_KEY" ]; then # A key pair is associated with this instance, add it @@ -71,10 +76,11 @@ ec2_init() fi fi - # May contain a "random_seed". Everything else doesn't matter. - OS_METADATA="$(ftp -o - -q 1 ${OS_METADATA_URL})" + # May contain a "random_seed". + OS_METADATA="$(ftp -o - -q 2 ${OS_METADATA_URL})" if echo "$OS_METADATA" | grep -q random_seed; then - echo "$OS_METADATA" >> /dev/urandom + echo "$OS_METADATA" | extract_random_seed | + base64 -di >> /dev/urandom fi ) }
CVS commit: src/distrib/amd64/liveimage/emuimage
Module Name:src Committed By: rhialto Date: Tue Jul 20 19:27:51 UTC 2021 Modified Files: src/distrib/amd64/liveimage/emuimage: ec2_init Log Message: Don't override /etc/rc.conf if it sets ec2_init. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/distrib/amd64/liveimage/emuimage/ec2_init Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/amd64/liveimage/emuimage/ec2_init diff -u src/distrib/amd64/liveimage/emuimage/ec2_init:1.3 src/distrib/amd64/liveimage/emuimage/ec2_init:1.4 --- src/distrib/amd64/liveimage/emuimage/ec2_init:1.3 Thu Jul 15 17:20:25 2021 +++ src/distrib/amd64/liveimage/emuimage/ec2_init Tue Jul 20 19:27:51 2021 @@ -1,4 +1,4 @@ -# $NetBSD: ec2_init,v 1.3 2021/07/15 17:20:25 rhialto Exp $ +# $NetBSD: ec2_init,v 1.4 2021/07/20 19:27:51 rhialto Exp $ is_ec2() { val=NO @@ -23,4 +23,9 @@ is_ec2() { printf $val } -ec2_init=$(is_ec2) +# Don't override /etc/rc.conf +if [ -z "$ec2_init" ] +then + ec2_init=$(is_ec2) +fi +
CVS commit: src/usr.bin/xlint/arch/aarch64
Module Name:src Committed By: rillig Date: Tue Jul 20 18:43:06 UTC 2021 Modified Files: src/usr.bin/xlint/arch/aarch64: targparam.h Log Message: lint: make char unsigned on aarch64 This fixes tests msg_074 and msg_076, which previously warned for '\xff': conversion of 'int' to 'char' is out of range [119] The commit from 2014-08-10 that first defined char as signed had the remark "Enough for a distribution build". At that time, there was no unit test for lint1 that would have detected the signedness of char. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/xlint/arch/aarch64/targparam.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/arch/aarch64/targparam.h diff -u src/usr.bin/xlint/arch/aarch64/targparam.h:1.5 src/usr.bin/xlint/arch/aarch64/targparam.h:1.6 --- src/usr.bin/xlint/arch/aarch64/targparam.h:1.5 Sun Jun 27 08:43:46 2021 +++ src/usr.bin/xlint/arch/aarch64/targparam.h Tue Jul 20 18:43:06 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: targparam.h,v 1.5 2021/06/27 08:43:46 rillig Exp $ */ +/* $NetBSD: targparam.h,v 1.6 2021/07/20 18:43:06 rillig Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ /* * Machine-dependent target parameters for lint1. */ -#include "schar.h" +#include "uchar.h" #include "lp64.h" /*
CVS commit: src/usr.sbin/sysinst
Module Name:src Committed By: martin Date: Tue Jul 20 16:41:27 UTC 2021 Modified Files: src/usr.sbin/sysinst: bsddisklabel.c Log Message: PR 56303: do not borrow from the default swap allocation if we are in tiny ram conditions and will need to enable swap early. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/sysinst/bsddisklabel.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/sysinst/bsddisklabel.c diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.58 src/usr.sbin/sysinst/bsddisklabel.c:1.59 --- src/usr.sbin/sysinst/bsddisklabel.c:1.58 Sat Feb 13 15:31:35 2021 +++ src/usr.sbin/sysinst/bsddisklabel.c Tue Jul 20 16:41:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bsddisklabel.c,v 1.58 2021/02/13 15:31:35 martin Exp $ */ +/* $NetBSD: bsddisklabel.c,v 1.59 2021/07/20 16:41:27 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -1153,7 +1153,8 @@ fill_defaults(struct partition_usage_set continue; free_space -= wanted->infos[i].size; } - if (free_space < 0 && swap < wanted->num) { + if (free_space < 0 && swap < wanted->num && + get_ramsize() > TINY_RAM_SIZE) { /* steel from swap partition */ daddr_t d = wanted->infos[swap].size; daddr_t inc = roundup(-free_space, align);
CVS commit: src/usr.sbin/sysinst
Module Name:src Committed By: martin Date: Tue Jul 20 16:40:12 UTC 2021 Modified Files: src/usr.sbin/sysinst: util.c Log Message: RAM size will not change during installation, do the sysctl() dance only once. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/sysinst/util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/sysinst/util.c diff -u src/usr.sbin/sysinst/util.c:1.57 src/usr.sbin/sysinst/util.c:1.58 --- src/usr.sbin/sysinst/util.c:1.57 Sun Jan 31 22:45:47 2021 +++ src/usr.sbin/sysinst/util.c Tue Jul 20 16:40:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.57 2021/01/31 22:45:47 rillig Exp $ */ +/* $NetBSD: util.c,v 1.58 2021/07/20 16:40:12 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -264,11 +264,14 @@ file_mode_match(const char *path, unsign uint64_t get_ramsize(void) { - uint64_t ramsize; - size_t len = sizeof ramsize; - int mib[2] = {CTL_HW, HW_PHYSMEM64}; + static uint64_t ramsize; - sysctl(mib, 2, &ramsize, &len, NULL, 0); + if (ramsize == 0) { + size_t len = sizeof ramsize; + int mib[2] = {CTL_HW, HW_PHYSMEM64}; + + sysctl(mib, 2, &ramsize, &len, NULL, 0); + } /* Find out how many Megs ... round up. */ return (ramsize + MEG - 1) / MEG;
CVS commit: src/sys/ddb
Module Name:src Committed By: christos Date: Tue Jul 20 11:39:16 UTC 2021 Modified Files: src/sys/ddb: db_panic.c Log Message: need for COHERENCY_UNIT To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/ddb/db_panic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ddb/db_panic.c diff -u src/sys/ddb/db_panic.c:1.9 src/sys/ddb/db_panic.c:1.10 --- src/sys/ddb/db_panic.c:1.9 Sat Jan 26 21:08:41 2019 +++ src/sys/ddb/db_panic.c Tue Jul 20 07:39:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_panic.c,v 1.9 2019/01/27 02:08:41 pgoyette Exp $ */ +/* $NetBSD: db_panic.c,v 1.10 2021/07/20 11:39:16 christos Exp $ */ /*- * Copyright (c) 2000, 2002, 2006, 2007, 2009, 2013 The NetBSD Foundation, Inc. @@ -27,8 +27,9 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_panic.c,v 1.9 2019/01/27 02:08:41 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_panic.c,v 1.10 2021/07/20 11:39:16 christos Exp $"); +#include #include #include
CVS commit: src/sys/sys
Module Name:src Committed By: skrll Date: Tue Jul 20 08:37:20 UTC 2021 Modified Files: src/sys/sys: timevar.h Log Message: no need for extern kmutex_t itimer_mutex or #include here. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/sys/timevar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/timevar.h diff -u src/sys/sys/timevar.h:1.47 src/sys/sys/timevar.h:1.48 --- src/sys/sys/timevar.h:1.47 Tue Jul 20 08:36:11 2021 +++ src/sys/sys/timevar.h Tue Jul 20 08:37:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: timevar.h,v 1.47 2021/07/20 08:36:11 skrll Exp $ */ +/* $NetBSD: timevar.h,v 1.48 2021/07/20 08:37:20 skrll Exp $ */ /* * Copyright (c) 2005, 2008, 2020 The NetBSD Foundation, Inc. @@ -64,7 +64,6 @@ #include #include #include -#include struct itimer; LIST_HEAD(itlist, itimer); @@ -143,8 +142,6 @@ struct ptimers { struct itimer *pts_timers[TIMER_MAX]; }; -extern kmutex_t itimer_mutex; /* XXX */ - /* * Functions for looking at our clock: [get]{bin,nano,micro}[up]time() *
CVS commit: src/sys/sys
Module Name:src Committed By: skrll Date: Tue Jul 20 08:36:11 UTC 2021 Modified Files: src/sys/sys: timevar.h Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/sys/timevar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/timevar.h diff -u src/sys/sys/timevar.h:1.46 src/sys/sys/timevar.h:1.47 --- src/sys/sys/timevar.h:1.46 Tue Dec 8 04:09:38 2020 +++ src/sys/sys/timevar.h Tue Jul 20 08:36:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: timevar.h,v 1.46 2020/12/08 04:09:38 thorpej Exp $ */ +/* $NetBSD: timevar.h,v 1.47 2021/07/20 08:36:11 skrll Exp $ */ /* * Copyright (c) 2005, 2008, 2020 The NetBSD Foundation, Inc. @@ -154,7 +154,7 @@ extern kmutex_t itimer_mutex; /* XXX */ * "bin" == struct bintime == seconds + 64 bit fraction of seconds. * "nano" == struct timespec == seconds + nanoseconds. * "micro" == struct timeval == seconds + microseconds. - * + * * Functions containing "up" returns time relative to boot and * should be used for calculating time intervals. * @@ -164,8 +164,8 @@ extern kmutex_t itimer_mutex; /* XXX */ * much faster than the functions without "get" prefix and should * be used where a precision of 1/HZ (eg 10 msec on a 100HZ machine) * is acceptable or where performance is priority. - * (NB: "precision", _not_ "resolution" !) - * + * (NB: "precision", _not_ "resolution" !) + * */ void binuptime(struct bintime *);