sync with OpenBSD -current
This commit is contained in:
parent
e0d126d03b
commit
9d8ac7f158
49 changed files with 304 additions and 657 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: scandir.c,v 1.21 2019/06/28 13:32:41 deraadt Exp $ */
|
/* $OpenBSD: scandir.c,v 1.22 2024/04/14 11:21:08 florian Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1993
|
* Copyright (c) 1983, 1993
|
||||||
* The Regents of the University of California. All rights reserved.
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: ec_ameth.c,v 1.52 2024/04/13 14:02:51 tb Exp $ */
|
/* $OpenBSD: ec_ameth.c,v 1.53 2024/04/14 15:41:09 tb Exp $ */
|
||||||
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
|
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
|
||||||
* project 2006.
|
* project 2006.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: evp.h,v 1.133 2024/04/10 15:00:38 beck Exp $ */
|
/* $OpenBSD: evp.h,v 1.134 2024/04/14 14:14:14 tb Exp $ */
|
||||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -330,11 +330,6 @@ typedef int EVP_PBE_KEYGEN(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
|
||||||
(char *)(eckey))
|
(char *)(eckey))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_GOST
|
|
||||||
#define EVP_PKEY_assign_GOST(pkey,gostkey) EVP_PKEY_assign((pkey),EVP_PKEY_GOSTR01,\
|
|
||||||
(char *)(gostkey))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Add some extra combinations */
|
/* Add some extra combinations */
|
||||||
#define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))
|
#define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))
|
||||||
#define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a))
|
#define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a))
|
||||||
|
@ -602,12 +597,6 @@ const EVP_MD *EVP_ripemd160(void);
|
||||||
#ifndef OPENSSL_NO_WHIRLPOOL
|
#ifndef OPENSSL_NO_WHIRLPOOL
|
||||||
const EVP_MD *EVP_whirlpool(void);
|
const EVP_MD *EVP_whirlpool(void);
|
||||||
#endif
|
#endif
|
||||||
#ifndef OPENSSL_NO_GOST
|
|
||||||
const EVP_MD *EVP_gostr341194(void);
|
|
||||||
const EVP_MD *EVP_gost2814789imit(void);
|
|
||||||
const EVP_MD *EVP_streebog256(void);
|
|
||||||
const EVP_MD *EVP_streebog512(void);
|
|
||||||
#endif
|
|
||||||
const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */
|
const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */
|
||||||
#ifndef OPENSSL_NO_DES
|
#ifndef OPENSSL_NO_DES
|
||||||
const EVP_CIPHER *EVP_des_ecb(void);
|
const EVP_CIPHER *EVP_des_ecb(void);
|
||||||
|
@ -735,12 +724,6 @@ const EVP_CIPHER *EVP_camellia_256_ofb(void);
|
||||||
const EVP_CIPHER *EVP_chacha20(void);
|
const EVP_CIPHER *EVP_chacha20(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_GOST
|
|
||||||
const EVP_CIPHER *EVP_gost2814789_ecb(void);
|
|
||||||
const EVP_CIPHER *EVP_gost2814789_cfb64(void);
|
|
||||||
const EVP_CIPHER *EVP_gost2814789_cnt(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_SM4
|
#ifndef OPENSSL_NO_SM4
|
||||||
const EVP_CIPHER *EVP_sm4_ecb(void);
|
const EVP_CIPHER *EVP_sm4_ecb(void);
|
||||||
const EVP_CIPHER *EVP_sm4_cbc(void);
|
const EVP_CIPHER *EVP_sm4_cbc(void);
|
||||||
|
@ -820,9 +803,6 @@ struct ec_key_st *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey);
|
||||||
struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);
|
struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);
|
||||||
int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key);
|
int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key);
|
||||||
#endif
|
#endif
|
||||||
#ifndef OPENSSL_NO_GOST
|
|
||||||
struct gost_key_st;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
EVP_PKEY *EVP_PKEY_new(void);
|
EVP_PKEY *EVP_PKEY_new(void);
|
||||||
void EVP_PKEY_free(EVP_PKEY *pkey);
|
void EVP_PKEY_free(EVP_PKEY *pkey);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $OpenBSD: X509_LOOKUP_new.3,v 1.9 2021/11/12 14:05:28 schwarze Exp $
|
.\" $OpenBSD: X509_LOOKUP_new.3,v 1.10 2024/04/14 10:56:18 tb Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
|
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
|
||||||
.\"
|
.\"
|
||||||
|
@ -14,22 +14,15 @@
|
||||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: November 12 2021 $
|
.Dd $Mdocdate: April 14 2024 $
|
||||||
.Dt X509_LOOKUP_NEW 3
|
.Dt X509_LOOKUP_NEW 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm X509_LOOKUP_new ,
|
|
||||||
.Nm X509_LOOKUP_free ,
|
.Nm X509_LOOKUP_free ,
|
||||||
.Nm X509_LOOKUP_ctrl ,
|
.Nm X509_LOOKUP_ctrl ,
|
||||||
.Nm X509_LOOKUP_add_dir ,
|
.Nm X509_LOOKUP_add_dir ,
|
||||||
.Nm X509_LOOKUP_load_file ,
|
.Nm X509_LOOKUP_load_file ,
|
||||||
.Nm X509_LOOKUP_add_mem ,
|
.Nm X509_LOOKUP_add_mem ,
|
||||||
.Nm X509_LOOKUP_by_subject ,
|
|
||||||
.Nm X509_LOOKUP_init ,
|
|
||||||
.Nm X509_LOOKUP_shutdown ,
|
|
||||||
.Nm X509_LOOKUP_by_issuer_serial ,
|
|
||||||
.Nm X509_LOOKUP_by_fingerprint ,
|
|
||||||
.Nm X509_LOOKUP_by_alias ,
|
|
||||||
.Nm X509_get_default_cert_dir ,
|
.Nm X509_get_default_cert_dir ,
|
||||||
.Nm X509_get_default_cert_file ,
|
.Nm X509_get_default_cert_file ,
|
||||||
.Nm X509_get_default_cert_dir_env ,
|
.Nm X509_get_default_cert_dir_env ,
|
||||||
|
@ -40,8 +33,6 @@
|
||||||
.Nd certificate lookup object
|
.Nd certificate lookup object
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.In openssl/x509_vfy.h
|
.In openssl/x509_vfy.h
|
||||||
.Ft X509_LOOKUP *
|
|
||||||
.Fn X509_LOOKUP_new "X509_LOOKUP_METHOD *method"
|
|
||||||
.Ft void
|
.Ft void
|
||||||
.Fn X509_LOOKUP_free "X509_LOOKUP *lookup"
|
.Fn X509_LOOKUP_free "X509_LOOKUP *lookup"
|
||||||
.Ft int
|
.Ft int
|
||||||
|
@ -70,41 +61,6 @@
|
||||||
.Fa "const struct iovec *source"
|
.Fa "const struct iovec *source"
|
||||||
.Fa "long type"
|
.Fa "long type"
|
||||||
.Fc
|
.Fc
|
||||||
.Ft int
|
|
||||||
.Fo X509_LOOKUP_by_subject
|
|
||||||
.Fa "X509_LOOKUP *lookup"
|
|
||||||
.Fa "X509_LOOKUP_TYPE type"
|
|
||||||
.Fa "X509_NAME *name"
|
|
||||||
.Fa "X509_OBJECT *object"
|
|
||||||
.Fc
|
|
||||||
.Ft int
|
|
||||||
.Fn X509_LOOKUP_init "X509_LOOKUP *lookup"
|
|
||||||
.Ft int
|
|
||||||
.Fn X509_LOOKUP_shutdown "X509_LOOKUP *lookup"
|
|
||||||
.Ft int
|
|
||||||
.Fo X509_LOOKUP_by_issuer_serial
|
|
||||||
.Fa "X509_LOOKUP *lookup"
|
|
||||||
.Fa "X509_LOOKUP_TYPE type"
|
|
||||||
.Fa "X509_NAME *name"
|
|
||||||
.Fa "ASN1_INTEGER *serial"
|
|
||||||
.Fa "X509_OBJECT *object"
|
|
||||||
.Fc
|
|
||||||
.Ft int
|
|
||||||
.Fo X509_LOOKUP_by_fingerprint
|
|
||||||
.Fa "X509_LOOKUP *lookup"
|
|
||||||
.Fa "X509_LOOKUP_TYPE type"
|
|
||||||
.Fa "const unsigned char *bytes"
|
|
||||||
.Fa "int length"
|
|
||||||
.Fa "X509_OBJECT *object"
|
|
||||||
.Fc
|
|
||||||
.Ft int
|
|
||||||
.Fo X509_LOOKUP_by_alias
|
|
||||||
.Fa "X509_LOOKUP *lookup"
|
|
||||||
.Fa "X509_LOOKUP_TYPE type"
|
|
||||||
.Fa "const char *string"
|
|
||||||
.Fa "int length"
|
|
||||||
.Fa "X509_OBJECT *object"
|
|
||||||
.Fc
|
|
||||||
.In openssl/x509.h
|
.In openssl/x509.h
|
||||||
.Ft const char *
|
.Ft const char *
|
||||||
.Fn X509_get_default_cert_dir void
|
.Fn X509_get_default_cert_dir void
|
||||||
|
@ -115,21 +71,11 @@
|
||||||
.Ft const char *
|
.Ft const char *
|
||||||
.Fn X509_get_default_cert_file_env void
|
.Fn X509_get_default_cert_file_env void
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Fn X509_LOOKUP_new
|
|
||||||
allocates a new, empty
|
|
||||||
.Vt X509_LOOKUP
|
|
||||||
object and associates it with the
|
|
||||||
.Fa method
|
|
||||||
which is a static object returned from either
|
|
||||||
.Xr X509_LOOKUP_hash_dir 3
|
|
||||||
or
|
|
||||||
.Xr X509_LOOKUP_file 3
|
|
||||||
or
|
|
||||||
.Xr X509_LOOKUP_mem 3 .
|
|
||||||
.Pp
|
|
||||||
.Fn X509_LOOKUP_free
|
.Fn X509_LOOKUP_free
|
||||||
|
is a deprecated function that
|
||||||
releases the memory used by
|
releases the memory used by
|
||||||
.Fa lookup .
|
.Fa lookup .
|
||||||
|
It is provided for compatibility only.
|
||||||
If
|
If
|
||||||
.Fa lookup
|
.Fa lookup
|
||||||
is a
|
is a
|
||||||
|
@ -332,21 +278,7 @@ and the files are read with
|
||||||
In case of success, the first match is returned in the
|
In case of success, the first match is returned in the
|
||||||
.Pf * Fa object
|
.Pf * Fa object
|
||||||
provided by the caller, overwriting any previous content.
|
provided by the caller, overwriting any previous content.
|
||||||
.Pp
|
|
||||||
With LibreSSL,
|
|
||||||
.Fn X509_LOOKUP_init ,
|
|
||||||
.Fn X509_LOOKUP_shutdown ,
|
|
||||||
.Fn X509_LOOKUP_by_issuer_serial ,
|
|
||||||
.Fn X509_LOOKUP_by_fingerprint ,
|
|
||||||
and
|
|
||||||
.Fn X509_LOOKUP_by_alias
|
|
||||||
have no effect.
|
|
||||||
.Sh RETURN VALUES
|
.Sh RETURN VALUES
|
||||||
.Fn X509_LOOKUP_new
|
|
||||||
returns the new object or
|
|
||||||
.Dv NULL
|
|
||||||
if memory allocation fails.
|
|
||||||
.Pp
|
|
||||||
.Fn X509_LOOKUP_ctrl
|
.Fn X509_LOOKUP_ctrl
|
||||||
returns 1 for success or 0 for failure.
|
returns 1 for success or 0 for failure.
|
||||||
With library implementations other than LibreSSL,
|
With library implementations other than LibreSSL,
|
||||||
|
@ -374,19 +306,6 @@ if no match is found, or if memory allocation fails.
|
||||||
With library implementations other than LibreSSL,
|
With library implementations other than LibreSSL,
|
||||||
it might also return negative values for internal errors.
|
it might also return negative values for internal errors.
|
||||||
.Pp
|
.Pp
|
||||||
.Fn X509_LOOKUP_init
|
|
||||||
and
|
|
||||||
.Fn X509_LOOKUP_shutdown
|
|
||||||
are supposed to return 1 for success and 0 for failure.
|
|
||||||
With LibreSSL, they always return 1.
|
|
||||||
.Pp
|
|
||||||
With LibreSSL,
|
|
||||||
.Fn X509_LOOKUP_by_issuer_serial ,
|
|
||||||
.Fn X509_LOOKUP_by_fingerprint ,
|
|
||||||
and
|
|
||||||
.Fn X509_LOOKUP_by_alias
|
|
||||||
always return 0.
|
|
||||||
.Pp
|
|
||||||
.Fn X509_get_default_cert_dir
|
.Fn X509_get_default_cert_dir
|
||||||
returns a pointer to the constant string
|
returns a pointer to the constant string
|
||||||
.Qq /etc/ssl/certs ,
|
.Qq /etc/ssl/certs ,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: malloc_errs.c,v 1.4 2023/10/22 12:20:07 otto Exp $ */
|
/* $OpenBSD: malloc_errs.c,v 1.5 2024/04/14 17:47:41 otto Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2023 Otto Moerbeek <otto@drijf.net>
|
* Copyright (c) 2023 Otto Moerbeek <otto@drijf.net>
|
||||||
*
|
*
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
@ -231,7 +232,16 @@ void
|
||||||
t22(void)
|
t22(void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned char *p = malloc(32);
|
unsigned char *p;
|
||||||
|
while (1) {
|
||||||
|
uintptr_t address;
|
||||||
|
p = malloc(32);
|
||||||
|
address = (uintptr_t)(void *)p;
|
||||||
|
/* we don't want to have a chunk on the last slot of a page */
|
||||||
|
if (address / getpagesize() == (address + 32) / getpagesize())
|
||||||
|
break;
|
||||||
|
free(p);
|
||||||
|
}
|
||||||
p[32] = 0;
|
p[32] = 0;
|
||||||
for (i = 0; i < 10000; i++)
|
for (i = 0; i < 10000; i++)
|
||||||
p = malloc(32);
|
p = malloc(32);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $OpenBSD: update-plist.1,v 1.9 2021/05/28 18:45:09 tb Exp $
|
.\" $OpenBSD: update-plist.1,v 1.10 2024/04/14 17:24:15 phessler Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2018 Marc Espie <espie@openbsd.org>
|
.\" Copyright (c) 2018 Marc Espie <espie@openbsd.org>
|
||||||
.\"
|
.\"
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: May 28 2021 $
|
.Dd $Mdocdate: April 14 2024 $
|
||||||
.Dt UPDATE-PLIST 1
|
.Dt UPDATE-PLIST 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -304,8 +304,8 @@ will first write files as
|
||||||
.Pa <file>.new ,
|
.Pa <file>.new ,
|
||||||
then it will display which files are new and which files have changed.
|
then it will display which files are new and which files have changed.
|
||||||
If old packing-lists already exist, it will move old packing lists into
|
If old packing-lists already exist, it will move old packing lists into
|
||||||
.Pa <file>.orig
|
.Pa <file>.orig ,
|
||||||
unless these already exist, then move the new files into position.
|
then move the new files into position.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr pkg_add 1 ,
|
.Xr pkg_add 1 ,
|
||||||
.Xr pkg_create 1 ,
|
.Xr pkg_create 1 ,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $OpenBSD: python-module.5,v 1.9 2023/12/22 12:51:53 sthen Exp $
|
.\" $OpenBSD: python-module.5,v 1.10 2024/04/14 12:09:28 sthen Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2008 Marc Espie
|
.\" Copyright (c) 2008 Marc Espie
|
||||||
.\"
|
.\"
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: December 22 2023 $
|
.Dd $Mdocdate: April 14 2024 $
|
||||||
.Dt PYTHON-MODULE 5
|
.Dt PYTHON-MODULE 5
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -114,7 +114,7 @@ If the port provides a
|
||||||
file, check the "build-backend" line in the [build-system] section.
|
file, check the "build-backend" line in the [build-system] section.
|
||||||
.Nm
|
.Nm
|
||||||
currently supports flit_core, hatchling, hatch-vcs, jupyter_packaging,
|
currently supports flit_core, hatchling, hatch-vcs, jupyter_packaging,
|
||||||
poetry-core, setuptools and setuptools_scm.
|
maturin, poetry-core, setuptools and setuptools_scm.
|
||||||
If no
|
If no
|
||||||
.Pa pyproject.toml
|
.Pa pyproject.toml
|
||||||
is provided then it probably uses setuptools.
|
is provided then it probably uses setuptools.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: cpu.c,v 1.185 2024/04/03 02:01:21 guenther Exp $ */
|
/* $OpenBSD: cpu.c,v 1.186 2024/04/14 09:59:04 kettenis Exp $ */
|
||||||
/* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
|
/* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
|
@ -294,6 +294,7 @@ replacemds(void)
|
||||||
static int replacedone = 0;
|
static int replacedone = 0;
|
||||||
extern long mds_handler_bdw, mds_handler_ivb, mds_handler_skl;
|
extern long mds_handler_bdw, mds_handler_ivb, mds_handler_skl;
|
||||||
extern long mds_handler_skl_sse, mds_handler_skl_avx;
|
extern long mds_handler_skl_sse, mds_handler_skl_avx;
|
||||||
|
extern long mds_handler_skl_avx512;
|
||||||
extern long mds_handler_silvermont, mds_handler_knights;
|
extern long mds_handler_silvermont, mds_handler_knights;
|
||||||
struct cpu_info *ci = &cpu_info_primary;
|
struct cpu_info *ci = &cpu_info_primary;
|
||||||
CPU_INFO_ITERATOR cii;
|
CPU_INFO_ITERATOR cii;
|
||||||
|
@ -302,9 +303,9 @@ replacemds(void)
|
||||||
int use_verw = 0, s;
|
int use_verw = 0, s;
|
||||||
uint32_t cap = 0;
|
uint32_t cap = 0;
|
||||||
|
|
||||||
/* ci_mds_tmp must be 32byte aligned for AVX instructions */
|
/* ci_mds_tmp must be 64-byte aligned for AVX-512 instructions */
|
||||||
CTASSERT((offsetof(struct cpu_info, ci_mds_tmp) -
|
CTASSERT((offsetof(struct cpu_info, ci_mds_tmp) -
|
||||||
offsetof(struct cpu_info, ci_PAGEALIGN)) % 32 == 0);
|
offsetof(struct cpu_info, ci_PAGEALIGN)) % 64 == 0);
|
||||||
|
|
||||||
if (replacedone)
|
if (replacedone)
|
||||||
return;
|
return;
|
||||||
|
@ -358,8 +359,10 @@ replacemds(void)
|
||||||
* Skylake, KabyLake, CoffeeLake, WhiskeyLake,
|
* Skylake, KabyLake, CoffeeLake, WhiskeyLake,
|
||||||
* CascadeLake
|
* CascadeLake
|
||||||
*/
|
*/
|
||||||
/* XXX mds_handler_skl_avx512 */
|
if (xgetbv(0) & XFEATURE_AVX512) {
|
||||||
if (xgetbv(0) & XFEATURE_AVX) {
|
handler = &mds_handler_skl_avx512;
|
||||||
|
type = "Skylake AVX-512";
|
||||||
|
} else if (xgetbv(0) & XFEATURE_AVX) {
|
||||||
handler = &mds_handler_skl_avx;
|
handler = &mds_handler_skl_avx;
|
||||||
type = "Skylake AVX";
|
type = "Skylake AVX";
|
||||||
} else {
|
} else {
|
||||||
|
@ -803,6 +806,7 @@ cpu_init(struct cpu_info *ci)
|
||||||
xsave_mask = XFEATURE_X87 | XFEATURE_SSE;
|
xsave_mask = XFEATURE_X87 | XFEATURE_SSE;
|
||||||
CPUID_LEAF(0xd, 0, eax, ebx, ecx, edx);
|
CPUID_LEAF(0xd, 0, eax, ebx, ecx, edx);
|
||||||
xsave_mask |= eax & XFEATURE_AVX;
|
xsave_mask |= eax & XFEATURE_AVX;
|
||||||
|
xsave_mask |= eax & XFEATURE_AVX512;
|
||||||
xsetbv(0, xsave_mask);
|
xsetbv(0, xsave_mask);
|
||||||
CPUID_LEAF(0xd, 0, eax, ebx, ecx, edx);
|
CPUID_LEAF(0xd, 0, eax, ebx, ecx, edx);
|
||||||
if (CPU_IS_PRIMARY(ci)) {
|
if (CPU_IS_PRIMARY(ci)) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: mds.S,v 1.4 2023/04/22 18:27:28 guenther Exp $ */
|
/* $OpenBSD: mds.S,v 1.5 2024/04/14 09:59:04 kettenis Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 Philip Guenther <guenther@openbsd.org>
|
* Copyright (c) 2019 Philip Guenther <guenther@openbsd.org>
|
||||||
*
|
*
|
||||||
|
@ -77,6 +77,8 @@ END(mds_handler_bdw)
|
||||||
ENTRY(mds_handler_skl)
|
ENTRY(mds_handler_skl)
|
||||||
xorl %ecx,%ecx
|
xorl %ecx,%ecx
|
||||||
xgetbv
|
xgetbv
|
||||||
|
testb $XFEATURE_AVX512,%al
|
||||||
|
jne mds_handler_skl_avx512
|
||||||
testb $XFEATURE_AVX,%al
|
testb $XFEATURE_AVX,%al
|
||||||
jne mds_handler_skl_avx
|
jne mds_handler_skl_avx
|
||||||
jmp mds_handler_skl_sse
|
jmp mds_handler_skl_sse
|
||||||
|
@ -136,14 +138,12 @@ ENTRY(mds_handler_skl_avx)
|
||||||
lfence
|
lfence
|
||||||
END(mds_handler_skl_avx)
|
END(mds_handler_skl_avx)
|
||||||
|
|
||||||
/* we don't support AVX512 yet */
|
|
||||||
#if 0
|
|
||||||
ENTRY(mds_handler_skl_avx512)
|
ENTRY(mds_handler_skl_avx512)
|
||||||
RETGUARD_SETUP(mds_handler_skl_avx512, r11)
|
RETGUARD_SETUP(mds_handler_skl_avx512, r11)
|
||||||
movq CPUVAR(MDS_BUF),%rax
|
movq CPUVAR(MDS_BUF),%rax
|
||||||
leaq 64(%rax),%rdi
|
leaq 64(%rax),%rdi
|
||||||
vmovdqa64 %zmm0,CPUVAR(MDS_TMP)
|
vmovdqa64 %zmm0,CPUVAR(MDS_TMP)
|
||||||
vpxor %zmm0,%zmm0,%zmm0
|
vpxorq %zmm0,%zmm0,%zmm0
|
||||||
|
|
||||||
lfence
|
lfence
|
||||||
vorpd (%rax),%zmm0,%zmm0
|
vorpd (%rax),%zmm0,%zmm0
|
||||||
|
@ -164,7 +164,6 @@ ENTRY(mds_handler_skl_avx512)
|
||||||
retq
|
retq
|
||||||
lfence
|
lfence
|
||||||
END(mds_handler_skl_avx512)
|
END(mds_handler_skl_avx512)
|
||||||
#endif
|
|
||||||
|
|
||||||
ENTRY(mds_handler_silvermont)
|
ENTRY(mds_handler_silvermont)
|
||||||
RETGUARD_SETUP(mds_handler_silvermont, r11)
|
RETGUARD_SETUP(mds_handler_silvermont, r11)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: cpu.h,v 1.164 2024/04/03 02:01:21 guenther Exp $ */
|
/* $OpenBSD: cpu.h,v 1.165 2024/04/14 09:59:04 kettenis Exp $ */
|
||||||
/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
|
/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
|
@ -132,7 +132,7 @@ struct cpu_info {
|
||||||
u_int64_t ci_user_cr3; /* [o] U-K page table */
|
u_int64_t ci_user_cr3; /* [o] U-K page table */
|
||||||
|
|
||||||
/* bits for mitigating Micro-architectural Data Sampling */
|
/* bits for mitigating Micro-architectural Data Sampling */
|
||||||
char ci_mds_tmp[32]; /* [o] 32byte aligned */
|
char ci_mds_tmp[64]; /* [o] 64-byte aligned */
|
||||||
void *ci_mds_buf; /* [I] */
|
void *ci_mds_buf; /* [I] */
|
||||||
|
|
||||||
struct proc *ci_curproc; /* [o] */
|
struct proc *ci_curproc; /* [o] */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: fpu.h,v 1.19 2023/07/10 03:32:10 guenther Exp $ */
|
/* $OpenBSD: fpu.h,v 1.20 2024/04/14 09:59:04 kettenis Exp $ */
|
||||||
/* $NetBSD: fpu.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ */
|
/* $NetBSD: fpu.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ */
|
||||||
|
|
||||||
#ifndef _MACHINE_FPU_H_
|
#ifndef _MACHINE_FPU_H_
|
||||||
|
@ -40,7 +40,7 @@ struct savefpu {
|
||||||
struct fxsave64 fp_fxsave; /* see above */
|
struct fxsave64 fp_fxsave; /* see above */
|
||||||
struct xstate_hdr fp_xstate;
|
struct xstate_hdr fp_xstate;
|
||||||
u_int64_t fp_ymm[16][2];
|
u_int64_t fp_ymm[16][2];
|
||||||
u_int64_t fp_cet_u[2];
|
u_int8_t fp_components[1856]; /* enough for AVX-512 */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: biosdev.c,v 1.36 2023/04/25 10:06:12 kn Exp $ */
|
/* $OpenBSD: biosdev.c,v 1.37 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996 Michael Shalayeff
|
* Copyright (c) 1996 Michael Shalayeff
|
||||||
|
@ -724,7 +724,8 @@ biosdisk_errno(u_int error)
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (p = tab; p->error && p->error != error; p++);
|
for (p = tab; p->error && p->error != error; p++)
|
||||||
|
;
|
||||||
|
|
||||||
return p->errno;
|
return p->errno;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: biosdev.c,v 1.101 2023/04/25 14:48:17 kn Exp $ */
|
/* $OpenBSD: biosdev.c,v 1.102 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996 Michael Shalayeff
|
* Copyright (c) 1996 Michael Shalayeff
|
||||||
|
@ -723,7 +723,8 @@ biosdisk_errno(u_int error)
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (p = tab; p->error && p->error != error; p++);
|
for (p = tab; p->error && p->error != error; p++)
|
||||||
|
;
|
||||||
|
|
||||||
return p->errno;
|
return p->errno;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: ciss.c,v 1.91 2022/04/16 19:19:59 naddy Exp $ */
|
/* $OpenBSD: ciss.c,v 1.92 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005,2006 Michael Shalayeff
|
* Copyright (c) 2005,2006 Michael Shalayeff
|
||||||
|
@ -217,7 +217,8 @@ ciss_attach(struct ciss_softc *sc)
|
||||||
sc->maxsg = MAXPHYS / PAGE_SIZE;
|
sc->maxsg = MAXPHYS / PAGE_SIZE;
|
||||||
i = sizeof(struct ciss_ccb) +
|
i = sizeof(struct ciss_ccb) +
|
||||||
sizeof(ccb->ccb_cmd.sgl[0]) * (sc->maxsg - 1);
|
sizeof(ccb->ccb_cmd.sgl[0]) * (sc->maxsg - 1);
|
||||||
for (sc->ccblen = 0x10; sc->ccblen < i; sc->ccblen <<= 1);
|
for (sc->ccblen = 0x10; sc->ccblen < i; sc->ccblen <<= 1)
|
||||||
|
;
|
||||||
|
|
||||||
total = sc->ccblen * sc->maxcmd;
|
total = sc->ccblen * sc->maxcmd;
|
||||||
if ((error = bus_dmamem_alloc(sc->dmat, total, PAGE_SIZE, 0,
|
if ((error = bus_dmamem_alloc(sc->dmat, total, PAGE_SIZE, 0,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: imxiic.c,v 1.1 2020/11/17 14:30:13 patrick Exp $ */
|
/* $OpenBSD: imxiic.c,v 1.2 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
|
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
|
||||||
*
|
*
|
||||||
|
@ -119,7 +119,8 @@ imxiic_setspeed(struct imxiic_softc *sc, u_int speed)
|
||||||
else if (div > sc->sc_clk_div[sc->sc_clk_ndiv - 1].div)
|
else if (div > sc->sc_clk_div[sc->sc_clk_ndiv - 1].div)
|
||||||
i = sc->sc_clk_ndiv - 1;
|
i = sc->sc_clk_ndiv - 1;
|
||||||
else
|
else
|
||||||
for (i = 0; sc->sc_clk_div[i].div < div; i++);
|
for (i = 0; sc->sc_clk_div[i].div < div; i++)
|
||||||
|
;
|
||||||
|
|
||||||
sc->frequency = sc->sc_clk_div[i].val;
|
sc->frequency = sc->sc_clk_div[i].val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: rt2661.c,v 1.99 2022/04/21 21:03:02 stsp Exp $ */
|
/* $OpenBSD: rt2661.c,v 1.100 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2006
|
* Copyright (c) 2006
|
||||||
|
@ -2274,7 +2274,8 @@ rt2661_set_chan(struct rt2661_softc *sc, struct ieee80211_channel *c)
|
||||||
rfprog = (sc->rfprog == 0) ? rt2661_rf5225_1 : rt2661_rf5225_2;
|
rfprog = (sc->rfprog == 0) ? rt2661_rf5225_1 : rt2661_rf5225_2;
|
||||||
|
|
||||||
/* find the settings for this channel (we know it exists) */
|
/* find the settings for this channel (we know it exists) */
|
||||||
for (i = 0; rfprog[i].chan != chan; i++);
|
for (i = 0; rfprog[i].chan != chan; i++)
|
||||||
|
;
|
||||||
|
|
||||||
power = sc->txpow[i];
|
power = sc->txpow[i];
|
||||||
if (power < 0) {
|
if (power < 0) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: rt2860.c,v 1.102 2022/04/21 21:03:02 stsp Exp $ */
|
/* $OpenBSD: rt2860.c,v 1.103 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
|
* Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
|
||||||
|
@ -2225,7 +2225,8 @@ rt2860_set_chan(struct rt2860_softc *sc, u_int chan)
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
/* find the settings for this channel (we know it exists) */
|
/* find the settings for this channel (we know it exists) */
|
||||||
for (i = 0; rfprog[i].chan != chan; i++);
|
for (i = 0; rfprog[i].chan != chan; i++)
|
||||||
|
;
|
||||||
|
|
||||||
r2 = rfprog[i].r2;
|
r2 = rfprog[i].r2;
|
||||||
if (sc->ntxchains == 1)
|
if (sc->ntxchains == 1)
|
||||||
|
@ -2281,7 +2282,8 @@ rt3090_set_chan(struct rt2860_softc *sc, u_int chan)
|
||||||
KASSERT(chan >= 1 && chan <= 14); /* RT3090 is 2GHz only */
|
KASSERT(chan >= 1 && chan <= 14); /* RT3090 is 2GHz only */
|
||||||
|
|
||||||
/* find the settings for this channel (we know it exists) */
|
/* find the settings for this channel (we know it exists) */
|
||||||
for (i = 0; rt2860_rf2850[i].chan != chan; i++);
|
for (i = 0; rt2860_rf2850[i].chan != chan; i++)
|
||||||
|
;
|
||||||
|
|
||||||
/* use Tx power values from EEPROM */
|
/* use Tx power values from EEPROM */
|
||||||
txpow1 = sc->txpow1[i];
|
txpow1 = sc->txpow1[i];
|
||||||
|
@ -2346,7 +2348,8 @@ rt5390_set_chan(struct rt2860_softc *sc, u_int chan)
|
||||||
KASSERT(chan >= 1 && chan <= 14);
|
KASSERT(chan >= 1 && chan <= 14);
|
||||||
|
|
||||||
/* find the settings for this channel (we know it exists) */
|
/* find the settings for this channel (we know it exists) */
|
||||||
for (i = 0; rt2860_rf2850[i].chan != chan; i++);
|
for (i = 0; rt2860_rf2850[i].chan != chan; i++)
|
||||||
|
;
|
||||||
|
|
||||||
/* use Tx power values from EEPROM */
|
/* use Tx power values from EEPROM */
|
||||||
txpow1 = sc->txpow1[i];
|
txpow1 = sc->txpow1[i];
|
||||||
|
@ -4054,10 +4057,12 @@ rt2860_calib(struct rt2860_softc *sc)
|
||||||
|
|
||||||
if (bbp49 < tssi[0]) { /* lower than reference */
|
if (bbp49 < tssi[0]) { /* lower than reference */
|
||||||
/* use higher Tx power than default */
|
/* use higher Tx power than default */
|
||||||
for (d = 0; d > -4 && bbp49 <= tssi[d - 1]; d--);
|
for (d = 0; d > -4 && bbp49 <= tssi[d - 1]; d--)
|
||||||
|
;
|
||||||
} else if (bbp49 > tssi[0]) { /* greater than reference */
|
} else if (bbp49 > tssi[0]) { /* greater than reference */
|
||||||
/* use lower Tx power than default */
|
/* use lower Tx power than default */
|
||||||
for (d = 0; d < +4 && bbp49 >= tssi[d + 1]; d++);
|
for (d = 0; d < +4 && bbp49 >= tssi[d + 1]; d++)
|
||||||
|
;
|
||||||
} else {
|
} else {
|
||||||
/* use default Tx power */
|
/* use default Tx power */
|
||||||
d = 0;
|
d = 0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: auglx.c,v 1.23 2022/10/26 20:19:08 kn Exp $ */
|
/* $OpenBSD: auglx.c,v 1.24 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008 Marc Balmer <mbalmer@openbsd.org>
|
* Copyright (c) 2008 Marc Balmer <mbalmer@openbsd.org>
|
||||||
|
@ -669,7 +669,8 @@ auglx_trigger_output(void *v, void *start, void *end, int blksize,
|
||||||
DPRINTF(AUGLX_DBG_DMA, ("%s: trigger_output, %p 0x%08x bytes, "
|
DPRINTF(AUGLX_DBG_DMA, ("%s: trigger_output, %p 0x%08x bytes, "
|
||||||
"blksize 0x%04x\n", sc->sc_dev.dv_xname, start, size, blksize));
|
"blksize 0x%04x\n", sc->sc_dev.dv_xname, start, size, blksize));
|
||||||
|
|
||||||
for (p = sc->sc_dmas; p && p->addr != start; p = p->next);
|
for (p = sc->sc_dmas; p && p->addr != start; p = p->next)
|
||||||
|
;
|
||||||
if (!p) {
|
if (!p) {
|
||||||
DPRINTF(AUGLX_DBG_DMA, ("%s dma reg not found\n",
|
DPRINTF(AUGLX_DBG_DMA, ("%s dma reg not found\n",
|
||||||
sc->sc_dev.dv_xname));
|
sc->sc_dev.dv_xname));
|
||||||
|
@ -730,7 +731,8 @@ auglx_trigger_input(void *v, void *start, void *end, int blksize,
|
||||||
DPRINTF(AUGLX_DBG_DMA, ("%s: trigger_input, %p 0x%08x bytes, "
|
DPRINTF(AUGLX_DBG_DMA, ("%s: trigger_input, %p 0x%08x bytes, "
|
||||||
"blksize 0x%04x\n", sc->sc_dev.dv_xname, start, size, blksize));
|
"blksize 0x%04x\n", sc->sc_dev.dv_xname, start, size, blksize));
|
||||||
|
|
||||||
for (p = sc->sc_dmas; p && p->addr != start; p = p->next);
|
for (p = sc->sc_dmas; p && p->addr != start; p = p->next)
|
||||||
|
;
|
||||||
if (!p) {
|
if (!p) {
|
||||||
DPRINTF(AUGLX_DBG_DMA, ("%s dma reg not found\n",
|
DPRINTF(AUGLX_DBG_DMA, ("%s dma reg not found\n",
|
||||||
sc->sc_dev.dv_xname));
|
sc->sc_dev.dv_xname));
|
||||||
|
|
|
@ -778,8 +778,8 @@ static int kfd_ioctl_get_process_apertures_new(struct file *filp,
|
||||||
* nodes, but not more than args->num_of_nodes as that is
|
* nodes, but not more than args->num_of_nodes as that is
|
||||||
* the amount of memory allocated by user
|
* the amount of memory allocated by user
|
||||||
*/
|
*/
|
||||||
pa = kzalloc((sizeof(struct kfd_process_device_apertures) *
|
pa = kcalloc(args->num_of_nodes, sizeof(struct kfd_process_device_apertures),
|
||||||
args->num_of_nodes), GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!pa)
|
if (!pa)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
|
@ -57,10 +57,10 @@ void mod_stats_update_event(struct mod_stats *mod_stats,
|
||||||
unsigned int length);
|
unsigned int length);
|
||||||
|
|
||||||
void mod_stats_update_flip(struct mod_stats *mod_stats,
|
void mod_stats_update_flip(struct mod_stats *mod_stats,
|
||||||
unsigned long timestamp_in_ns);
|
unsigned long long timestamp_in_ns);
|
||||||
|
|
||||||
void mod_stats_update_vupdate(struct mod_stats *mod_stats,
|
void mod_stats_update_vupdate(struct mod_stats *mod_stats,
|
||||||
unsigned long timestamp_in_ns);
|
unsigned long long timestamp_in_ns);
|
||||||
|
|
||||||
void mod_stats_update_freesync(struct mod_stats *mod_stats,
|
void mod_stats_update_freesync(struct mod_stats *mod_stats,
|
||||||
unsigned int v_total_min,
|
unsigned int v_total_min,
|
||||||
|
|
|
@ -193,13 +193,22 @@ int drm_mode_config_helper_suspend(struct drm_device *dev)
|
||||||
|
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return 0;
|
return 0;
|
||||||
|
/*
|
||||||
|
* Don't disable polling if it was never initialized
|
||||||
|
*/
|
||||||
|
if (dev->mode_config.poll_enabled)
|
||||||
drm_kms_helper_poll_disable(dev);
|
drm_kms_helper_poll_disable(dev);
|
||||||
|
|
||||||
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 1);
|
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 1);
|
||||||
state = drm_atomic_helper_suspend(dev);
|
state = drm_atomic_helper_suspend(dev);
|
||||||
if (IS_ERR(state)) {
|
if (IS_ERR(state)) {
|
||||||
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
|
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
|
||||||
|
/*
|
||||||
|
* Don't enable polling if it was never initialized
|
||||||
|
*/
|
||||||
|
if (dev->mode_config.poll_enabled)
|
||||||
drm_kms_helper_poll_enable(dev);
|
drm_kms_helper_poll_enable(dev);
|
||||||
|
|
||||||
return PTR_ERR(state);
|
return PTR_ERR(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,6 +248,10 @@ int drm_mode_config_helper_resume(struct drm_device *dev)
|
||||||
dev->mode_config.suspend_state = NULL;
|
dev->mode_config.suspend_state = NULL;
|
||||||
|
|
||||||
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
|
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
|
||||||
|
/*
|
||||||
|
* Don't enable polling if it is not initialized
|
||||||
|
*/
|
||||||
|
if (dev->mode_config.poll_enabled)
|
||||||
drm_kms_helper_poll_enable(dev);
|
drm_kms_helper_poll_enable(dev);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -293,14 +293,17 @@ static void reschedule_output_poll_work(struct drm_device *dev)
|
||||||
* Drivers can call this helper from their device resume implementation. It is
|
* Drivers can call this helper from their device resume implementation. It is
|
||||||
* not an error to call this even when output polling isn't enabled.
|
* not an error to call this even when output polling isn't enabled.
|
||||||
*
|
*
|
||||||
|
* If device polling was never initialized before, this call will trigger a
|
||||||
|
* warning and return.
|
||||||
|
*
|
||||||
* Note that calls to enable and disable polling must be strictly ordered, which
|
* Note that calls to enable and disable polling must be strictly ordered, which
|
||||||
* is automatically the case when they're only call from suspend/resume
|
* is automatically the case when they're only call from suspend/resume
|
||||||
* callbacks.
|
* callbacks.
|
||||||
*/
|
*/
|
||||||
void drm_kms_helper_poll_enable(struct drm_device *dev)
|
void drm_kms_helper_poll_enable(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll ||
|
if (drm_WARN_ON_ONCE(dev, !dev->mode_config.poll_enabled) ||
|
||||||
dev->mode_config.poll_running)
|
!drm_kms_helper_poll || dev->mode_config.poll_running)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (drm_kms_helper_enable_hpd(dev) ||
|
if (drm_kms_helper_enable_hpd(dev) ||
|
||||||
|
@ -626,7 +629,11 @@ retry:
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-enable polling in case the global poll config changed. */
|
/*
|
||||||
|
* Re-enable polling in case the global poll config changed but polling
|
||||||
|
* is still initialized.
|
||||||
|
*/
|
||||||
|
if (dev->mode_config.poll_enabled)
|
||||||
drm_kms_helper_poll_enable(dev);
|
drm_kms_helper_poll_enable(dev);
|
||||||
|
|
||||||
if (connector->status == connector_status_disconnected) {
|
if (connector->status == connector_status_disconnected) {
|
||||||
|
@ -881,12 +888,18 @@ EXPORT_SYMBOL(drm_kms_helper_is_poll_worker);
|
||||||
* not an error to call this even when output polling isn't enabled or already
|
* not an error to call this even when output polling isn't enabled or already
|
||||||
* disabled. Polling is re-enabled by calling drm_kms_helper_poll_enable().
|
* disabled. Polling is re-enabled by calling drm_kms_helper_poll_enable().
|
||||||
*
|
*
|
||||||
|
* If however, the polling was never initialized, this call will trigger a
|
||||||
|
* warning and return
|
||||||
|
*
|
||||||
* Note that calls to enable and disable polling must be strictly ordered, which
|
* Note that calls to enable and disable polling must be strictly ordered, which
|
||||||
* is automatically the case when they're only call from suspend/resume
|
* is automatically the case when they're only call from suspend/resume
|
||||||
* callbacks.
|
* callbacks.
|
||||||
*/
|
*/
|
||||||
void drm_kms_helper_poll_disable(struct drm_device *dev)
|
void drm_kms_helper_poll_disable(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
|
if (drm_WARN_ON(dev, !dev->mode_config.poll_enabled))
|
||||||
|
return;
|
||||||
|
|
||||||
if (dev->mode_config.poll_running)
|
if (dev->mode_config.poll_running)
|
||||||
drm_kms_helper_disable_hpd(dev);
|
drm_kms_helper_disable_hpd(dev);
|
||||||
|
|
||||||
|
|
|
@ -764,7 +764,7 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,
|
||||||
* This function may sleep while waiting for space to become available.
|
* This function may sleep while waiting for space to become available.
|
||||||
* Returns:
|
* Returns:
|
||||||
* -EBUSY: No space available (only if no_wait == 1).
|
* -EBUSY: No space available (only if no_wait == 1).
|
||||||
* -ENOMEM: Could not allocate memory for the buffer object, either due to
|
* -ENOSPC: Could not allocate space for the buffer object, either due to
|
||||||
* fragmentation or concurrent allocators.
|
* fragmentation or concurrent allocators.
|
||||||
* -ERESTARTSYS: An interruptible sleep was interrupted by a signal.
|
* -ERESTARTSYS: An interruptible sleep was interrupted by a signal.
|
||||||
*/
|
*/
|
||||||
|
@ -824,7 +824,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = -ENOMEM;
|
ret = -ENOSPC;
|
||||||
if (!type_found) {
|
if (!type_found) {
|
||||||
pr_err(TTM_PFX "No compatible memory type found\n");
|
pr_err(TTM_PFX "No compatible memory type found\n");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
@ -910,6 +910,9 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
ret = ttm_bo_move_buffer(bo, placement, ctx);
|
ret = ttm_bo_move_buffer(bo, placement, ctx);
|
||||||
|
/* For backward compatibility with userspace */
|
||||||
|
if (ret == -ENOSPC)
|
||||||
|
return -ENOMEM;
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: if_bge.c,v 1.403 2024/02/11 06:40:46 jmc Exp $ */
|
/* $OpenBSD: if_bge.c,v 1.404 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001 Wind River Systems
|
* Copyright (c) 2001 Wind River Systems
|
||||||
|
@ -4079,7 +4079,8 @@ bge_cksum_pad(struct mbuf *m)
|
||||||
* Walk packet chain to find last mbuf. We will either
|
* Walk packet chain to find last mbuf. We will either
|
||||||
* pad there, or append a new mbuf and pad it.
|
* pad there, or append a new mbuf and pad it.
|
||||||
*/
|
*/
|
||||||
for (last = m; last->m_next != NULL; last = last->m_next);
|
for (last = m; last->m_next != NULL; last = last->m_next)
|
||||||
|
;
|
||||||
if (m_trailingspace(last) < padlen) {
|
if (m_trailingspace(last) < padlen) {
|
||||||
/* Allocate new empty mbuf, pad it. Compact later. */
|
/* Allocate new empty mbuf, pad it. Compact later. */
|
||||||
struct mbuf *n;
|
struct mbuf *n;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: if_ipw.c,v 1.133 2023/03/08 04:43:08 guenther Exp $ */
|
/* $OpenBSD: if_ipw.c,v 1.134 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2004-2008
|
* Copyright (c) 2004-2008
|
||||||
|
@ -653,7 +653,8 @@ ipw_media_status(struct ifnet *ifp, struct ifmediareq *imr)
|
||||||
val &= 0xf;
|
val &= 0xf;
|
||||||
|
|
||||||
/* convert rate to 802.11 rate */
|
/* convert rate to 802.11 rate */
|
||||||
for (i = 0; i < nitems(rates) && rates[i].val != val; i++);
|
for (i = 0; i < nitems(rates) && rates[i].val != val; i++)
|
||||||
|
;
|
||||||
rate = (i < nitems(rates)) ? rates[i].rate : 0;
|
rate = (i < nitems(rates)) ? rates[i].rate : 0;
|
||||||
|
|
||||||
imr->ifm_active |= IFM_IEEE80211_11B;
|
imr->ifm_active |= IFM_IEEE80211_11B;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: bpp.c,v 1.6 2019/12/31 10:05:33 mpi Exp $ */
|
/* $OpenBSD: bpp.c,v 1.7 2024/04/14 03:23:13 jsg Exp $ */
|
||||||
/* $NetBSD: bpp.c,v 1.25 2005/12/11 12:23:44 christos Exp $ */
|
/* $NetBSD: bpp.c,v 1.25 2005/12/11 12:23:44 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
|
@ -318,7 +318,8 @@ bppwrite(dev_t dev, struct uio *uio, int flags)
|
||||||
if (bppdebug) {
|
if (bppdebug) {
|
||||||
size_t i;
|
size_t i;
|
||||||
printf("bpp: writing %ld : ", len);
|
printf("bpp: writing %ld : ", len);
|
||||||
for (i=0; i<len; i++) printf("%c(0x%x)", bp[i], bp[i]);
|
for (i=0; i<len; i++)
|
||||||
|
printf("%c(0x%x)", bp[i], bp[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: if_mtw.c,v 1.9 2024/04/12 09:56:39 jsg Exp $ */
|
/* $OpenBSD: if_mtw.c,v 1.10 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008-2010 Damien Bergamini <damien.bergamini@free.fr>
|
* Copyright (c) 2008-2010 Damien Bergamini <damien.bergamini@free.fr>
|
||||||
* Copyright (c) 2013-2014 Kevin Lo
|
* Copyright (c) 2013-2014 Kevin Lo
|
||||||
|
@ -2549,7 +2549,8 @@ mt7601_set_chan(struct mtw_softc *sc, u_int chan)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* find the settings for this channel */
|
/* find the settings for this channel */
|
||||||
for (i = 0; mt7601_rf_chan[i].chan != chan; i++);
|
for (i = 0; mt7601_rf_chan[i].chan != chan; i++)
|
||||||
|
;
|
||||||
|
|
||||||
mtw_rf_write(sc, 0, 17, mt7601_rf_chan[i].r17);
|
mtw_rf_write(sc, 0, 17, mt7601_rf_chan[i].r17);
|
||||||
mtw_rf_write(sc, 0, 18, mt7601_rf_chan[i].r18);
|
mtw_rf_write(sc, 0, 18, mt7601_rf_chan[i].r18);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: if_rum.c,v 1.127 2022/04/21 21:03:03 stsp Exp $ */
|
/* $OpenBSD: if_rum.c,v 1.128 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr>
|
* Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr>
|
||||||
|
@ -1654,7 +1654,8 @@ rum_set_chan(struct rum_softc *sc, struct ieee80211_channel *c)
|
||||||
sc->rf_rev == RT2573_RF_2527) ? rum_rf5225 : rum_rf5226;
|
sc->rf_rev == RT2573_RF_2527) ? rum_rf5225 : rum_rf5226;
|
||||||
|
|
||||||
/* find the settings for this channel (we know it exists) */
|
/* find the settings for this channel (we know it exists) */
|
||||||
for (i = 0; rfprog[i].chan != chan; i++);
|
for (i = 0; rfprog[i].chan != chan; i++)
|
||||||
|
;
|
||||||
|
|
||||||
power = sc->txpow[i];
|
power = sc->txpow[i];
|
||||||
if (power < 0) {
|
if (power < 0) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: if_run.c,v 1.138 2023/03/08 04:43:08 guenther Exp $ */
|
/* $OpenBSD: if_run.c,v 1.139 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2008-2010 Damien Bergamini <damien.bergamini@free.fr>
|
* Copyright (c) 2008-2010 Damien Bergamini <damien.bergamini@free.fr>
|
||||||
|
@ -2906,7 +2906,8 @@ run_rt2870_set_chan(struct run_softc *sc, u_int chan)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* find the settings for this channel (we know it exists) */
|
/* find the settings for this channel (we know it exists) */
|
||||||
for (i = 0; rfprog[i].chan != chan; i++);
|
for (i = 0; rfprog[i].chan != chan; i++)
|
||||||
|
;
|
||||||
|
|
||||||
r2 = rfprog[i].r2;
|
r2 = rfprog[i].r2;
|
||||||
if (sc->ntxchains == 1)
|
if (sc->ntxchains == 1)
|
||||||
|
@ -2960,7 +2961,8 @@ run_rt3070_set_chan(struct run_softc *sc, u_int chan)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* find the settings for this channel (we know it exists) */
|
/* find the settings for this channel (we know it exists) */
|
||||||
for (i = 0; rt2860_rf2850[i].chan != chan; i++);
|
for (i = 0; rt2860_rf2850[i].chan != chan; i++)
|
||||||
|
;
|
||||||
|
|
||||||
/* use Tx power values from EEPROM */
|
/* use Tx power values from EEPROM */
|
||||||
txpow1 = sc->txpow1[i];
|
txpow1 = sc->txpow1[i];
|
||||||
|
@ -3026,7 +3028,8 @@ run_rt3572_set_chan(struct run_softc *sc, u_int chan)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* find the settings for this channel (we know it exists) */
|
/* find the settings for this channel (we know it exists) */
|
||||||
for (i = 0; rt2860_rf2850[i].chan != chan; i++);
|
for (i = 0; rt2860_rf2850[i].chan != chan; i++)
|
||||||
|
;
|
||||||
|
|
||||||
/* use Tx power values from EEPROM */
|
/* use Tx power values from EEPROM */
|
||||||
txpow1 = sc->txpow1[i];
|
txpow1 = sc->txpow1[i];
|
||||||
|
@ -3175,7 +3178,8 @@ run_rt3593_set_chan(struct run_softc *sc, u_int chan)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* find the settings for this channel (we know it exists) */
|
/* find the settings for this channel (we know it exists) */
|
||||||
for (i = 0; rt2860_rf2850[i].chan != chan; i++);
|
for (i = 0; rt2860_rf2850[i].chan != chan; i++)
|
||||||
|
;
|
||||||
|
|
||||||
/* use Tx power values from EEPROM */
|
/* use Tx power values from EEPROM */
|
||||||
txpow1 = sc->txpow1[i];
|
txpow1 = sc->txpow1[i];
|
||||||
|
@ -3335,7 +3339,8 @@ run_rt5390_set_chan(struct run_softc *sc, u_int chan)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* find the settings for this channel (we know it exists) */
|
/* find the settings for this channel (we know it exists) */
|
||||||
for (i = 0; rt2860_rf2850[i].chan != chan; i++);
|
for (i = 0; rt2860_rf2850[i].chan != chan; i++)
|
||||||
|
;
|
||||||
|
|
||||||
/* use Tx power values from EEPROM */
|
/* use Tx power values from EEPROM */
|
||||||
txpow1 = sc->txpow1[i];
|
txpow1 = sc->txpow1[i];
|
||||||
|
@ -3451,7 +3456,8 @@ run_rt5592_set_chan(struct run_softc *sc, u_int chan)
|
||||||
rt5592_freqs_40mhz : rt5592_freqs_20mhz;
|
rt5592_freqs_40mhz : rt5592_freqs_20mhz;
|
||||||
|
|
||||||
/* find the settings for this channel (we know it exists) */
|
/* find the settings for this channel (we know it exists) */
|
||||||
for (i = 0; rt2860_rf2850[i].chan != chan; i++, freqs++);
|
for (i = 0; rt2860_rf2850[i].chan != chan; i++, freqs++)
|
||||||
|
;
|
||||||
|
|
||||||
/* use Tx power values from EEPROM */
|
/* use Tx power values from EEPROM */
|
||||||
txpow1 = sc->txpow1[i];
|
txpow1 = sc->txpow1[i];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: msdosfs_conv.c,v 1.20 2019/09/04 14:40:22 cheloha Exp $ */
|
/* $OpenBSD: msdosfs_conv.c,v 1.21 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
/* $NetBSD: msdosfs_conv.c,v 1.24 1997/10/17 11:23:54 ws Exp $ */
|
/* $NetBSD: msdosfs_conv.c,v 1.24 1997/10/17 11:23:54 ws Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
|
@ -491,7 +491,8 @@ unix2dosfn(u_char *un, u_char dn[11], int unlen, u_int gen)
|
||||||
conv = 3;
|
conv = 3;
|
||||||
dp--;
|
dp--;
|
||||||
} else {
|
} else {
|
||||||
for (dp = cp; *--dp == ' ' || *dp == '.';);
|
for (dp = cp; *--dp == ' ' || *dp == '.';)
|
||||||
|
;
|
||||||
dp++;
|
dp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,7 +541,8 @@ unix2dosfn(u_char *un, u_char dn[11], int unlen, u_int gen)
|
||||||
*--cp = gen % 10 + '0';
|
*--cp = gen % 10 + '0';
|
||||||
if (gen)
|
if (gen)
|
||||||
return 0;
|
return 0;
|
||||||
for (i = 8; dn[--i] == ' ';);
|
for (i = 8; dn[--i] == ' ';)
|
||||||
|
;
|
||||||
if (gentext + sizeof(gentext) - cp + 1 > 8 - i)
|
if (gentext + sizeof(gentext) - cp + 1 > 8 - i)
|
||||||
i = 8 - (gentext + sizeof(gentext) - cp + 1);
|
i = 8 - (gentext + sizeof(gentext) - cp + 1);
|
||||||
dn[i++] = '~';
|
dn[i++] = '~';
|
||||||
|
@ -563,7 +565,8 @@ unix2winfn(u_char *un, int unlen, struct winentry *wep, int cnt, int chksum)
|
||||||
/*
|
/*
|
||||||
* Drop trailing blanks and dots
|
* Drop trailing blanks and dots
|
||||||
*/
|
*/
|
||||||
for (cp = un + unlen; *--cp == ' ' || *cp == '.'; unlen--);
|
for (cp = un + unlen; *--cp == ' ' || *cp == '.'; unlen--)
|
||||||
|
;
|
||||||
|
|
||||||
un += (cnt - 1) * WIN_CHARS;
|
un += (cnt - 1) * WIN_CHARS;
|
||||||
unlen -= (cnt - 1) * WIN_CHARS;
|
unlen -= (cnt - 1) * WIN_CHARS;
|
||||||
|
@ -571,7 +574,8 @@ unix2winfn(u_char *un, int unlen, struct winentry *wep, int cnt, int chksum)
|
||||||
/*
|
/*
|
||||||
* Initialize winentry to some useful default
|
* Initialize winentry to some useful default
|
||||||
*/
|
*/
|
||||||
for (cp = (u_int8_t *)wep, i = sizeof(*wep); --i >= 0; *cp++ = 0xff);
|
for (cp = (u_int8_t *)wep, i = sizeof(*wep); --i >= 0; *cp++ = 0xff)
|
||||||
|
;
|
||||||
wep->weCnt = cnt;
|
wep->weCnt = cnt;
|
||||||
wep->weAttributes = ATTR_WIN95;
|
wep->weAttributes = ATTR_WIN95;
|
||||||
wep->weReserved1 = 0;
|
wep->weReserved1 = 0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: if_bridge.c,v 1.369 2024/02/13 12:22:09 bluhm Exp $ */
|
/* $OpenBSD: if_bridge.c,v 1.370 2024/04/14 20:46:27 bluhm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
|
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
|
||||||
|
@ -1600,7 +1600,7 @@ bridge_ipsec(struct ifnet *ifp, struct ether_header *eh, int hassnap,
|
||||||
off);
|
off);
|
||||||
tdb_unref(tdb);
|
tdb_unref(tdb);
|
||||||
if (prot != IPPROTO_DONE)
|
if (prot != IPPROTO_DONE)
|
||||||
ip_deliver(&m, &hlen, prot, af);
|
ip_deliver(&m, &hlen, prot, af, 0);
|
||||||
return (1);
|
return (1);
|
||||||
} else {
|
} else {
|
||||||
tdb_unref(tdb);
|
tdb_unref(tdb);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: ieee80211_crypto.c,v 1.78 2021/05/11 08:46:31 stsp Exp $ */
|
/* $OpenBSD: ieee80211_crypto.c,v 1.79 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr>
|
* Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr>
|
||||||
|
@ -538,7 +538,8 @@ ieee80211_eapol_key_encrypt(struct ieee80211com *ic,
|
||||||
/* set IV to the lower 16 octets of our global key counter */
|
/* set IV to the lower 16 octets of our global key counter */
|
||||||
memcpy(key->iv, ic->ic_globalcnt + 16, 16);
|
memcpy(key->iv, ic->ic_globalcnt + 16, 16);
|
||||||
/* increment our global key counter (256-bit, big-endian) */
|
/* increment our global key counter (256-bit, big-endian) */
|
||||||
for (n = 31; n >= 0 && ++ic->ic_globalcnt[n] == 0; n--);
|
for (n = 31; n >= 0 && ++ic->ic_globalcnt[n] == 0; n--)
|
||||||
|
;
|
||||||
|
|
||||||
/* concatenate the EAPOL-Key IV field and the KEK */
|
/* concatenate the EAPOL-Key IV field and the KEK */
|
||||||
memcpy(keybuf, key->iv, EAPOL_KEY_IV_LEN);
|
memcpy(keybuf, key->iv, EAPOL_KEY_IV_LEN);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: ieee80211_output.c,v 1.137 2022/03/14 15:07:24 stsp Exp $ */
|
/* $OpenBSD: ieee80211_output.c,v 1.138 2024/04/14 03:26:25 jsg Exp $ */
|
||||||
/* $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $ */
|
/* $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
|
@ -798,14 +798,16 @@ ieee80211_add_tim(u_int8_t *frm, struct ieee80211com *ic)
|
||||||
u_int i, offset = 0, len;
|
u_int i, offset = 0, len;
|
||||||
|
|
||||||
/* find first non-zero octet in the virtual bit map */
|
/* find first non-zero octet in the virtual bit map */
|
||||||
for (i = 0; i < ic->ic_tim_len && ic->ic_tim_bitmap[i] == 0; i++);
|
for (i = 0; i < ic->ic_tim_len && ic->ic_tim_bitmap[i] == 0; i++)
|
||||||
|
;
|
||||||
|
|
||||||
/* clear the lsb as it is reserved for the broadcast indication bit */
|
/* clear the lsb as it is reserved for the broadcast indication bit */
|
||||||
if (i < ic->ic_tim_len)
|
if (i < ic->ic_tim_len)
|
||||||
offset = i & ~1;
|
offset = i & ~1;
|
||||||
|
|
||||||
/* find last non-zero octet in the virtual bit map */
|
/* find last non-zero octet in the virtual bit map */
|
||||||
for (i = ic->ic_tim_len - 1; i > 0 && ic->ic_tim_bitmap[i] == 0; i--);
|
for (i = ic->ic_tim_len - 1; i > 0 && ic->ic_tim_bitmap[i] == 0; i--)
|
||||||
|
;
|
||||||
|
|
||||||
len = i - offset + 1;
|
len = i - offset + 1;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: in_proto.c,v 1.103 2024/01/11 14:15:12 bluhm Exp $ */
|
/* $OpenBSD: in_proto.c,v 1.104 2024/04/14 20:46:27 bluhm Exp $ */
|
||||||
/* $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $ */
|
/* $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -210,7 +210,7 @@ const struct protosw inetsw[] = {
|
||||||
.pr_type = SOCK_RAW,
|
.pr_type = SOCK_RAW,
|
||||||
.pr_domain = &inetdomain,
|
.pr_domain = &inetdomain,
|
||||||
.pr_protocol = IPPROTO_RAW,
|
.pr_protocol = IPPROTO_RAW,
|
||||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT,
|
||||||
.pr_input = rip_input,
|
.pr_input = rip_input,
|
||||||
.pr_ctloutput = rip_ctloutput,
|
.pr_ctloutput = rip_ctloutput,
|
||||||
.pr_usrreqs = &rip_usrreqs,
|
.pr_usrreqs = &rip_usrreqs,
|
||||||
|
@ -377,7 +377,7 @@ const struct protosw inetsw[] = {
|
||||||
/* raw wildcard */
|
/* raw wildcard */
|
||||||
.pr_type = SOCK_RAW,
|
.pr_type = SOCK_RAW,
|
||||||
.pr_domain = &inetdomain,
|
.pr_domain = &inetdomain,
|
||||||
.pr_flags = PR_ATOMIC|PR_ADDR,
|
.pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT,
|
||||||
.pr_input = rip_input,
|
.pr_input = rip_input,
|
||||||
.pr_ctloutput = rip_ctloutput,
|
.pr_ctloutput = rip_ctloutput,
|
||||||
.pr_usrreqs = &rip_usrreqs,
|
.pr_usrreqs = &rip_usrreqs,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: ip_input.c,v 1.391 2024/02/28 10:57:20 bluhm Exp $ */
|
/* $OpenBSD: ip_input.c,v 1.392 2024/04/14 20:46:27 bluhm Exp $ */
|
||||||
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
|
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -245,6 +245,30 @@ ip_ours(struct mbuf **mp, int *offp, int nxt, int af)
|
||||||
if (af != AF_UNSPEC)
|
if (af != AF_UNSPEC)
|
||||||
return nxt;
|
return nxt;
|
||||||
|
|
||||||
|
nxt = ip_deliver(mp, offp, nxt, AF_INET, 1);
|
||||||
|
if (nxt == IPPROTO_DONE)
|
||||||
|
return IPPROTO_DONE;
|
||||||
|
|
||||||
|
/* save values for later, use after dequeue */
|
||||||
|
if (*offp != sizeof(struct ip)) {
|
||||||
|
struct m_tag *mtag;
|
||||||
|
struct ipoffnxt *ion;
|
||||||
|
|
||||||
|
/* mbuf tags are expensive, but only used for header options */
|
||||||
|
mtag = m_tag_get(PACKET_TAG_IP_OFFNXT, sizeof(*ion),
|
||||||
|
M_NOWAIT);
|
||||||
|
if (mtag == NULL) {
|
||||||
|
ipstat_inc(ips_idropped);
|
||||||
|
m_freemp(mp);
|
||||||
|
return IPPROTO_DONE;
|
||||||
|
}
|
||||||
|
ion = (struct ipoffnxt *)(mtag + 1);
|
||||||
|
ion->ion_off = *offp;
|
||||||
|
ion->ion_nxt = nxt;
|
||||||
|
|
||||||
|
m_tag_prepend(*mp, mtag);
|
||||||
|
}
|
||||||
|
|
||||||
niq_enqueue(&ipintrq, *mp);
|
niq_enqueue(&ipintrq, *mp);
|
||||||
*mp = NULL;
|
*mp = NULL;
|
||||||
return IPPROTO_DONE;
|
return IPPROTO_DONE;
|
||||||
|
@ -260,18 +284,31 @@ ipintr(void)
|
||||||
struct mbuf *m;
|
struct mbuf *m;
|
||||||
|
|
||||||
while ((m = niq_dequeue(&ipintrq)) != NULL) {
|
while ((m = niq_dequeue(&ipintrq)) != NULL) {
|
||||||
struct ip *ip;
|
struct m_tag *mtag;
|
||||||
int off, nxt;
|
int off, nxt;
|
||||||
|
|
||||||
#ifdef DIAGNOSTIC
|
#ifdef DIAGNOSTIC
|
||||||
if ((m->m_flags & M_PKTHDR) == 0)
|
if ((m->m_flags & M_PKTHDR) == 0)
|
||||||
panic("ipintr no HDR");
|
panic("ipintr no HDR");
|
||||||
#endif
|
#endif
|
||||||
|
mtag = m_tag_find(m, PACKET_TAG_IP_OFFNXT, NULL);
|
||||||
|
if (mtag != NULL) {
|
||||||
|
struct ipoffnxt *ion;
|
||||||
|
|
||||||
|
ion = (struct ipoffnxt *)(mtag + 1);
|
||||||
|
off = ion->ion_off;
|
||||||
|
nxt = ion->ion_nxt;
|
||||||
|
|
||||||
|
m_tag_delete(m, mtag);
|
||||||
|
} else {
|
||||||
|
struct ip *ip;
|
||||||
|
|
||||||
ip = mtod(m, struct ip *);
|
ip = mtod(m, struct ip *);
|
||||||
off = ip->ip_hl << 2;
|
off = ip->ip_hl << 2;
|
||||||
nxt = ip->ip_p;
|
nxt = ip->ip_p;
|
||||||
|
}
|
||||||
|
|
||||||
nxt = ip_deliver(&m, &off, nxt, AF_INET);
|
nxt = ip_deliver(&m, &off, nxt, AF_INET, 0);
|
||||||
KASSERT(nxt == IPPROTO_DONE);
|
KASSERT(nxt == IPPROTO_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -675,15 +712,11 @@ ip_fragcheck(struct mbuf **mp, int *offp)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
ip_deliver(struct mbuf **mp, int *offp, int nxt, int af)
|
ip_deliver(struct mbuf **mp, int *offp, int nxt, int af, int shared)
|
||||||
{
|
{
|
||||||
const struct protosw *psw;
|
|
||||||
int naf = af;
|
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
int nest = 0;
|
int nest = 0;
|
||||||
#endif /* INET6 */
|
#endif
|
||||||
|
|
||||||
NET_ASSERT_LOCKED_EXCLUSIVE();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tell launch routine the next header
|
* Tell launch routine the next header
|
||||||
|
@ -691,13 +724,41 @@ ip_deliver(struct mbuf **mp, int *offp, int nxt, int af)
|
||||||
IPSTAT_INC(delivered);
|
IPSTAT_INC(delivered);
|
||||||
|
|
||||||
while (nxt != IPPROTO_DONE) {
|
while (nxt != IPPROTO_DONE) {
|
||||||
|
const struct protosw *psw;
|
||||||
|
int naf;
|
||||||
|
|
||||||
|
switch (af) {
|
||||||
|
case AF_INET:
|
||||||
|
psw = &inetsw[ip_protox[nxt]];
|
||||||
|
break;
|
||||||
|
#ifdef INET6
|
||||||
|
case AF_INET6:
|
||||||
|
psw = &inet6sw[ip6_protox[nxt]];
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
if (shared && !ISSET(psw->pr_flags, PR_MPINPUT)) {
|
||||||
|
/* delivery not finished, decrement counter, queue */
|
||||||
|
switch (af) {
|
||||||
|
case AF_INET:
|
||||||
|
counters_dec(ipcounters, ips_delivered);
|
||||||
|
break;
|
||||||
|
#ifdef INET6
|
||||||
|
case AF_INET6:
|
||||||
|
counters_dec(ip6counters, ip6s_delivered);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
if (af == AF_INET6 &&
|
if (af == AF_INET6 &&
|
||||||
ip6_hdrnestlimit && (++nest > ip6_hdrnestlimit)) {
|
ip6_hdrnestlimit && (++nest > ip6_hdrnestlimit)) {
|
||||||
ip6stat_inc(ip6s_toomanyhdr);
|
ip6stat_inc(ip6s_toomanyhdr);
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
#endif /* INET6 */
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* protection against faulty packet - there should be
|
* protection against faulty packet - there should be
|
||||||
|
@ -716,7 +777,7 @@ ip_deliver(struct mbuf **mp, int *offp, int nxt, int af)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Otherwise, just fall through and deliver the packet */
|
/* Otherwise, just fall through and deliver the packet */
|
||||||
#endif /* IPSEC */
|
#endif
|
||||||
|
|
||||||
switch (nxt) {
|
switch (nxt) {
|
||||||
case IPPROTO_IPV4:
|
case IPPROTO_IPV4:
|
||||||
|
@ -728,17 +789,10 @@ ip_deliver(struct mbuf **mp, int *offp, int nxt, int af)
|
||||||
naf = AF_INET6;
|
naf = AF_INET6;
|
||||||
ip6stat_inc(ip6s_delivered);
|
ip6stat_inc(ip6s_delivered);
|
||||||
break;
|
break;
|
||||||
#endif /* INET6 */
|
#endif
|
||||||
}
|
default:
|
||||||
switch (af) {
|
naf = af;
|
||||||
case AF_INET:
|
|
||||||
psw = &inetsw[ip_protox[nxt]];
|
|
||||||
break;
|
break;
|
||||||
#ifdef INET6
|
|
||||||
case AF_INET6:
|
|
||||||
psw = &inet6sw[ip6_protox[nxt]];
|
|
||||||
break;
|
|
||||||
#endif /* INET6 */
|
|
||||||
}
|
}
|
||||||
nxt = (*psw->pr_input)(mp, offp, nxt, af);
|
nxt = (*psw->pr_input)(mp, offp, nxt, af);
|
||||||
af = naf;
|
af = naf;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: ip_var.h,v 1.114 2024/03/05 09:45:13 bluhm Exp $ */
|
/* $OpenBSD: ip_var.h,v 1.115 2024/04/14 20:46:27 bluhm Exp $ */
|
||||||
/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */
|
/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -198,6 +198,11 @@ struct ipq {
|
||||||
struct in_addr ipq_src, ipq_dst;
|
struct in_addr ipq_src, ipq_dst;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ipoffnxt {
|
||||||
|
int ion_off;
|
||||||
|
int ion_nxt;
|
||||||
|
};
|
||||||
|
|
||||||
/* flags passed to ip_output */
|
/* flags passed to ip_output */
|
||||||
#define IP_FORWARDING 0x1 /* most of ip header exists */
|
#define IP_FORWARDING 0x1 /* most of ip header exists */
|
||||||
#define IP_RAWOUTPUT 0x2 /* raw ip header exists */
|
#define IP_RAWOUTPUT 0x2 /* raw ip header exists */
|
||||||
|
@ -254,7 +259,7 @@ int ip_sysctl(int *, u_int, void *, size_t *, void *, size_t);
|
||||||
void ip_savecontrol(struct inpcb *, struct mbuf **, struct ip *,
|
void ip_savecontrol(struct inpcb *, struct mbuf **, struct ip *,
|
||||||
struct mbuf *);
|
struct mbuf *);
|
||||||
int ip_input_if(struct mbuf **, int *, int, int, struct ifnet *);
|
int ip_input_if(struct mbuf **, int *, int, int, struct ifnet *);
|
||||||
int ip_deliver(struct mbuf **, int *, int, int);
|
int ip_deliver(struct mbuf **, int *, int, int, int);
|
||||||
void ip_forward(struct mbuf *, struct ifnet *, struct rtentry *, int);
|
void ip_forward(struct mbuf *, struct ifnet *, struct rtentry *, int);
|
||||||
int rip_ctloutput(int, struct socket *, int, int, struct mbuf *);
|
int rip_ctloutput(int, struct socket *, int, int, struct mbuf *);
|
||||||
void rip_init(void);
|
void rip_init(void);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: ip6_input.c,v 1.259 2024/02/28 10:57:20 bluhm Exp $ */
|
/* $OpenBSD: ip6_input.c,v 1.260 2024/04/14 20:46:27 bluhm Exp $ */
|
||||||
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
|
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -166,11 +166,6 @@ ip6_init(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ip6_offnxt {
|
|
||||||
int ion_off;
|
|
||||||
int ion_nxt;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enqueue packet for local delivery. Queuing is used as a boundary
|
* Enqueue packet for local delivery. Queuing is used as a boundary
|
||||||
* between the network layer (input/forward path) running with
|
* between the network layer (input/forward path) running with
|
||||||
|
@ -190,10 +185,14 @@ ip6_ours(struct mbuf **mp, int *offp, int nxt, int af)
|
||||||
if (af != AF_UNSPEC)
|
if (af != AF_UNSPEC)
|
||||||
return nxt;
|
return nxt;
|
||||||
|
|
||||||
|
nxt = ip_deliver(mp, offp, nxt, AF_INET6, 1);
|
||||||
|
if (nxt == IPPROTO_DONE)
|
||||||
|
return IPPROTO_DONE;
|
||||||
|
|
||||||
/* save values for later, use after dequeue */
|
/* save values for later, use after dequeue */
|
||||||
if (*offp != sizeof(struct ip6_hdr)) {
|
if (*offp != sizeof(struct ip6_hdr)) {
|
||||||
struct m_tag *mtag;
|
struct m_tag *mtag;
|
||||||
struct ip6_offnxt *ion;
|
struct ipoffnxt *ion;
|
||||||
|
|
||||||
/* mbuf tags are expensive, but only used for header options */
|
/* mbuf tags are expensive, but only used for header options */
|
||||||
mtag = m_tag_get(PACKET_TAG_IP6_OFFNXT, sizeof(*ion),
|
mtag = m_tag_get(PACKET_TAG_IP6_OFFNXT, sizeof(*ion),
|
||||||
|
@ -203,7 +202,7 @@ ip6_ours(struct mbuf **mp, int *offp, int nxt, int af)
|
||||||
m_freemp(mp);
|
m_freemp(mp);
|
||||||
return IPPROTO_DONE;
|
return IPPROTO_DONE;
|
||||||
}
|
}
|
||||||
ion = (struct ip6_offnxt *)(mtag + 1);
|
ion = (struct ipoffnxt *)(mtag + 1);
|
||||||
ion->ion_off = *offp;
|
ion->ion_off = *offp;
|
||||||
ion->ion_nxt = nxt;
|
ion->ion_nxt = nxt;
|
||||||
|
|
||||||
|
@ -234,9 +233,9 @@ ip6intr(void)
|
||||||
#endif
|
#endif
|
||||||
mtag = m_tag_find(m, PACKET_TAG_IP6_OFFNXT, NULL);
|
mtag = m_tag_find(m, PACKET_TAG_IP6_OFFNXT, NULL);
|
||||||
if (mtag != NULL) {
|
if (mtag != NULL) {
|
||||||
struct ip6_offnxt *ion;
|
struct ipoffnxt *ion;
|
||||||
|
|
||||||
ion = (struct ip6_offnxt *)(mtag + 1);
|
ion = (struct ipoffnxt *)(mtag + 1);
|
||||||
off = ion->ion_off;
|
off = ion->ion_off;
|
||||||
nxt = ion->ion_nxt;
|
nxt = ion->ion_nxt;
|
||||||
|
|
||||||
|
@ -248,7 +247,7 @@ ip6intr(void)
|
||||||
off = sizeof(struct ip6_hdr);
|
off = sizeof(struct ip6_hdr);
|
||||||
nxt = ip6->ip6_nxt;
|
nxt = ip6->ip6_nxt;
|
||||||
}
|
}
|
||||||
nxt = ip_deliver(&m, &off, nxt, AF_INET6);
|
nxt = ip_deliver(&m, &off, nxt, AF_INET6, 0);
|
||||||
KASSERT(nxt == IPPROTO_DONE);
|
KASSERT(nxt == IPPROTO_DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: mbuf.h,v 1.262 2024/02/21 13:42:06 bluhm Exp $ */
|
/* $OpenBSD: mbuf.h,v 1.263 2024/04/14 20:46:27 bluhm Exp $ */
|
||||||
/* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */
|
/* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -471,6 +471,8 @@ struct m_tag *m_tag_next(struct mbuf *, struct m_tag *);
|
||||||
#define PACKET_TAG_IPSEC_IN_DONE 0x0001 /* IPsec applied, in */
|
#define PACKET_TAG_IPSEC_IN_DONE 0x0001 /* IPsec applied, in */
|
||||||
#define PACKET_TAG_IPSEC_OUT_DONE 0x0002 /* IPsec applied, out */
|
#define PACKET_TAG_IPSEC_OUT_DONE 0x0002 /* IPsec applied, out */
|
||||||
#define PACKET_TAG_IPSEC_FLOWINFO 0x0004 /* IPsec flowinfo */
|
#define PACKET_TAG_IPSEC_FLOWINFO 0x0004 /* IPsec flowinfo */
|
||||||
|
#define PACKET_TAG_IP_OFFNXT 0x0010 /* IPv4 offset and next proto */
|
||||||
|
#define PACKET_TAG_IP6_OFFNXT 0x0020 /* IPv6 offset and next proto */
|
||||||
#define PACKET_TAG_WIREGUARD 0x0040 /* WireGuard data */
|
#define PACKET_TAG_WIREGUARD 0x0040 /* WireGuard data */
|
||||||
#define PACKET_TAG_GRE 0x0080 /* GRE processing done */
|
#define PACKET_TAG_GRE 0x0080 /* GRE processing done */
|
||||||
#define PACKET_TAG_DLT 0x0100 /* data link layer type */
|
#define PACKET_TAG_DLT 0x0100 /* data link layer type */
|
||||||
|
@ -479,7 +481,6 @@ struct m_tag *m_tag_next(struct mbuf *, struct m_tag *);
|
||||||
#define PACKET_TAG_SRCROUTE 0x1000 /* IPv4 source routing options */
|
#define PACKET_TAG_SRCROUTE 0x1000 /* IPv4 source routing options */
|
||||||
#define PACKET_TAG_TUNNEL 0x2000 /* Tunnel endpoint address */
|
#define PACKET_TAG_TUNNEL 0x2000 /* Tunnel endpoint address */
|
||||||
#define PACKET_TAG_CARP_BAL_IP 0x4000 /* carp(4) ip balanced marker */
|
#define PACKET_TAG_CARP_BAL_IP 0x4000 /* carp(4) ip balanced marker */
|
||||||
#define PACKET_TAG_IP6_OFFNXT 0x8000 /* IPv6 offset and next proto */
|
|
||||||
|
|
||||||
#define MTAG_BITS \
|
#define MTAG_BITS \
|
||||||
("\20\1IPSEC_IN_DONE\2IPSEC_OUT_DONE\3IPSEC_FLOWINFO" \
|
("\20\1IPSEC_IN_DONE\2IPSEC_OUT_DONE\3IPSEC_FLOWINFO" \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: protosw.h,v 1.65 2024/02/03 22:50:09 mvs Exp $ */
|
/* $OpenBSD: protosw.h,v 1.66 2024/04/14 20:46:27 bluhm Exp $ */
|
||||||
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
|
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
|
@ -132,6 +132,7 @@ struct protosw {
|
||||||
#define PR_ABRTACPTDIS 0x0020 /* abort on accept(2) to disconnected
|
#define PR_ABRTACPTDIS 0x0020 /* abort on accept(2) to disconnected
|
||||||
socket */
|
socket */
|
||||||
#define PR_SPLICE 0x0040 /* socket splicing is possible */
|
#define PR_SPLICE 0x0040 /* socket splicing is possible */
|
||||||
|
#define PR_MPINPUT 0x0080 /* input runs with shared netlock */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The arguments to usrreq are:
|
* The arguments to usrreq are:
|
||||||
|
|
|
@ -778,7 +778,7 @@ ch_close(void)
|
||||||
if (thisfile == NULL)
|
if (thisfile == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ch_flags & (CH_CANSEEK|CH_POPENED|CH_HELPFILE)) {
|
if (ch_flags & (CH_CANSEEK|CH_HELPFILE)) {
|
||||||
/*
|
/*
|
||||||
* We can seek or re-open, so we don't need to keep buffers.
|
* We can seek or re-open, so we don't need to keep buffers.
|
||||||
*/
|
*/
|
||||||
|
@ -790,10 +790,7 @@ ch_close(void)
|
||||||
/*
|
/*
|
||||||
* We don't need to keep the file descriptor open
|
* We don't need to keep the file descriptor open
|
||||||
* (because we can re-open it.)
|
* (because we can re-open it.)
|
||||||
* But don't really close it if it was opened via popen(),
|
|
||||||
* because pclose() wants to close it.
|
|
||||||
*/
|
*/
|
||||||
if (!(ch_flags & CH_POPENED))
|
|
||||||
close(ch_file);
|
close(ch_file);
|
||||||
ch_file = -1;
|
ch_file = -1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -35,7 +35,6 @@ extern int hshift;
|
||||||
extern int show_attn;
|
extern int show_attn;
|
||||||
extern off_t highest_hilite;
|
extern off_t highest_hilite;
|
||||||
extern char *every_first_cmd;
|
extern char *every_first_cmd;
|
||||||
extern char *curr_altfilename;
|
|
||||||
extern char version[];
|
extern char version[];
|
||||||
extern struct scrpos initial_scrpos;
|
extern struct scrpos initial_scrpos;
|
||||||
extern IFILE curr_ifile;
|
extern IFILE curr_ifile;
|
||||||
|
@ -1412,10 +1411,6 @@ again:
|
||||||
error("Cannot edit standard input", NULL);
|
error("Cannot edit standard input", NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (curr_altfilename != NULL) {
|
|
||||||
error("WARNING: This file was viewed via "
|
|
||||||
"LESSOPEN", NULL);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Expand the editor prototype string
|
* Expand the editor prototype string
|
||||||
* and pass it to the system to execute.
|
* and pass it to the system to execute.
|
||||||
|
|
|
@ -35,9 +35,6 @@ extern char *namelogfile;
|
||||||
dev_t curr_dev;
|
dev_t curr_dev;
|
||||||
ino_t curr_ino;
|
ino_t curr_ino;
|
||||||
|
|
||||||
char *curr_altfilename = NULL;
|
|
||||||
static void *curr_altpipe;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Textlist functions deal with a list of words separated by spaces.
|
* Textlist functions deal with a list of words separated by spaces.
|
||||||
|
@ -146,16 +143,6 @@ close_file(void)
|
||||||
* Close the file descriptor, unless it is a pipe.
|
* Close the file descriptor, unless it is a pipe.
|
||||||
*/
|
*/
|
||||||
ch_close();
|
ch_close();
|
||||||
/*
|
|
||||||
* If we opened a file using an alternate name,
|
|
||||||
* do special stuff to close it.
|
|
||||||
*/
|
|
||||||
if (curr_altfilename != NULL) {
|
|
||||||
close_altfile(curr_altfilename, get_filename(curr_ifile),
|
|
||||||
curr_altpipe);
|
|
||||||
free(curr_altfilename);
|
|
||||||
curr_altfilename = NULL;
|
|
||||||
}
|
|
||||||
curr_ifile = NULL;
|
curr_ifile = NULL;
|
||||||
curr_ino = curr_dev = 0;
|
curr_ino = curr_dev = 0;
|
||||||
}
|
}
|
||||||
|
@ -185,10 +172,7 @@ edit_ifile(IFILE ifile)
|
||||||
int no_display;
|
int no_display;
|
||||||
int chflags;
|
int chflags;
|
||||||
char *filename;
|
char *filename;
|
||||||
char *open_filename;
|
|
||||||
char *qopen_filename;
|
char *qopen_filename;
|
||||||
char *alt_filename;
|
|
||||||
void *alt_pipe;
|
|
||||||
IFILE was_curr_ifile;
|
IFILE was_curr_ifile;
|
||||||
PARG parg;
|
PARG parg;
|
||||||
|
|
||||||
|
@ -200,11 +184,9 @@ edit_ifile(IFILE ifile)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We must close the currently open file now.
|
* We close the currently open file now. This was done before
|
||||||
* This is necessary to make the open_altfile/close_altfile pairs
|
* to avoid linked popen/pclose pairs from LESSOPEN, but there
|
||||||
* nest properly (or rather to avoid nesting at all).
|
* may other code that has come to rely on this restriction.
|
||||||
* {{ Some stupid implementations of popen() mess up if you do:
|
|
||||||
* fA = popen("A"); fB = popen("B"); pclose(fA); pclose(fB); }}
|
|
||||||
*/
|
*/
|
||||||
end_logfile();
|
end_logfile();
|
||||||
was_curr_ifile = save_curr_ifile();
|
was_curr_ifile = save_curr_ifile();
|
||||||
|
@ -233,47 +215,28 @@ edit_ifile(IFILE ifile)
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = estrdup(get_filename(ifile));
|
filename = estrdup(get_filename(ifile));
|
||||||
/*
|
qopen_filename = shell_unquote(filename);
|
||||||
* See if LESSOPEN specifies an "alternate" file to open.
|
|
||||||
*/
|
|
||||||
alt_pipe = NULL;
|
|
||||||
alt_filename = open_altfile(filename, &f, &alt_pipe);
|
|
||||||
open_filename = (alt_filename != NULL) ? alt_filename : filename;
|
|
||||||
qopen_filename = shell_unquote(open_filename);
|
|
||||||
|
|
||||||
chflags = 0;
|
chflags = 0;
|
||||||
if (strcmp(open_filename, helpfile()) == 0)
|
if (strcmp(filename, helpfile()) == 0)
|
||||||
chflags |= CH_HELPFILE;
|
chflags |= CH_HELPFILE;
|
||||||
if (alt_pipe != NULL) {
|
if (strcmp(filename, "-") == 0) {
|
||||||
/*
|
|
||||||
* The alternate "file" is actually a pipe.
|
|
||||||
* f has already been set to the file descriptor of the pipe
|
|
||||||
* in the call to open_altfile above.
|
|
||||||
* Keep the file descriptor open because it was opened
|
|
||||||
* via popen(), and pclose() wants to close it.
|
|
||||||
*/
|
|
||||||
chflags |= CH_POPENED;
|
|
||||||
} else if (strcmp(open_filename, "-") == 0) {
|
|
||||||
/*
|
/*
|
||||||
* Use standard input.
|
* Use standard input.
|
||||||
* Keep the file descriptor open because we can't reopen it.
|
* Keep the file descriptor open because we can't reopen it.
|
||||||
*/
|
*/
|
||||||
f = fd0;
|
f = fd0;
|
||||||
chflags |= CH_KEEPOPEN;
|
chflags |= CH_KEEPOPEN;
|
||||||
} else if (strcmp(open_filename, FAKE_EMPTYFILE) == 0) {
|
} else if (strcmp(filename, FAKE_EMPTYFILE) == 0) {
|
||||||
f = -1;
|
f = -1;
|
||||||
chflags |= CH_NODATA;
|
chflags |= CH_NODATA;
|
||||||
} else if ((parg.p_string = bad_file(open_filename)) != NULL) {
|
} else if ((parg.p_string = bad_file(filename)) != NULL) {
|
||||||
/*
|
/*
|
||||||
* It looks like a bad file. Don't try to open it.
|
* It looks like a bad file. Don't try to open it.
|
||||||
*/
|
*/
|
||||||
error("%s", &parg);
|
error("%s", &parg);
|
||||||
free(parg.p_string);
|
free(parg.p_string);
|
||||||
err1:
|
err1:
|
||||||
if (alt_filename != NULL) {
|
|
||||||
close_altfile(alt_filename, filename, alt_pipe);
|
|
||||||
free(alt_filename);
|
|
||||||
}
|
|
||||||
del_ifile(ifile);
|
del_ifile(ifile);
|
||||||
free(qopen_filename);
|
free(qopen_filename);
|
||||||
free(filename);
|
free(filename);
|
||||||
|
@ -323,8 +286,6 @@ err1:
|
||||||
unsave_ifile(was_curr_ifile);
|
unsave_ifile(was_curr_ifile);
|
||||||
}
|
}
|
||||||
curr_ifile = ifile;
|
curr_ifile = ifile;
|
||||||
curr_altfilename = alt_filename;
|
|
||||||
curr_altpipe = alt_pipe;
|
|
||||||
set_open(curr_ifile); /* File has been opened */
|
set_open(curr_ifile); /* File has been opened */
|
||||||
get_pos(curr_ifile, &initial_scrpos);
|
get_pos(curr_ifile, &initial_scrpos);
|
||||||
new_file = TRUE;
|
new_file = TRUE;
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
extern int force_open;
|
extern int force_open;
|
||||||
extern int secure;
|
extern int secure;
|
||||||
extern int use_lessopen;
|
|
||||||
extern int ctldisp;
|
extern int ctldisp;
|
||||||
extern int utf_mode;
|
extern int utf_mode;
|
||||||
extern IFILE curr_ifile;
|
extern IFILE curr_ifile;
|
||||||
|
@ -106,6 +105,15 @@ metachar(char c)
|
||||||
return (strchr(metachars(), c) != NULL);
|
return (strchr(metachars(), c) != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Must use quotes rather than escape characters for this meta character.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
must_quote(char c)
|
||||||
|
{
|
||||||
|
return (c == '\n');
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insert a backslash before each metacharacter in a string.
|
* Insert a backslash before each metacharacter in a string.
|
||||||
*/
|
*/
|
||||||
|
@ -136,6 +144,9 @@ shell_quote(const char *s)
|
||||||
* doesn't support escape chars. Use quotes.
|
* doesn't support escape chars. Use quotes.
|
||||||
*/
|
*/
|
||||||
use_quotes = 1;
|
use_quotes = 1;
|
||||||
|
} else if (must_quote(*p)) {
|
||||||
|
/* Opening quote + character + closing quote. */
|
||||||
|
len += 3;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Allow space for the escape char.
|
* Allow space for the escape char.
|
||||||
|
@ -155,15 +166,20 @@ shell_quote(const char *s)
|
||||||
} else {
|
} else {
|
||||||
newstr = r = ecalloc(len, sizeof (char));
|
newstr = r = ecalloc(len, sizeof (char));
|
||||||
while (*s != '\0') {
|
while (*s != '\0') {
|
||||||
if (metachar(*s)) {
|
if (!metachar(*s)) {
|
||||||
/*
|
*r++ = *s++;
|
||||||
* Add the escape char.
|
} else if (must_quote(*s)) {
|
||||||
*/
|
/* Surround the character with quotes. */
|
||||||
|
*r++ = openquote;
|
||||||
|
*r++ = *s++;
|
||||||
|
*r++ = closequote;
|
||||||
|
} else {
|
||||||
|
/* Escape the character. */
|
||||||
(void) strlcpy(r, esc, newstr + len - p);
|
(void) strlcpy(r, esc, newstr + len - p);
|
||||||
r += esclen;
|
r += esclen;
|
||||||
}
|
|
||||||
*r++ = *s++;
|
*r++ = *s++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
*r = '\0';
|
*r = '\0';
|
||||||
}
|
}
|
||||||
return (newstr);
|
return (newstr);
|
||||||
|
@ -501,182 +517,6 @@ lglob(char *filename)
|
||||||
return (gfilename);
|
return (gfilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Expand LESSOPEN or LESSCLOSE. Returns a newly allocated string
|
|
||||||
* on success, NULL otherwise.
|
|
||||||
*/
|
|
||||||
static char *
|
|
||||||
expand_pct_s(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
int len;
|
|
||||||
char *r, *d;
|
|
||||||
const char *f[3]; /* max expansions + 1 for NULL */
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
va_start(ap, fmt);
|
|
||||||
for (n = 0; n < ((sizeof (f)/sizeof (f[0])) - 1); n++) {
|
|
||||||
f[n] = (const char *)va_arg(ap, const char *);
|
|
||||||
if (f[n] == NULL) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
va_end(ap);
|
|
||||||
f[n] = NULL; /* terminate list */
|
|
||||||
|
|
||||||
len = strlen(fmt) + 1;
|
|
||||||
for (n = 0; f[n] != NULL; n++) {
|
|
||||||
len += strlen(f[n]); /* technically could -2 for "%s" */
|
|
||||||
}
|
|
||||||
r = ecalloc(len, sizeof (char));
|
|
||||||
|
|
||||||
for (n = 0, d = r; *fmt != 0; ) {
|
|
||||||
if (*fmt != '%') {
|
|
||||||
*d++ = *fmt++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
fmt++;
|
|
||||||
/* Permit embedded "%%" */
|
|
||||||
switch (*fmt) {
|
|
||||||
case '%':
|
|
||||||
*d++ = '%';
|
|
||||||
fmt++;
|
|
||||||
break;
|
|
||||||
case 's':
|
|
||||||
if (f[n] == NULL) {
|
|
||||||
va_end(ap);
|
|
||||||
free(r);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
(void) strlcpy(d, f[n++], r + len - d);
|
|
||||||
fmt++;
|
|
||||||
d += strlen(d);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
va_end(ap);
|
|
||||||
free(r);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*d = '\0';
|
|
||||||
return (r);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* See if we should open a "replacement file"
|
|
||||||
* instead of the file we're about to open.
|
|
||||||
*/
|
|
||||||
char *
|
|
||||||
open_altfile(char *filename, int *pf, void **pfd)
|
|
||||||
{
|
|
||||||
char *lessopen;
|
|
||||||
char *cmd;
|
|
||||||
FILE *fd;
|
|
||||||
int returnfd = 0;
|
|
||||||
|
|
||||||
if (!use_lessopen || secure)
|
|
||||||
return (NULL);
|
|
||||||
ch_ungetchar(-1);
|
|
||||||
if ((lessopen = lgetenv("LESSOPEN")) == NULL)
|
|
||||||
return (NULL);
|
|
||||||
while (*lessopen == '|') {
|
|
||||||
/*
|
|
||||||
* If LESSOPEN starts with a |, it indicates
|
|
||||||
* a "pipe preprocessor".
|
|
||||||
*/
|
|
||||||
lessopen++;
|
|
||||||
returnfd++;
|
|
||||||
}
|
|
||||||
if (*lessopen == '-') {
|
|
||||||
/*
|
|
||||||
* Lessopen preprocessor will accept "-" as a filename.
|
|
||||||
*/
|
|
||||||
lessopen++;
|
|
||||||
} else {
|
|
||||||
if (strcmp(filename, "-") == 0)
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((cmd = expand_pct_s(lessopen, filename, NULL)) == NULL) {
|
|
||||||
error("Invalid LESSOPEN variable", NULL);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
fd = shellcmd(cmd);
|
|
||||||
free(cmd);
|
|
||||||
if (fd == NULL) {
|
|
||||||
/*
|
|
||||||
* Cannot create the pipe.
|
|
||||||
*/
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
if (returnfd) {
|
|
||||||
int f;
|
|
||||||
char c;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Read one char to see if the pipe will produce any data.
|
|
||||||
* If it does, push the char back on the pipe.
|
|
||||||
*/
|
|
||||||
f = fileno(fd);
|
|
||||||
if (read(f, &c, 1) != 1) {
|
|
||||||
/*
|
|
||||||
* Pipe is empty.
|
|
||||||
* If more than 1 pipe char was specified,
|
|
||||||
* the exit status tells whether the file itself
|
|
||||||
* is empty, or if there is no alt file.
|
|
||||||
* If only one pipe char, just assume no alt file.
|
|
||||||
*/
|
|
||||||
int status = pclose(fd);
|
|
||||||
if (returnfd > 1 && status == 0) {
|
|
||||||
*pfd = NULL;
|
|
||||||
*pf = -1;
|
|
||||||
return (estrdup(FAKE_EMPTYFILE));
|
|
||||||
}
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
ch_ungetchar(c);
|
|
||||||
*pfd = (void *) fd;
|
|
||||||
*pf = f;
|
|
||||||
return (estrdup("-"));
|
|
||||||
}
|
|
||||||
cmd = readfd(fd);
|
|
||||||
pclose(fd);
|
|
||||||
if (*cmd == '\0')
|
|
||||||
/*
|
|
||||||
* Pipe is empty. This means there is no alt file.
|
|
||||||
*/
|
|
||||||
return (NULL);
|
|
||||||
return (cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Close a replacement file.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
close_altfile(char *altfilename, char *filename, void *pipefd)
|
|
||||||
{
|
|
||||||
char *lessclose;
|
|
||||||
FILE *fd;
|
|
||||||
char *cmd;
|
|
||||||
|
|
||||||
if (secure)
|
|
||||||
return;
|
|
||||||
if (pipefd != NULL) {
|
|
||||||
pclose((FILE *)pipefd);
|
|
||||||
}
|
|
||||||
if ((lessclose = lgetenv("LESSCLOSE")) == NULL)
|
|
||||||
return;
|
|
||||||
cmd = expand_pct_s(lessclose, filename, altfilename, NULL);
|
|
||||||
if (cmd == NULL) {
|
|
||||||
error("Invalid LESSCLOSE variable", NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fd = shellcmd(cmd);
|
|
||||||
free(cmd);
|
|
||||||
if (fd != NULL)
|
|
||||||
(void) pclose(fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is the specified file a directory?
|
* Is the specified file a directory?
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -122,8 +122,6 @@ char *fexpand(char *);
|
||||||
char *fcomplete(char *);
|
char *fcomplete(char *);
|
||||||
int bin_file(int f);
|
int bin_file(int f);
|
||||||
char *lglob(char *);
|
char *lglob(char *);
|
||||||
char *open_altfile(char *, int *, void **);
|
|
||||||
void close_altfile(char *, char *, void *);
|
|
||||||
int is_dir(char *);
|
int is_dir(char *);
|
||||||
char *bad_file(char *);
|
char *bad_file(char *);
|
||||||
off_t filesize(int);
|
off_t filesize(int);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $OpenBSD: less.1,v 1.59 2021/12/10 17:26:54 schwarze Exp $
|
.\" $OpenBSD: less.1,v 1.60 2024/04/14 18:11:54 guenther Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (C) 1984-2012 Mark Nudelman
|
.\" Copyright (C) 1984-2012 Mark Nudelman
|
||||||
.\"
|
.\"
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: December 10 2021 $
|
.Dd $Mdocdate: April 14 2024 $
|
||||||
.Dt LESS 1
|
.Dt LESS 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -304,16 +304,6 @@ environment variable is set, or if a lesskey file is found in a standard place
|
||||||
(see
|
(see
|
||||||
.Sx KEY BINDINGS ) ,
|
.Sx KEY BINDINGS ) ,
|
||||||
it is also used as a lesskey file.
|
it is also used as a lesskey file.
|
||||||
.It Fl L | -no-lessopen
|
|
||||||
Ignore the
|
|
||||||
.Ev LESSOPEN
|
|
||||||
environment variable (see the
|
|
||||||
.Sx INPUT PREPROCESSOR
|
|
||||||
section below).
|
|
||||||
This option can be set from within
|
|
||||||
.Nm less ,
|
|
||||||
but it will apply only to files opened subsequently, not to the
|
|
||||||
file which is currently open.
|
|
||||||
.It Fl M | -LONG-PROMPT
|
.It Fl M | -LONG-PROMPT
|
||||||
Causes
|
Causes
|
||||||
.Nm
|
.Nm
|
||||||
|
@ -1258,160 +1248,6 @@ On
|
||||||
.Ox ,
|
.Ox ,
|
||||||
the system-wide lesskey file is
|
the system-wide lesskey file is
|
||||||
.Pa /etc/sysless .
|
.Pa /etc/sysless .
|
||||||
.Sh INPUT PREPROCESSOR
|
|
||||||
You may define an "input preprocessor" for
|
|
||||||
.Nm less .
|
|
||||||
Before
|
|
||||||
.Nm less
|
|
||||||
opens a file, it first gives your input preprocessor a chance to modify the
|
|
||||||
way the contents of the file are displayed.
|
|
||||||
An input preprocessor is simply an executable program (or shell script),
|
|
||||||
which writes the contents of the file to a different file,
|
|
||||||
called the replacement file.
|
|
||||||
The contents of the replacement file are then displayed
|
|
||||||
in place of the contents of the original file.
|
|
||||||
However, it will appear to the user as if the original file is opened;
|
|
||||||
that is,
|
|
||||||
.Nm less
|
|
||||||
will display the original filename as the name of the current file.
|
|
||||||
.Pp
|
|
||||||
An input preprocessor receives one command line argument, the original filename,
|
|
||||||
as entered by the user.
|
|
||||||
It should create the replacement file, and when finished
|
|
||||||
print the name of the replacement file to its standard output.
|
|
||||||
If the input preprocessor does not output a replacement filename,
|
|
||||||
.Nm
|
|
||||||
uses the original file, as normal.
|
|
||||||
The input preprocessor is not called when viewing standard input.
|
|
||||||
To set up an input preprocessor, set the
|
|
||||||
.Ev LESSOPEN
|
|
||||||
environment variable to a command line which will invoke your
|
|
||||||
input preprocessor.
|
|
||||||
This command line should include one occurrence of the string "%s",
|
|
||||||
which will be replaced by the filename
|
|
||||||
when the input preprocessor command is invoked.
|
|
||||||
.Pp
|
|
||||||
When
|
|
||||||
.Nm
|
|
||||||
closes a file opened in such a way, it will call another program,
|
|
||||||
called the input postprocessor,
|
|
||||||
which may perform any desired clean-up action (such as deleting the
|
|
||||||
replacement file created by
|
|
||||||
.Ev LESSOPEN ) .
|
|
||||||
This program receives two command line arguments, the original filename
|
|
||||||
as entered by the user, and the name of the replacement file.
|
|
||||||
To set up an input postprocessor, set the
|
|
||||||
.Ev LESSCLOSE
|
|
||||||
environment variable to a command line which will invoke your
|
|
||||||
input postprocessor.
|
|
||||||
It may include two occurrences of the string "%s";
|
|
||||||
the first is replaced with the original name of the file and the second
|
|
||||||
with the name of the replacement file, which was output by
|
|
||||||
.Ev LESSOPEN .
|
|
||||||
.Pp
|
|
||||||
For example, these two scripts will allow you
|
|
||||||
to keep files in compressed format, but still let
|
|
||||||
.Nm
|
|
||||||
view them directly:
|
|
||||||
.Pp
|
|
||||||
lessopen.sh:
|
|
||||||
.Bd -literal -offset indent
|
|
||||||
#! /bin/sh
|
|
||||||
case "$1" in
|
|
||||||
*.Z) uncompress -c $1 >/tmp/less.$$ 2>/dev/null
|
|
||||||
if [ -s /tmp/less.$$ ]; then
|
|
||||||
echo /tmp/less.$$
|
|
||||||
else
|
|
||||||
rm -f /tmp/less.$$
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
.Ed
|
|
||||||
.Pp
|
|
||||||
lessclose.sh:
|
|
||||||
.Bd -literal -offset indent
|
|
||||||
#! /bin/sh
|
|
||||||
rm $2
|
|
||||||
.Ed
|
|
||||||
.Pp
|
|
||||||
To use these scripts, put them both where they can be executed and
|
|
||||||
set LESSOPEN="lessopen.sh\ %s", and LESSCLOSE="lessclose.sh\ %s\ %s".
|
|
||||||
More complex LESSOPEN and LESSCLOSE scripts may be written
|
|
||||||
to accept other types of compressed files, and so on.
|
|
||||||
.Pp
|
|
||||||
It is also possible to set up an input preprocessor to
|
|
||||||
pipe the file data directly to
|
|
||||||
.Nm less ,
|
|
||||||
rather than putting the data into a replacement file.
|
|
||||||
This avoids the need to decompress the entire file before starting to view it.
|
|
||||||
An input preprocessor that works this way is called an input pipe.
|
|
||||||
An input pipe, instead of writing the name of a replacement file on
|
|
||||||
its standard output,
|
|
||||||
writes the entire contents of the replacement file on its standard output.
|
|
||||||
If the input pipe does not write any characters on its standard output,
|
|
||||||
then there is no replacement file and
|
|
||||||
.Nm
|
|
||||||
uses the original file, as normal.
|
|
||||||
To use an input pipe, make the first character in the
|
|
||||||
.Ev LESSOPEN
|
|
||||||
environment variable a vertical bar (|) to signify that the
|
|
||||||
input preprocessor is an input pipe.
|
|
||||||
.Pp
|
|
||||||
For example, this script will work like the previous example scripts:
|
|
||||||
.Pp
|
|
||||||
lesspipe.sh:
|
|
||||||
.Bd -literal -offset indent
|
|
||||||
#! /bin/sh
|
|
||||||
case "$1" in
|
|
||||||
*.Z) uncompress -c $1 2>/dev/null
|
|
||||||
*) exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
exit $?
|
|
||||||
.Ed
|
|
||||||
.Pp
|
|
||||||
To use this script, put it where it can be executed and set
|
|
||||||
LESSOPEN="|lesspipe.sh %s".
|
|
||||||
.Pp
|
|
||||||
Note that a preprocessor cannot output an empty file, since that
|
|
||||||
is interpreted as meaning there is no replacement, and
|
|
||||||
the original file is used.
|
|
||||||
To avoid this, if
|
|
||||||
.Ev LESSOPEN
|
|
||||||
starts with two vertical bars,
|
|
||||||
the exit status of the script becomes meaningful.
|
|
||||||
If the exit status is zero, the output is considered to be
|
|
||||||
replacement text, even if it empty.
|
|
||||||
If the exit status is nonzero, any output is ignored and the
|
|
||||||
original file is used.
|
|
||||||
For compatibility with previous versions of
|
|
||||||
.Nm less ,
|
|
||||||
if
|
|
||||||
.Ev LESSOPEN
|
|
||||||
starts with only one vertical bar, the exit status
|
|
||||||
of the preprocessor is ignored.
|
|
||||||
.Pp
|
|
||||||
When an input pipe is used, a LESSCLOSE postprocessor can be used,
|
|
||||||
but it is usually not necessary since there is no replacement file to clean up.
|
|
||||||
In this case, the replacement file name passed to the LESSCLOSE
|
|
||||||
postprocessor is "-".
|
|
||||||
.Pp
|
|
||||||
For compatibility with previous versions of
|
|
||||||
.Nm less ,
|
|
||||||
the input preprocessor or pipe is not used if
|
|
||||||
.Nm
|
|
||||||
is viewing standard input.
|
|
||||||
However, if the first character of LESSOPEN is a dash (-),
|
|
||||||
the input preprocessor is used on standard input as well as other files.
|
|
||||||
In this case, the dash is not considered to be part of
|
|
||||||
the preprocessor command.
|
|
||||||
If standard input is being viewed, the input preprocessor is passed
|
|
||||||
a file name consisting of a single dash.
|
|
||||||
Similarly, if the first two characters of LESSOPEN are vertical bar and dash
|
|
||||||
(|-) or two vertical bars and a dash (||-),
|
|
||||||
the input pipe is used on standard input as well as other files.
|
|
||||||
Again, in this case the dash is not considered to be part of
|
|
||||||
the input pipe command.
|
|
||||||
.Sh NATIONAL CHARACTER SETS
|
.Sh NATIONAL CHARACTER SETS
|
||||||
There are three types of characters in the input file:
|
There are three types of characters in the input file:
|
||||||
.Bl -tag -width "control characters"
|
.Bl -tag -width "control characters"
|
||||||
|
@ -1843,8 +1679,6 @@ end character in an ANSI color escape sequence
|
||||||
(default "0123456789;[?!"'#%()*+\ ").
|
(default "0123456789;[?!"'#%()*+\ ").
|
||||||
.It Ev LESSBINFMT
|
.It Ev LESSBINFMT
|
||||||
Format for displaying non-printable, non-control characters.
|
Format for displaying non-printable, non-control characters.
|
||||||
.It Ev LESSCLOSE
|
|
||||||
Command line to invoke the (optional) input-postprocessor.
|
|
||||||
.It Ev LESSEDIT
|
.It Ev LESSEDIT
|
||||||
Editor prototype string (used for the v command).
|
Editor prototype string (used for the v command).
|
||||||
See discussion under
|
See discussion under
|
||||||
|
@ -1874,8 +1708,6 @@ Prefix which
|
||||||
will add before each metacharacter in a command sent to the shell.
|
will add before each metacharacter in a command sent to the shell.
|
||||||
If LESSMETAESCAPE is an empty string, commands containing
|
If LESSMETAESCAPE is an empty string, commands containing
|
||||||
metacharacters will not be passed to the shell.
|
metacharacters will not be passed to the shell.
|
||||||
.It Ev LESSOPEN
|
|
||||||
Command line to invoke the (optional) input-preprocessor.
|
|
||||||
.It Ev LESSSECURE
|
.It Ev LESSSECURE
|
||||||
Runs less in "secure" mode.
|
Runs less in "secure" mode.
|
||||||
See discussion under
|
See discussion under
|
||||||
|
|
|
@ -165,7 +165,6 @@ extern int abort_sigs(void);
|
||||||
/* filestate flags */
|
/* filestate flags */
|
||||||
#define CH_CANSEEK 001
|
#define CH_CANSEEK 001
|
||||||
#define CH_KEEPOPEN 002
|
#define CH_KEEPOPEN 002
|
||||||
#define CH_POPENED 004
|
|
||||||
#define CH_HELPFILE 010
|
#define CH_HELPFILE 010
|
||||||
#define CH_NODATA 020 /* Special case for zero length files */
|
#define CH_NODATA 020 /* Special case for zero length files */
|
||||||
|
|
||||||
|
|
|
@ -149,8 +149,6 @@
|
||||||
Use a lesskey file.
|
Use a lesskey file.
|
||||||
-K --quit-on-intr
|
-K --quit-on-intr
|
||||||
Exit less in response to ctrl-C.
|
Exit less in response to ctrl-C.
|
||||||
-L ........ --no-lessopen
|
|
||||||
Ignore the LESSOPEN environment variable.
|
|
||||||
-m -M .... --long-prompt --LONG-PROMPT
|
-m -M .... --long-prompt --LONG-PROMPT
|
||||||
Set prompt style.
|
Set prompt style.
|
||||||
-n -N .... --line-numbers --LINE-NUMBERS
|
-n -N .... --line-numbers --LINE-NUMBERS
|
||||||
|
|
|
@ -53,7 +53,6 @@ extern int quit_if_one_screen;
|
||||||
extern int quit_at_eof;
|
extern int quit_at_eof;
|
||||||
extern int pr_type;
|
extern int pr_type;
|
||||||
extern int hilite_search;
|
extern int hilite_search;
|
||||||
extern int use_lessopen;
|
|
||||||
extern int no_init;
|
extern int no_init;
|
||||||
extern int top_scroll;
|
extern int top_scroll;
|
||||||
extern int errmsgs;
|
extern int errmsgs;
|
||||||
|
@ -131,9 +130,6 @@ main(int argc, char *argv[])
|
||||||
/* do not highlight search terms */
|
/* do not highlight search terms */
|
||||||
hilite_search = OPT_OFF;
|
hilite_search = OPT_OFF;
|
||||||
|
|
||||||
/* do not use LESSOPEN */
|
|
||||||
use_lessopen = OPT_OFF;
|
|
||||||
|
|
||||||
/* do not set init strings to terminal */
|
/* do not set init strings to terminal */
|
||||||
no_init = OPT_ON;
|
no_init = OPT_ON;
|
||||||
|
|
||||||
|
|
|
@ -236,8 +236,8 @@ static struct loption option[] = {
|
||||||
{ 'L', &L__optname,
|
{ 'L', &L__optname,
|
||||||
BOOL, OPT_ON, &use_lessopen, NULL,
|
BOOL, OPT_ON, &use_lessopen, NULL,
|
||||||
{
|
{
|
||||||
"Don't use the LESSOPEN filter",
|
"(ignored)",
|
||||||
"Use the LESSOPEN filter",
|
"(ignored)",
|
||||||
NULL
|
NULL
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue