Skip to content

Commit 9974618

Browse files
authored
Merge pull request #377 from ghostbsd/releng/15.0-update
Sync GhostBSD releng/15.0 with FreeBSD releng/15.0
2 parents 659542a + b855515 commit 9974618

2,105 files changed

Lines changed: 124228 additions & 86457 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile.inc1

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ SUBDIR+= ${_DIR}
466466
# by calling 'makedb' in share/man. This is only relevant for
467467
# install/distribute so they build the whatis file after every manpage is
468468
# installed.
469-
.if make(installworld) || make(install)
469+
.if make(installworld) || make(install) || make(distributeworld) || make(distribute)
470470
SUBDIR+=.WAIT
471471
.endif
472472
SUBDIR+=etc
@@ -600,7 +600,16 @@ PKG_VERSION:= ${_PKG_REVISION}${EXTRA_REVISION:C/[[:space:]]//g}
600600
.endif
601601
.endif # !defined(_MKSHOWCONFIG)
602602

603+
PKG_NAME_PREFIX?= FreeBSD
604+
PKG_MAINTAINER?= re@FreeBSD.org
605+
PKG_WWW?= https://www.FreeBSD.org
606+
PKG_WORKERS_COUNT?= 1
607+
603608
.if make(*package*)
609+
.export PKG_NAME_PREFIX
610+
.export PKG_MAINTAINER
611+
.export PKG_WWW
612+
604613
.if !defined(PKG_TIMESTAMP)
605614
.if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git)
606615
SOURCE_DATE_EPOCH!= ${GIT_CMD} -C ${SRCDIR} show -s --format=%ct HEAD
@@ -611,14 +620,6 @@ SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime}
611620
.else
612621
SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP}
613622
.endif
614-
PKG_WORKERS_COUNT?= 1
615-
616-
PKG_NAME_PREFIX?= FreeBSD
617-
PKG_MAINTAINER?= re@FreeBSD.org
618-
PKG_WWW?= https://www.FreeBSD.org
619-
.export PKG_NAME_PREFIX
620-
.export PKG_MAINTAINER
621-
.export PKG_WWW
622623
.endif
623624

624625
.if !defined(_MKSHOWCONFIG)
@@ -1366,6 +1367,28 @@ __installcheck_DESTDIR: .PHONY
13661367
.endif
13671368
.endif
13681369

