Remove old outdated packages

This commit is contained in:
Alex D. 2022-01-11 20:13:17 +00:00
parent d0d8299d10
commit 1569e6132e
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
36 changed files with 0 additions and 74210 deletions

View File

@ -1,106 +0,0 @@
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Alex Denes <caskd@redxen.eu>
pkgname=baselayout
pkgver=1.0
pkgrel=0
pkgdesc="Base directory structure for linux"
url="none"
arch="noarch"
license="GPL-2.0-only"
options="!check"
install="
$pkgname.pre-install
$pkgname.pre-upgrade
$pkgname.post-upgrade
$pkgname.post-install
"
_nbver=6.3
source="
group
inittab
passwd
profile
protocols-$_nbver::https://salsa.debian.org/md/netbase/-/raw/v$_nbver/etc/protocols
services-$_nbver::https://salsa.debian.org/md/netbase/-/raw/v$_nbver/etc/services
"
builddir="$srcdir/build"
prepare() {
default_prepare
mkdir -p "$builddir"
mv "$srcdir"/protocols-$_nbver "$srcdir"/protocols
mv "$srcdir"/services-$_nbver "$srcdir"/services
}
_passwd2shadow() {
local name="$(echo "$1" | cut -d: -f1)"
printf '%s:!:::::::\n' "$name"
}
build() {
while read -r LINE; do
_passwd2shadow "$LINE"
done < "$srcdir"/passwd > shadow
}
package() {
mkdir -p "$pkgdir"
cd "$pkgdir"
install -m 0755 -d \
etc \
var \
mnt \
proc \
run \
sys
install -d -m 0700 root
install -d -m 1777 tmp
ln -s /run var/run
ln -s /tmp var/tmp
echo "localhost" > etc/hostname
cat > etc/hosts <<-EOF
127.0.0.1 localhost localhost.localdomain
::1 localhost localhost.localdomain
EOF
cat > etc/shells <<-EOF
# valid login shells
/bin/sh
/bin/ash
EOF
cat > etc/motd <<-EOF
Welcome to Alpine!
The Alpine Wiki contains a large amount of how-to guides and general
information about administrating Alpine systems.
See <http://wiki.alpinelinux.org/>.
EOF
install -m644 \
"$srcdir"/group \
"$srcdir"/passwd \
"$srcdir"/inittab \
"$srcdir"/profile \
"$srcdir"/protocols \
"$srcdir"/services \
etc/
install -m640 "$builddir"/shadow \
etc/
# symlinks
ln -s /proc/mounts etc/mtab
}
sha512sums="
356ec457ad1f1866e268a04d32e4952bca19977ff3017e912c62a30c4681ea1281390b06b2d009d17665c1ffae591506580a084ef9ef1ec273a00b6d60dbf15a group
fdab6f8fec2a556ab817d90a73635a927ea04dbc4e0470ed59ee6a62c87393f9534c9b746b09a776d938c25b8af9c9fb1686578e24f8307d1d074921ade1bdc7 inittab
f6fe247889a9c09a1c6ac6b1f5baae9ecc9f6300594428dc04dd8e7543c06b4774f57cf034e970a913faf7bbf0aff28b170e5c6425ab04b380b34a3b80a3b529 passwd
2e0c19c08bc161278db950ca66c138091724a134ccbaa655cb7efa933f32ce28cfc006a563d0c150646c8ac7b6c84ab03f0958fd1a55c17e7d3f91c9ff0c1e94 profile
eadc83e47fcc354ab83fd109bee452bda170886fb684e67faf615930c11480919505f4af60c685b124efc54af0ded9522663132f911eac6622144f8b4c8be695 protocols-6.3
47b0f3ee73af2d259bd206a026204be0ea25531a895a0b035a904b38fe5407bc3dd2beab7f8fcb3d760587e6159702ebdb9cbc4f508942befdf7f10c10c87888 services-6.3
"

View File

@ -1,4 +0,0 @@
#!/bin/sh
# force /etc/shadow to be owned by root and not be world readable
chown root:shadow /etc/shadow

View File

@ -1 +0,0 @@
alpine-baselayout.post-install

View File

@ -1,5 +0,0 @@
#!/bin/sh
addgroup -S -g 42 shadow 2>/dev/null
exit 0

View File

@ -1 +0,0 @@
alpine-baselayout.pre-install

View File

@ -1,3 +0,0 @@
root:x:0:root
nogroup:x:65533:
nobody:x:65534:

View File

@ -1,23 +0,0 @@
# /etc/inittab
::sysinit:/sbin/openrc sysinit
::sysinit:/sbin/openrc boot
::wait:/sbin/openrc default
# Set up a couple of getty's
tty1::respawn:/sbin/getty 38400 tty1
tty2::respawn:/sbin/getty 38400 tty2
tty3::respawn:/sbin/getty 38400 tty3
tty4::respawn:/sbin/getty 38400 tty4
tty5::respawn:/sbin/getty 38400 tty5
tty6::respawn:/sbin/getty 38400 tty6
# Put a getty on the serial port
#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100
# Stuff to do for the 3-finger salute
::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
::shutdown:/sbin/openrc shutdown

View File

@ -1,2 +0,0 @@
root:x:0:0:root:/root:/bin/ash
nobody:x:65534:65534:nobody:/:/sbin/nologin

View File

@ -1,23 +0,0 @@
# Append "$1" to $PATH when not already in.
# Copied from Arch Linux, see #12803 for details.
append_path () {
case ":$PATH:" in
*:"$1":*)
;;
*)
PATH="${PATH:+$PATH:}$1"
;;
esac
}
append_path "/usr/local/sbin"
append_path "/usr/local/bin"
append_path "/usr/sbin"
append_path "/usr/bin"
append_path "/sbin"
append_path "/bin"
unset -f append_path
export PATH
export PAGER=less
umask 022

View File

@ -1,37 +0,0 @@
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
pkgname=nnd
pkgver=0.1
pkgrel=0
pkgdesc="Metapackage for nnd"
url="none"
arch="noarch"
license="MIT"
depends="
baselayout
apk-tools
sbase
"
builddir="$srcdir/"
build() {
local NAME="nonamedistribution"
echo "$pkgver" > release
cat >issue <<EOF
Welcome to $NAME $pkgver
Kernel \\r on an \\m (\\l)
EOF
cat >os-release <<EOF
NAME="$NAME"
ID=nnd
VERSION_ID=$pkgver
PRETTY_NAME="$NAME $pkgver"
EOF
}
package() {
install -Dm400 "$builddir"/os-release "$pkgdir"/etc/os-release
install -Dm400 "$builddir"/issue "$pkgdir"/etc/issue
}

View File

@ -1,69 +0,0 @@
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
pkgname=linux-headers
_kver=5.10
_kpatch=55
pkgver=$_kver.$_kpatch
pkgrel=0
source="
https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$pkgver.tar.xz
"
_kabi= _klocalver= _kconfig= _kbdmain= _kbddev= _kflavor=
_kdir_src="$srcdir/linux-$pkgver"
arch="noarch"
_depends_dev="
perl
gmp-dev
elfutils-dev
bash
flex
bison
"
makedepends="
$_depends_dev
sed
installkernel
bc
openssl-dev
diffutils
findutils
"
pkgdesc="Linux Kernel - Headers"
url="https://www.kernel.org"
license="GPL-2.0"
options="!strip"
builddir="$_kdir_src"
_carch=${CARCH} # abuild to kernel arch mapping
case "$_carch" in
aarch64*) _carch="arm64" ;;
arm*) _carch="arm" ;;
mips*) _carch="mips" ;;
ppc*) _carch="powerpc" ;;
s390*) _carch="s390" ;;
esac
package() {
local _outdir="$pkgdir/usr"
mkdir -p "$_outdir"
cd "$_kdir_src"
make headers_install \
ARCH="$_carch" \
INSTALL_HDR_PATH="$_outdir"
rm -f **/.install **/install.cmd
rm -rf "$_outdir/include/drm" # provided by libdrm-dev
}
sha512sums="
53b80d1027c6df6a4f13237a21a3ea69bfe51ba12dd4bf4e984da29150e457fea6fdc493542e4b86a04a9ba1481ae0db866bd883767f7107c323b41fb9fe022c linux-5.10.55.tar.xz
"

