sync
This commit is contained in:
parent
8e644b001d
commit
3f8ae0d130
@ -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
|
||||
@ -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,
|
||||
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
|
||||
x_print_expansions(int nwords, char *const *words, int is_command)
|
||||
{
|
||||
|
@ -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:
|
||||
* edit.h - globals for edit modes
|
||||
@ -16,6 +16,10 @@
|
||||
|
||||
#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 */
|
||||
typedef struct {
|
||||
int erase;
|
||||
|
@ -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
|
||||
@ -32,10 +32,6 @@
|
||||
static Area aedit;
|
||||
#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 */
|
||||
#define KSTD 0
|
||||
#define KEOL 1 /* ^M, ^J */
|
||||
|
@ -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
|
||||
@ -1340,33 +1340,6 @@ pr_menu(char *const *ap)
|
||||
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
|
||||
*/
|
||||
|
@ -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
|
||||
@ -441,7 +441,6 @@ void flushcom(int);
|
||||
char * search(const char *, const char *, int, int *);
|
||||
int search_access(const char *, int, int *);
|
||||
int pr_menu(char *const *);
|
||||
int pr_list(char *const *);
|
||||
/* expr.c */
|
||||
int evaluate(const char *, int64_t *, int, bool);
|
||||
int v_evaluate(struct tbl *, const char *, volatile int, bool);
|
||||
|
@ -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 $
|
||||
.\"
|
||||
.\" Copyright (c) 1998 Matthew R. Green
|
||||
@ -28,7 +28,7 @@
|
||||
.\" XXX this manual sets nS to 1 or 0 in the description, to obtain
|
||||
.\" synopsis-like function prototypes. any better way?
|
||||
.\"
|
||||
.Dd $Mdocdate: June 20 2023 $
|
||||
.Dd $Mdocdate: June 21 2023 $
|
||||
.Dt UVM_INIT 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -168,7 +168,7 @@ argument is ignored.
|
||||
.Ft void
|
||||
.Fn uvm_kernacc "caddr_t addr" "size_t len" "int rw"
|
||||
.Ft void
|
||||
.Fn uvm_meter "void *"
|
||||
.Fn uvm_meter
|
||||
.Ft int
|
||||
.Fn uvm_sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp " "size_t newlen" "struct proc *p"
|
||||
.Ft int
|
||||
@ -212,7 +212,7 @@ access, in the kernel address space.
|
||||
.Pp
|
||||
The
|
||||
.Fn uvm_meter
|
||||
function periodically recomputes the load average.
|
||||
function calculates the load average and wakes up the swapper if necessary.
|
||||
.Pp
|
||||
The
|
||||
.Fn uvm_sysctl
|
||||
|
@ -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>
|
||||
|
@ -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 $ */
|
||||
|
||||
/*-
|
||||
@ -234,6 +234,7 @@ schedcpu(void *arg)
|
||||
}
|
||||
SCHED_UNLOCK(s);
|
||||
}
|
||||
uvm_meter();
|
||||
wakeup(&lbolt);
|
||||
timeout_add_sec(to, 1);
|
||||
}
|
||||
@ -668,7 +669,6 @@ scheduler_start(void)
|
||||
|
||||
rrticks_init = hz / 10;
|
||||
schedcpu(&schedcpu_to);
|
||||
uvm_meter(NULL);
|
||||
|
||||
#ifndef SMALL_KERNEL
|
||||
if (perfpolicy == PERFPOL_AUTO)
|
||||
|
@ -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 $ */
|
||||
|
||||
/*
|
||||
@ -414,7 +414,7 @@ void uvmspace_free(struct vmspace *);
|
||||
struct vmspace *uvmspace_share(struct process *);
|
||||
int uvm_share(vm_map_t, vaddr_t, vm_prot_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 *,
|
||||
void *, size_t, struct proc *);
|
||||
struct vm_page *uvm_pagealloc(struct uvm_object *,
|
||||
|
@ -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 $ */
|
||||
|
||||
/*
|
||||
@ -65,9 +65,6 @@
|
||||
int maxslp = MAXSLP; /* patchable ... */
|
||||
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
|
||||
* 5 second intervals.
|
||||
@ -85,13 +82,15 @@ void uvm_total(struct vmtotal *);
|
||||
void uvmexp_read(struct uvmexp *);
|
||||
|
||||
/*
|
||||
* uvm_meter: recompute load averages
|
||||
* uvm_meter: calculate load average and wake up the swapper (if needed)
|
||||
*/
|
||||
void
|
||||
uvm_meter(void *unused)
|
||||
uvm_meter(void)
|
||||
{
|
||||
timeout_add_sec(&uvm_meter_to, UVM_METER_INTVL);
|
||||
if ((gettime() % 5) == 0)
|
||||
uvm_loadav(&averunnable);
|
||||
if (proc0.p_slptime > (maxslp / 2))
|
||||
wakeup(&proc0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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>
|
||||
@ -593,40 +593,29 @@ lka_filter_process_response(const char *name, const char *line)
|
||||
{
|
||||
uint64_t reqid;
|
||||
uint64_t token;
|
||||
char buffer[LINE_MAX];
|
||||
char *ep = NULL;
|
||||
char *kind = NULL;
|
||||
char *qid = NULL;
|
||||
/*char *phase = NULL;*/
|
||||
char *response = NULL;
|
||||
char *parameter = NULL;
|
||||
const char *kind = NULL;
|
||||
const char *qid = NULL;
|
||||
const char *response = NULL;
|
||||
const char *parameter = NULL;
|
||||
struct filter_session *fs;
|
||||
|
||||
(void)strlcpy(buffer, line, sizeof buffer);
|
||||
if ((ep = strchr(buffer, '|')) == NULL)
|
||||
kind = line;
|
||||
|
||||
if ((ep = strchr(kind, '|')) == NULL)
|
||||
fatalx("Missing token: %s", line);
|
||||
ep[0] = '\0';
|
||||
|
||||
kind = buffer;
|
||||
|
||||
qid = ep+1;
|
||||
if ((ep = strchr(qid, '|')) == NULL)
|
||||
fatalx("Missing reqid: %s", line);
|
||||
ep[0] = '\0';
|
||||
|
||||
errno = 0;
|
||||
reqid = strtoull(qid, &ep, 16);
|
||||
if (qid[0] == '\0' || *ep != '\0')
|
||||
if (qid[0] == '\0' || *ep != '|')
|
||||
fatalx("Invalid reqid: %s", line);
|
||||
if (errno == ERANGE && reqid == ULLONG_MAX)
|
||||
fatal("Invalid reqid: %s", line);
|
||||
|
||||
qid = ep + 1;
|
||||
if ((ep = strchr(qid, '|')) == NULL)
|
||||
fatal("Missing directive: %s", line);
|
||||
ep[0] = '\0';
|
||||
|
||||
token = strtoull(qid, &ep, 16);
|
||||
if (qid[0] == '\0' || *ep != '\0')
|
||||
if (qid[0] == '\0' || *ep != '|')
|
||||
fatalx("Invalid token: %s", line);
|
||||
if (errno == ERANGE && token == ULLONG_MAX)
|
||||
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)
|
||||
return;
|
||||
|
||||
if (strcmp(kind, "filter-dataline") == 0) {
|
||||
if (strncmp(kind, "filter-dataline|", 16) == 0) {
|
||||
if (fs->phase != FILTER_DATA_LINE)
|
||||
fatalx("filter-dataline out of dataline phase");
|
||||
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)
|
||||
fatalx("filter-result in dataline phase");
|
||||
|
||||
if ((ep = strchr(response, '|'))) {
|
||||
if ((ep = strchr(response, '|')) != NULL)
|
||||
parameter = ep + 1;
|
||||
ep[0] = '\0';
|
||||
}
|
||||
|
||||
if (strcmp(response, "proceed") == 0) {
|
||||
if (parameter != NULL)
|
||||
fatalx("Unexpected parameter after proceed: %s", line);
|
||||
filter_protocol_next(token, reqid, 0);
|
||||
return;
|
||||
} else if (strcmp(response, "junk") == 0) {
|
||||
if (parameter != NULL)
|
||||
fatalx("Unexpected parameter after junk: %s", line);
|
||||
if (fs->phase == FILTER_COMMIT)
|
||||
fatalx("filter-reponse junk after DATA");
|
||||
filter_result_junk(reqid);
|
||||
@ -667,11 +650,11 @@ lka_filter_process_response(const char *name, const char *line)
|
||||
if (parameter == NULL)
|
||||
fatalx("Missing parameter: %s", line);
|
||||
|
||||
if (strcmp(response, "rewrite") == 0)
|
||||
if (strncmp(response, "rewrite|", 8) == 0)
|
||||
filter_result_rewrite(reqid, parameter);
|
||||
else if (strcmp(response, "reject") == 0)
|
||||
else if (strncmp(response, "reject|", 7) == 0)
|
||||
filter_result_reject(reqid, parameter);
|
||||
else if (strcmp(response, "disconnect") == 0)
|
||||
else if (strncmp(response, "disconnect|", 11) == 0)
|
||||
filter_result_disconnect(reqid, parameter);
|
||||
else
|
||||
fatalx("Invalid directive: %s", line);
|
||||
|
Loading…
Reference in New Issue
Block a user