1370+
#
1371+
# Don't allow installworld or installkernel on a pkgbase system. This avoids
1372+
# accidentally updating a pkgbase system with install{world,kernel}, causing
1373+
# the installed system to become out of date with the package database.
1374+
#
1375+
# Skip the check if DESTDIR is defined on the assumption the user knows what
1376+
# they're doing. This means the check can be disabled for the running system
1377+
# using DESTDIR=/.
1378+
#
1379+
.if !make(distributeworld) && !defined(DESTDIR)
1380+
_installcheck_world: __installcheck_PKG
1381+
_installcheck_kernel: __installcheck_PKG
1382+
__installcheck_PKG: .PHONY
1383+
.if exists(${LOCALBASE}/sbin/pkg-static)
1384+
@if ${LOCALBASE}/sbin/pkg-static info -e ${PKG_NAME_PREFIX}-runtime; then \
1385+
echo >&2 "ERROR: This target should not be used on a system installed from packages." ; \
1386+
echo >&2 " To override this check, set DESTDIR=/."; \
1387+
false; \
1388+
fi
1389+
.endif
1390+
.endif
1391+
13691392
.if !defined(DB_FROM_SRC)
13701393
#
13711394
# Check for missing UIDs/GIDs.
@@ -1977,6 +2000,7 @@ REPODIR?= ${OBJROOT}repo
19772000
PKG_FORMAT?= tzst
19782001
PKG_LEVEL?= -1
19792002
PKG_CLEVEL?= ${"${PKG_FORMAT:Mtar}" != "":?:-l ${PKG_LEVEL}}
2003+
PKG_CTHREADS?= 0
19802004
PKG_REPO_SIGNING_KEY?= # empty
19812005
PKG_OUTPUT_DIR?= ${PKG_VERSION}
19822006
PKG_ABI_FILE?= ${WSTAGEDIR}/usr/bin/uname
@@ -2157,7 +2181,7 @@ create-source-src-package: _pkgbootstrap .PHONY
21572181
${SSTAGEDIR}/src.ucl
21582182
${PKG_CMD} -o ABI=${PKG_ABI} \
21592183
-o OSVERSION="${SRCRELDATE}" \
2160-
create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
2184+
create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
21612185
-M ${SSTAGEDIR}/src.ucl \
21622186
-p ${SSTAGEDIR}/src.plist \
21632187
-r ${SRCDIR} \
@@ -2183,7 +2207,7 @@ create-source-src-sys-package: _pkgbootstrap .PHONY
21832207
${SSTAGEDIR}/src-sys.ucl
21842208
${PKG_CMD} -o ABI=${PKG_ABI} \
21852209
-o OSVERSION="${SRCRELDATE}" \
2186-
create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
2210+
create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
21872211
-M ${SSTAGEDIR}/src-sys.ucl \
21882212
-p ${SSTAGEDIR}/src-sys.plist \
21892213
-r ${SRCDIR} \
@@ -2226,7 +2250,7 @@ create-world-package-${pkgname}: .PHONY
22262250
fi
22272251
${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
22282252
-o OSVERSION="${SRCRELDATE}" \
2229-
create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
2253+
create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
22302254
-M ${WSTAGEDIR}/${pkgname}.ucl \
22312255
-p ${WSTAGEDIR}/${pkgname}.plist \
22322256
-r ${WSTAGEDIR} \
@@ -2245,7 +2269,7 @@ create-sets-packages: .PHONY
22452269
@for manifest in ${WSTAGEDIR}/set-*.ucl; do \
22462270
echo "--> Processing manifest: $$manifest"; \
22472271
${PKG_CMD} -o ABI=${PKG_ABI} -o OSVERSION="${SRCRELDATE}" \
2248-
create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
2272+
create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
22492273
-M $$manifest \
22502274
-o "${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}" \
22512275
|| exit 1; \
@@ -2275,7 +2299,7 @@ create-dtb-package: .PHONY
22752299
${KSTAGEDIR}/${DISTDIR}/dtb.ucl ; \
22762300
${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
22772301
-o OSVERSION="${SRCRELDATE}" \
2278-
create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
2302+
create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
22792303
-M ${KSTAGEDIR}/${DISTDIR}/dtb.ucl \
22802304
-p ${KSTAGEDIR}/${DISTDIR}/dtb.plist \
22812305
-r ${KSTAGEDIR}/${DISTDIR} \
@@ -2312,7 +2336,7 @@ create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap
23122336
${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \
23132337
${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
23142338
-o OSVERSION="${SRCRELDATE}" \
2315-
create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
2339+
create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
23162340
-M ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl \
23172341
-p ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \
23182342
-r ${KSTAGEDIR}/${DISTDIR} \
@@ -2352,7 +2376,7 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kerne
23522376
${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \
23532377
${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
23542378
-o OSVERSION="${SRCRELDATE}" \
2355-
create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
2379+
create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
23562380
-M ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl \
23572381
-p ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \
23582382
-r ${KSTAGEDIR}/kernel.${_kernel} \

UPDATING

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ Items affecting the ports and packages system can be found in
1212
/usr/ports/UPDATING. Please read that file before updating system packages
1313
and/or ports.
1414

15+
20251030:
16+
flua(1) has moved to the new FreeBSD-flua package. If you use flua,
17+
you may want to install this package if it's not otherwise installed
18+
as a dependency of something else. This change only affects pkgbase
19+
users.
20+
21+
20251023:
22+
Bump __FreeBSD_version to 1500068 for LinuxKPI. An embedded struct
23+
has changed size and might possibly be an issue otherwise.
24+
25+
20251022:
26+
15.0-BETA2-p1 SA-25:09.netinet
27+
28+
SO_REUSEPORT_LB breaks connect(2) for UDP sockets. [SA-25:09.netinet]
29+
1530
20251015:
1631
The "FreeBSD-unbound" package is renamed to "FreeBSD-local-unbound".
1732
If you have set-optional or set-base installed, the new package will

bin/pwait/pwait.1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
.\" USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
3131
.\" OF SUCH DAMAGE.
3232
.\"
33-
.Dd January 21, 2021
33+
.Dd October 22, 2025
3434
.Dt PWAIT 1
3535
.Os
3636
.Sh NAME
@@ -39,7 +39,7 @@
3939
.Sh SYNOPSIS
4040
.Nm
4141
.Op Fl t Ar duration
42-
.Op Fl ov
42+
.Op Fl opv
4343
.Ar pid
4444
\&...
4545
.Sh DESCRIPTION
@@ -51,6 +51,8 @@ The following option is available:
5151
.Bl -tag -width indent
5252
.It Fl o
5353
Exit when any of the given processes has terminated.
54+
.It Fl p
55+
On exit, print a list of processes that have not terminated.
5456
.It Fl t Ar duration
5557
If any process is still running after
5658
.Ar duration ,

bin/pwait/pwait.c

Lines changed: 68 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333

3434
#include <sys/types.h>
3535
#include <sys/event.h>
36+
#include <sys/sysctl.h>
3637
#include <sys/time.h>
38+
#include <sys/tree.h>
3739
#include <sys/wait.h>
3840

3941
#include <err.h>
@@ -46,10 +48,25 @@
4648
#include <sysexits.h>
4749
#include <unistd.h>
4850

51+
struct pid {
52+
RB_ENTRY(pid) entry;
53+
pid_t pid;
54+
};
55+
56+
static int
57+
pidcmp(const struct pid *a, const struct pid *b)
58+
{
59+
return (a->pid > b->pid ? 1 : a->pid < b->pid ? -1 : 0);
60+
}
61+
62+
RB_HEAD(pidtree, pid);
63+
static struct pidtree pids = RB_INITIALIZER(&pids);
64+
RB_GENERATE_STATIC(pidtree, pid, entry, pidcmp);
65+
4966
static void
5067
usage(void)
5168
{
52-
fprintf(stderr, "usage: pwait [-t timeout] [-ov] pid ...\n");
69+
fprintf(stderr, "usage: pwait [-t timeout] [-opv] pid ...\n");
5370
exit(EX_USAGE);
5471
}
5572

@@ -61,21 +78,28 @@ main(int argc, char *argv[])
6178
{
6279
struct itimerval itv;
6380
struct kevent *e;
81+
struct pid k, *p;
6482
char *end, *s;
6583
double timeout;
84+
size_t sz;
6685
long pid;
67-
int i, kq, n, nleft, opt, status;
68-
bool oflag, tflag, verbose;
86+
pid_t mypid;
87+
int i, kq, n, ndone, nleft, opt, pid_max, ret, status;
88+
bool oflag, pflag, tflag, verbose;
6989

7090
oflag = false;
91+
pflag = false;
7192
tflag = false;
7293
verbose = false;
7394
memset(&itv, 0, sizeof(itv));
7495

75-
while ((opt = getopt(argc, argv, "ot:v")) != -1) {
96+
while ((opt = getopt(argc, argv, "opt:v")) != -1) {
7697
switch (opt) {
7798
case 'o':
78-
oflag = 1;
99+
oflag = true;
100+
break;
101+
case 'p':
102+
pflag = true;
79103
break;
80104
case 't':
81105
tflag = true;
@@ -127,16 +151,18 @@ main(int argc, char *argv[])
127151
usage();
128152
}
129153

130-
kq = kqueue();
131-
if (kq == -1) {
154+
if ((kq = kqueue()) < 0)
132155
err(EX_OSERR, "kqueue");
133-
}
134156

135-
e = malloc((argc + tflag) * sizeof(struct kevent));
136-
if (e == NULL) {
157+
sz = sizeof(pid_max);
158+
if (sysctlbyname("kern.pid_max", &pid_max, &sz, NULL, 0) != 0) {
159+
pid_max = 99999;
160+
}
161+
if ((e = malloc((argc + tflag) * sizeof(*e))) == NULL) {
137162
err(EX_OSERR, "malloc");
138163
}
139-
nleft = 0;
164+
ndone = nleft = 0;
165+
mypid = getpid();
140166
for (n = 0; n < argc; n++) {
141167
s = argv[n];
142168
/* Undocumented Solaris compat */
@@ -145,35 +171,37 @@ main(int argc, char *argv[])
145171
}
146172
errno = 0;
147173
pid = strtol(s, &end, 10);
148-
if (pid < 0 || *end != '\0' || errno != 0) {
174+
if (pid < 0 || pid > pid_max || *end != '\0' || errno != 0) {
149175
warnx("%s: bad process id", s);
150176
continue;
151177
}
152-
if (pid == getpid()) {
178+
if (pid == mypid) {
153179
warnx("%s: skipping my own pid", s);
154180
continue;
155181
}
156-
for (i = 0; i < nleft; i++) {
157-
if (e[i].ident == (uintptr_t)pid) {
158-
break;
159-
}
182+
if ((p = malloc(sizeof(*p))) == NULL) {
183+
err(EX_OSERR, NULL);
160184
}
161-
if (i < nleft) {
185+
p->pid = pid;
186+
if (RB_INSERT(pidtree, &pids, p) != NULL) {
162187
/* Duplicate. */
188+
free(p);
163189
continue;
164190
}
165191
EV_SET(e + nleft, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
166192
if (kevent(kq, e + nleft, 1, NULL, 0, NULL) == -1) {
193+
if (errno != ESRCH)
194+
err(EX_OSERR, "kevent()");
167195
warn("%ld", pid);
168-
if (oflag) {
169-
exit(EX_OK);
170-
}
196+
RB_REMOVE(pidtree, &pids, p);
197+
free(p);
198+
ndone++;
171199
} else {
172200
nleft++;
173201
}
174202
}
175203

176-
if (nleft > 0 && tflag) {
204+
if ((ndone == 0 || !oflag) && nleft > 0 && tflag) {
177205
/*
178206
* Explicitly detect SIGALRM so that an exit status of 124
179207
* can be returned rather than 142.
@@ -188,7 +216,8 @@ main(int argc, char *argv[])
188216
err(EX_OSERR, "setitimer");
189217
}
190218
}
191-
while (nleft > 0) {
219+
ret = EX_OK;
220+
while ((ndone == 0 || !oflag) && ret == EX_OK && nleft > 0) {
192221
n = kevent(kq, NULL, 0, e, nleft + tflag, NULL);
193222
if (n == -1) {
194223
err(EX_OSERR, "kevent");
@@ -198,29 +227,34 @@ main(int argc, char *argv[])
198227
if (verbose) {
199228
printf("timeout\n");
200229
}
201-
exit(124);
230+
ret = 124;
202231
}
232+
pid = e[i].ident;
203233
if (verbose) {
204234
status = e[i].data;
205235
if (WIFEXITED(status)) {
206236
printf("%ld: exited with status %d.\n",
207-
(long)e[i].ident,
208-
WEXITSTATUS(status));
237+
pid, WEXITSTATUS(status));
209238
} else if (WIFSIGNALED(status)) {
210239
printf("%ld: killed by signal %d.\n",
211-
(long)e[i].ident,
212-
WTERMSIG(status));
240+
pid, WTERMSIG(status));
213241
} else {
214-
printf("%ld: terminated.\n",
215-
(long)e[i].ident);
242+
printf("%ld: terminated.\n", pid);
216243
}
217244
}
218-
if (oflag) {
219-
exit(EX_OK);
245+
k.pid = pid;
246+
if ((p = RB_FIND(pidtree, &pids, &k)) != NULL) {
247+
RB_REMOVE(pidtree, &pids, p);
248+
free(p);
249+
ndone++;
220250
}
221251
--nleft;
222252
}
223253
}
224-
225-
exit(EX_OK);
254+
if (pflag) {
255+
RB_FOREACH(p, pidtree, &pids) {
256+
printf("%d\n", p->pid);
257+
}
258+
}
259+
exit(ret);
226260
}

0 commit comments

Comments
 (0)