View File

@ -1,255 +0,0 @@
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
pkgname=linux
_kver=5.10
_kpatch=55
_ksupport=lts
pkgver=$_kver.$_kpatch
pkgrel=0
_configs="
config-full.aarch64
config-full.armv7
config-full.mips64
config-full.ppc64le
config-full.x86
config-full.x86_64
config-virt.aarch64
config-virt.armv7
config-virt.ppc64le
config-virt.s390x
config-virt.x86
config-virt.x86_64
"
source="
https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$pkgver.tar.xz
$_configs
"
_kabi= _klocalver= _kconfig= _kbdmain= _kbddev= _kflavor=
_kdir_src="$srcdir/linux-$pkgver"
arch="noarch"
_depends_dev="
perl
gmp-dev
elfutils-dev
bash
flex
bison
"
makedepends="
$_depends_dev
sed
linux-headers
installkernel
bc
openssl-dev
diffutils
findutils
"
pkgdesc="Linux Kernel - Metapackage"
url="https://www.kernel.org"
license="GPL-2.0"
options="!strip"
builddir="$_kdir_src"
_carch=${CARCH} # abuild to kernel arch mapping
case "$_carch" in
aarch64*) _carch="arm64" ;;
arm*) _carch="arm" ;;
mips*) _carch="mips" ;;
ppc*) _carch="powerpc" ;;
s390*) _carch="s390" ;;
esac
_archflavors() {
for i in $_configs; do
local _nocfg="${i#config-}"
local _arch="${_nocfg#*.}"
local _flavour="${_nocfg%.*}"
[ "$_arch" == "$CARCH" ] && echo "$_flavour"
done
}
_bvars() {
_kconfig="config-$_kflavor.$CARCH"
_kdir_main="$srcdir/build-$_kflavor.$CARCH"
_kdir_dev="$srcdir/build-$_kflavor-dev.$CARCH"
_ksaf="$_ksupport-$_kflavor"
_kabi="$pkgver-$pkgrel-$_ksaf"
_klocalver="-$pkgrel-$_ksaf"
}
_spvars() {
_kflavor="$(echo $subpkgname | cut -d- -f3)"
}
for _kflavor in $(_archflavors); do
_bvars
subpackages="
$subpackages
$pkgname-$_ksaf:_pkg_kernel:$CBUILD_ARCH
$pkgname-$_ksaf-dev:_pkg_extmod:$CBUILD_ARCH
"
done
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
prepare() {
default_prepare
for _kflavor in $(_archflavors); do
_bvars
for _kbuilddir in "$_kdir_main" "$_kdir_dev"; do
mkdir -p "$_kbuilddir"
echo "$_klocalver" > "$_kbuilddir"/localversion-alpine \
|| return 1
cp "$srcdir"/"$_kconfig" "$_kbuilddir"/.config
make -C "$_kdir_src" \
O="$_kbuilddir" \
ARCH="$_carch" \
olddefconfig
done
done
}
build() {
unset LDFLAGS
for _kflavor in $(_archflavors); do
_bvars
# Build kernel and modules
msg "Building $_kflavor for $CARCH"
cd "$_kdir_main"
make \
ARCH="$_carch" \
CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine"
# Build out-of-tree builder
msg "Building $_kflavor-dev for $CARCH"
cd "$_kdir_dev"
make syncconfig \
ARCH="$_carch"
make prepare \
ARCH="$_carch"
make modules_prepare \
ARCH="$_carch"
make scripts \
ARCH="$_carch"
done
}
package() {
mkdir -p "$pkgdir"
}
_pkg_kernel() {
_spvars
_bvars
local _install=
case "$CARCH" in
arm*|aarch64) _install="zinstall dtbs_install";;
*) _install=install;;
esac
local _outdir="$subpkgdir"
mkdir -p "$_outdir"/boot "$_outdir"/lib/modules
cd "$_kdir_main"
# Install modules
make modules_install \
ARCH="$_carch" \
INSTALL_MOD_PATH="$_outdir"
# Install kernel
make "$_install" \
ARCH="$_carch" \
INSTALL_PATH="$_outdir"/boot \
INSTALL_DTBS_PATH="$_outdir/boot/dtbs-$_ksaf"
# Remove incorrect build-time symlinks
rm -f "$_outdir"/lib/modules/"$_kabi"/build \
"$_outdir"/lib/modules/"$_kabi"/source
rm -rf "$_outdir"/lib/firmware
# Install release file
install -D -m644 include/config/kernel.release \
"$_outdir"/usr/share/kernel/"$_kflavor"/kernel.release
}
_pkg_extmod() {
_spvars
_bvars
depends="$_depends_dev"
local _outdir="$subpkgdir/usr/src/linux-headers-$_kabi" _builddir="$subpkgdir/lib/modules/$_kabi"
mkdir -p "$_outdir"
cd "$_kdir_dev"
msg "Copying kernel out-of-tree build files"
rm Makefile source
cp -t "$_outdir" -a .
cd "$_kdir_src"
msg "Copying kernel out-of-tree build tree"
cp -t "$_outdir" -a scripts include
find . \
-path './include/*' -prune -o \
-path './scripts/*' -prune -o \
-type f \( \
-name 'Makefile*' -o \
-name 'Kconfig*' -o \
-name 'Kbuild*' -o \
-name '*.sh' -o \
-name '*.pl' -o \
-name '*.lds' -o \
-name 'Platform' \
\) -print | \
cpio -pdm "$_outdir"
find ./arch \
-path './arch/*/include/*' \
-type f -print | \
cpio -pdm "$_outdir"
mkdir -p "$_builddir"
ln -sf "/usr/src/linux-headers-$_kabi" "$_builddir"/build
}
sha512sums="
53b80d1027c6df6a4f13237a21a3ea69bfe51ba12dd4bf4e984da29150e457fea6fdc493542e4b86a04a9ba1481ae0db866bd883767f7107c323b41fb9fe022c linux-5.10.55.tar.xz
7ae670f2dbbdec616becce3944fe190a797a19346b4fa266deae71d4c1ccd7b0e60e400bde47d32261cb15c1b2f1579a2848adace3397d82552c52bff1421f0a config-full.aarch64
84aaad1001be4e55c5885dcf27a4647028319123bf54195f8c1233287bec9c890dbb131920976e950136d5eacc7ff153fc9ad305cfd0ca28fd0194a263e8be4f config-full.armv7
0caf98dec1162b1ba4e4bb4e198d0a34e59ac022532d562961cf9b22cbdb930675ff3a845bb17ddff83b91a84ad61df9d607f175c34133916e0a3cdbb4c13786 config-full.mips64
35b8424024af2fdcd93a8f2062f6b55bdfe65daf4d0a160e5b217df122dbb1727ef899636ba18d063af0e0c02a5bd57ba414466264f82c4525dd20e54d6b4b82 config-full.ppc64le
35bce78364f269e5e1fa07d36614a0204b4e180239a83d793e118c461eaf0e305e4ed3821bcfa8be128b79bf1837be5248c13c44817c8038cd80806dfb06525c config-full.x86
6984f5fa18a0b15929b80f5480072c40cf153b96e1fbb9adf626fc9707cd2df2b702d5925fecd32362c02b28b9109c603ce520d26924105f4f9513b309949d47 config-full.x86_64
078e2b8ac688c79728c388f6cd87633b7835f19a5b3842b8ab97ef961d8b537e377e4acef4c0e65d94a686525a345586d9c31898c37a75075b5c0e5c8b6db748 config-virt.aarch64
3ce5419983ec07d3ae525fed81f26bc4b08e829d5128d6fb76d2ee707343c1ed1efbc03ca53910d406a4c6d303a01e3d2eed8af5257e134083434de0ccede5eb config-virt.armv7
287cf039eb8a5df7844559812f9eb5cb0ce41bd47c96132e3d234d2a2b28a883cd59d7964682a530da2e482d49e2bb94601e84085cac0b631c7bf858b4f3f7c6 config-virt.ppc64le
e2657b50b1844710cc29b545e4b560b7b79827b9005c6b1ccc7e5c89de31ce0a2a169407b0bff1e3cd9a1bcaa88745c149092d45029ca13bcc2b56a2b6d77ac6 config-virt.s390x
3eba52caf34ec45f0cdaa2606643b98f46f8a19251ea3ab9d6fbe9def714674c28388be825dddeed4085eda865c63d321884ad435529b14f0fb04310d7275b31 config-virt.x86
acc7f183a6773d3de0e10c808cbfadb7b54b6f9fcf891234473adef449f87e04a486ed6ec3fae106d0ff10f0c4bc3224971319aeba03fbcaafb1590e89c5ae84 config-virt.x86_64
"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
From e5d2823631bbfebacf48e1a34ed28f28d7cb2570 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 11 Jan 2021 09:40:33 -0800
Subject: [PATCH] riscv64: define ELF_NFPREG
ELF_NFPREG is used by some userspace applications like gdb
---
arch/riscv64/bits/user.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h
index 2da743ea..0d37de0b 100644
--- a/arch/riscv64/bits/user.h
+++ b/arch/riscv64/bits/user.h
@@ -1,5 +1,6 @@
#include <signal.h>
#define ELF_NGREG 32
+#define ELF_NFPREG 33
typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
typedef union __riscv_mc_fp_state elf_fpregset_t;
--
2.30.1

