This commit is contained in:
purplerain 2023-06-21 20:48:42 +00:00
parent 8e644b001d
commit 3f8ae0d130
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
11 changed files with 127 additions and 112 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: edit.c,v 1.69 2019/06/28 13:34:59 deraadt Exp $ */ /* $OpenBSD: edit.c,v 1.70 2023/06/21 22:22:08 millert Exp $ */
/* /*
* Command line editing - common code * Command line editing - common code
@ -294,6 +294,67 @@ static void glob_table(const char *pat, XPtrV *wp, struct table *tp);
static void glob_path(int flags, const char *pat, XPtrV *wp, static void glob_path(int flags, const char *pat, XPtrV *wp,
const char *path); const char *path);
static char *
plain_fmt_entry(void *arg, int i, char *buf, int bsize)
{
const char *str = ((char *const *)arg)[i];
char *buf0 = buf;
int ch;
if (buf == NULL || bsize <= 0)
internal_errorf("%s: buf %lx, bsize %d",
__func__, (long) buf, bsize);
while ((ch = (unsigned char)*str++) != '\0') {
if (iscntrl(ch)) {
if (bsize < 3)
break;
*buf++ = '^';
*buf++ = UNCTRL(ch);
bsize -= 2;
continue;
}
if (bsize < 2)
break;
*buf++ = ch;
bsize--;
}
*buf = '\0';
return buf0;
}
/* Compute the length of string taking into account escape characters. */
static size_t
strlen_esc(const char *str)
{
size_t len = 0;
int ch;
while ((ch = (unsigned char)*str++) != '\0') {
if (iscntrl(ch))
len++;
len++;
}
return len;
}
static int
pr_list(char *const *ap)
{
char *const *pp;
int nwidth;
int i, n;
for (n = 0, nwidth = 0, pp = ap; *pp; n++, pp++) {
i = strlen_esc(*pp);
nwidth = (i > nwidth) ? i : nwidth;
}
print_columns(shl_out, n, plain_fmt_entry, (void *) ap, nwidth + 1, 0);
return n;
}
void void
x_print_expansions(int nwords, char *const *words, int is_command) x_print_expansions(int nwords, char *const *words, int is_command)
{ {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: edit.h,v 1.12 2018/06/18 17:03:58 millert Exp $ */ /* $OpenBSD: edit.h,v 1.13 2023/06/21 22:22:08 millert Exp $ */
/* NAME: /* NAME:
* edit.h - globals for edit modes * edit.h - globals for edit modes
@ -16,6 +16,10 @@
#define BEL 0x07 #define BEL 0x07
#undef CTRL
#define CTRL(x) ((x) == '?' ? 0x7F : (x) & 0x1F) /* ASCII */
#define UNCTRL(x) ((x) == 0x7F ? '?' : (x) | 0x40) /* ASCII */
/* tty driver characters we are interested in */ /* tty driver characters we are interested in */
typedef struct { typedef struct {
int erase; int erase;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: emacs.c,v 1.89 2021/10/09 21:38:00 halex Exp $ */ /* $OpenBSD: emacs.c,v 1.90 2023/06/21 22:22:08 millert Exp $ */
/* /*
* Emacs-like command line editing and history * Emacs-like command line editing and history
@ -32,10 +32,6 @@
static Area aedit; static Area aedit;
#define AEDIT &aedit /* area for kill ring and macro defns */ #define AEDIT &aedit /* area for kill ring and macro defns */
#undef CTRL
#define CTRL(x) ((x) == '?' ? 0x7F : (x) & 0x1F) /* ASCII */
#define UNCTRL(x) ((x) == 0x7F ? '?' : (x) | 0x40) /* ASCII */
/* values returned by keyboard functions */ /* values returned by keyboard functions */
#define KSTD 0 #define KSTD 0
#define KEOL 1 /* ^M, ^J */ #define KEOL 1 /* ^M, ^J */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: exec.c,v 1.76 2022/10/10 14:57:48 kn Exp $ */ /* $OpenBSD: exec.c,v 1.77 2023/06/21 22:22:08 millert Exp $ */
/* /*
* execute command tree * execute command tree
@ -1340,33 +1340,6 @@ pr_menu(char *const *ap)
return n; return n;
} }
/* XXX: horrible kludge to fit within the framework */
static char *plain_fmt_entry(void *arg, int i, char *buf, int buflen);
static char *
plain_fmt_entry(void *arg, int i, char *buf, int buflen)
{
shf_snprintf(buf, buflen, "%s", ((char *const *)arg)[i]);
return buf;
}
int
pr_list(char *const *ap)
{
char *const *pp;
int nwidth;
int i, n;
for (n = 0, nwidth = 0, pp = ap; *pp; n++, pp++) {
i = strlen(*pp);
nwidth = (i > nwidth) ? i : nwidth;
}
print_columns(shl_out, n, plain_fmt_entry, (void *) ap, nwidth + 1, 0);
return n;
}
/* /*
* [[ ... ]] evaluation routines * [[ ... ]] evaluation routines
*/ */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sh.h,v 1.76 2020/07/07 10:33:58 jca Exp $ */ /* $OpenBSD: sh.h,v 1.77 2023/06/21 22:22:08 millert Exp $ */
/* /*
* Public Domain Bourne/Korn shell * Public Domain Bourne/Korn shell
@ -441,7 +441,6 @@ void flushcom(int);
char * search(const char *, const char *, int, int *); char * search(const char *, const char *, int, int *);
int search_access(const char *, int, int *); int search_access(const char *, int, int *);
int pr_menu(char *const *); int pr_menu(char *const *);
int pr_list(char *const *);
/* expr.c */ /* expr.c */
int evaluate(const char *, int64_t *, int, bool); int evaluate(const char *, int64_t *, int, bool);
int v_evaluate(struct tbl *, const char *, volatile int, bool); int v_evaluate(struct tbl *, const char *, volatile int, bool);

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: uvm_init.9,v 1.6 2023/06/20 16:30:30 cheloha Exp $ .\" $OpenBSD: uvm_init.9,v 1.7 2023/06/21 21:16:21 cheloha Exp $
.\" $NetBSD: uvm.9,v 1.14 2000/06/29 06:08:44 mrg Exp $ .\" $NetBSD: uvm.9,v 1.14 2000/06/29 06:08:44 mrg Exp $
.\" .\"
.\" Copyright (c) 1998 Matthew R. Green .\" Copyright (c) 1998 Matthew R. Green
@ -28,7 +28,7 @@
.\" XXX this manual sets nS to 1 or 0 in the description, to obtain .\" XXX this manual sets nS to 1 or 0 in the description, to obtain
.\" synopsis-like function prototypes. any better way? .\" synopsis-like function prototypes. any better way?
.\" .\"
.Dd $Mdocdate: June 20 2023 $ .Dd $Mdocdate: June 21 2023 $
.Dt UVM_INIT 9 .Dt UVM_INIT 9
.Os .Os
.Sh NAME .Sh NAME
@ -168,7 +168,7 @@ argument is ignored.
.Ft void .Ft void
.Fn uvm_kernacc "caddr_t addr" "size_t len" "int rw" .Fn uvm_kernacc "caddr_t addr" "size_t len" "int rw"
.Ft void .Ft void
.Fn uvm_meter "void *" .Fn uvm_meter
.Ft int .Ft int
.Fn uvm_sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp " "size_t newlen" "struct proc *p" .Fn uvm_sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp " "size_t newlen" "struct proc *p"
.Ft int .Ft int
@ -212,7 +212,7 @@ access, in the kernel address space.
.Pp .Pp
The The
.Fn uvm_meter .Fn uvm_meter
function periodically recomputes the load average. function calculates the load average and wakes up the swapper if necessary.
.Pp .Pp
The The
.Fn uvm_sysctl .Fn uvm_sysctl

View File

@ -1,4 +1,4 @@
/* $OpenBSD: if_iwx.c,v 1.171 2023/05/11 16:55:46 stsp Exp $ */ /* $OpenBSD: if_iwx.c,v 1.172 2023/06/21 23:24:10 mlarkin Exp $ */
/* /*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de> * Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@ -724,7 +724,7 @@ iwx_init_fw_sec(struct iwx_softc *sc, const struct iwx_fw_sects *fws,
return 0; return 0;
} }
void void
iwx_fw_version_str(char *buf, size_t bufsize, iwx_fw_version_str(char *buf, size_t bufsize,
uint32_t major, uint32_t minor, uint32_t api) uint32_t major, uint32_t minor, uint32_t api)
@ -1075,7 +1075,7 @@ iwx_ctxt_info_gen3_init(struct iwx_softc *sc, const struct iwx_fw_sects *fws)
IWX_SETBITS(sc, IWX_CSR_CTXT_INFO_BOOT_CTRL, IWX_SETBITS(sc, IWX_CSR_CTXT_INFO_BOOT_CTRL,
IWX_CSR_AUTO_FUNC_BOOT_ENA); IWX_CSR_AUTO_FUNC_BOOT_ENA);
/* kick FW self load */ /* kick FW self load */
if (!iwx_nic_lock(sc)) { if (!iwx_nic_lock(sc)) {
iwx_dma_contig_free(&sc->iml_dma); iwx_dma_contig_free(&sc->iml_dma);
@ -1713,7 +1713,7 @@ iwx_read_mem(struct iwx_softc *sc, uint32_t addr, void *buf, int dwords)
int int
iwx_write_mem(struct iwx_softc *sc, uint32_t addr, const void *buf, int dwords) iwx_write_mem(struct iwx_softc *sc, uint32_t addr, const void *buf, int dwords)
{ {
int offs; int offs;
const uint32_t *vals = buf; const uint32_t *vals = buf;
if (iwx_nic_lock(sc)) { if (iwx_nic_lock(sc)) {
@ -2343,7 +2343,7 @@ iwx_prepare_card_hw(struct iwx_softc *sc)
IWX_SETBITS(sc, IWX_CSR_DBG_LINK_PWR_MGMT_REG, IWX_SETBITS(sc, IWX_CSR_DBG_LINK_PWR_MGMT_REG,
IWX_CSR_RESET_LINK_PWR_MGMT_DISABLED); IWX_CSR_RESET_LINK_PWR_MGMT_DISABLED);
DELAY(1000); DELAY(1000);
for (ntries = 0; ntries < 10; ntries++) { for (ntries = 0; ntries < 10; ntries++) {
/* If HW is not ready, prepare the conditions to check again */ /* If HW is not ready, prepare the conditions to check again */
IWX_SETBITS(sc, IWX_CSR_HW_IF_CONFIG_REG, IWX_SETBITS(sc, IWX_CSR_HW_IF_CONFIG_REG,
@ -2709,7 +2709,7 @@ iwx_stop_device(struct iwx_softc *sc)
*/ */
iwx_conf_msix_hw(sc, 1); iwx_conf_msix_hw(sc, 1);
/* /*
* Upon stop, the APM issues an interrupt if HW RF kill is set. * Upon stop, the APM issues an interrupt if HW RF kill is set.
* Clear the interrupt again. * Clear the interrupt again.
*/ */
@ -4396,7 +4396,7 @@ iwx_run_init_mvm_ucode(struct iwx_softc *sc, int readnvm)
if (IEEE80211_ADDR_EQ(etheranyaddr, sc->sc_ic.ic_myaddr)) if (IEEE80211_ADDR_EQ(etheranyaddr, sc->sc_ic.ic_myaddr))
IEEE80211_ADDR_COPY(sc->sc_ic.ic_myaddr, IEEE80211_ADDR_COPY(sc->sc_ic.ic_myaddr,
sc->sc_nvm.hw_addr); sc->sc_nvm.hw_addr);
} }
return 0; return 0;
} }
@ -4657,7 +4657,7 @@ iwx_rx_frame(struct iwx_softc *sc, struct mbuf *m, int chanidx,
struct ieee80211_frame *wh; struct ieee80211_frame *wh;
struct ieee80211_node *ni; struct ieee80211_node *ni;
if (chanidx < 0 || chanidx >= nitems(ic->ic_channels)) if (chanidx < 0 || chanidx >= nitems(ic->ic_channels))
chanidx = ieee80211_chan2ieee(ic, ic->ic_ibss_chan); chanidx = ieee80211_chan2ieee(ic, ic->ic_ibss_chan);
wh = mtod(m, struct ieee80211_frame *); wh = mtod(m, struct ieee80211_frame *);
@ -5209,7 +5209,7 @@ iwx_rx_mpdu_mq(struct iwx_softc *sc, struct mbuf *m, void *pktdata,
/* Padding is inserted after the IV. */ /* Padding is inserted after the IV. */
hdrlen += IEEE80211_CCMP_HDRLEN; hdrlen += IEEE80211_CCMP_HDRLEN;
} }
memmove(m->m_data + 2, m->m_data, hdrlen); memmove(m->m_data + 2, m->m_data, hdrlen);
m_adj(m, 2); m_adj(m, 2);
} }
@ -5245,7 +5245,7 @@ iwx_rx_mpdu_mq(struct iwx_softc *sc, struct mbuf *m, void *pktdata,
struct ieee80211_qosframe *qwh = mtod(m, struct ieee80211_qosframe *qwh = mtod(m,
struct ieee80211_qosframe *); struct ieee80211_qosframe *);
qwh->i_qos[0] &= htole16(~IEEE80211_QOS_AMSDU); qwh->i_qos[0] &= htole16(~IEEE80211_QOS_AMSDU);
} }
} }
/* /*
@ -5890,7 +5890,7 @@ iwx_send_cmd(struct iwx_softc *sc, struct iwx_host_cmd *hcmd)
} else if (generation == sc->sc_generation) { } else if (generation == sc->sc_generation) {
free(sc->sc_cmd_resp_pkt[idx], M_DEVBUF, free(sc->sc_cmd_resp_pkt[idx], M_DEVBUF,
sc->sc_cmd_resp_len[idx]); sc->sc_cmd_resp_len[idx]);
sc->sc_cmd_resp_pkt[idx] = NULL; sc->sc_cmd_resp_pkt[idx] = NULL;
} }
} }
out: out:
@ -6946,7 +6946,7 @@ iwx_fill_probe_req(struct iwx_softc *sc, struct iwx_scan_probe_req *preq)
frm = ieee80211_add_xrates(frm, rs); frm = ieee80211_add_xrates(frm, rs);
remain -= frm - pos; remain -= frm - pos;
if (isset(sc->sc_enabled_capa, if (isset(sc->sc_enabled_capa,
IWX_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT)) { IWX_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT)) {
if (remain < 3) if (remain < 3)
return ENOBUFS; return ENOBUFS;
@ -7271,7 +7271,7 @@ iwx_ack_rates(struct iwx_softc *sc, struct iwx_node *in, int *cck_rates,
} }
for (i = IWX_FIRST_OFDM_RATE; i <= IWX_LAST_NON_HT_RATE; i++) { for (i = IWX_FIRST_OFDM_RATE; i <= IWX_LAST_NON_HT_RATE; i++) {
if ((iwx_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0) if ((iwx_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0)
continue; continue;
ofdm |= (1 << (i - IWX_FIRST_OFDM_RATE)); ofdm |= (1 << (i - IWX_FIRST_OFDM_RATE));
if (lowest_present_ofdm == -1 || lowest_present_ofdm > i) if (lowest_present_ofdm == -1 || lowest_present_ofdm > i)
lowest_present_ofdm = i; lowest_present_ofdm = i;
@ -7479,7 +7479,7 @@ iwx_mac_ctxt_cmd(struct iwx_softc *sc, struct iwx_node *in, uint32_t action,
IWX_MAC_FILTER_IN_PROBE_REQUEST | IWX_MAC_FILTER_IN_PROBE_REQUEST |
IWX_MAC_FILTER_IN_CRC32); IWX_MAC_FILTER_IN_CRC32);
} else if (!assoc || !ni->ni_associd || !ni->ni_dtimperiod) { } else if (!assoc || !ni->ni_associd || !ni->ni_dtimperiod) {
/* /*
* Allow beacons to pass through as long as we are not * Allow beacons to pass through as long as we are not
* associated or we do not have dtim period information. * associated or we do not have dtim period information.
*/ */
@ -7580,7 +7580,7 @@ iwx_scan(struct iwx_softc *sc)
} }
int int
iwx_bgscan(struct ieee80211com *ic) iwx_bgscan(struct ieee80211com *ic)
{ {
struct iwx_softc *sc = IC2IFP(ic)->if_softc; struct iwx_softc *sc = IC2IFP(ic)->if_softc;
int err; int err;
@ -7799,7 +7799,7 @@ iwx_rs_vht_rates(struct iwx_softc *sc, struct ieee80211_node *ni, int num_ss)
/* Should not happen; Values above cover the possible range. */ /* Should not happen; Values above cover the possible range. */
panic("invalid VHT Rx MCS value %u", rx_mcs); panic("invalid VHT Rx MCS value %u", rx_mcs);
} }
return ((1 << (max_mcs + 1)) - 1); return ((1 << (max_mcs + 1)) - 1);
} }
@ -8136,7 +8136,7 @@ iwx_auth(struct iwx_softc *sc)
return err; return err;
} }
in->in_phyctxt = &sc->sc_phyctxt[0]; in->in_phyctxt = &sc->sc_phyctxt[0];
IEEE80211_ADDR_COPY(in->in_macaddr, in->in_ni.ni_macaddr); IEEE80211_ADDR_COPY(in->in_macaddr, in->in_ni.ni_macaddr);
err = iwx_mac_ctxt_cmd(sc, in, IWX_FW_CTXT_ACTION_ADD, 0); err = iwx_mac_ctxt_cmd(sc, in, IWX_FW_CTXT_ACTION_ADD, 0);
if (err) { if (err) {
@ -8186,7 +8186,7 @@ iwx_auth(struct iwx_softc *sc)
if (in->in_ni.ni_intval) if (in->in_ni.ni_intval)
duration = in->in_ni.ni_intval * 9; duration = in->in_ni.ni_intval * 9;
else else
duration = 900; duration = 900;
return iwx_schedule_session_protection(sc, in, duration); return iwx_schedule_session_protection(sc, in, duration);
rm_mgmt_queue: rm_mgmt_queue:
if (generation == sc->sc_generation) if (generation == sc->sc_generation)
@ -8344,7 +8344,7 @@ iwx_run(struct iwx_softc *sc)
return err; return err;
} }
#ifdef notyet #ifdef notyet
/* /*
* Disabled for now. Default beacon filter settings * Disabled for now. Default beacon filter settings
* prevent net80211 from getting ERP and HT protection * prevent net80211 from getting ERP and HT protection
* updates from beacons. * updates from beacons.
@ -8422,7 +8422,7 @@ iwx_run_stop(struct iwx_softc *sc)
printf("%s: could not disable beacon filter (error %d)\n", printf("%s: could not disable beacon filter (error %d)\n",
DEVNAME(sc), err); DEVNAME(sc), err);
return err; return err;
} }
/* Mark station as disassociated. */ /* Mark station as disassociated. */
err = iwx_mac_ctxt_cmd(sc, in, IWX_FW_CTXT_ACTION_MODIFY, 0); err = iwx_mac_ctxt_cmd(sc, in, IWX_FW_CTXT_ACTION_MODIFY, 0);
@ -9199,7 +9199,7 @@ iwx_init(struct ifnet *ifp)
ieee80211_begin_scan(ifp); ieee80211_begin_scan(ifp);
/* /*
* ieee80211_begin_scan() ends up scheduling iwx_newstate_task(). * ieee80211_begin_scan() ends up scheduling iwx_newstate_task().
* Wait until the transition to SCAN state has completed. * Wait until the transition to SCAN state has completed.
*/ */
@ -10042,7 +10042,7 @@ iwx_rx_pkt(struct iwx_softc *sc, struct iwx_rx_data *data, struct mbuf_list *ml)
iwx_mcc_update(sc, notif); iwx_mcc_update(sc, notif);
break; break;
} }
case IWX_REPLY_ERROR: { case IWX_REPLY_ERROR: {
struct iwx_error_resp *resp; struct iwx_error_resp *resp;
SYNC_RESP_STRUCT(resp, pkt); SYNC_RESP_STRUCT(resp, pkt);
@ -10149,7 +10149,7 @@ iwx_rx_pkt(struct iwx_softc *sc, struct iwx_rx_data *data, struct mbuf_list *ml)
/* /*
* uCode sets bit 0x80 when it originates the notification, * uCode sets bit 0x80 when it originates the notification,
* i.e. when the notification is not a direct response to a * i.e. when the notification is not a direct response to a
* command sent by the driver. * command sent by the driver.
* For example, uCode issues IWX_REPLY_RX when it sends a * For example, uCode issues IWX_REPLY_RX when it sends a
* received frame to the driver. * received frame to the driver.
*/ */
@ -10459,7 +10459,7 @@ iwx_match(struct device *parent, iwx_match_t match __unused, void *aux)
* Part of this complexity comes from iwlwifi supporting both iwm(4) and iwx(4) * Part of this complexity comes from iwlwifi supporting both iwm(4) and iwx(4)
* devices in the same driver. * devices in the same driver.
* *
* Our table below contains mostly "new" entries declared in iwlwifi * Our table below contains mostly "new" entries declared in iwlwifi
* with the _IWL_DEV_INFO() macro (with a leading underscore). * with the _IWL_DEV_INFO() macro (with a leading underscore).
* Other devices are matched based on PCI vendor/product ID as usual, * Other devices are matched based on PCI vendor/product ID as usual,
* unless matching specific PCI subsystem vendor/product IDs is required. * unless matching specific PCI subsystem vendor/product IDs is required.
@ -11341,7 +11341,7 @@ fail4: while (--txq_i >= 0)
iwx_free_rx_ring(sc, &sc->rxq); iwx_free_rx_ring(sc, &sc->rxq);
if (sc->ict_dma.vaddr != NULL) if (sc->ict_dma.vaddr != NULL)
iwx_dma_contig_free(&sc->ict_dma); iwx_dma_contig_free(&sc->ict_dma);
fail1: iwx_dma_contig_free(&sc->ctxt_info_dma); fail1: iwx_dma_contig_free(&sc->ctxt_info_dma);
iwx_dma_contig_free(&sc->prph_scratch_dma); iwx_dma_contig_free(&sc->prph_scratch_dma);
iwx_dma_contig_free(&sc->prph_info_dma); iwx_dma_contig_free(&sc->prph_info_dma);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sched_bsd.c,v 1.75 2023/06/20 16:30:30 cheloha Exp $ */ /* $OpenBSD: sched_bsd.c,v 1.76 2023/06/21 21:16:21 cheloha Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*- /*-
@ -234,6 +234,7 @@ schedcpu(void *arg)
} }
SCHED_UNLOCK(s); SCHED_UNLOCK(s);
} }
uvm_meter();
wakeup(&lbolt); wakeup(&lbolt);
timeout_add_sec(to, 1); timeout_add_sec(to, 1);
} }
@ -668,7 +669,6 @@ scheduler_start(void)
rrticks_init = hz / 10; rrticks_init = hz / 10;
schedcpu(&schedcpu_to); schedcpu(&schedcpu_to);
uvm_meter(NULL);
#ifndef SMALL_KERNEL #ifndef SMALL_KERNEL
if (perfpolicy == PERFPOL_AUTO) if (perfpolicy == PERFPOL_AUTO)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: uvm_extern.h,v 1.169 2023/06/20 16:30:30 cheloha Exp $ */ /* $OpenBSD: uvm_extern.h,v 1.170 2023/06/21 21:16:21 cheloha Exp $ */
/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */
/* /*
@ -414,7 +414,7 @@ void uvmspace_free(struct vmspace *);
struct vmspace *uvmspace_share(struct process *); struct vmspace *uvmspace_share(struct process *);
int uvm_share(vm_map_t, vaddr_t, vm_prot_t, int uvm_share(vm_map_t, vaddr_t, vm_prot_t,
vm_map_t, vaddr_t, vsize_t); vm_map_t, vaddr_t, vsize_t);
void uvm_meter(void *); void uvm_meter(void);
int uvm_sysctl(int *, u_int, void *, size_t *, int uvm_sysctl(int *, u_int, void *, size_t *,
void *, size_t, struct proc *); void *, size_t, struct proc *);
struct vm_page *uvm_pagealloc(struct uvm_object *, struct vm_page *uvm_pagealloc(struct uvm_object *,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: uvm_meter.c,v 1.43 2023/06/20 16:30:30 cheloha Exp $ */ /* $OpenBSD: uvm_meter.c,v 1.44 2023/06/21 21:16:21 cheloha Exp $ */
/* $NetBSD: uvm_meter.c,v 1.21 2001/07/14 06:36:03 matt Exp $ */ /* $NetBSD: uvm_meter.c,v 1.21 2001/07/14 06:36:03 matt Exp $ */
/* /*
@ -65,9 +65,6 @@
int maxslp = MAXSLP; /* patchable ... */ int maxslp = MAXSLP; /* patchable ... */
struct loadavg averunnable; struct loadavg averunnable;
#define UVM_METER_INTVL 5
struct timeout uvm_meter_to = TIMEOUT_INITIALIZER(uvm_meter, NULL);
/* /*
* constants for averages over 1, 5, and 15 minutes when sampling at * constants for averages over 1, 5, and 15 minutes when sampling at
* 5 second intervals. * 5 second intervals.
@ -85,13 +82,15 @@ void uvm_total(struct vmtotal *);
void uvmexp_read(struct uvmexp *); void uvmexp_read(struct uvmexp *);
/* /*
* uvm_meter: recompute load averages * uvm_meter: calculate load average and wake up the swapper (if needed)
*/ */
void void
uvm_meter(void *unused) uvm_meter(void)
{ {
timeout_add_sec(&uvm_meter_to, UVM_METER_INTVL); if ((gettime() % 5) == 0)
uvm_loadav(&averunnable); uvm_loadav(&averunnable);
if (proc0.p_slptime > (maxslp / 2))
wakeup(&proc0);
} }
/* /*

View File

@ -1,4 +1,4 @@
/* $OpenBSD: lka_filter.c,v 1.70 2023/05/15 12:03:04 op Exp $ */ /* $OpenBSD: lka_filter.c,v 1.72 2023/06/21 17:59:24 op Exp $ */
/* /*
* Copyright (c) 2018 Gilles Chehade <gilles@poolp.org> * Copyright (c) 2018 Gilles Chehade <gilles@poolp.org>
@ -593,40 +593,29 @@ lka_filter_process_response(const char *name, const char *line)
{ {
uint64_t reqid; uint64_t reqid;
uint64_t token; uint64_t token;
char buffer[LINE_MAX];
char *ep = NULL; char *ep = NULL;
char *kind = NULL; const char *kind = NULL;
char *qid = NULL; const char *qid = NULL;
/*char *phase = NULL;*/ const char *response = NULL;
char *response = NULL; const char *parameter = NULL;
char *parameter = NULL;
struct filter_session *fs; struct filter_session *fs;
(void)strlcpy(buffer, line, sizeof buffer); kind = line;
if ((ep = strchr(buffer, '|')) == NULL)
if ((ep = strchr(kind, '|')) == NULL)
fatalx("Missing token: %s", line); fatalx("Missing token: %s", line);
ep[0] = '\0';
kind = buffer;
qid = ep+1; qid = ep+1;
if ((ep = strchr(qid, '|')) == NULL)
fatalx("Missing reqid: %s", line);
ep[0] = '\0';
errno = 0;
reqid = strtoull(qid, &ep, 16); reqid = strtoull(qid, &ep, 16);
if (qid[0] == '\0' || *ep != '\0') if (qid[0] == '\0' || *ep != '|')
fatalx("Invalid reqid: %s", line); fatalx("Invalid reqid: %s", line);
if (errno == ERANGE && reqid == ULLONG_MAX) if (errno == ERANGE && reqid == ULLONG_MAX)
fatal("Invalid reqid: %s", line); fatal("Invalid reqid: %s", line);
qid = ep+1; qid = ep + 1;
if ((ep = strchr(qid, '|')) == NULL)
fatal("Missing directive: %s", line);
ep[0] = '\0';
token = strtoull(qid, &ep, 16); token = strtoull(qid, &ep, 16);
if (qid[0] == '\0' || *ep != '\0') if (qid[0] == '\0' || *ep != '|')
fatalx("Invalid token: %s", line); fatalx("Invalid token: %s", line);
if (errno == ERANGE && token == ULLONG_MAX) if (errno == ERANGE && token == ULLONG_MAX)
fatal("Invalid token: %s", line); fatal("Invalid token: %s", line);
@ -637,7 +626,7 @@ lka_filter_process_response(const char *name, const char *line)
if ((fs = tree_get(&sessions, reqid)) == NULL) if ((fs = tree_get(&sessions, reqid)) == NULL)
return; return;
if (strcmp(kind, "filter-dataline") == 0) { if (strncmp(kind, "filter-dataline|", 16) == 0) {
if (fs->phase != FILTER_DATA_LINE) if (fs->phase != FILTER_DATA_LINE)
fatalx("filter-dataline out of dataline phase"); fatalx("filter-dataline out of dataline phase");
filter_data_next(token, reqid, response); filter_data_next(token, reqid, response);
@ -646,19 +635,13 @@ lka_filter_process_response(const char *name, const char *line)
if (fs->phase == FILTER_DATA_LINE) if (fs->phase == FILTER_DATA_LINE)
fatalx("filter-result in dataline phase"); fatalx("filter-result in dataline phase");
if ((ep = strchr(response, '|'))) { if ((ep = strchr(response, '|')) != NULL)
parameter = ep + 1; parameter = ep + 1;
ep[0] = '\0';
}
if (strcmp(response, "proceed") == 0) { if (strcmp(response, "proceed") == 0) {
if (parameter != NULL)
fatalx("Unexpected parameter after proceed: %s", line);
filter_protocol_next(token, reqid, 0); filter_protocol_next(token, reqid, 0);
return; return;
} else if (strcmp(response, "junk") == 0) { } else if (strcmp(response, "junk") == 0) {
if (parameter != NULL)
fatalx("Unexpected parameter after junk: %s", line);
if (fs->phase == FILTER_COMMIT) if (fs->phase == FILTER_COMMIT)
fatalx("filter-reponse junk after DATA"); fatalx("filter-reponse junk after DATA");
filter_result_junk(reqid); filter_result_junk(reqid);
@ -667,11 +650,11 @@ lka_filter_process_response(const char *name, const char *line)
if (parameter == NULL) if (parameter == NULL)
fatalx("Missing parameter: %s", line); fatalx("Missing parameter: %s", line);
if (strcmp(response, "rewrite") == 0) if (strncmp(response, "rewrite|", 8) == 0)
filter_result_rewrite(reqid, parameter); filter_result_rewrite(reqid, parameter);
else if (strcmp(response, "reject") == 0) else if (strncmp(response, "reject|", 7) == 0)
filter_result_reject(reqid, parameter); filter_result_reject(reqid, parameter);
else if (strcmp(response, "disconnect") == 0) else if (strncmp(response, "disconnect|", 11) == 0)
filter_result_disconnect(reqid, parameter); filter_result_disconnect(reqid, parameter);
else else
fatalx("Invalid directive: %s", line); fatalx("Invalid directive: %s", line);