Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,65 @@
From c41b3be62fbb78e0939fddaebad519360cbd8702 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex@linutronix.de>
Date: Mon, 6 Mar 2023 09:27:57 +0100
Subject: [PATCH] src/w.c: use only utmpx
Nowadays this works both on musl and glibc systems, however on musl
utmp.h is also needed to avoid the following failure:
| ../git/src/w.c: In function 'print_from':
| ../git/src/w.c:73:28: error: '__UT_HOSTSIZE' undeclared (first use in this function); did you mean 'UT_HOSTSIZE'?
| 73 | # define UT_HOSTSIZE __UT_HOSTSIZE
| | ^~~~~~~~~~~~~
| ../git/src/w.c:233:64: note: in expansion of macro 'UT_HOSTSIZE'
| 233 | print_display_or_interface(u->ut_host, UT_HOSTSIZE, fromlen - len);
| | ^~~~~~~~~~~
|
It is caused by including utmpx.h, but not utmp.h, which (on musl)
lacks the needed definitions.
I have verified that both musl and glibc based builds continue to work.
Upstream-Status: Submitted [https://gitlab.com/procps-ng/procps/-/merge_requests/171]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
src/w.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/src/w.c b/src/w.c
index 5e878f04..912c5df3 100644
--- a/src/w.c
+++ b/src/w.c
@@ -46,11 +46,8 @@
#include <termios.h>
#include <time.h>
#include <unistd.h>
-#ifdef HAVE_UTMPX_H
-# include <utmpx.h>
-#else
-# include <utmp.h>
-#endif
+#include <utmp.h>
+#include <utmpx.h>
#include <arpa/inet.h>
#include "c.h"
@@ -63,17 +60,7 @@
static int ignoreuser = 0; /* for '-u' */
static int oldstyle = 0; /* for '-o' */
-#ifdef HAVE_UTMPX_H
typedef struct utmpx utmp_t;
-#else
-typedef struct utmp utmp_t;
-#endif
-
-#if !defined(UT_HOSTSIZE) || defined(__UT_HOSTSIZE)
-# define UT_HOSTSIZE __UT_HOSTSIZE
-# define UT_LINESIZE __UT_LINESIZE
-# define UT_NAMESIZE __UT_NAMESIZE
-#endif
#ifdef W_SHOWFROM
# define FROM_STRING "on"
@@ -0,0 +1,67 @@
# This configuration taken from procps v3.3.15
# Commented out kernel/pid_max=10000 line
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See sysctl.conf (5) for information.
# you can have the CD-ROM close when you use it, and open
# when you are done.
#dev.cdrom.autoeject = 1
#dev.cdrom.autoclose = 1
# protection from the SYN flood attack
net/ipv4/tcp_syncookies=1
# see the evil packets in your log files
net/ipv4/conf/all/log_martians=1
# makes you vulnerable or not :-)
net/ipv4/conf/all/accept_redirects=0
net/ipv4/conf/all/accept_source_route=0
net/ipv4/icmp_echo_ignore_broadcasts =1
# needed for routing, including masquerading or NAT
#net/ipv4/ip_forward=1
# sets the port range used for outgoing connections
#net.ipv4.ip_local_port_range = 32768 61000
# Broken routers and obsolete firewalls will corrupt the window scaling
# and ECN. Set these values to 0 to disable window scaling and ECN.
# This may, rarely, cause some performance loss when running high-speed
# TCP/IP over huge distances or running TCP/IP over connections with high
# packet loss and modern routers. This sure beats dropped connections.
#net.ipv4.tcp_ecn = 0
# Swapping too much or not enough? Disks spinning up when you'd
# rather they didn't? Tweak these.
#vm.vfs_cache_pressure = 100
#vm.laptop_mode = 0
#vm.swappiness = 60
#kernel.printk_ratelimit_burst = 10
#kernel.printk_ratelimit = 5
#kernel.panic_on_oops = 0
# Reboot 600 seconds after a panic
#kernel.panic = 600
# enable SysRq key (note: console security issues)
#kernel.sysrq = 1
# Change name of core file to start with the command name
# so you get things like: emacs.core mozilla-bin.core X.core
#kernel.core_pattern = %e.core
# NIS/YP domain (not always equal to DNS domain)
#kernel.domainname = example.com
#kernel.hostname = darkstar
# This limits PID values to 4 digits, which allows tools like ps
# to save screen space.
#kernel/pid_max=10000
# Protects against creating or following links under certain conditions
# See https://www.kernel.org/doc/Documentation/sysctl/fs.txt
#fs.protected_hardlinks = 1
#fs.protected_symlinks = 1
@@ -0,0 +1,98 @@
SUMMARY = "System and process monitoring utilities"
DESCRIPTION = "Procps contains a set of system utilities that provide system information about processes using \
the /proc filesystem. The package includes the programs ps, top, vmstat, w, kill, and skill."
HOMEPAGE = "https://gitlab.com/procps-ng/procps"
SECTION = "base"
LICENSE = "GPL-2.0-or-later & LGPL-2.0-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
file://COPYING.LIB;md5=4cf66a4984120007c9881cc871cf49db \
"
DEPENDS = "ncurses"
inherit autotools gettext pkgconfig update-alternatives
SRC_URI = "git://gitlab.com/procps-ng/procps.git;protocol=https;branch=master \
file://sysctl.conf \
file://0001-src-w.c-use-utmp.h-only.patch \
"
SRCREV = "806eb270f217ff7e1e745c7bda2b002b5be74be4"
S = "${WORKDIR}/git"
# Upstream has a custom autogen.sh which invokes po/update-potfiles as they
# don't ship a po/POTFILES.in (which is silly). Without that file gettext
# doesn't believe po/ is a gettext directory and won't generate po/Makefile.
do_configure:prepend() {
( cd ${S} && po/update-potfiles )
}
EXTRA_OECONF = "--enable-skill --disable-modern-top"
PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"
do_install:append () {
install -d ${D}${base_bindir}
[ "${bindir}" != "${base_bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i; done
install -d ${D}${base_sbindir}
[ "${sbindir}" != "${base_sbindir}" ] && for i in ${base_sbindir_progs}; do mv ${D}${sbindir}/$i ${D}${base_sbindir}/$i; done
if [ "${base_sbindir}" != "${sbindir}" ]; then
rmdir ${D}${sbindir}
fi
install -d ${D}${sysconfdir}
install -m 0644 ${WORKDIR}/sysctl.conf ${D}${sysconfdir}/sysctl.conf
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
install -d ${D}${sysconfdir}/sysctl.d
ln -sf ../sysctl.conf ${D}${sysconfdir}/sysctl.d/99-sysctl.conf
fi
}
CONFFILES:${PN} = "${sysconfdir}/sysctl.conf"
bindir_progs = "free pkill pmap pgrep pwdx skill snice top uptime w"
base_bindir_progs += "kill pidof ps watch"
base_sbindir_progs += "sysctl"
ALTERNATIVE_PRIORITY = "200"
ALTERNATIVE_PRIORITY[pidof] = "150"
ALTERNATIVE:${PN} = "${bindir_progs} ${base_bindir_progs} ${base_sbindir_progs}"
ALTERNATIVE:${PN}-doc = "kill.1 uptime.1"
ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
ALTERNATIVE_LINK_NAME[uptime.1] = "${mandir}/man1/uptime.1"
python __anonymous() {
for prog in d.getVar('base_bindir_progs').split():
d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog))
for prog in d.getVar('base_sbindir_progs').split():
d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_sbindir'), prog))
}
PROCPS_PACKAGES = "${PN}-lib \
${PN}-ps \
${PN}-sysctl"
PACKAGE_BEFORE_PN = "${PROCPS_PACKAGES}"
RDEPENDS:${PN} += "${PROCPS_PACKAGES}"
RDEPENDS:${PN}-ps += "${PN}-lib"
RDEPENDS:${PN}-sysctl += "${PN}-lib"
FILES:${PN}-lib = "${libdir}"
FILES:${PN}-ps = "${base_bindir}/ps.${BPN}"
FILES:${PN}-sysctl = "${base_sbindir}/sysctl.${BPN} ${sysconfdir}/sysctl.conf ${sysconfdir}/sysctl.d"
ALTERNATIVE:${PN}:remove = "ps"
ALTERNATIVE:${PN}:remove = "sysctl"
ALTERNATIVE:${PN}-ps = "ps"
ALTERNATIVE_TARGET[ps] = "${base_bindir}/ps"
ALTERNATIVE_LINK_NAME[ps] = "${base_bindir}/ps"
ALTERNATIVE:${PN}-sysctl = "sysctl"
ALTERNATIVE_TARGET[sysctl] = "${base_sbindir}/sysctl"
ALTERNATIVE_LINK_NAME[sysctl] = "${base_sbindir}/sysctl"