View File

@ -1,55 +0,0 @@
# Contributor: Ariadne Conill <ariadne@dereferenced.org>
# Contributor: Timo Teräs <timo.teras@iki.fi>
# Maintainer: Alex Denes <caskd@redxen.eu>
pkgname=musl
pkgver=1.2.2
pkgrel=6
pkgdesc="the musl c library (libc) implementation"
url="https://musl.libc.org/"
arch="all"
license="MIT"
options="!check"
source="
musl-$pkgver.tar.gz::https://git.musl-libc.org/cgit/musl/snapshot/v$pkgver.tar.gz
0001-riscv64-define-ELF_NFPREG.patch
handle-aux-at_base.patch
syscall-cp-epoll.patch
"
# secfixes:
# 1.2.2_pre2-r0:
# - CVE-2020-28928
# 1.1.23-r2:
# - CVE-2019-14697
# 1.1.15-r4:
# - CVE-2016-8859
builddir="$srcdir"/"v$pkgver"
build() {
# note: not autotools
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--localstatedir=/var \
--enable-debug \
--disable-eh-frame \
--disable-shared
make
}
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install
}
sha512sums="
7240550ab45cb6b410d65013c92f1f1de0f274322e7ba10e3cf9ce0464a1a833337c2fde39d2fc8c25af1d60599a5bb0ec0d9fb3723c098df3a72e82251bb3eb musl-1.2.2.tar.gz
f036317426d54efb4df41c08664c8513d3991408b20f4c74220c8b0324d2e96a97094851ea225e363dd593828c2280e77422b0f4b924dbd106df45504723a00e 0001-riscv64-define-ELF_NFPREG.patch
a76f79b801497ad994746cf82bb6eaf86f9e1ae646e6819fbae8532a7f4eee53a96ac1d4e789ec8f66aea2a68027b0597f7a579b3369e01258da8accfce41370 handle-aux-at_base.patch
d256ba7857c98d39b86aa73674eda5d45ab8134dde3fac2bc48ebb6ba9a824c20c43f2cdc6af54d2a45c162d1e4ec6517c36400992bba10496bcc51b374cbcd0 syscall-cp-epoll.patch
"

View File

@ -1,2 +0,0 @@
extern void __stack_chk_fail(void);
void __attribute__((visibility ("hidden"))) __stack_chk_fail_local(void) { __stack_chk_fail(); }

View File

