sync with OpenBSD -current

This commit is contained in:
purplerain 2024-04-28 21:30:53 +00:00
parent 6bd4a87a12
commit 6fc9e02a30
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
25 changed files with 193 additions and 130 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: date.c,v 1.59 2022/09/23 16:58:33 florian Exp $ */
/* $OpenBSD: date.c,v 1.60 2024/04/28 16:43:15 florian Exp $ */
/* $NetBSD: date.c,v 1.11 1995/09/07 06:21:05 jtc Exp $ */
/*
@ -151,6 +151,8 @@ setthetime(char *p, const char *pformat)
err(1, "pledge");
lt = localtime(&tval);
if (lt == NULL)
errx(1, "conversion error");
lt->tm_isdst = -1; /* correct for DST */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: lex.c,v 1.79 2023/02/08 17:22:10 kn Exp $ */
/* $OpenBSD: lex.c,v 1.80 2024/04/28 16:43:15 florian Exp $ */
/*
* lexical analysis and source input
@ -1251,7 +1251,11 @@ dopprompt(const char *sp, int ntruncate, const char **spp, int doprint)
case 'd': /* '\' 'd' Dow Mon DD */
time(&t);
tm = localtime(&t);
strftime(strbuf, sizeof strbuf, "%a %b %d", tm);
if (tm)
strftime(strbuf, sizeof strbuf,
"%a %b %d", tm);
else
strbuf[0] = '\0';
break;
case 'D': /* '\' 'D' '{' strftime format '}' */
p = strchr(cp + 2, '}');
@ -1266,7 +1270,11 @@ dopprompt(const char *sp, int ntruncate, const char **spp, int doprint)
*p = '\0';
time(&t);
tm = localtime(&t);
strftime(strbuf, sizeof strbuf, tmpbuf, tm);
if (tm)
strftime(strbuf, sizeof strbuf, tmpbuf,
tm);
else
strbuf[0] = '\0';
cp = strchr(cp + 2, '}');
break;
case 'e': /* '\' 'e' escape */
@ -1315,22 +1323,38 @@ dopprompt(const char *sp, int ntruncate, const char **spp, int doprint)
case 't': /* '\' 't' 24 hour HH:MM:SS */
time(&t);
tm = localtime(&t);
strftime(strbuf, sizeof strbuf, "%T", tm);
if (tm)
strftime(strbuf, sizeof strbuf, "%T",
tm);
else
strbuf[0] = '\0';
break;
case 'T': /* '\' 'T' 12 hour HH:MM:SS */
time(&t);
tm = localtime(&t);
strftime(strbuf, sizeof strbuf, "%l:%M:%S", tm);
if (tm)
strftime(strbuf, sizeof strbuf,
"%l:%M:%S", tm);
else
strbuf[0] = '\0';
break;
case '@': /* '\' '@' 12 hour am/pm format */
time(&t);
tm = localtime(&t);
strftime(strbuf, sizeof strbuf, "%r", tm);
if (tm)
strftime(strbuf, sizeof strbuf, "%r",
tm);
else
strbuf[0] = '\0';
break;
case 'A': /* '\' 'A' 24 hour HH:MM */
time(&t);
tm = localtime(&t);
strftime(strbuf, sizeof strbuf, "%R", tm);
if (tm)
strftime(strbuf, sizeof strbuf, "%R",
tm);
else
strbuf[0] = '\0';
break;
case 'u': /* '\' 'u' username */
strlcpy(strbuf, username, sizeof strbuf);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sel_subs.c,v 1.28 2019/06/24 03:33:09 deraadt Exp $ */
/* $OpenBSD: sel_subs.c,v 1.29 2024/04/28 16:43:15 florian Exp $ */
/* $NetBSD: sel_subs.c,v 1.5 1995/03/21 09:07:42 cgd Exp $ */
/*-
@ -572,7 +572,8 @@ str_sec(const char *p, time_t *tval)
return(-1);
}
lt = localtime(tval);
if ((lt = localtime(tval)) == NULL)
return (-1);
if (dot != NULL) { /* .SS */
if (strlen(++dot) != 2)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: print.c,v 1.88 2024/01/28 19:05:33 deraadt Exp $ */
/* $OpenBSD: print.c,v 1.89 2024/04/28 16:43:15 florian Exp $ */
/* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */
/*-
@ -524,6 +524,10 @@ started(const struct pinfo *pi, VARENT *ve)
startt = kp->p_ustart_sec;
tp = localtime(&startt);
if (tp == NULL) {
(void)printf("%-*s", v->width, "-");
return;
}
if (!now)
(void)time(&now);
if (now - kp->p_ustart_sec < 12 * SECSPERHOUR) {

View File

@ -40,6 +40,7 @@
./usr/share/man/man1/ci.1
./usr/share/man/man1/cksum.1
./usr/share/man/man1/clean-old-distfiles.1
./usr/share/man/man1/clear.1
./usr/share/man/man1/cmp.1
./usr/share/man/man1/co.1
./usr/share/man/man1/col.1
@ -487,7 +488,6 @@
./usr/share/man/man1/tmux.1
./usr/share/man/man1/top.1
./usr/share/man/man1/touch.1
./usr/share/man/man1/tput.1
./usr/share/man/man1/tr.1
./usr/share/man/man1/tradcpp.1
./usr/share/man/man1/true.1

View File

@ -1,4 +1,4 @@
/* $OpenBSD: fvwrite.c,v 1.21 2023/10/06 16:41:02 millert Exp $ */
/* $OpenBSD: fvwrite.c,v 1.22 2024/04/28 14:28:02 millert Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@ -31,6 +31,7 @@
* SUCH DAMAGE.
*/
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -76,11 +77,12 @@ __sfvwrite(FILE *fp, struct __suio *uio)
}
if (fp->_flags & __SNBF) {
/*
* Unbuffered: write up to BUFSIZ bytes at a time.
* Unbuffered: write up to INT_MAX bytes at a time, to not
* truncate the value of len if it is greater than 2^31 bytes.
*/
do {
GETIOV(;);
w = (*fp->_write)(fp->_cookie, p, MIN(len, BUFSIZ));
w = (*fp->_write)(fp->_cookie, p, MIN(len, INT_MAX));
if (w <= 0)
goto err;
p += w;
@ -90,7 +92,8 @@ __sfvwrite(FILE *fp, struct __suio *uio)
/*
* Fully buffered: fill partially full buffer, if any,
* and then flush. If there is no partial buffer, write
* one _bf._size byte chunk directly (without copying).
* entire payload directly (without copying) up to a
* multiple of the buffer size.
*
* String output is a special case: write as many bytes
* as fit, but pretend we wrote everything. This makes
@ -134,7 +137,15 @@ __sfvwrite(FILE *fp, struct __suio *uio)
if (__sflush(fp))
goto err;
} else if (len >= (w = fp->_bf._size)) {
/* write directly */
/*
* Write directly up to INT_MAX or greatest
* multiple of buffer size (whichever is
* smaller), keeping in the memory buffer the
* remaining part of payload that is smaller
* than buffer size.
*/
if (w != 0)
w = MIN(w * (len / w), INT_MAX);
w = (*fp->_write)(fp->_cookie, p, w);
if (w <= 0)
goto err;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ftpcmd.y,v 1.74 2023/03/08 04:43:05 guenther Exp $ */
/* $OpenBSD: ftpcmd.y,v 1.75 2024/04/28 16:42:53 florian Exp $ */
/* $NetBSD: ftpcmd.y,v 1.7 1996/04/08 19:03:11 jtc Exp $ */
/*
@ -613,6 +613,11 @@ cmd
} else {
struct tm *t;
t = gmtime(&stbuf.st_mtime);
if (t == NULL) {
/* invalid time, use epoch */
stbuf.st_mtime = 0;
t = gmtime(&stbuf.st_mtime);
}
reply(213,
"%04d%02d%02d%02d%02d%02d",
1900 + t->tm_year,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: main.c,v 1.54 2019/06/28 13:32:53 deraadt Exp $ */
/* $OpenBSD: main.c,v 1.55 2024/04/28 16:42:53 florian Exp $ */
/*-
* Copyright (c) 1980, 1993
@ -562,10 +562,12 @@ putf(char *cp)
break;
case 'd': {
(void)time(&t);
(void)strftime(db, sizeof(db),
"%l:%M%p on %A, %d %B %Y", localtime(&t));
xputs(db);
struct tm *tm;
time(&t);
if ((tm = localtime(&t)) != NULL)
if (strftime(db, sizeof(db),
"%l:%M%p on %A, %d %B %Y", tm) != 0)
xputs(db);
break;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: mib.c,v 1.7 2023/11/21 08:49:08 martijn Exp $ */
/* $OpenBSD: mib.c,v 1.8 2024/04/28 16:42:53 florian Exp $ */
/*
* Copyright (c) 2022 Martijn van Duren <martijn@openbsd.org>
@ -296,27 +296,29 @@ mib_hrsystemdate(struct agentx_varbind *vb)
int tzoffset;
unsigned short year;
memset(s, 0, sizeof(s));
(void)time(&now);
ptm = localtime(&now);
year = htons(ptm->tm_year + 1900);
memcpy(s, &year, 2);
s[2] = ptm->tm_mon + 1;
s[3] = ptm->tm_mday;
s[4] = ptm->tm_hour;
s[5] = ptm->tm_min;
s[6] = ptm->tm_sec;
s[7] = 0;
if (ptm != NULL) {
year = htons(ptm->tm_year + 1900);
memcpy(s, &year, 2);
s[2] = ptm->tm_mon + 1;
s[3] = ptm->tm_mday;
s[4] = ptm->tm_hour;
s[5] = ptm->tm_min;
s[6] = ptm->tm_sec;
s[7] = 0;
tzoffset = ptm->tm_gmtoff;
if (tzoffset < 0)
s[8] = '-';
else
s[8] = '+';
s[9] = abs(tzoffset) / 3600;
s[10] = (abs(tzoffset) - (s[9] * 3600)) / 60;
tzoffset = ptm->tm_gmtoff;
if (tzoffset < 0)
s[8] = '-';
else
s[8] = '+';
s[9] = abs(tzoffset) / 3600;
s[10] = (abs(tzoffset) - (s[9] * 3600)) / 60;
}
agentx_varbind_nstring(vb, s, sizeof(s));
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: announce.c,v 1.25 2019/06/28 13:32:53 deraadt Exp $ */
/* $OpenBSD: announce.c,v 1.26 2024/04/28 16:42:53 florian Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@ -102,9 +102,14 @@ print_mesg(FILE *tf, CTL_MSG *request, char *remote_machine)
sizes[i] = strlen(line_buf[i]);
max_size = max(max_size, sizes[i]);
i++;
(void)snprintf(line_buf[i], N_CHARS,
"Message from Talk_Daemon@%s at %d:%02d ...",
hostname, localclock->tm_hour , localclock->tm_min );
if (localclock) {
(void)snprintf(line_buf[i], N_CHARS,
"Message from Talk_Daemon@%s at %d:%02d ...",
hostname, localclock->tm_hour , localclock->tm_min );
} else {
(void)snprintf(line_buf[i], N_CHARS,
"Message from Talk_Daemon@%s ...", hostname);
}
sizes[i] = strlen(line_buf[i]);
max_size = max(max_size, sizes[i]);
i++;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: dhclient.c,v 1.727 2022/07/02 17:21:32 deraadt Exp $ */
/* $OpenBSD: dhclient.c,v 1.728 2024/04/28 16:43:42 florian Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@ -2079,6 +2079,7 @@ lease_as_string(char *type, struct client_lease *lease)
static char string[8192];
char timebuf[27]; /* 6 2017/04/08 05:47:50 UTC; */
struct option_data *opt;
struct tm *tm;
char *buf, *name;
time_t t;
size_t rslt;
@ -2138,19 +2139,25 @@ lease_as_string(char *type, struct client_lease *lease)
free(buf);
t = lease->epoch + lease_renewal(lease);
rslt = strftime(timebuf, sizeof(timebuf), DB_TIMEFMT, gmtime(&t));
if ((tm = gmtime(&t)) == NULL)
return NULL;
rslt = strftime(timebuf, sizeof(timebuf), DB_TIMEFMT, tm);
if (rslt == 0)
return NULL;
append_statement(string, sizeof(string), " renew ", timebuf);
t = lease->epoch + lease_rebind(lease);
rslt = strftime(timebuf, sizeof(timebuf), DB_TIMEFMT, gmtime(&t));
if ((tm = gmtime(&t)) == NULL)
return NULL;
rslt = strftime(timebuf, sizeof(timebuf), DB_TIMEFMT, tm);
if (rslt == 0)
return NULL;
append_statement(string, sizeof(string), " rebind ", timebuf);
t = lease->epoch + lease_expiry(lease);
rslt = strftime(timebuf, sizeof(timebuf), DB_TIMEFMT, gmtime(&t));
if ((tm = gmtime(&t)) == NULL)
return NULL;
rslt = strftime(timebuf, sizeof(timebuf), DB_TIMEFMT, tm);
if (rslt == 0)
return NULL;
append_statement(string, sizeof(string), " expire ", timebuf);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: log.c,v 1.64 2018/01/15 09:54:48 mpi Exp $ */
/* $OpenBSD: log.c,v 1.65 2024/04/28 16:43:42 florian Exp $ */
/* $EOM: log.c,v 1.30 2000/09/29 08:19:23 niklas Exp $ */
/*
@ -182,7 +182,11 @@ _log_print(int error, int syslog_level, const char *fmt, va_list ap,
if (log_output) {
gettimeofday(&now, 0);
t = now.tv_sec;
tm = localtime(&t);
if ((tm = localtime(&t)) == NULL) {
/* Invalid time, use the epoch. */
t = 0;
tm = localtime(&t);
}
if (class >= 0)
snprintf(nbuf, sizeof nbuf,
"%02d%02d%02d.%06ld %s %02d ",

View File

@ -1,4 +1,4 @@
/* $OpenBSD: policy.c,v 1.102 2021/10/22 12:30:54 bluhm Exp $ */
/* $OpenBSD: policy.c,v 1.103 2024/04/28 16:43:42 florian Exp $ */
/* $EOM: policy.c,v 1.49 2000/10/24 13:33:39 niklas Exp $ */
/*
@ -1728,13 +1728,23 @@ policy_callback(char *name)
return phase_1;
if (strcmp(name, "GMTTimeOfDay") == 0) {
struct tm *tm;
tt = time(NULL);
strftime(mytimeofday, 14, "%Y%m%d%H%M%S", gmtime(&tt));
if ((tm = gmtime(&tt)) == NULL) {
log_error("policy_callback: invalid time %lld", tt);
goto bad;
}
strftime(mytimeofday, 14, "%Y%m%d%H%M%S", tm);
return mytimeofday;
}
if (strcmp(name, "LocalTimeOfDay") == 0) {
struct tm *tm;
tt = time(NULL);
strftime(mytimeofday, 14, "%Y%m%d%H%M%S", localtime(&tt));
if ((tm = localtime(&tt)) == NULL) {
log_error("policy_callback: invalid time %lld", tt);
goto bad;
}
strftime(mytimeofday, 14, "%Y%m%d%H%M%S", tm);
return mytimeofday;
}
if (strcmp(name, "initiator") == 0)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: x509.c,v 1.125 2022/01/16 14:30:11 naddy Exp $ */
/* $OpenBSD: x509.c,v 1.126 2024/04/28 16:43:42 florian Exp $ */
/* $EOM: x509.c,v 1.54 2001/01/16 18:42:16 ho Exp $ */
/*
@ -222,8 +222,15 @@ x509_generate_kn(int id, X509 *cert)
if (((tm = X509_get_notBefore(cert)) == NULL) ||
(tm->type != V_ASN1_UTCTIME &&
tm->type != V_ASN1_GENERALIZEDTIME)) {
tt = time(0);
strftime(before, 14, "%Y%m%d%H%M%S", localtime(&tt));
struct tm *ltm;
tt = time(NULL);
if ((ltm = localtime(&tt)) == NULL) {
LOG_DBG((LOG_POLICY, 30,
"x509_generate_kn: invalid local time"));
goto fail;
}
strftime(before, 14, "%Y%m%d%H%M%S", ltm);
timecomp = "LocalTimeOfDay";
} else {
if (tm->data[tm->length - 1] == 'Z') {
@ -312,8 +319,15 @@ x509_generate_kn(int id, X509 *cert)
if (tm == NULL ||
(tm->type != V_ASN1_UTCTIME &&
tm->type != V_ASN1_GENERALIZEDTIME)) {
struct tm *ltm;
tt = time(0);
strftime(after, 14, "%Y%m%d%H%M%S", localtime(&tt));
if ((ltm = localtime(&tt)) == NULL) {
LOG_DBG((LOG_POLICY, 30,
"x509_generate_kn: invalid local time"));
goto fail;
}
strftime(after, 14, "%Y%m%d%H%M%S", ltm);
timecomp2 = "LocalTimeOfDay";
} else {
if (tm->data[tm->length - 1] == 'Z') {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: newfs_msdos.c,v 1.28 2021/07/11 15:39:58 kettenis Exp $ */
/* $OpenBSD: newfs_msdos.c,v 1.29 2024/04/28 16:43:42 florian Exp $ */
/*
* Copyright (c) 1998 Robert Nordier
@ -550,7 +550,9 @@ main(int argc, char *argv[])
if (!opt_N) {
gettimeofday(&tv, NULL);
now = tv.tv_sec;
tm = localtime(&now);
if ((tm = localtime(&now)) == NULL)
errx(1, "Invalid time");
if (!(img = malloc(bpb.bps)))
err(1, NULL);
dir = bpb.res + (bpb.spf ? bpb.spf : bpb.bspf) * bpb.nft;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: route.c,v 1.265 2023/03/17 16:11:09 claudio Exp $ */
/* $OpenBSD: route.c,v 1.266 2024/04/28 16:43:42 florian Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
@ -1878,7 +1878,10 @@ bfd_calc_uptime(time_t time)
fmt = "%Ss";
tp = localtime(&time);
(void)strftime(buf, sizeof(buf), fmt, tp);
if (tp)
(void)strftime(buf, sizeof(buf), fmt, tp);
else
buf[0] = '\0';
return (buf);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: shutdown.c,v 1.55 2023/04/19 12:58:15 jsg Exp $ */
/* $OpenBSD: shutdown.c,v 1.56 2024/04/28 16:43:42 florian Exp $ */
/* $NetBSD: shutdown.c,v 1.9 1995/03/18 15:01:09 cgd Exp $ */
/*
@ -345,8 +345,13 @@ timewarn(time_t timeleft)
if (timeleft > 10 * 60) {
shuttime = time(NULL) + timeleft;
lt = localtime(&shuttime);
strftime(when, sizeof(when), "%H:%M %Z", lt);
dprintf(fd[1], "System going down at %s\n\n", when);
if (lt != NULL) {
strftime(when, sizeof(when), "%H:%M %Z", lt);
dprintf(fd[1], "System going down at %s\n\n", when);
} else
dprintf(fd[1], "System going down in %lld minute%s\n\n",
(long long)(timeleft / 60),
(timeleft > 60) ? "s" : "");
} else if (timeleft > 59) {
dprintf(fd[1], "System going down in %lld minute%s\n\n",
(long long)(timeleft / 60), (timeleft > 60) ? "s" : "");
@ -525,6 +530,9 @@ getoffset(char *timearg)
time(&now);
lt = localtime(&now); /* current time val */
if (lt == NULL)
badtime();
switch (strlen(timearg)) {
case 10:
this_year = lt->tm_year;
@ -595,10 +603,17 @@ nolog(time_t timeleft)
(void)signal(SIGTERM, finish);
shuttime = time(NULL) + timeleft;
tm = localtime(&shuttime);
if (tm && (logfd = open(_PATH_NOLOGIN, O_WRONLY|O_CREAT|O_TRUNC,
if ((logfd = open(_PATH_NOLOGIN, O_WRONLY|O_CREAT|O_TRUNC,
0664)) >= 0) {
strftime(when, sizeof(when), "at %H:%M %Z", tm);
dprintf(logfd, "\n\nNO LOGINS: System going down %s\n\n", when);
if (tm) {
strftime(when, sizeof(when), "at %H:%M %Z", tm);
dprintf(logfd,
"\n\nNO LOGINS: System going down %s\n\n", when);
} else
dprintf(logfd,
"\n\nNO LOGINS: System going in %lld minute%s\n\n",
(long long)(timeleft / 60),
(timeleft > 60) ? "s" : "");
close(logfd);
}
}

View File

@ -271,8 +271,8 @@ log_vmsg(int pri, const char* type,
}
now = (time_t)time(NULL);
#if defined(HAVE_STRFTIME) && defined(HAVE_LOCALTIME_R)
if(log_time_asc && strftime(tmbuf, sizeof(tmbuf), "%b %d %H:%M:%S",
localtime_r(&now, &tm))%(sizeof(tmbuf)) != 0) {
if(log_time_asc && localtime_r(&now, &tm) && strftime(tmbuf,
sizeof(tmbuf), "%b %d %H:%M:%S", &tm)%(sizeof(tmbuf)) != 0) {
/* %sizeof buf!=0 because old strftime returned max on error */
fprintf(logfile, "%s %s[%d:%x] %s: %s\n", tmbuf,
ident, (int)getpid(), tid?*tid:0, type, message);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: machdep.c,v 1.292 2024/04/03 02:01:21 guenther Exp $ */
/* $OpenBSD: machdep.c,v 1.293 2024/04/29 00:29:48 jsg Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@ -178,10 +178,7 @@ int biosbasemem = 0; /* base memory reported by BIOS */
u_int bootapiver = 0; /* /boot API version */
int physmem;
u_int64_t dumpmem_low;
u_int64_t dumpmem_high;
extern int boothowto;
int cpu_class;
paddr_t dumpmem_paddr;
vaddr_t dumpmem_vaddr;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: machdep.c,v 1.669 2023/08/23 01:55:46 cheloha Exp $ */
/* $OpenBSD: machdep.c,v 1.670 2024/04/29 00:29:48 jsg Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@ -191,9 +191,6 @@ int dumpsize = 0; /* pages */
long dumplo = 0; /* blocks */
int cpu_class;
int i386_fpu_present;
int i386_fpu_exception;
int i386_fpu_fdivbug;
int i386_use_fxsave;
int i386_has_sse;
@ -207,7 +204,6 @@ struct vm_map *exec_map = NULL;
struct vm_map *phys_map = NULL;
#if !defined(SMALL_KERNEL)
int p4_model;
int p3_early;
void (*update_cpuspeed)(void) = NULL;
void via_update_sensor(void *args);
@ -1547,7 +1543,6 @@ intel686_p4_cpu_setup(struct cpu_info *ci)
intel686_common_cpu_setup(ci);
#if !defined(SMALL_KERNEL)
p4_model = (ci->ci_signature >> 4) & 15;
update_cpuspeed = p4_update_cpuspeed;
#endif
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: npx.c,v 1.74 2023/01/30 10:49:05 jsg Exp $ */
/* $OpenBSD: npx.c,v 1.75 2024/04/29 00:29:48 jsg Exp $ */
/* $NetBSD: npx.c,v 1.57 1996/05/12 23:12:24 mycroft Exp $ */
#if 0
@ -132,10 +132,6 @@ static volatile u_int npx_intrs_while_probing
static volatile u_int npx_traps_while_probing
__attribute__((section(".kudata")));
extern int i386_fpu_present;
extern int i386_fpu_exception;
extern int i386_fpu_fdivbug;
#define fxsave(addr) __asm("fxsave %0" : "=m" (*addr))
#define fxrstor(addr) __asm("fxrstor %0" : : "m" (*addr))
#define ldmxcsr(addr) __asm("ldmxcsr %0" : : "m" (*addr))
@ -235,7 +231,6 @@ npxprobe1(struct isa_attach_args *ia)
*/
npx_type = NPX_EXCEPTION;
ia->ia_irq = IRQUNK; /* zap the interrupt */
i386_fpu_exception = 1;
} else if (npx_intrs_while_probing != 0) {
/*
* Bad, we are stuck with IRQ13.
@ -278,7 +273,6 @@ npxprobe(struct device *parent, void *match, void *aux)
if (cpu_feature & CPUID_FPU) {
npx_type = NPX_CPUID;
i386_fpu_exception = 1;
ia->ia_irq = IRQUNK; /* Don't want the interrupt vector */
ia->ia_iosize = 16;
ia->ia_msize = 0;
@ -348,7 +342,6 @@ npxinit(struct cpu_info *ci)
lcr0(rcr0() & ~(CR0_EM|CR0_TS));
fninit();
if (npx586bug1(4195835, 3145727) != 0) {
i386_fpu_fdivbug = 1;
printf("%s: WARNING: Pentium FDIV bug detected!\n",
ci->ci_dev->dv_xname);
}
@ -397,7 +390,6 @@ npxattach(struct device *parent, struct device *self, void *aux)
}
npxinit(&cpu_info_primary);
i386_fpu_present = 1;
if (i386_use_fxsave)
npxdna_func = npxdna_xmm;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pcibios.c,v 1.49 2022/02/21 10:24:28 mpi Exp $ */
/* $OpenBSD: pcibios.c,v 1.50 2024/04/29 00:29:48 jsg Exp $ */
/* $NetBSD: pcibios.c,v 1.5 2000/08/01 05:23:59 uch Exp $ */
/*
@ -101,7 +101,6 @@
#include <machine/biosvar.h>
int pcibios_flags;
int pcibios_present;
struct pcibios_pir_header pcibios_pir_header;
struct pcibios_intr_routing *pcibios_pir_table;
@ -187,8 +186,6 @@ pcibiosattach(struct device *parent, struct device *self, void *aux)
*/
pci_mode = mech1 ? 1 : 2;
pcibios_present = 1;
/*
* Find the PCI IRQ Routing table.
*/

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ac97.c,v 1.84 2018/04/11 04:48:31 ratchov Exp $ */
/* $OpenBSD: ac97.c,v 1.85 2024/04/29 00:29:48 jsg Exp $ */
/*
* Copyright (c) 1999, 2000 Constantine Sapuntzakis
@ -69,17 +69,6 @@
#include <dev/audio_if.h>
#include <dev/ic/ac97.h>
/* default parameters; supported by all ac97 codecs */
const struct audio_params ac97_audio_default = {
48000, /* sample_rate */
AUDIO_ENCODING_SLINEAR_LE, /* encoding */
16, /* precision */
2, /* bps */
1, /* msb */
2 /* channels */
};
const struct audio_mixer_enum ac97_on_off = {
2,
{ { { AudioNoff } , 0 },

View File

@ -1,4 +1,4 @@
/* $OpenBSD: mpls_raw.c,v 1.19 2022/02/22 01:15:02 guenther Exp $ */
/* $OpenBSD: mpls_raw.c,v 1.20 2024/04/29 00:29:48 jsg Exp $ */
/*
* Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project.
@ -45,8 +45,6 @@
#include <netmpls/mpls.h>
int mpls_defttl = 255;
int mpls_push_expnull_ip = 0;
int mpls_push_expnull_ip6 = 0;
int mpls_mapttl_ip = 1;
int mpls_mapttl_ip6 = 0;

View File

@ -1,4 +1,4 @@
/* $Id: netproc.c,v 1.33 2022/12/14 18:32:26 florian Exp $ */
/* $Id: netproc.c,v 1.35 2024/04/28 10:09:25 tb Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@ -54,34 +54,19 @@ struct conn {
/*
* If something goes wrong (or we're tracing output), we dump the
* current transfer's data as a debug message.
* Make sure that print all non-printable characters as question marks
* so that we don't spam the console.
* Also, consolidate white-space.
* This of course will ruin string literals, but the intent here is just
* to show the message, not to replicate it.
*/
static void
buf_dump(const struct buf *buf)
{
size_t i;
int j;
char *nbuf;
if (buf->sz == 0)
return;
if ((nbuf = malloc(buf->sz)) == NULL)
err(EXIT_FAILURE, "malloc");
for (j = 0, i = 0; i < buf->sz; i++)
if (isspace((unsigned char)buf->buf[i])) {
nbuf[j++] = ' ';
while (isspace((unsigned char)buf->buf[i]))
i++;
i--;
} else
nbuf[j++] = isprint((unsigned char)buf->buf[i]) ?
buf->buf[i] : '?';
dodbg("transfer buffer: [%.*s] (%zu bytes)", j, nbuf, buf->sz);
/* must be at least 4 * srclen + 1 long */
if ((nbuf = calloc(buf->sz + 1, 4)) == NULL)
err(EXIT_FAILURE, "calloc");
strvisx(nbuf, buf->buf, buf->sz, VIS_SAFE);
dodbg("transfer buffer: [%s] (%zu bytes)", nbuf, buf->sz);
free(nbuf);
}
@ -678,7 +663,7 @@ netproc(int kfd, int afd, int Cfd, int cfd, int dfd, int rfd,
{
int rc = 0;
size_t i;
char *cert = NULL, *thumb = NULL, *url = NULL, *error = NULL;
char *cert = NULL, *thumb = NULL, *error = NULL;
struct conn c;
struct capaths paths;
struct order order;
@ -913,7 +898,6 @@ out:
close(dfd);
close(rfd);
free(cert);
free(url);
free(thumb);
free(c.kid);
free(c.buf.buf);