@ -1,140 +0,0 @@
From b2d24e3cc6015aa6a4b01b1fdbad1e68b6fccb96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Fri, 9 Jul 2021 10:57:20 +0300
Subject: add configure option to enable .eh_frame generation
Add --enable-eh-frame to enable .eh_frame generation. This adds
about 80kB to ELF size on x86_64.
This is useful to run continuous profilers, gdb, valgrind and other
debugging utilities to generate backtrace information without having
to install the full musl-dbg package.
As side effect, this might seem to make exception handling work
through C-library fuctions when they are calling a callback (e.g. qsort),
but this continues to be UB and is not supported. This actually is the
case on ARM where .ARM.exidx is used for unwind info which is present
always on the musl DSO.
---
Makefile | 4 ++--
configure | 30 ++++++++++++++++++++++--------
tools/add-cfi.i386.awk | 2 +-
tools/add-cfi.x86_64.awk | 2 +-
4 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile
index e8cc4436..2b501c25 100644
--- a/Makefile
+++ b/Makefile
@@ -134,8 +134,8 @@ $(LOBJS) $(LDSO_OBJS): CFLAGS_ALL += -fPIC
CC_CMD = $(CC) $(CFLAGS_ALL) -c -o $@ $<
# Choose invocation of assembler to be used
-ifeq ($(ADD_CFI),yes)
- AS_CMD = LC_ALL=C awk -f $(srcdir)/tools/add-cfi.common.awk -f $(srcdir)/tools/add-cfi.$(ARCH).awk $< | $(CC) $(CFLAGS_ALL) -x assembler -c -o $@ -
+ifneq ($(ADD_CFI),no)
+ AS_CMD = LC_ALL=C awk -v CFI_SECTIONS="$(ADD_CFI)" -f $(srcdir)/tools/add-cfi.common.awk -f $(srcdir)/tools/add-cfi.$(ARCH).awk $< | $(CC) $(CFLAGS_ALL) -x assembler -c -o $@ -
else
AS_CMD = $(CC_CMD)
endif
diff --git a/configure b/configure
index a5231a0e..eea16e6c 100755
--- a/configure
+++ b/configure
@@ -30,6 +30,7 @@ System types:
Optional features:
--enable-optimize=... optimize listed components for speed over size [auto]
--enable-debug build with debugging information [disabled]
+ --enable-eh-frame keep .eh_frame on main binary [disabled]
--disable-warnings build with recommended warnings flags [enabled]
--enable-wrapper=... build given musl toolchain wrapper [auto]
--disable-shared inhibit building shared library [enabled]
@@ -142,6 +143,7 @@ static=yes
wrapper=auto
gcc_wrapper=no
clang_wrapper=no
+eh_frame=no
malloc_dir=mallocng
for arg ; do
@@ -172,6 +174,8 @@ case "$arg" in
--disable-wrapper|--enable-wrapper=no) wrapper=no ;;
--enable-gcc-wrapper|--enable-gcc-wrapper=yes) wrapper=yes ; gcc_wrapper=yes ;;
--disable-gcc-wrapper|--enable-gcc-wrapper=no) wrapper=no ;;
+--enable-eh-frame|--enable-eh-frame=yes) eh_frame=yes ;;
+--disable-eh-frame|--enable-eh-frame=no) eh_frame=no ;;
--with-malloc=*) malloc_dir=${arg#*=} ;;
--enable-*|--disable-*|--with-*|--without-*|--*dir=*) ;;
--host=*|--target=*) target=${arg#*=} ;;
@@ -407,14 +411,22 @@ test "$debug" = yes && CFLAGS_AUTO=-g
# enabled, our assembler supports the needed directives, and the
# preprocessing script has been written for our architecture.
#
-printf "checking whether we should preprocess assembly to add debugging information... "
-if fnmatch '-g*|*\ -g*' "$CFLAGS_AUTO $CFLAGS" &&
- test -f "tools/add-cfi.$ARCH.awk" &&
+printf "checking whether we should preprocess assembly to add unwind information... "
+
+ADD_CFI="no"
+if test -f "tools/add-cfi.$ARCH.awk" &&
printf ".file 1 \"srcfile.s\"\n.line 1\n.cfi_startproc\n.cfi_endproc" | $CC -g -x assembler -c -o /dev/null 2>/dev/null -
then
- ADD_CFI=yes
-else
- ADD_CFI=no
+ if test "$eh_frame" = "yes" && fnmatch '-g*|*\ -g*' "$CFLAGS_AUTO $CFLAGS"
+ then
+ ADD_CFI=".eh_frame, .debug_frame"
+ elif test "$eh_frame" = "yes"
+ then
+ ADD_CFI=".eh_frame"
+ elif fnmatch '-g*|*\ -g*' "$CFLAGS_AUTO $CFLAGS"
+ then
+ ADD_CFI=".debug_frame"
+ fi
fi
printf "%s\n" "$ADD_CFI"
@@ -478,8 +490,10 @@ fi
# unstrippable. These options force them back to debug sections (and
# cause them not to get generated at all if debugging is off).
#
-tryflag CFLAGS_AUTO -fno-unwind-tables
-tryflag CFLAGS_AUTO -fno-asynchronous-unwind-tables
+if test "$eh_frame" = "no"; then
+ tryflag CFLAGS_AUTO -fno-unwind-tables
+ tryflag CFLAGS_AUTO -fno-asynchronous-unwind-tables
+fi
#
# Attempt to put each function and each data object in its own
diff --git a/tools/add-cfi.i386.awk b/tools/add-cfi.i386.awk
index d05037de..f758acec 100644
--- a/tools/add-cfi.i386.awk
+++ b/tools/add-cfi.i386.awk
@@ -9,7 +9,7 @@
BEGIN {
# don't put CFI data in the .eh_frame ELF section (which we don't keep)
- print ".cfi_sections .debug_frame"
+ print ".cfi_sections " CFI_SECTIONS
# only emit CFI directives inside a function
in_function = 0
diff --git a/tools/add-cfi.x86_64.awk b/tools/add-cfi.x86_64.awk
index 7e1513d6..4a2ae029 100644
--- a/tools/add-cfi.x86_64.awk
+++ b/tools/add-cfi.x86_64.awk
@@ -2,7 +2,7 @@
BEGIN {
# don't put CFI data in the .eh_frame ELF section (which we don't keep)
- print ".cfi_sections .debug_frame"
+ print ".cfi_sections " CFI_SECTIONS
# only emit CFI directives inside a function
in_function = 0
--
2.32.0

View File

@ -1,338 +0,0 @@
/*-
* Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by J.T. Conklin.
*
* Mostly rewritten to be used in Alpine Linux (with musl c-library)
* by Timo Teräs.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <err.h>
#include <errno.h>
#include <values.h>
#include <limits.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
struct conf_variable {
const char *name;
enum { SYSCONF, CONFSTR, PATHCONF, CONSTANT, UCONSTANT, NUM_TYPES } type;
long value;
};
static const struct conf_variable conf_table[] = {
{ "PATH", CONFSTR, _CS_PATH },
/* Utility Limit Minimum Values */
{ "POSIX2_BC_BASE_MAX", CONSTANT, _POSIX2_BC_BASE_MAX },
{ "POSIX2_BC_DIM_MAX", CONSTANT, _POSIX2_BC_DIM_MAX },
{ "POSIX2_BC_SCALE_MAX", CONSTANT, _POSIX2_BC_SCALE_MAX },
{ "POSIX2_BC_STRING_MAX", CONSTANT, _POSIX2_BC_STRING_MAX },
{ "POSIX2_COLL_WEIGHTS_MAX", CONSTANT, _POSIX2_COLL_WEIGHTS_MAX },
{ "POSIX2_EXPR_NEST_MAX", CONSTANT, _POSIX2_EXPR_NEST_MAX },
{ "POSIX2_LINE_MAX", CONSTANT, _POSIX2_LINE_MAX },
{ "POSIX2_RE_DUP_MAX", CONSTANT, _POSIX2_RE_DUP_MAX },
{ "POSIX2_VERSION", CONSTANT, _POSIX2_VERSION },
/* POSIX.1 Minimum Values */
{ "_POSIX_AIO_LISTIO_MAX", CONSTANT, _POSIX_AIO_LISTIO_MAX },
{ "_POSIX_AIO_MAX", CONSTANT, _POSIX_AIO_MAX },
{ "_POSIX_ARG_MAX", CONSTANT, _POSIX_ARG_MAX },
{ "_POSIX_CHILD_MAX", CONSTANT, _POSIX_CHILD_MAX },
{ "_POSIX_LINK_MAX", CONSTANT, _POSIX_LINK_MAX },
{ "_POSIX_MAX_CANON", CONSTANT, _POSIX_MAX_CANON },
{ "_POSIX_MAX_INPUT", CONSTANT, _POSIX_MAX_INPUT },
{ "_POSIX_MQ_OPEN_MAX", CONSTANT, _POSIX_MQ_OPEN_MAX },
{ "_POSIX_MQ_PRIO_MAX", CONSTANT, _POSIX_MQ_PRIO_MAX },
{ "_POSIX_NAME_MAX", CONSTANT, _POSIX_NAME_MAX },
{ "_POSIX_NGROUPS_MAX", CONSTANT, _POSIX_NGROUPS_MAX },
{ "_POSIX_OPEN_MAX", CONSTANT, _POSIX_OPEN_MAX },
{ "_POSIX_PATH_MAX", CONSTANT, _POSIX_PATH_MAX },
{ "_POSIX_PIPE_BUF", CONSTANT, _POSIX_PIPE_BUF },
{ "_POSIX_SSIZE_MAX", CONSTANT, _POSIX_SSIZE_MAX },
{ "_POSIX_STREAM_MAX", CONSTANT, _POSIX_STREAM_MAX },
{ "_POSIX_TZNAME_MAX", CONSTANT, _POSIX_TZNAME_MAX },
/* Symbolic Utility Limits */
{ "BC_BASE_MAX", SYSCONF, _SC_BC_BASE_MAX },
{ "BC_DIM_MAX", SYSCONF, _SC_BC_DIM_MAX },
{ "BC_SCALE_MAX", SYSCONF, _SC_BC_SCALE_MAX },
{ "BC_STRING_MAX", SYSCONF, _SC_BC_STRING_MAX },
{ "COLL_WEIGHTS_MAX", SYSCONF, _SC_COLL_WEIGHTS_MAX },
{ "EXPR_NEST_MAX", SYSCONF, _SC_EXPR_NEST_MAX },
{ "LINE_MAX", SYSCONF, _SC_LINE_MAX },
{ "RE_DUP_MAX", SYSCONF, _SC_RE_DUP_MAX },
/* Optional Facility Configuration Values */
{ "_POSIX2_C_BIND", SYSCONF, _SC_2_C_BIND },
{ "POSIX2_C_DEV", SYSCONF, _SC_2_C_DEV },
{ "POSIX2_CHAR_TERM", SYSCONF, _SC_2_CHAR_TERM },
{ "POSIX2_FORT_DEV", SYSCONF, _SC_2_FORT_DEV },
{ "POSIX2_FORT_RUN", SYSCONF, _SC_2_FORT_RUN },
{ "POSIX2_LOCALEDEF", SYSCONF, _SC_2_LOCALEDEF },
{ "POSIX2_SW_DEV", SYSCONF, _SC_2_SW_DEV },
{ "POSIX2_UPE", SYSCONF, _SC_2_UPE },
/* POSIX.1 Configurable System Variables */
{ "AIO_LISTIO_MAX", SYSCONF, _SC_AIO_LISTIO_MAX },
{ "AIO_MAX", SYSCONF, _SC_AIO_MAX },
{ "ARG_MAX", SYSCONF, _SC_ARG_MAX },
{ "CHILD_MAX", SYSCONF, _SC_CHILD_MAX },
{ "CLK_TCK", SYSCONF, _SC_CLK_TCK },
{ "MQ_OPEN_MAX", SYSCONF, _SC_MQ_OPEN_MAX },
{ "MQ_PRIO_MAX", SYSCONF, _SC_MQ_PRIO_MAX },
{ "NGROUPS_MAX", SYSCONF, _SC_NGROUPS_MAX },
{ "OPEN_MAX", SYSCONF, _SC_OPEN_MAX },
{ "STREAM_MAX", SYSCONF, _SC_STREAM_MAX },
{ "TZNAME_MAX", SYSCONF, _SC_TZNAME_MAX },
{ "_POSIX_JOB_CONTROL", SYSCONF, _SC_JOB_CONTROL },
{ "_POSIX_SAVED_IDS", SYSCONF, _SC_SAVED_IDS },
{ "_POSIX_VERSION", SYSCONF, _SC_VERSION },
{ "LINK_MAX", PATHCONF, _PC_LINK_MAX },
{ "MAX_CANON", PATHCONF, _PC_MAX_CANON },
{ "MAX_INPUT", PATHCONF, _PC_MAX_INPUT },
{ "NAME_MAX", PATHCONF, _PC_NAME_MAX },
{ "PATH_MAX", PATHCONF, _PC_PATH_MAX },
{ "PIPE_BUF", PATHCONF, _PC_PIPE_BUF },
{ "_POSIX_CHOWN_RESTRICTED", PATHCONF, _PC_CHOWN_RESTRICTED },
{ "_POSIX_NO_TRUNC", PATHCONF, _PC_NO_TRUNC },
{ "_POSIX_VDISABLE", PATHCONF, _PC_VDISABLE },
/* POSIX.1b Configurable System Variables */
{ "PAGESIZE", SYSCONF, _SC_PAGESIZE },
{ "_POSIX_ASYNCHRONOUS_IO", SYSCONF, _SC_ASYNCHRONOUS_IO },
{ "_POSIX_FSYNC", SYSCONF, _SC_FSYNC },
{ "_POSIX_MAPPED_FILES", SYSCONF, _SC_MAPPED_FILES },
{ "_POSIX_MEMLOCK", SYSCONF, _SC_MEMLOCK },
{ "_POSIX_MEMLOCK_RANGE", SYSCONF, _SC_MEMLOCK_RANGE },
{ "_POSIX_MEMORY_PROTECTION", SYSCONF, _SC_MEMORY_PROTECTION },
{ "_POSIX_MESSAGE_PASSING", SYSCONF, _SC_MESSAGE_PASSING },
{ "_POSIX_MONOTONIC_CLOCK", SYSCONF, _SC_MONOTONIC_CLOCK },
{ "_POSIX_PRIORITY_SCHEDULING", SYSCONF, _SC_PRIORITY_SCHEDULING },
{ "_POSIX_SEMAPHORES", SYSCONF, _SC_SEMAPHORES },
{ "_POSIX_SHARED_MEMORY_OBJECTS", SYSCONF, _SC_SHARED_MEMORY_OBJECTS },
{ "_POSIX_SYNCHRONIZED_IO", SYSCONF, _SC_SYNCHRONIZED_IO },
{ "_POSIX_TIMERS", SYSCONF, _SC_TIMERS },
{ "_POSIX_SYNC_IO", PATHCONF, _PC_SYNC_IO },
/* POSIX.1c Configurable System Variables */
{ "LOGIN_NAME_MAX", SYSCONF, _SC_LOGIN_NAME_MAX },
{ "_POSIX_THREADS", SYSCONF, _SC_THREADS },
/* POSIX.1j Configurable System Variables */
{ "_POSIX_BARRIERS", SYSCONF, _SC_BARRIERS },
{ "_POSIX_READER_WRITER_LOCKS", SYSCONF, _SC_READER_WRITER_LOCKS },
{ "_POSIX_SPIN_LOCKS", SYSCONF, _SC_SPIN_LOCKS },
/* XPG4.2 Configurable System Variables */
{ "IOV_MAX", SYSCONF, _SC_IOV_MAX },
{ "PAGE_SIZE", SYSCONF, _SC_PAGE_SIZE },
{ "_XOPEN_SHM", SYSCONF, _SC_XOPEN_SHM },
/* X/Open CAE Spec. Issue 5 Version 2 Configurable System Variables */
{ "FILESIZEBITS", PATHCONF, _PC_FILESIZEBITS },
/* POSIX.1-2001 XSI Option Group Configurable System Variables */
{ "ATEXIT_MAX", SYSCONF, _SC_ATEXIT_MAX },
/* POSIX.1-2001 TSF Configurable System Variables */
{ "GETGR_R_SIZE_MAX", SYSCONF, _SC_GETGR_R_SIZE_MAX },
{ "GETPW_R_SIZE_MAX", SYSCONF, _SC_GETPW_R_SIZE_MAX },
/* Commonly provided extensions */
{ "_PHYS_PAGES", SYSCONF, _SC_PHYS_PAGES },
{ "_AVPHYS_PAGES", SYSCONF, _SC_AVPHYS_PAGES },
{ "_NPROCESSORS_CONF", SYSCONF, _SC_NPROCESSORS_CONF },
{ "_NPROCESSORS_ONLN", SYSCONF, _SC_NPROCESSORS_ONLN },
/* Data type related extensions */
{ "CHAR_BIT", CONSTANT, CHAR_BIT },
{ "CHAR_MAX", CONSTANT, CHAR_MAX },
{ "CHAR_MIN", CONSTANT, CHAR_MIN },
{ "INT_MAX", CONSTANT, INT_MAX },
{ "INT_MIN", CONSTANT, INT_MIN },
{ "LONG_BIT", CONSTANT, LONG_BIT },
{ "LONG_MAX", CONSTANT, LONG_MAX },
{ "LONG_MIN", CONSTANT, LONG_MIN },
{ "SCHAR_MAX", CONSTANT, SCHAR_MAX },
{ "SCHAR_MIN", CONSTANT, SCHAR_MIN },
{ "SHRT_MAX", CONSTANT, SHRT_MAX },
{ "SHRT_MIN", CONSTANT, SHRT_MIN },
{ "SSIZE_MAX", CONSTANT, SSIZE_MAX },
{ "UCHAR_MAX", UCONSTANT, (long) UCHAR_MAX },
{ "UINT_MAX", UCONSTANT, (long) UINT_MAX },
{ "ULONG_MAX", UCONSTANT, (long) ULONG_MAX },
{ "USHRT_MAX", UCONSTANT, (long) USHRT_MAX },
{ "WORD_BIT", CONSTANT, WORD_BIT },
{ NULL, CONSTANT, 0L }
};
static int all = 0;
static void usage(const char *p)
{
(void)fprintf(stderr, "Usage: %s system_var\n\t%s -a\n"
"\t%s path_var pathname\n\t%s -a pathname\n", p, p, p, p);
exit(EXIT_FAILURE);
}
static void print_long(const char *name, long val)
{
if (all) printf("%s = %ld\n", name, val);
else printf("%ld\n", val);
}
static void print_ulong(const char *name, unsigned long val)
{
if (all) printf("%s = %lu\n", name, val);
else printf("%lu\n", val);
}
static void print_string(const char *name, const char *val)
{
if (all) printf("%s = %s\n", name, val);
else printf("%s\n", val);
}
static int print_constant(const struct conf_variable *cp, const char *pathname)
{
print_long(cp->name, cp->value);
return 0;
}
static int print_uconstant(const struct conf_variable *cp, const char *pathname)
{
print_ulong(cp->name, (unsigned long) cp->value);
return 0;
}
static int print_sysconf(const struct conf_variable *cp, const char *pathname)
{
long val;
errno = 0;
if ((val = sysconf((int)cp->value)) == -1) {
if (errno != 0) err(EXIT_FAILURE, "sysconf(%ld)", cp->value);
return -1;
}
print_long(cp->name, val);
return 0;
}
static int print_confstr(const struct conf_variable *cp, const char *pathname)
{
size_t len;
char *val;
errno = 0;
if ((len = confstr((int)cp->value, NULL, 0)) == 0) goto error;
if ((val = malloc(len)) == NULL) err(EXIT_FAILURE, "Can't allocate %zu bytes", len);
errno = 0;
if (confstr((int)cp->value, val, len) == 0) goto error;
print_string(cp->name, val);
free(val);
return 0;
error:
if (errno != EINVAL) err(EXIT_FAILURE, "confstr(%ld)", cp->value);
return -1;
}
static int print_pathconf(const struct conf_variable *cp, const char *pathname)
{
long val;
errno = 0;
if ((val = pathconf(pathname, (int)cp->value)) == -1) {
if (all && errno == EINVAL) return 0;
if (errno != 0) err(EXIT_FAILURE, "pathconf(%s, %ld)", pathname, cp->value);
return -1;
}
print_long(cp->name, val);
return 0;
}
typedef int (*handler_t)(const struct conf_variable *cp, const char *pathname);
static const handler_t type_handlers[NUM_TYPES] = {
[SYSCONF] = print_sysconf,
[CONFSTR] = print_confstr,
[PATHCONF] = print_pathconf,
[CONSTANT] = print_constant,
[UCONSTANT] = print_uconstant,
};
int main(int argc, char **argv)
{
const char *progname = argv[0];
const struct conf_variable *cp;
const char *varname, *pathname;
int ch, found = 0;
(void)setlocale(LC_ALL, "");
while ((ch = getopt(argc, argv, "a")) != -1) {
switch (ch) {
case 'a':
all = 1;
break;
case '?':
default:
usage(progname);
}
}
argc -= optind;
argv += optind;
if (!all) {
if (argc == 0)
usage(progname);
varname = argv[0];
argc--;
argv++;
} else
varname = NULL;
if (argc > 1)
usage(progname);
pathname = argv[0]; /* may be NULL */
for (cp = conf_table; cp->name != NULL; cp++) {
if (!all && strcmp(varname, cp->name) != 0) continue;
if ((cp->type == PATHCONF) == (pathname != NULL)) {
if (type_handlers[cp->type](cp, pathname) < 0)
print_string(cp->name, "undefined");
found = 1;
} else if (!all)
errx(EXIT_FAILURE, "%s: invalid variable type", cp->name);
}
if (!all && !found) errx(EXIT_FAILURE, "%s: unknown variable", varname);
(void)fflush(stdout);
return ferror(stdout) ? EXIT_FAILURE : EXIT_SUCCESS;
}

View File

@ -1,536 +0,0 @@
/*-
* Copyright (c) 2004-2006 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Luke Mewburn.
* Timo Teräs cleaned up the code for use in Alpine Linux with musl libc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/socket.h>
#include <sys/param.h>
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <netdb.h>
#include <pwd.h>
#include <grp.h>
#include <shadow.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <paths.h>
#include <err.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <net/if.h>
#include <net/ethernet.h>
#include <netinet/ether.h>
#include <netinet/in.h>
enum {
RV_OK = 0,
RV_USAGE = 1,
RV_NOTFOUND = 2,
RV_NOENUM = 3
};
static int usage(const char *);
static int parsenum(const char *word, unsigned long *result)
{
unsigned long num;
char *ep;
if (!isdigit((unsigned char)word[0]))
return 0;
errno = 0;
num = strtoul(word, &ep, 10);
if (num == ULONG_MAX && errno == ERANGE)
return 0;
if (*ep != '\0')
return 0;
*result = num;
return 1;
}
/*
* printfmtstrings --
* vprintf(format, ...),
* then the aliases (beginning with prefix, separated by sep),
* then a newline
*/
__attribute__ ((format (printf, 4, 5)))
static void printfmtstrings(char *strings[], const char *prefix, const char *sep,
const char *fmt, ...)
{
va_list ap;
const char *curpref;
size_t i;
va_start(ap, fmt);
(void)vprintf(fmt, ap);
va_end(ap);
curpref = prefix;
for (i = 0; strings[i] != NULL; i++) {
(void)printf("%s%s", curpref, strings[i]);
curpref = sep;
}
(void)printf("\n");
}
static int ethers(int argc, char *argv[])
{
char hostname[MAXHOSTNAMELEN + 1], *hp;
struct ether_addr ea, *eap;
int i, rv;
if (argc == 2) {
warnx("Enumeration not supported on ethers");
return RV_NOENUM;
}
rv = RV_OK;
for (i = 2; i < argc; i++) {
if ((eap = ether_aton(argv[i])) == NULL) {
eap = &ea;
hp = argv[i];
if (ether_hostton(hp, eap) != 0) {
rv = RV_NOTFOUND;
break;
}
} else {
hp = hostname;
if (ether_ntohost(hp, eap) != 0) {
rv = RV_NOTFOUND;
break;
}
}
(void)printf("%-17s %s\n", ether_ntoa(eap), hp);
}
return rv;
}
static void groupprint(const struct group *gr)
{
printfmtstrings(gr->gr_mem, ":", ",", "%s:%s:%u",
gr->gr_name, gr->gr_passwd, gr->gr_gid);
}
static int group(int argc, char *argv[])
{
struct group *gr;
unsigned long id;
int i, rv;
rv = RV_OK;
if (argc == 2) {
while ((gr = getgrent()) != NULL)
groupprint(gr);
} else {
for (i = 2; i < argc; i++) {
if (parsenum(argv[i], &id))
gr = getgrgid((gid_t)id);
else
gr = getgrnam(argv[i]);
if (gr == NULL) {
rv = RV_NOTFOUND;
break;
}
groupprint(gr);
}
}
endgrent();
return rv;
}
static void hostsprint(const struct hostent *he)
{
char buf[INET6_ADDRSTRLEN];
if (inet_ntop(he->h_addrtype, he->h_addr, buf, sizeof(buf)) == NULL)
(void)strlcpy(buf, "# unknown", sizeof(buf));
printfmtstrings(he->h_aliases, " ", " ", "%-16s %s", buf, he->h_name);
}
static int hosts(int argc, char *argv[])
{
struct hostent *he;
char addr[IN6ADDRSZ];
int i, rv;
sethostent(1);
rv = RV_OK;
if (argc == 2) {
while ((he = gethostent()) != NULL)
hostsprint(he);
} else {
for (i = 2; i < argc; i++) {
if (inet_pton(AF_INET6, argv[i], (void *)addr) > 0)
he = gethostbyaddr(addr, IN6ADDRSZ, AF_INET6);
else if (inet_pton(AF_INET, argv[i], (void *)addr) > 0)
he = gethostbyaddr(addr, INADDRSZ, AF_INET);
else if ((he = gethostbyname2(argv[i], AF_INET6)) == NULL)
he = gethostbyname2(argv[i], AF_INET);
if (he == NULL) {
rv = RV_NOTFOUND;
break;
}
hostsprint(he);
}
}
endhostent();
return rv;
}
static int ahosts_ex(int family, int flags, int argc, char *argv[])
{
static const char *socktypes[] = {
[SOCK_STREAM] = "STREAM",
[SOCK_DGRAM] = "DGRAM",
[SOCK_RAW] = "RAW",
[SOCK_RDM] = "RDM",
[SOCK_SEQPACKET] = "SEQPACKET",
[SOCK_DCCP] = "DCCP",
[SOCK_PACKET] = "PACKET",
};
const char *sockstr;
char sockbuf[16], buf[INET6_ADDRSTRLEN];
struct addrinfo *res, *r, hint;
void *addr;
int i;
if (argc == 2)
return hosts(argc, argv);
hint = (struct addrinfo) {
.ai_family = family,
.ai_flags = AI_ADDRCONFIG | AI_CANONNAME | flags,
};
for (i = 2; i < argc; i++) {
if (getaddrinfo(argv[i], 0, &hint, &res) != 0)
return RV_NOTFOUND;
for (r = res; r; r = r->ai_next) {
sockstr = NULL;
if (r->ai_socktype >= 0 && r->ai_socktype < sizeof(socktypes)/sizeof(socktypes[0]))
sockstr = socktypes[r->ai_socktype];
if (!sockstr) {
sprintf(buf, "%d", r->ai_socktype);
sockstr = sockbuf;
}
switch (r->ai_family) {
case AF_INET:
addr = &((struct sockaddr_in*) r->ai_addr)->sin_addr;
break;
case AF_INET6:
addr = &((struct sockaddr_in6*) r->ai_addr)->sin6_addr;
break;
default:
continue;
}
if (inet_ntop(r->ai_family, addr, buf, sizeof(buf)) == NULL)
(void)strlcpy(buf, "# unknown", sizeof(buf));
printf("%-15s %-6s %s\n", buf, sockstr, r->ai_canonname ?: "");
}
}
return RV_OK;
}
static int ahosts(int argc, char *argv[])
{
return ahosts_ex(AF_UNSPEC, 0, argc, argv);
}
static int ahostsv4(int argc, char *argv[])
{
return ahosts_ex(AF_INET, 0, argc, argv);
}
static int ahostsv6(int argc, char *argv[])
{
return ahosts_ex(AF_INET6, AI_V4MAPPED, argc, argv);
}
static void networksprint(const struct netent *ne)
{
char buf[INET6_ADDRSTRLEN];
struct in_addr ianet;
ianet = inet_makeaddr(ne->n_net, 0);
if (inet_ntop(ne->n_addrtype, &ianet, buf, sizeof(buf)) == NULL)
(void)strlcpy(buf, "# unknown", sizeof(buf));
printfmtstrings(ne->n_aliases, " ", " ", "%-16s %s", ne->n_name, buf);
}
static int networks(int argc, char *argv[])
{
struct netent *ne;
in_addr_t net;
int i, rv;
setnetent(1);
rv = RV_OK;
if (argc == 2) {
while ((ne = getnetent()) != NULL)
networksprint(ne);
} else {
for (i = 2; i < argc; i++) {
net = inet_network(argv[i]);
if (net != INADDR_NONE)
ne = getnetbyaddr(net, AF_INET);
else
ne = getnetbyname(argv[i]);
if (ne != NULL) {
rv = RV_NOTFOUND;
break;
}
networksprint(ne);
}
}
endnetent();
return rv;
}
static void passwdprint(struct passwd *pw)
{
(void)printf("%s:%s:%u:%u:%s:%s:%s\n",
pw->pw_name, pw->pw_passwd, pw->pw_uid,
pw->pw_gid, pw->pw_gecos, pw->pw_dir, pw->pw_shell);
}
static int passwd(int argc, char *argv[])
{
struct passwd *pw;
unsigned long id;
int i, rv;
rv = RV_OK;
if (argc == 2) {
while ((pw = getpwent()) != NULL)
passwdprint(pw);
} else {
for (i = 2; i < argc; i++) {
if (parsenum(argv[i], &id))
pw = getpwuid((uid_t)id);
else
pw = getpwnam(argv[i]);
if (pw == NULL) {
rv = RV_NOTFOUND;
break;
}
passwdprint(pw);
}
}
endpwent();
return rv;
}
static void protocolsprint(struct protoent *pe)
{
printfmtstrings(pe->p_aliases, " ", " ",
"%-16s %5d", pe->p_name, pe->p_proto);
}
static int protocols(int argc, char *argv[])
{
struct protoent *pe;
unsigned long id;
int i, rv;
setprotoent(1);
rv = RV_OK;
if (argc == 2) {
while ((pe = getprotoent()) != NULL)
protocolsprint(pe);
} else {
for (i = 2; i < argc; i++) {
if (parsenum(argv[i], &id))
pe = getprotobynumber((int)id);
else
pe = getprotobyname(argv[i]);
if (pe == NULL) {
rv = RV_NOTFOUND;
break;
}
protocolsprint(pe);
}
}
endprotoent();
return rv;
}
static void servicesprint(struct servent *se)
{
printfmtstrings(se->s_aliases, " ", " ",
"%-16s %5d/%s",
se->s_name, ntohs(se->s_port), se->s_proto);
}
static int services(int argc, char *argv[])
{
struct servent *se;
unsigned long id;
char *proto;
int i, rv;
setservent(1);
rv = RV_OK;
if (argc == 2) {
while ((se = getservent()) != NULL)
servicesprint(se);
} else {
for (i = 2; i < argc; i++) {
proto = strchr(argv[i], '/');
if (proto != NULL)
*proto++ = '\0';
if (parsenum(argv[i], &id))
se = getservbyport(htons(id), proto);
else
se = getservbyname(argv[i], proto);
if (se == NULL) {
rv = RV_NOTFOUND;
break;
}
servicesprint(se);
}
}
endservent();
return rv;
}
static int shadow(int argc, char *argv[])
{
struct spwd *sp;
int i, rv;
rv = RV_OK;
if (argc == 2) {
while ((sp = getspent()) != NULL)
putspent(sp, stdout);
} else {
for (i = 2; i < argc; i++) {
sp = getspnam(argv[i]);
if (sp == NULL) {
rv = RV_NOTFOUND;
break;
}
putspent(sp, stdout);
}
}
endspent();
return rv;
}
static int shells(int argc, char *argv[])
{
const char *sh;
int i, rv;
setusershell();
rv = RV_OK;
if (argc == 2) {
while ((sh = getusershell()) != NULL)
(void)printf("%s\n", sh);
} else {
for (i = 2; i < argc; i++) {
setusershell();
while ((sh = getusershell()) != NULL) {
if (strcmp(sh, argv[i]) == 0) {
(void)printf("%s\n", sh);
break;
}
}
if (sh == NULL) {
rv = RV_NOTFOUND;
break;
}
}
}
endusershell();
return rv;
}
static struct getentdb {
const char *name;
int (*callback)(int, char *[]);
} databases[] = {
{ "ethers", ethers, },
{ "group", group, },
{ "hosts", hosts, },
{ "ahosts", ahosts, },
{ "ahostsv4", ahostsv4, },
{ "ahostsv6", ahostsv6, },
{ "networks", networks, },
{ "passwd", passwd, },
{ "protocols", protocols, },
{ "services", services, },
{ "shadow", shadow, },
{ "shells", shells, },
{ NULL, NULL, },
};
static int usage(const char *arg0)
{
struct getentdb *curdb;
size_t i;
(void)fprintf(stderr, "Usage: %s database [key ...]\n", arg0);
(void)fprintf(stderr, "\tdatabase may be one of:");
for (i = 0, curdb = databases; curdb->name != NULL; curdb++, i++) {
if (i % 7 == 0)
(void)fputs("\n\t\t", stderr);
(void)fprintf(stderr, "%s%s", i % 7 == 0 ? "" : " ",
curdb->name);
}
(void)fprintf(stderr, "\n");
exit(RV_USAGE);
/* NOTREACHED */
}
int
main(int argc, char *argv[])
{
struct getentdb *curdb;
if (argc < 2)
usage(argv[0]);
for (curdb = databases; curdb->name != NULL; curdb++)
if (strcmp(curdb->name, argv[1]) == 0)
return (*curdb->callback)(argc, argv);
warn("Unknown database `%s'", argv[1]);
usage(argv[0]);
/* NOTREACHED */
}

View File

@ -1,46 +0,0 @@
This is required to make the gcompat ELF interpreter stub work with some
packed binaries.
diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c
index b125eb1..616c6a6 100644
--- a/src/env/__init_tls.c
+++ b/src/env/__init_tls.c
@@ -66,8 +66,10 @@ void *__copy_tls(unsigned char *mem)
}
#if ULONG_MAX == 0xffffffff
+typedef Elf32_Ehdr Ehdr;
typedef Elf32_Phdr Phdr;
#else
+typedef Elf64_Ehdr Ehdr;
typedef Elf64_Phdr Phdr;
#endif
@@ -77,15 +79,23 @@ extern const size_t _DYNAMIC[];
static void static_init_tls(size_t *aux)
{
unsigned char *p;
- size_t n;
+ size_t n, e;
Phdr *phdr, *tls_phdr=0;
size_t base = 0;
void *mem;
- for (p=(void *)aux[AT_PHDR],n=aux[AT_PHNUM]; n; n--,p+=aux[AT_PHENT]) {
+ if (aux[AT_BASE]) {
+ Ehdr *ehdr = (void *)aux[AT_BASE];
+ p = (unsigned char *)aux[AT_BASE] + ehdr->e_phoff;
+ n = ehdr->e_phnum;
+ e = ehdr->e_phentsize;
+ } else {
+ p = (void *)aux[AT_PHDR];
+ n = aux[AT_PHNUM];
+ e = aux[AT_PHENT];
+ }
+ for (; n; n--, p+=e) {
phdr = (void *)p;
- if (phdr->p_type == PT_PHDR)
- base = aux[AT_PHDR] - phdr->p_vaddr;
if (phdr->p_type == PT_DYNAMIC && _DYNAMIC)
base = (size_t)_DYNAMIC - phdr->p_vaddr;
if (phdr->p_type == PT_TLS)

View File

@ -1,110 +0,0 @@
/*
* iconv.c
* Implementation of SUSv4 XCU iconv utility
* Copyright © 2011 Rich Felker
* Licensed under the terms of the GNU General Public License, v2 or later
*/
#include <stdlib.h>
#include <stdio.h>
#include <iconv.h>
#include <locale.h>
#include <langinfo.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
int main(int argc, char **argv)
{
const char *from=0, *to=0;
int b;
iconv_t cd;
char buf[BUFSIZ];
char outbuf[BUFSIZ*4];
char *in, *out;
size_t inb;
size_t l;
size_t unitsize=0;
int err=0;
FILE *f;
while ((b = getopt(argc, argv, "f:t:csl")) != EOF) switch(b) {
case 'l':
puts("UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF32-LE, UCS-2BE, UCS-2LE, WCHAR_T,\n"
"US_ASCII, ISO8859-1, ISO8859-2, ISO8859-3, ISO8859-4, ISO8859-5,\n"
"ISO8859-6, ISO8859-7, ...");
exit(0);
case 'c': case 's': break;
case 'f': from=optarg; break;
case 't': to=optarg; break;
default: exit(1);
}
if (!from || !to) {
setlocale(LC_CTYPE, "");
if (!to) to = nl_langinfo(CODESET);
if (!from) from = nl_langinfo(CODESET);
}
cd = iconv_open(to, from);
if (cd == (iconv_t)-1) {
if (iconv_open(to, "WCHAR_T") == (iconv_t)-1)
fprintf(stderr, "iconv: destination charset %s: ", to);
else
fprintf(stderr, "iconv: source charset %s: ", from);
perror("");
exit(1);
}
if (optind == argc) argv[argc++] = "-";
for (; optind < argc; optind++) {
if (argv[optind][0]=='-' && !argv[optind][1]) {
f = stdin;
argv[optind] = "(stdin)";
} else if (!(f = fopen(argv[optind], "rb"))) {
fprintf(stderr, "iconv: %s: ", argv[optind]);
perror("");
err = 1;
continue;
}
inb = 0;
for (;;) {
in = buf;
out = outbuf;
l = fread(buf+inb, 1, sizeof(buf)-inb, f);
inb += l;
if (!inb) break;
if (iconv(cd, &in, &inb, &out, (size_t [1]){sizeof outbuf})==-1
&& errno == EILSEQ) {
if (!unitsize) {
wchar_t wc='0';
char dummy[4], *dummyp=dummy;
iconv_t cd2 = iconv_open(from, "WCHAR_T");
if (cd == (iconv_t)-1) {
unitsize = 1;
} else {
iconv(cd2,
(char *[1]){(char *)&wc},
(size_t[1]){1},
&dummyp, (size_t[1]){4});
unitsize = dummyp-dummy;
if (!unitsize) unitsize=1;
}
}
inb-=unitsize;
in+=unitsize;
}
if (inb && !l && errno==EINVAL) break;
if (out>outbuf && !fwrite(outbuf, out-outbuf, 1, stdout)) {
perror("iconv: write error");
exit(1);
}
if (inb) memmove(buf, in, inb);
}
if (ferror(f)) {
fprintf(stderr, "iconv: %s: ", argv[optind]);
perror("");
err = 1;
}
}
return err;
}

View File

@ -1,18 +0,0 @@
#!/bin/sh
scan_dirs() {
scanelf -qS "$@" | while read SONAME FILE; do
TARGET="${FILE##*/}"
LINK="${FILE%/*}/$SONAME"
case "$FILE" in
/lib/*|/usr/lib/*|/usr/local/lib/*) ;;
*) [ -h "$LINK" -o ! -e "$LINK" ] && ln -sf "$TARGET" "$LINK"
esac
done
return 0
}
# eat ldconfig options
while getopts "nNvXvf:C:r:" opt; do
:
done
shift $(( $OPTIND - 1 ))
[ $# -gt 0 ] && scan_dirs "$@"

View File

@ -1,16 +0,0 @@
diff --git a/src/linux/epoll.c b/src/linux/epoll.c
index deff5b10..93baa814 100644
--- a/src/linux/epoll.c
+++ b/src/linux/epoll.c
@@ -24,9 +24,9 @@ int epoll_ctl(int fd, int op, int fd2, struct epoll_event *ev)
int epoll_pwait(int fd, struct epoll_event *ev, int cnt, int to, const sigset_t *sigs)
{
- int r = __syscall(SYS_epoll_pwait, fd, ev, cnt, to, sigs, _NSIG/8);
+ int r = __syscall_cp(SYS_epoll_pwait, fd, ev, cnt, to, sigs, _NSIG/8);
#ifdef SYS_epoll_wait
- if (r==-ENOSYS && !sigs) r = __syscall(SYS_epoll_wait, fd, ev, cnt, to);
+ if (r==-ENOSYS && !sigs) r = __syscall_cp(SYS_epoll_wait, fd, ev, cnt, to);
#endif
return __syscall_ret(r);
}

View File

@ -1,34 +0,0 @@
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
pkgname=sbase
_commit="7d60e2cabbe07495ee74f3d5e705f1e3470148eb"
pkgver="0.0_git"
pkgrel=0
pkgdesc="suckless unix tools"
url="https://core.suckless.org/sbase/"
arch="all"
license="MIT"
makedepends="
make
"
#cc
subpackages="$pkgname-doc"
source="
$pkgname-$pkgver-$_commit.tar.gz::https://git.redxen.eu/suckless/sbase/archive/$_commit.tar.gz
config.patch
"
builddir="$srcdir/sbase"
options="!check"
build() {
make
}
package() {
make DESTDIR="$pkgdir" install
}
sha512sums="
9b1734e8968947c47bf2c3de51a9472daa3a835e6f9f0a233be5765e82d4eea3dc16c47944a8693fa3484b34a12817c2da40a263b3fa046e91c03a3f1416155e sbase-0.0_git-7d60e2cabbe07495ee74f3d5e705f1e3470148eb.tar.gz
5038e847feddeaaed565b52070f580122337e2ebde205459f6b08a88f7ac040302f6dcb20c18de501117e0aa34d5c3fa0ed756bb35b66ac9a56231d53116dcc1 config.patch
"

View File

@ -1,17 +0,0 @@
--- a/config.mk
+++ b/config.mk
@@ -2,7 +2,7 @@
VERSION = 0.0
# paths
-PREFIX = /usr/local
+PREFIX = /usr
MANPREFIX = $(PREFIX)/share/man
CC = cc
@@ -13,4 +13,4 @@
# -lrt might be needed on some systems
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_FILE_OFFSET_BITS=64
CFLAGS = -std=c99 -Wall -pedantic
-LDFLAGS = -s
+LDFLAGS = -s -static