mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-28 14:01:43 +01:00
chore(coreos-base): remove unused ebuilds
Remove leftover things from chromeos
This commit is contained in:
parent
25be6f5389
commit
bfdc8d5058
@ -1,50 +0,0 @@
|
||||
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=2
|
||||
CROS_WORKON_COMMIT="7cbe18c6f1b8446d486a501a94297e6b04128b6d"
|
||||
CROS_WORKON_TREE="b5ef87a2635b6cbba9816bf32c256b3cdec80cef"
|
||||
CROS_WORKON_PROJECT="chromiumos/platform/bootstat"
|
||||
inherit cros-workon
|
||||
|
||||
DESCRIPTION="Chrome OS Boot Time Statistics Utilities"
|
||||
HOMEPAGE="http://www.chromium.org/"
|
||||
SRC_URI=""
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 x86 arm"
|
||||
IUSE=""
|
||||
|
||||
RDEPEND=""
|
||||
|
||||
DEPEND="dev-cpp/gtest"
|
||||
|
||||
src_compile() {
|
||||
tc-export CC CXX AR PKG_CONFIG
|
||||
emake || die "bootstat compile failed."
|
||||
}
|
||||
|
||||
src_test() {
|
||||
tc-export CC CXX AR PKG_CONFIG
|
||||
emake tests || die "could not build tests"
|
||||
if ! use x86 && ! use amd64 ; then
|
||||
echo Skipping unit tests on non-x86 platform
|
||||
else
|
||||
for test in ./*_test; do
|
||||
"${test}" ${GTEST_ARGS} || die "${test} failed"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
src_install() {
|
||||
into /
|
||||
dosbin bootstat || die
|
||||
dosbin bootstat_get_last || die
|
||||
dobin bootstat_summary || die
|
||||
|
||||
into /usr
|
||||
dolib.a libbootstat.a || die
|
||||
|
||||
insinto /usr/include/metrics
|
||||
doins bootstat.h || die
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=2
|
||||
CROS_WORKON_PROJECT="chromiumos/platform/bootstat"
|
||||
inherit cros-workon
|
||||
|
||||
DESCRIPTION="Chrome OS Boot Time Statistics Utilities"
|
||||
HOMEPAGE="http://www.chromium.org/"
|
||||
SRC_URI=""
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~x86 ~arm"
|
||||
IUSE=""
|
||||
|
||||
RDEPEND=""
|
||||
|
||||
DEPEND="dev-cpp/gtest"
|
||||
|
||||
src_compile() {
|
||||
tc-export CC CXX AR PKG_CONFIG
|
||||
emake || die "bootstat compile failed."
|
||||
}
|
||||
|
||||
src_test() {
|
||||
tc-export CC CXX AR PKG_CONFIG
|
||||
emake tests || die "could not build tests"
|
||||
if ! use x86 && ! use amd64 ; then
|
||||
echo Skipping unit tests on non-x86 platform
|
||||
else
|
||||
for test in ./*_test; do
|
||||
"${test}" ${GTEST_ARGS} || die "${test} failed"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
src_install() {
|
||||
into /
|
||||
dosbin bootstat || die
|
||||
dosbin bootstat_get_last || die
|
||||
dobin bootstat_summary || die
|
||||
|
||||
into /usr
|
||||
dolib.a libbootstat.a || die
|
||||
|
||||
insinto /usr/include/metrics
|
||||
doins bootstat.h || die
|
||||
}
|
||||
@ -100,14 +100,7 @@ RDEPEND="${RDEPEND}
|
||||
# things like line editing in dash, so its interactive mode is very bare.
|
||||
# TODO(ifup):
|
||||
# coreos-base/crash-reporter
|
||||
# coreos-base/chromeos-debugd
|
||||
# coreos-base/chromeos-init
|
||||
# coreos-base/cros-disks
|
||||
# coreos-base/shill
|
||||
# coreos-base/userfeedback
|
||||
# coreos-base/metrics
|
||||
# sys-apps/ureadahead
|
||||
# coreos-base/bootstat
|
||||
|
||||
RDEPEND="${RDEPEND}
|
||||
sys-apps/findutils
|
||||
|
||||
@ -1,81 +0,0 @@
|
||||
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="4"
|
||||
CROS_WORKON_COMMIT="8bc9b0296b66a1f93a34aa613cc45864450f69c6"
|
||||
CROS_WORKON_TREE="6c05b98c91993c6c4921e505f83372bf87cbc5bd"
|
||||
CROS_WORKON_PROJECT="chromiumos/platform/cros-disks"
|
||||
CROS_WORKON_OUTOFTREE_BUILD=1
|
||||
|
||||
inherit cros-debug cros-workon
|
||||
|
||||
DESCRIPTION="Disk mounting daemon for Chromium OS"
|
||||
HOMEPAGE="http://www.chromium.org/"
|
||||
SRC_URI=""
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
KEYWORDS="arm amd64 x86"
|
||||
IUSE="test"
|
||||
|
||||
LIBCHROME_VERS="125070"
|
||||
|
||||
RDEPEND="
|
||||
app-arch/unrar
|
||||
chromeos-base/chromeos-minijail
|
||||
chromeos-base/libchromeos
|
||||
chromeos-base/metrics
|
||||
dev-cpp/gflags
|
||||
dev-libs/dbus-c++
|
||||
>=dev-libs/glib-2.30
|
||||
sys-apps/rootdev
|
||||
sys-apps/util-linux
|
||||
sys-block/parted
|
||||
sys-fs/avfs
|
||||
sys-fs/fuse-exfat
|
||||
sys-fs/ntfs3g
|
||||
virtual/udev
|
||||
"
|
||||
|
||||
DEPEND="${RDEPEND}
|
||||
chromeos-base/libchrome:${LIBCHROME_VERS}[cros-debug=]
|
||||
chromeos-base/system_api
|
||||
dev-cpp/gmock
|
||||
test? ( dev-cpp/gtest )"
|
||||
|
||||
src_prepare() {
|
||||
cros-workon_src_prepare
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
cros-workon_src_configure
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
cros-workon_src_compile
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# Needed for `cros_run_unit_tests`.
|
||||
cros-workon_src_test
|
||||
}
|
||||
|
||||
src_install() {
|
||||
exeinto /opt/google/cros-disks
|
||||
doexe "${OUT}"/disks
|
||||
|
||||
# Install USB device IDs file.
|
||||
insinto /opt/google/cros-disks
|
||||
doins usb-device-info
|
||||
|
||||
# Install seccomp policy file.
|
||||
newins "avfsd-seccomp-${ARCH}.policy" avfsd-seccomp.policy
|
||||
|
||||
# Install upstart config file.
|
||||
insinto /etc/init
|
||||
doins cros-disks.conf
|
||||
|
||||
# Install D-Bus config file.
|
||||
insinto /etc/dbus-1/system.d
|
||||
doins org.chromium.CrosDisks.conf
|
||||
}
|
||||
@ -1,79 +0,0 @@
|
||||
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="4"
|
||||
CROS_WORKON_PROJECT="chromiumos/platform/cros-disks"
|
||||
CROS_WORKON_OUTOFTREE_BUILD=1
|
||||
|
||||
inherit cros-debug cros-workon
|
||||
|
||||
DESCRIPTION="Disk mounting daemon for Chromium OS"
|
||||
HOMEPAGE="http://www.chromium.org/"
|
||||
SRC_URI=""
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
KEYWORDS="~arm ~amd64 ~x86"
|
||||
IUSE="test"
|
||||
|
||||
LIBCHROME_VERS="125070"
|
||||
|
||||
RDEPEND="
|
||||
app-arch/unrar
|
||||
chromeos-base/chromeos-minijail
|
||||
chromeos-base/libchromeos
|
||||
chromeos-base/metrics
|
||||
dev-cpp/gflags
|
||||
dev-libs/dbus-c++
|
||||
>=dev-libs/glib-2.30
|
||||
sys-apps/rootdev
|
||||
sys-apps/util-linux
|
||||
sys-block/parted
|
||||
sys-fs/avfs
|
||||
sys-fs/fuse-exfat
|
||||
sys-fs/ntfs3g
|
||||
virtual/udev
|
||||
"
|
||||
|
||||
DEPEND="${RDEPEND}
|
||||
chromeos-base/libchrome:${LIBCHROME_VERS}[cros-debug=]
|
||||
chromeos-base/system_api
|
||||
dev-cpp/gmock
|
||||
test? ( dev-cpp/gtest )"
|
||||
|
||||
src_prepare() {
|
||||
cros-workon_src_prepare
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
cros-workon_src_configure
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
cros-workon_src_compile
|
||||
}
|
||||
|
||||
src_test() {
|
||||
# Needed for `cros_run_unit_tests`.
|
||||
cros-workon_src_test
|
||||
}
|
||||
|
||||
src_install() {
|
||||
exeinto /opt/google/cros-disks
|
||||
doexe "${OUT}"/disks
|
||||
|
||||
# Install USB device IDs file.
|
||||
insinto /opt/google/cros-disks
|
||||
doins usb-device-info
|
||||
|
||||
# Install seccomp policy file.
|
||||
newins "avfsd-seccomp-${ARCH}.policy" avfsd-seccomp.policy
|
||||
|
||||
# Install upstart config file.
|
||||
insinto /etc/init
|
||||
doins cros-disks.conf
|
||||
|
||||
# Install D-Bus config file.
|
||||
insinto /etc/dbus-1/system.d
|
||||
doins org.chromium.CrosDisks.conf
|
||||
}
|
||||
@ -1,101 +0,0 @@
|
||||
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=4
|
||||
CROS_WORKON_COMMIT="d73783fb016a4c9d7d8644db83c8caeb447b0063"
|
||||
CROS_WORKON_TREE="e68fbfeee03d9d1e0e4a248b13d7081eaaacf317"
|
||||
CROS_WORKON_PROJECT="chromiumos/platform/shill"
|
||||
|
||||
inherit cros-debug cros-workon toolchain-funcs multilib
|
||||
|
||||
DESCRIPTION="Shill Connection Manager for Chromium OS"
|
||||
HOMEPAGE="http://src.chromium.org"
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
IUSE="test"
|
||||
KEYWORDS="amd64 arm x86"
|
||||
|
||||
RDEPEND="chromeos-base/bootstat
|
||||
chromeos-base/chromeos-minijail
|
||||
!<chromeos-base/flimflam-0.0.1-r530
|
||||
chromeos-base/libchrome:125070[cros-debug=]
|
||||
chromeos-base/libchromeos
|
||||
chromeos-base/metrics
|
||||
>=chromeos-base/mobile-providers-0.0.1-r12
|
||||
chromeos-base/vpn-manager
|
||||
dev-libs/dbus-c++
|
||||
>=dev-libs/glib-2.30
|
||||
dev-libs/libnl:3
|
||||
dev-libs/nss
|
||||
dev-libs/protobuf
|
||||
net-dialup/ppp
|
||||
net-dns/c-ares
|
||||
net-misc/dhcpcd
|
||||
net-misc/openvpn
|
||||
net-wireless/wpa_supplicant[dbus]"
|
||||
|
||||
DEPEND="${RDEPEND}
|
||||
chromeos-base/system_api
|
||||
chromeos-base/wimax_manager
|
||||
test? ( dev-cpp/gmock )
|
||||
test? ( dev-cpp/gtest )
|
||||
virtual/modemmanager"
|
||||
|
||||
make_flags() {
|
||||
echo LIBDIR="/usr/$(get_libdir)"
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
tc-export CC CXX AR RANLIB LD NM PKG_CONFIG
|
||||
cros-debug-add-NDEBUG
|
||||
|
||||
emake $(make_flags) shill shims
|
||||
}
|
||||
|
||||
src_test() {
|
||||
tc-export CC CXX AR RANLIB LD NM PKG_CONFIG
|
||||
cros-debug-add-NDEBUG
|
||||
|
||||
# Build tests
|
||||
emake $(make_flags) shill_unittest
|
||||
|
||||
# Run tests if we're on x86
|
||||
if ! use x86 && ! use amd64 ; then
|
||||
echo Skipping tests on non-x86/amd64 platform...
|
||||
else
|
||||
for ut in shill ; do
|
||||
"${S}/${ut}_unittest" \
|
||||
${GTEST_ARGS} || die "${ut}_unittest failed"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
src_install() {
|
||||
dobin bin/ff_debug
|
||||
dobin bin/mm_debug
|
||||
dobin bin/set_apn
|
||||
dobin bin/set_arpgw
|
||||
dobin bin/shill_login_user
|
||||
dobin bin/shill_logout_user
|
||||
dobin bin/wpa_debug
|
||||
dobin shill
|
||||
local shims_dir="/usr/$(get_libdir)/shill/shims"
|
||||
exeinto "${shims_dir}"
|
||||
doexe build/shims/net-diags-upload
|
||||
doexe build/shims/nss-get-cert
|
||||
doexe build/shims/openvpn-script
|
||||
doexe build/shims/set-apn-helper
|
||||
doexe build/shims/shill-pppd-plugin.so
|
||||
insinto "${shims_dir}"
|
||||
doins build/shims/wpa_supplicant.conf
|
||||
insinto /etc
|
||||
doins shims/nsswitch.conf
|
||||
dosym /var/run/shill/resolv.conf /etc/resolv.conf
|
||||
insinto /etc/dbus-1/system.d
|
||||
doins shims/org.chromium.flimflam.conf
|
||||
insinto /usr/share/shill
|
||||
doins data/cellular_operator_info
|
||||
# Install introspection XML
|
||||
insinto /usr/share/dbus-1/interfaces
|
||||
doins dbus_bindings/org.chromium.flimflam.*.xml
|
||||
}
|
||||
@ -1,99 +0,0 @@
|
||||
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=4
|
||||
CROS_WORKON_PROJECT="chromiumos/platform/shill"
|
||||
|
||||
inherit cros-debug cros-workon toolchain-funcs multilib
|
||||
|
||||
DESCRIPTION="Shill Connection Manager for Chromium OS"
|
||||
HOMEPAGE="http://src.chromium.org"
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
IUSE="test"
|
||||
KEYWORDS="~amd64 ~arm ~x86"
|
||||
|
||||
RDEPEND="chromeos-base/bootstat
|
||||
chromeos-base/chromeos-minijail
|
||||
!<chromeos-base/flimflam-0.0.1-r530
|
||||
chromeos-base/libchrome:125070[cros-debug=]
|
||||
chromeos-base/libchromeos
|
||||
chromeos-base/metrics
|
||||
>=chromeos-base/mobile-providers-0.0.1-r12
|
||||
chromeos-base/vpn-manager
|
||||
dev-libs/dbus-c++
|
||||
>=dev-libs/glib-2.30
|
||||
dev-libs/libnl:3
|
||||
dev-libs/nss
|
||||
dev-libs/protobuf
|
||||
net-dialup/ppp
|
||||
net-dns/c-ares
|
||||
net-misc/dhcpcd
|
||||
net-misc/openvpn
|
||||
net-wireless/wpa_supplicant[dbus]"
|
||||
|
||||
DEPEND="${RDEPEND}
|
||||
chromeos-base/system_api
|
||||
chromeos-base/wimax_manager
|
||||
test? ( dev-cpp/gmock )
|
||||
test? ( dev-cpp/gtest )
|
||||
virtual/modemmanager"
|
||||
|
||||
make_flags() {
|
||||
echo LIBDIR="/usr/$(get_libdir)"
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
tc-export CC CXX AR RANLIB LD NM PKG_CONFIG
|
||||
cros-debug-add-NDEBUG
|
||||
|
||||
emake $(make_flags) shill shims
|
||||
}
|
||||
|
||||
src_test() {
|
||||
tc-export CC CXX AR RANLIB LD NM PKG_CONFIG
|
||||
cros-debug-add-NDEBUG
|
||||
|
||||
# Build tests
|
||||
emake $(make_flags) shill_unittest
|
||||
|
||||
# Run tests if we're on x86
|
||||
if ! use x86 && ! use amd64 ; then
|
||||
echo Skipping tests on non-x86/amd64 platform...
|
||||
else
|
||||
for ut in shill ; do
|
||||
"${S}/${ut}_unittest" \
|
||||
${GTEST_ARGS} || die "${ut}_unittest failed"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
src_install() {
|
||||
dobin bin/ff_debug
|
||||
dobin bin/mm_debug
|
||||
dobin bin/set_apn
|
||||
dobin bin/set_arpgw
|
||||
dobin bin/shill_login_user
|
||||
dobin bin/shill_logout_user
|
||||
dobin bin/wpa_debug
|
||||
dobin shill
|
||||
local shims_dir="/usr/$(get_libdir)/shill/shims"
|
||||
exeinto "${shims_dir}"
|
||||
doexe build/shims/net-diags-upload
|
||||
doexe build/shims/nss-get-cert
|
||||
doexe build/shims/openvpn-script
|
||||
doexe build/shims/set-apn-helper
|
||||
doexe build/shims/shill-pppd-plugin.so
|
||||
insinto "${shims_dir}"
|
||||
doins build/shims/wpa_supplicant.conf
|
||||
insinto /etc
|
||||
doins shims/nsswitch.conf
|
||||
dosym /var/run/shill/resolv.conf /etc/resolv.conf
|
||||
insinto /etc/dbus-1/system.d
|
||||
doins shims/org.chromium.flimflam.conf
|
||||
insinto /usr/share/shill
|
||||
doins data/cellular_operator_info
|
||||
# Install introspection XML
|
||||
insinto /usr/share/dbus-1/interfaces
|
||||
doins dbus_bindings/org.chromium.flimflam.*.xml
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="2"
|
||||
CROS_WORKON_COMMIT="be13c42c801e18096f357684dc2a2848a4bf5162"
|
||||
CROS_WORKON_TREE="f209555c63c55fe03d652edfb83c61d912c54f16"
|
||||
CROS_WORKON_PROJECT="chromiumos/platform/userfeedback"
|
||||
|
||||
inherit cros-workon
|
||||
|
||||
DESCRIPTION="Log scripts used by userfeedback to report cros system information"
|
||||
HOMEPAGE="http://www.chromium.org/"
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 arm x86"
|
||||
IUSE=""
|
||||
|
||||
RDEPEND="chromeos-base/chromeos-init
|
||||
chromeos-base/modem-utilities
|
||||
chromeos-base/vboot_reference
|
||||
media-libs/fontconfig
|
||||
sys-apps/mosys
|
||||
sys-apps/net-tools
|
||||
sys-apps/pciutils
|
||||
sys-apps/usbutils
|
||||
x11-apps/setxkbmap"
|
||||
|
||||
DEPEND=""
|
||||
|
||||
src_install() {
|
||||
exeinto /usr/share/userfeedback/scripts
|
||||
doexe scripts/* || die "Could not copy scripts"
|
||||
|
||||
insinto /usr/share/userfeedback/etc
|
||||
doins etc/* || die "Could not copy etc"
|
||||
|
||||
insinto /etc/init
|
||||
doins init/* || die "Could not copy init"
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="2"
|
||||
CROS_WORKON_PROJECT="chromiumos/platform/userfeedback"
|
||||
|
||||
inherit cros-workon
|
||||
|
||||
DESCRIPTION="Log scripts used by userfeedback to report cros system information"
|
||||
HOMEPAGE="http://www.chromium.org/"
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~arm ~x86"
|
||||
IUSE=""
|
||||
|
||||
RDEPEND="chromeos-base/chromeos-init
|
||||
chromeos-base/modem-utilities
|
||||
chromeos-base/vboot_reference
|
||||
media-libs/fontconfig
|
||||
sys-apps/mosys
|
||||
sys-apps/net-tools
|
||||
sys-apps/pciutils
|
||||
sys-apps/usbutils
|
||||
x11-apps/setxkbmap"
|
||||
|
||||
DEPEND=""
|
||||
|
||||
src_install() {
|
||||
exeinto /usr/share/userfeedback/scripts
|
||||
doexe scripts/* || die "Could not copy scripts"
|
||||
|
||||
insinto /usr/share/userfeedback/etc
|
||||
doins etc/* || die "Could not copy etc"
|
||||
|
||||
insinto /etc/init
|
||||
doins init/* || die "Could not copy init"
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
DIST upstart-0.6.3.tar.bz2 1208034 SHA256 8238cbccb705ffe0930ceb2c4170e2617ada4e84d3c2404765de18d2ba138754 SHA512 fc68592941874b4e8e1e79ac0c3ce2b65e0a6be46cd2f229dda6acdd14a95d871a16655faee1cc4ceeabf17a54df688f13b925cf210d012ad89a97ebc6f085cf WHIRLPOOL 88faf4858b46e29960e4bd8f361a55544ca4c0c55f922e7e70a78b07c784d863c6665ff07fd97423f06cacc3760de260e67f980552ed5a80bb287aa2a817921c
|
||||
DIST upstart-0.6.6.tar.gz 991950 SHA256 7ab4014a808751327f0a4f9687844c4022fc12d5d8b21755775d4a4aac30c9b3 SHA512 ca99d4c8968b9309d5a6d65220acef695e403aa09daca96ff3664c6d4cdf5d427537552e2e730c92d868b194599586f058a8bb1f34ffbe5b367f22d122b5f662 WHIRLPOOL 19995edcf231b3edc10395636119317b4d929fad09463d9b27e4f406f10db5e4b201a18e8bd67018b47733f6af8d75a34adc8e48c988e65b1ac6cbf8a81e5e2c
|
||||
DIST upstart-1.2.tar.gz 1005542 SHA256 df56f1f8638c6cc2202c9ba5f8a1d093f091303c58ad3bce6a375f9ca0821710 SHA512 5c9a1c48fe96f05cc02c6865221894b690df343df7935412bc6402b8fea564775bca7149d1e9f46349014d99c18694783cd8ce53e0492d8e2d53e699dff79f1c WHIRLPOOL 2f7545b433ada8ebfb021a70581313620928125b3a480adad438abea814790cd8a50d310e85c92c36640e570451dab494931b2d15833f7427a2d2a34bbf3fdac
|
||||
@ -1,94 +0,0 @@
|
||||
=== modified file 'init/main.c'
|
||||
--- init/main.c 2010-12-13 18:15:24 +0000
|
||||
+++ init/main.c 2011-02-07 22:08:27 +0000
|
||||
@@ -61,6 +61,7 @@
|
||||
|
||||
/* Prototypes for static functions */
|
||||
#ifndef DEBUG
|
||||
+static int logger_kmsg (NihLogLevel priority, const char *message);
|
||||
static void crash_handler (int signum);
|
||||
static void cad_handler (void *data, NihSignal *signal);
|
||||
static void kbd_handler (void *data, NihSignal *signal);
|
||||
@@ -314,10 +315,10 @@
|
||||
|
||||
#ifndef DEBUG
|
||||
/* Now that the startup is complete, send all further logging output
|
||||
- * to syslog instead of to the console.
|
||||
+ * to kmsg instead of to the console.
|
||||
*/
|
||||
- openlog (program_name, LOG_CONS, LOG_DAEMON);
|
||||
- nih_log_set_logger (nih_logger_syslog);
|
||||
+ nih_log_set_priority (NIH_LOG_INFO);
|
||||
+ nih_log_set_logger (logger_kmsg);
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
@@ -347,6 +348,67 @@
|
||||
|
||||
#ifndef DEBUG
|
||||
/**
|
||||
+ * logger_kmsg:
|
||||
+ * @priority: priority of message being logged,
|
||||
+ * @message: message to log.
|
||||
+ *
|
||||
+ * Outputs the @message to the kernel log message socket prefixed with an
|
||||
+ * appropriate tag based on @priority, the program name and terminated with
|
||||
+ * a new line.
|
||||
+ *
|
||||
+ * Returns: zero on success, negative value on error.
|
||||
+ **/
|
||||
+static int
|
||||
+logger_kmsg (NihLogLevel priority,
|
||||
+ const char *message)
|
||||
+{
|
||||
+ int tag;
|
||||
+ FILE *kmsg;
|
||||
+
|
||||
+ nih_assert (message != NULL);
|
||||
+
|
||||
+ switch (priority) {
|
||||
+ case NIH_LOG_DEBUG:
|
||||
+ tag = '7';
|
||||
+ break;
|
||||
+ case NIH_LOG_INFO:
|
||||
+ tag = '6';
|
||||
+ break;
|
||||
+ case NIH_LOG_MESSAGE:
|
||||
+ tag = '5';
|
||||
+ break;
|
||||
+ case NIH_LOG_WARN:
|
||||
+ tag = '4';
|
||||
+ break;
|
||||
+ case NIH_LOG_ERROR:
|
||||
+ tag = '3';
|
||||
+ break;
|
||||
+ case NIH_LOG_FATAL:
|
||||
+ tag = '2';
|
||||
+ break;
|
||||
+ default:
|
||||
+ tag = 'd';
|
||||
+ }
|
||||
+
|
||||
+ kmsg = fopen ("/dev/kmsg", "w");
|
||||
+ if (! kmsg)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (fprintf (kmsg, "<%c>%s: %s\n", tag, program_name, message) < 0) {
|
||||
+ int saved_errno = errno;
|
||||
+ fclose (kmsg);
|
||||
+ errno = saved_errno;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (fclose (kmsg) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
* crash_handler:
|
||||
* @signum: signal number received.
|
||||
*
|
||||
|
||||
@ -1,64 +0,0 @@
|
||||
diff -Naur upstart-0.6.3.orig/init/Makefile.am upstart-0.6.3.new/init/Makefile.am
|
||||
--- upstart-0.6.3.orig/init/Makefile.am 2009-07-11 10:41:09.000000000 +0000
|
||||
+++ upstart-0.6.3.new/init/Makefile.am 2009-10-14 20:29:46.000000000 +0000
|
||||
@@ -69,7 +69,7 @@
|
||||
../dbus/com.ubuntu.Upstart.xml
|
||||
|
||||
$(com_ubuntu_Upstart_OUTPUTS): $(com_ubuntu_Upstart_XML) $(top_builddir)/nih-dbus-tool/nih-dbus-tool
|
||||
- $(top_builddir)/nih-dbus-tool/nih-dbus-tool \
|
||||
+ $(NIH_DBUS_TOOL) \
|
||||
--mode=object --prefix=control --default-interface=com.ubuntu.Upstart0_6 \
|
||||
--output=$@ $<
|
||||
|
||||
@@ -81,8 +81,8 @@
|
||||
com_ubuntu_Upstart_Job_XML = \
|
||||
../dbus/com.ubuntu.Upstart.Job.xml
|
||||
|
||||
-$(com_ubuntu_Upstart_Job_OUTPUTS): $(com_ubuntu_Upstart_Job_XML) $(top_builddir)/nih-dbus-tool/nih-dbus-tool
|
||||
- $(top_builddir)/nih-dbus-tool/nih-dbus-tool \
|
||||
+$(com_ubuntu_Upstart_Job_OUTPUTS): $(com_ubuntu_Upstart_Job_XML) $(top_builddir)/nih-dbus-tool/nih-dbus-tool
|
||||
+ $(NIH_DBUS_TOOL) \
|
||||
--mode=object --prefix=job_class --default-interface=com.ubuntu.Upstart0_6.Job \
|
||||
--output=$@ $<
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
../dbus/com.ubuntu.Upstart.Instance.xml
|
||||
|
||||
$(com_ubuntu_Upstart_Instance_OUTPUTS): $(com_ubuntu_Upstart_Instance_XML) $(top_builddir)/nih-dbus-tool/nih-dbus-tool
|
||||
- $(top_builddir)/nih-dbus-tool/nih-dbus-tool \
|
||||
+ $(NIH_DBUS_TOOL) \
|
||||
--mode=object --prefix=job --default-interface=com.ubuntu.Upstart0_6.Instance \
|
||||
--output=$@ $<
|
||||
|
||||
diff -Naur upstart-0.6.3.orig/util/Makefile.am upstart-0.6.3.new/util/Makefile.am
|
||||
--- upstart-0.6.3.orig/util/Makefile.am 2009-07-21 11:30:06.000000000 +0000
|
||||
+++ upstart-0.6.3.new/util/Makefile.am 2009-10-14 20:30:47.000000000 +0000
|
||||
@@ -90,7 +90,7 @@
|
||||
../dbus/com.ubuntu.Upstart.xml
|
||||
|
||||
$(com_ubuntu_Upstart_OUTPUTS): $(com_ubuntu_Upstart_XML) $(top_builddir)/nih-dbus-tool/nih-dbus-tool
|
||||
- $(top_builddir)/nih-dbus-tool/nih-dbus-tool \
|
||||
+ $(NIH_DBUS_TOOL) \
|
||||
--mode=proxy --prefix=upstart --default-interface=com.ubuntu.Upstart0_6 \
|
||||
--output=$@ $<
|
||||
|
||||
@@ -102,8 +102,8 @@
|
||||
com_ubuntu_Upstart_Job_XML = \
|
||||
../dbus/com.ubuntu.Upstart.Job.xml
|
||||
|
||||
-$(com_ubuntu_Upstart_Job_OUTPUTS): $(com_ubuntu_Upstart_Job_XML) $(top_builddir)/nih-dbus-tool/nih-dbus-tool
|
||||
- $(top_builddir)/nih-dbus-tool/nih-dbus-tool \
|
||||
+$(com_ubuntu_Upstart_Job_OUTPUTS): $(com_ubuntu_Upstart_Job_XML) $(top_builddir)/nih-dbus-tool/nih-dbus-tool
|
||||
+ $(NIH_DBUS_TOOL) \
|
||||
--mode=proxy --prefix=job_class --default-interface=com.ubuntu.Upstart0_6.Job \
|
||||
--output=$@ $<
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
../dbus/com.ubuntu.Upstart.Instance.xml
|
||||
|
||||
$(com_ubuntu_Upstart_Instance_OUTPUTS): $(com_ubuntu_Upstart_Instance_XML) $(top_builddir)/nih-dbus-tool/nih-dbus-tool
|
||||
- $(top_builddir)/nih-dbus-tool/nih-dbus-tool \
|
||||
+ $(NIH_DBUS_TOOL) \
|
||||
--mode=proxy --prefix=job --default-interface=com.ubuntu.Upstart0_6.Instance \
|
||||
--output=$@ $<
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
diff -Naur upstart-0.6.3.orig/nih-dbus-tool/Makefile.am upstart-0.6.3.new/nih-dbus-tool/Makefile.am
|
||||
--- upstart-0.6.3.orig/nih-dbus-tool/Makefile.am 2009-07-31 08:15:52.000000000 +0000
|
||||
+++ upstart-0.6.3.new/nih-dbus-tool/Makefile.am 2009-10-14 21:53:52.000000000 +0000
|
||||
@@ -259,7 +259,7 @@
|
||||
$(MKDIR_P) `echo "$@" | \
|
||||
sed '/\//!d;s,/[^/]*$$,,' | \
|
||||
sort -u`
|
||||
- $(builddir)/nih-dbus-tool --mode=object --prefix=my --output=$@ $<
|
||||
+ $(NIH_DBUS_TOOL) --mode=object --prefix=my --output=$@ $<
|
||||
|
||||
|
||||
com_netsplit_Nih_Test_proxy_OUTPUTS = \
|
||||
@@ -273,7 +273,7 @@
|
||||
$(MKDIR_P) `echo "$@" | \
|
||||
sed '/\//!d;s,/[^/]*$$,,' | \
|
||||
sort -u`
|
||||
- $(builddir)/nih-dbus-tool --mode=proxy --prefix=proxy --output=$@ $<
|
||||
+ $(NIH_DBUS_TOOL) --mode=proxy --prefix=proxy --output=$@ $<
|
||||
|
||||
|
||||
# These have to be built sources because we can't compile test_*.o without
|
||||
@ -1,712 +0,0 @@
|
||||
=== modified file 'dbus/com.ubuntu.Upstart.Job.xml'
|
||||
--- dbus/com.ubuntu.Upstart.Job.xml 2009-07-03 16:28:21 +0000
|
||||
+++ dbus/com.ubuntu.Upstart.Job.xml 2010-12-10 02:43:11 +0000
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
com.ubuntu.Upstart.Job.xml - interface definition for job objects
|
||||
|
||||
- Copyright © 2009 Canonical Ltd.
|
||||
+ Copyright © 2010 Canonical Ltd.
|
||||
Author: Scott James Remnant <scott@netsplit.com>.
|
||||
|
||||
This file is free software; Canonical Ltd gives unlimited permission
|
||||
@@ -67,5 +67,10 @@
|
||||
<property name="description" type="s" access="read" />
|
||||
<property name="author" type="s" access="read" />
|
||||
<property name="version" type="s" access="read" />
|
||||
+
|
||||
+ <!-- Information about a job's relationship with Events -->
|
||||
+ <property name="start_on" type="aas" access="read" />
|
||||
+ <property name="stop_on" type="aas" access="read" />
|
||||
+ <property name="emits" type="as" access="read" />
|
||||
</interface>
|
||||
</node>
|
||||
|
||||
=== modified file 'init/job_class.c'
|
||||
--- init/job_class.c 2010-12-13 18:15:24 +0000
|
||||
+++ init/job_class.c 2010-12-14 15:30:06 +0000
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* job_class.c - job class definition handling
|
||||
*
|
||||
- * Copyright © 2009 Canonical Ltd.
|
||||
+ * Copyright © 2010 Canonical Ltd.
|
||||
* Author: Scott James Remnant <scott@netsplit.com>.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <nih/string.h>
|
||||
#include <nih/list.h>
|
||||
#include <nih/hash.h>
|
||||
+#include <nih/tree.h>
|
||||
#include <nih/logging.h>
|
||||
|
||||
#include <nih-dbus/dbus_error.h>
|
||||
@@ -1161,3 +1162,198 @@
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * job_class_get_start_on:
|
||||
+ * @class: class to obtain events from,
|
||||
+ * @message: D-Bus connection and message received,
|
||||
+ * @start_on: pointer for reply array.
|
||||
+ *
|
||||
+ * Implements the get method for the start_on property of the
|
||||
+ * com.ubuntu.Upstart.Job interface.
|
||||
+ *
|
||||
+ * Called to obtain the set of events that will start jobs of the given
|
||||
+ * @class, this is returned as an array of the event tree flattened into
|
||||
+ * reverse polish form.
|
||||
+ *
|
||||
+ * Each array element is an array of strings representing the events,
|
||||
+ * or a single element containing "/OR" or "/AND" to represent the
|
||||
+ * operators.
|
||||
+ *
|
||||
+ * Returns: zero on success, negative value on raised error.
|
||||
+ **/
|
||||
+int
|
||||
+job_class_get_start_on (JobClass * class,
|
||||
+ NihDBusMessage *message,
|
||||
+ char **** start_on)
|
||||
+{
|
||||
+ size_t len = 0;
|
||||
+
|
||||
+ nih_assert (class != NULL);
|
||||
+ nih_assert (message != NULL);
|
||||
+ nih_assert (start_on != NULL);
|
||||
+
|
||||
+ *start_on = nih_alloc (message, sizeof (char ***));
|
||||
+ if (! *start_on)
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+
|
||||
+ len = 0;
|
||||
+ (*start_on)[len] = NULL;
|
||||
+
|
||||
+ if (class->start_on) {
|
||||
+ NIH_TREE_FOREACH_POST (&class->start_on->node, iter) {
|
||||
+ EventOperator *oper = (EventOperator *)iter;
|
||||
+
|
||||
+ *start_on = nih_realloc (*start_on, message,
|
||||
+ sizeof (char ***) * (len + 2));
|
||||
+ if (! *start_on)
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+
|
||||
+ (*start_on)[len] = nih_str_array_new (*start_on);
|
||||
+ if (! (*start_on)[len])
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+
|
||||
+ switch (oper->type) {
|
||||
+ case EVENT_OR:
|
||||
+ if (! nih_str_array_add (&(*start_on)[len], *start_on,
|
||||
+ NULL, "/OR"))
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+ break;
|
||||
+ case EVENT_AND:
|
||||
+ if (! nih_str_array_add (&(*start_on)[len], *start_on,
|
||||
+ NULL, "/AND"))
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+ break;
|
||||
+ case EVENT_MATCH:
|
||||
+ if (! nih_str_array_add (&(*start_on)[len], *start_on,
|
||||
+ NULL, oper->name))
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+ if (oper->env)
|
||||
+ if (! nih_str_array_append (&(*start_on)[len], *start_on,
|
||||
+ NULL, oper->env))
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ (*start_on)[++len] = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * job_class_get_stop_on:
|
||||
+ * @class: class to obtain events from,
|
||||
+ * @message: D-Bus connection and message received,
|
||||
+ * @stop_on: pointer for reply array.
|
||||
+ *
|
||||
+ * Implements the get method for the stop_on property of the
|
||||
+ * com.ubuntu.Upstart.Job interface.
|
||||
+ *
|
||||
+ * Called to obtain the set of events that will stop jobs of the given
|
||||
+ * @class, this is returned as an array of the event tree flattened into
|
||||
+ * reverse polish form.
|
||||
+ *
|
||||
+ * Each array element is an array of strings representing the events,
|
||||
+ * or a single element containing "/OR" or "/AND" to represent the
|
||||
+ * operators.
|
||||
+ *
|
||||
+ * Returns: zero on success, negative value on raised error.
|
||||
+ **/
|
||||
+int
|
||||
+job_class_get_stop_on (JobClass * class,
|
||||
+ NihDBusMessage *message,
|
||||
+ char **** stop_on)
|
||||
+{
|
||||
+ size_t len = 0;
|
||||
+
|
||||
+ nih_assert (class != NULL);
|
||||
+ nih_assert (message != NULL);
|
||||
+ nih_assert (stop_on != NULL);
|
||||
+
|
||||
+ *stop_on = nih_alloc (message, sizeof (char ***));
|
||||
+ if (! *stop_on)
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+
|
||||
+ len = 0;
|
||||
+ (*stop_on)[len] = NULL;
|
||||
+
|
||||
+ if (class->stop_on) {
|
||||
+ NIH_TREE_FOREACH_POST (&class->stop_on->node, iter) {
|
||||
+ EventOperator *oper = (EventOperator *)iter;
|
||||
+
|
||||
+ *stop_on = nih_realloc (*stop_on, message,
|
||||
+ sizeof (char ***) * (len + 2));
|
||||
+ if (! *stop_on)
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+
|
||||
+ (*stop_on)[len] = nih_str_array_new (*stop_on);
|
||||
+ if (! (*stop_on)[len])
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+
|
||||
+ switch (oper->type) {
|
||||
+ case EVENT_OR:
|
||||
+ if (! nih_str_array_add (&(*stop_on)[len], *stop_on,
|
||||
+ NULL, "/OR"))
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+ break;
|
||||
+ case EVENT_AND:
|
||||
+ if (! nih_str_array_add (&(*stop_on)[len], *stop_on,
|
||||
+ NULL, "/AND"))
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+ break;
|
||||
+ case EVENT_MATCH:
|
||||
+ if (! nih_str_array_add (&(*stop_on)[len], *stop_on,
|
||||
+ NULL, oper->name))
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+ if (oper->env)
|
||||
+ if (! nih_str_array_append (&(*stop_on)[len], *stop_on,
|
||||
+ NULL, oper->env))
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ (*stop_on)[++len] = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * job_class_get_emits:
|
||||
+ * @class: class to obtain events from,
|
||||
+ * @message: D-Bus connection and message received,
|
||||
+ * @emits: pointer for reply array.
|
||||
+ *
|
||||
+ * Implements the get method for the emits property of the
|
||||
+ * com.ubuntu.Upstart.Job interface.
|
||||
+ *
|
||||
+ * Called to obtain the list of additional events of the given @class
|
||||
+ * which will be stored as an array in @emits.
|
||||
+ *
|
||||
+ * Returns: zero on success, negative value on raised error.
|
||||
+ **/
|
||||
+int
|
||||
+job_class_get_emits (JobClass * class,
|
||||
+ NihDBusMessage *message,
|
||||
+ char *** emits)
|
||||
+{
|
||||
+ nih_assert (class != NULL);
|
||||
+ nih_assert (message != NULL);
|
||||
+ nih_assert (emits != NULL);
|
||||
+
|
||||
+ if (class->emits) {
|
||||
+ *emits = nih_str_array_copy (message, NULL, class->emits);
|
||||
+ if (! *emits)
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+ } else {
|
||||
+ *emits = nih_str_array_new (message);
|
||||
+ if (! *emits)
|
||||
+ nih_return_no_memory_error (-1);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
|
||||
=== modified file 'init/job_class.h'
|
||||
--- init/job_class.h 2010-12-13 18:15:24 +0000
|
||||
+++ init/job_class.h 2010-12-14 15:30:06 +0000
|
||||
@@ -1,6 +1,6 @@
|
||||
/* upstart
|
||||
*
|
||||
- * Copyright © 2009 Canonical Ltd.
|
||||
+ * Copyright © 2010 Canonical Ltd.
|
||||
* Author: Scott James Remnant <scott@netsplit.com>.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -220,6 +220,16 @@
|
||||
char **version)
|
||||
__attribute__ ((warn_unused_result));
|
||||
|
||||
+int job_class_get_start_on (JobClass *class,
|
||||
+ NihDBusMessage *message,
|
||||
+ char ****start_on);
|
||||
+int job_class_get_stop_on (JobClass *class,
|
||||
+ NihDBusMessage *message,
|
||||
+ char ****stop_on);
|
||||
+int job_class_get_emits (JobClass *class,
|
||||
+ NihDBusMessage *message,
|
||||
+ char ***emits);
|
||||
+
|
||||
NIH_END_EXTERN
|
||||
|
||||
#endif /* INIT_JOB_CLASS_H */
|
||||
|
||||
=== modified file 'init/tests/test_job_class.c'
|
||||
--- init/tests/test_job_class.c 2009-07-09 11:50:19 +0000
|
||||
+++ init/tests/test_job_class.c 2010-12-14 15:09:52 +0000
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* test_job_class.c - test suite for init/job_class.c
|
||||
*
|
||||
- * Copyright © 2009 Canonical Ltd.
|
||||
+ * Copyright © 2010 Canonical Ltd.
|
||||
* Author: Scott James Remnant <scott@netsplit.com>.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -3232,6 +3232,415 @@
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+test_get_start_on (void)
|
||||
+{
|
||||
+ NihDBusMessage *message = NULL;
|
||||
+ JobClass *class = NULL;
|
||||
+ EventOperator *oper = NULL;
|
||||
+ EventOperator *and_oper = NULL;
|
||||
+ NihError *error;
|
||||
+ char ***start_on;
|
||||
+ int ret;
|
||||
+
|
||||
+ TEST_FUNCTION ("job_class_get_start_on");
|
||||
+
|
||||
+ /* Check that the job's start_on tree is returned as a flattened
|
||||
+ * array of string arrays, as a child of the message.
|
||||
+ */
|
||||
+ TEST_FEATURE ("with event tree");
|
||||
+ nih_error_init ();
|
||||
+ job_class_init ();
|
||||
+
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ TEST_ALLOC_SAFE {
|
||||
+ class = job_class_new (NULL, "test");
|
||||
+
|
||||
+ class->start_on = event_operator_new (
|
||||
+ class, EVENT_OR, NULL, NULL);
|
||||
+
|
||||
+ and_oper = event_operator_new (
|
||||
+ class, EVENT_AND, NULL, NULL);
|
||||
+ nih_tree_add (&class->start_on->node, &and_oper->node,
|
||||
+ NIH_TREE_LEFT);
|
||||
+
|
||||
+ oper = event_operator_new (
|
||||
+ class->start_on, EVENT_MATCH, "foo", NULL);
|
||||
+ oper->env = nih_str_array_new (oper);
|
||||
+ NIH_MUST (nih_str_array_add (&oper->env, oper, NULL, "omnomnom"));
|
||||
+ NIH_MUST (nih_str_array_add (&oper->env, oper, NULL, "ABER=crombie"));
|
||||
+ NIH_MUST (nih_str_array_add (&oper->env, oper, NULL, "HOBBIT=frodo"));
|
||||
+
|
||||
+ nih_tree_add (&class->start_on->node, &oper->node,
|
||||
+ NIH_TREE_RIGHT);
|
||||
+
|
||||
+ oper = event_operator_new (
|
||||
+ class->start_on, EVENT_MATCH, "wibble", NULL);
|
||||
+ nih_tree_add (&and_oper->node, &oper->node,
|
||||
+ NIH_TREE_LEFT);
|
||||
+
|
||||
+ oper = event_operator_new (
|
||||
+ class->start_on, EVENT_MATCH, "wobble", NULL);
|
||||
+ nih_tree_add (&and_oper->node, &oper->node,
|
||||
+ NIH_TREE_RIGHT);
|
||||
+
|
||||
+ message = nih_new (NULL, NihDBusMessage);
|
||||
+ message->connection = NULL;
|
||||
+ message->message = NULL;
|
||||
+ }
|
||||
+
|
||||
+ start_on = NULL;
|
||||
+
|
||||
+ ret = job_class_get_start_on (class, message, &start_on);
|
||||
+
|
||||
+ if (test_alloc_failed) {
|
||||
+ TEST_LT (ret, 0);
|
||||
+
|
||||
+ error = nih_error_get ();
|
||||
+ TEST_EQ (error->number, ENOMEM);
|
||||
+ nih_free (error);
|
||||
+
|
||||
+ nih_free (message);
|
||||
+ nih_free (class);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ TEST_EQ (ret, 0);
|
||||
+
|
||||
+ TEST_ALLOC_PARENT (start_on, message);
|
||||
+ TEST_ALLOC_SIZE (start_on, sizeof (char **) * 6);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (start_on[0], sizeof (char *) * 2);
|
||||
+ TEST_EQ_STR (start_on[0][0], "wibble");
|
||||
+ TEST_EQ_P (start_on[0][1], NULL);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (start_on[1], sizeof (char *) * 2);
|
||||
+ TEST_EQ_STR (start_on[1][0], "wobble");
|
||||
+ TEST_EQ_P (start_on[1][1], NULL);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (start_on[2], sizeof (char *) * 2);
|
||||
+ TEST_EQ_STR (start_on[2][0], "/AND");
|
||||
+ TEST_EQ_P (start_on[2][1], NULL);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (start_on[3], sizeof (char *) * 5);
|
||||
+ TEST_EQ_STR (start_on[3][0], "foo");
|
||||
+ TEST_EQ_STR (start_on[3][1], "omnomnom");
|
||||
+ TEST_EQ_STR (start_on[3][2], "ABER=crombie");
|
||||
+ TEST_EQ_STR (start_on[3][3], "HOBBIT=frodo");
|
||||
+ TEST_EQ_P (start_on[3][4], NULL);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (start_on[4], sizeof (char *) * 2);
|
||||
+ TEST_EQ_STR (start_on[4][0], "/OR");
|
||||
+ TEST_EQ_P (start_on[4][1], NULL);
|
||||
+
|
||||
+ TEST_EQ_P (start_on[5], NULL);
|
||||
+
|
||||
+ nih_free (message);
|
||||
+ nih_free (class);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /* Check that an empty array is returned when the job has no
|
||||
+ * start_on operator tree.
|
||||
+ */
|
||||
+ TEST_FEATURE ("with no events");
|
||||
+ nih_error_init ();
|
||||
+ job_class_init ();
|
||||
+
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ TEST_ALLOC_SAFE {
|
||||
+ class = job_class_new (NULL, "test");
|
||||
+
|
||||
+ message = nih_new (NULL, NihDBusMessage);
|
||||
+ message->connection = NULL;
|
||||
+ message->message = NULL;
|
||||
+ }
|
||||
+
|
||||
+ start_on = NULL;
|
||||
+
|
||||
+ ret = job_class_get_start_on (class, message, &start_on);
|
||||
+
|
||||
+ if (test_alloc_failed) {
|
||||
+ TEST_LT (ret, 0);
|
||||
+
|
||||
+ error = nih_error_get ();
|
||||
+ TEST_EQ (error->number, ENOMEM);
|
||||
+ nih_free (error);
|
||||
+
|
||||
+ nih_free (message);
|
||||
+ nih_free (class);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ TEST_EQ (ret, 0);
|
||||
+
|
||||
+ TEST_ALLOC_PARENT (start_on, message);
|
||||
+ TEST_ALLOC_SIZE (start_on, sizeof (char **));
|
||||
+ TEST_EQ_P (start_on[0], NULL);
|
||||
+
|
||||
+ nih_free (message);
|
||||
+ nih_free (class);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+test_get_stop_on (void)
|
||||
+{
|
||||
+ NihDBusMessage *message = NULL;
|
||||
+ JobClass *class = NULL;
|
||||
+ EventOperator *oper = NULL;
|
||||
+ EventOperator *and_oper = NULL;
|
||||
+ NihError *error;
|
||||
+ char ***stop_on;
|
||||
+ int ret;
|
||||
+
|
||||
+ TEST_FUNCTION ("job_class_get_stop_on");
|
||||
+
|
||||
+ /* Check that the job's stop_on tree is returned as a flattened
|
||||
+ * array of string arrays, as a child of the message.
|
||||
+ */
|
||||
+ TEST_FEATURE ("with event tree");
|
||||
+ nih_error_init ();
|
||||
+ job_class_init ();
|
||||
+
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ TEST_ALLOC_SAFE {
|
||||
+ class = job_class_new (NULL, "test");
|
||||
+
|
||||
+ class->stop_on = event_operator_new (
|
||||
+ class, EVENT_OR, NULL, NULL);
|
||||
+
|
||||
+ and_oper = event_operator_new (
|
||||
+ class, EVENT_AND, NULL, NULL);
|
||||
+ nih_tree_add (&class->stop_on->node, &and_oper->node,
|
||||
+ NIH_TREE_LEFT);
|
||||
+
|
||||
+ oper = event_operator_new (
|
||||
+ class->stop_on, EVENT_MATCH, "foo", NULL);
|
||||
+ oper->env = nih_str_array_new (oper);
|
||||
+ NIH_MUST (nih_str_array_add (&oper->env, oper, NULL, "omnomnom"));
|
||||
+ NIH_MUST (nih_str_array_add (&oper->env, oper, NULL, "ABER=crombie"));
|
||||
+ NIH_MUST (nih_str_array_add (&oper->env, oper, NULL, "HOBBIT=frodo"));
|
||||
+
|
||||
+ nih_tree_add (&class->stop_on->node, &oper->node,
|
||||
+ NIH_TREE_RIGHT);
|
||||
+
|
||||
+ oper = event_operator_new (
|
||||
+ class->stop_on, EVENT_MATCH, "wibble", NULL);
|
||||
+ nih_tree_add (&and_oper->node, &oper->node,
|
||||
+ NIH_TREE_LEFT);
|
||||
+
|
||||
+ oper = event_operator_new (
|
||||
+ class->stop_on, EVENT_MATCH, "wobble", NULL);
|
||||
+ nih_tree_add (&and_oper->node, &oper->node,
|
||||
+ NIH_TREE_RIGHT);
|
||||
+
|
||||
+ message = nih_new (NULL, NihDBusMessage);
|
||||
+ message->connection = NULL;
|
||||
+ message->message = NULL;
|
||||
+ }
|
||||
+
|
||||
+ stop_on = NULL;
|
||||
+
|
||||
+ ret = job_class_get_stop_on (class, message, &stop_on);
|
||||
+
|
||||
+ if (test_alloc_failed) {
|
||||
+ TEST_LT (ret, 0);
|
||||
+
|
||||
+ error = nih_error_get ();
|
||||
+ TEST_EQ (error->number, ENOMEM);
|
||||
+ nih_free (error);
|
||||
+
|
||||
+ nih_free (message);
|
||||
+ nih_free (class);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ TEST_EQ (ret, 0);
|
||||
+
|
||||
+ TEST_ALLOC_PARENT (stop_on, message);
|
||||
+ TEST_ALLOC_SIZE (stop_on, sizeof (char **) * 6);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (stop_on[0], sizeof (char *) * 2);
|
||||
+ TEST_EQ_STR (stop_on[0][0], "wibble");
|
||||
+ TEST_EQ_P (stop_on[0][1], NULL);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (stop_on[1], sizeof (char *) * 2);
|
||||
+ TEST_EQ_STR (stop_on[1][0], "wobble");
|
||||
+ TEST_EQ_P (stop_on[1][1], NULL);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (stop_on[2], sizeof (char *) * 2);
|
||||
+ TEST_EQ_STR (stop_on[2][0], "/AND");
|
||||
+ TEST_EQ_P (stop_on[2][1], NULL);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (stop_on[3], sizeof (char *) * 5);
|
||||
+ TEST_EQ_STR (stop_on[3][0], "foo");
|
||||
+ TEST_EQ_STR (stop_on[3][1], "omnomnom");
|
||||
+ TEST_EQ_STR (stop_on[3][2], "ABER=crombie");
|
||||
+ TEST_EQ_STR (stop_on[3][3], "HOBBIT=frodo");
|
||||
+ TEST_EQ_P (stop_on[3][4], NULL);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (stop_on[4], sizeof (char *) * 2);
|
||||
+ TEST_EQ_STR (stop_on[4][0], "/OR");
|
||||
+ TEST_EQ_P (stop_on[4][1], NULL);
|
||||
+
|
||||
+ TEST_EQ_P (stop_on[5], NULL);
|
||||
+
|
||||
+ nih_free (message);
|
||||
+ nih_free (class);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /* Check that an empty array is returned when the job has no
|
||||
+ * stop_on operator tree.
|
||||
+ */
|
||||
+ TEST_FEATURE ("with no events");
|
||||
+ nih_error_init ();
|
||||
+ job_class_init ();
|
||||
+
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ TEST_ALLOC_SAFE {
|
||||
+ class = job_class_new (NULL, "test");
|
||||
+
|
||||
+ message = nih_new (NULL, NihDBusMessage);
|
||||
+ message->connection = NULL;
|
||||
+ message->message = NULL;
|
||||
+ }
|
||||
+
|
||||
+ stop_on = NULL;
|
||||
+
|
||||
+ ret = job_class_get_stop_on (class, message, &stop_on);
|
||||
+
|
||||
+ if (test_alloc_failed) {
|
||||
+ TEST_LT (ret, 0);
|
||||
+
|
||||
+ error = nih_error_get ();
|
||||
+ TEST_EQ (error->number, ENOMEM);
|
||||
+ nih_free (error);
|
||||
+
|
||||
+ nih_free (message);
|
||||
+ nih_free (class);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ TEST_EQ (ret, 0);
|
||||
+
|
||||
+ TEST_ALLOC_PARENT (stop_on, message);
|
||||
+ TEST_ALLOC_SIZE (stop_on, sizeof (char **));
|
||||
+ TEST_EQ_P (stop_on[0], NULL);
|
||||
+
|
||||
+ nih_free (message);
|
||||
+ nih_free (class);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+test_get_emits (void)
|
||||
+{
|
||||
+ NihDBusMessage *message = NULL;
|
||||
+ JobClass *class = NULL;
|
||||
+ NihError *error;
|
||||
+ char **emits;
|
||||
+ int ret;
|
||||
+
|
||||
+ TEST_FUNCTION ("job_class_get_emits");
|
||||
+
|
||||
+ /* Check that an array of strings is returned from the property
|
||||
+ * as a child of the message when the job declares that it emits
|
||||
+ * extra events.
|
||||
+ */
|
||||
+ TEST_FEATURE ("with events");
|
||||
+ nih_error_init ();
|
||||
+ job_class_init ();
|
||||
+
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ TEST_ALLOC_SAFE {
|
||||
+ class = job_class_new (NULL, "test");
|
||||
+ class->emits = nih_str_array_new (class);
|
||||
+
|
||||
+ NIH_MUST (nih_str_array_add (&class->emits, class, NULL, "foo"));
|
||||
+ NIH_MUST (nih_str_array_add (&class->emits, class, NULL, "bar"));
|
||||
+ NIH_MUST (nih_str_array_add (&class->emits, class, NULL, "baz"));
|
||||
+
|
||||
+ message = nih_new (NULL, NihDBusMessage);
|
||||
+ message->connection = NULL;
|
||||
+ message->message = NULL;
|
||||
+ }
|
||||
+
|
||||
+ emits = NULL;
|
||||
+
|
||||
+ ret = job_class_get_emits (class, message, &emits);
|
||||
+
|
||||
+ if (test_alloc_failed) {
|
||||
+ TEST_LT (ret, 0);
|
||||
+
|
||||
+ error = nih_error_get ();
|
||||
+ TEST_EQ (error->number, ENOMEM);
|
||||
+ nih_free (error);
|
||||
+
|
||||
+ nih_free (message);
|
||||
+ nih_free (class);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ TEST_EQ (ret, 0);
|
||||
+
|
||||
+ TEST_ALLOC_PARENT (emits, message);
|
||||
+ TEST_ALLOC_SIZE (emits, sizeof (char *) * 4);
|
||||
+ TEST_EQ_STR (emits[0], "foo");
|
||||
+ TEST_EQ_STR (emits[1], "bar");
|
||||
+ TEST_EQ_STR (emits[2], "baz");
|
||||
+ TEST_EQ_P (emits[3], NULL);
|
||||
+
|
||||
+ nih_free (message);
|
||||
+ nih_free (class);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /* Check that an empty array is returned from the property
|
||||
+ * as a child of the message when the job doesn't declare
|
||||
+ * any particular emitted events.
|
||||
+ */
|
||||
+ TEST_FEATURE ("with no events");
|
||||
+ nih_error_init ();
|
||||
+ job_class_init ();
|
||||
+
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ TEST_ALLOC_SAFE {
|
||||
+ class = job_class_new (NULL, "test");
|
||||
+
|
||||
+ message = nih_new (NULL, NihDBusMessage);
|
||||
+ message->connection = NULL;
|
||||
+ message->message = NULL;
|
||||
+ }
|
||||
+
|
||||
+ emits = NULL;
|
||||
+
|
||||
+ ret = job_class_get_emits (class, message, &emits);
|
||||
+
|
||||
+ if (test_alloc_failed) {
|
||||
+ TEST_LT (ret, 0);
|
||||
+
|
||||
+ error = nih_error_get ();
|
||||
+ TEST_EQ (error->number, ENOMEM);
|
||||
+ nih_free (error);
|
||||
+
|
||||
+ nih_free (message);
|
||||
+ nih_free (class);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ TEST_EQ (ret, 0);
|
||||
+
|
||||
+ TEST_ALLOC_PARENT (emits, message);
|
||||
+ TEST_ALLOC_SIZE (emits, sizeof (char *));
|
||||
+ TEST_EQ_P (emits[0], NULL);
|
||||
+
|
||||
+ nih_free (message);
|
||||
+ nih_free (class);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
@@ -3256,6 +3665,9 @@
|
||||
test_get_description ();
|
||||
test_get_author ();
|
||||
test_get_version ();
|
||||
+ test_get_start_on ();
|
||||
+ test_get_stop_on ();
|
||||
+ test_get_emits ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
=== modified file 'init/job_class.h'
|
||||
--- init/job_class.h 2011-08-11 21:02:51 +0000
|
||||
+++ init/job_class.h 2011-08-11 21:03:25 +0000
|
||||
@@ -108,7 +108,7 @@
|
||||
*
|
||||
* The default OOM score adjustment for processes.
|
||||
**/
|
||||
-#define JOB_DEFAULT_OOM_SCORE_ADJ 0
|
||||
+#define JOB_DEFAULT_OOM_SCORE_ADJ -1000
|
||||
|
||||
/**
|
||||
* JOB_DEFAULT_ENVIRONMENT:
|
||||
|
||||
@ -1,237 +0,0 @@
|
||||
=== modified file 'init/job_process.c'
|
||||
--- init/job_process.c 2011-03-22 17:46:46 +0000
|
||||
+++ init/job_process.c 2011-05-12 19:21:16 +0000
|
||||
@@ -145,7 +145,8 @@
|
||||
nih_local char *script = NULL;
|
||||
char **e;
|
||||
size_t argc, envc;
|
||||
- int error = FALSE, fds[2], trace = FALSE, shell = FALSE;
|
||||
+ int fds[2] = { -1, -1 };
|
||||
+ int error = FALSE, trace = FALSE, shell = FALSE;
|
||||
|
||||
nih_assert (job != NULL);
|
||||
|
||||
@@ -208,12 +209,9 @@
|
||||
|
||||
shell = TRUE;
|
||||
|
||||
- /* FIXME actually always want it to be /proc/self/fd/3 and
|
||||
- * dup2() in the child to make it that way ... no way
|
||||
- * of passing that yet
|
||||
- */
|
||||
cmd = NIH_MUST (nih_sprintf (argv, "%s/%d",
|
||||
- "/proc/self/fd", fds[0]));
|
||||
+ "/proc/self/fd",
|
||||
+ JOB_PROCESS_SCRIPT_FD));
|
||||
NIH_MUST (nih_str_array_addp (&argv, NULL,
|
||||
&argc, cmd));
|
||||
}
|
||||
@@ -259,7 +257,7 @@
|
||||
|
||||
/* Spawn the process, repeat until fork() works */
|
||||
while ((job->pid[process] = job_process_spawn (job->class, argv,
|
||||
- env, trace)) < 0) {
|
||||
+ env, trace, fds[0])) < 0) {
|
||||
NihError *err;
|
||||
|
||||
err = nih_error_get ();
|
||||
@@ -321,7 +319,8 @@
|
||||
* a path. Instruct the shell to close this extra fd and
|
||||
* not to leak it.
|
||||
*/
|
||||
- NIH_ZERO (nih_io_printf (io, "exec %d<&-\n", fds[0]));
|
||||
+ NIH_ZERO (nih_io_printf (io, "exec %d<&-\n",
|
||||
+ JOB_PROCESS_SCRIPT_FD));
|
||||
|
||||
NIH_ZERO (nih_io_write (io, script, strlen (script)));
|
||||
nih_io_shutdown (io);
|
||||
@@ -336,7 +335,8 @@
|
||||
* @class: job class of process to be spawned,
|
||||
* @argv: NULL-terminated list of arguments for the process,
|
||||
* @env: NULL-terminated list of environment variables for the process,
|
||||
- * @trace: whether to trace this process.
|
||||
+ * @trace: whether to trace this process,
|
||||
+ * @script_fd: script file descriptor.
|
||||
*
|
||||
* This function spawns a new process using the @class details to set up the
|
||||
* environment for it; the process is always a session and process group
|
||||
@@ -352,6 +352,9 @@
|
||||
* wait for this and then may use it to set options before continuing the
|
||||
* process.
|
||||
*
|
||||
+ * If @script_fd is not -1, this file descriptor is dup()d to the special fd 9
|
||||
+ * (moving any other out of the way if necessary).
|
||||
+ *
|
||||
* This function only spawns the process, it is up to the caller to ensure
|
||||
* that the information is saved into the job and that the process is watched,
|
||||
* etc.
|
||||
@@ -367,7 +370,8 @@
|
||||
job_process_spawn (JobClass *class,
|
||||
char * const argv[],
|
||||
char * const *env,
|
||||
- int trace)
|
||||
+ int trace,
|
||||
+ int script_fd)
|
||||
{
|
||||
sigset_t child_set, orig_set;
|
||||
pid_t pid;
|
||||
@@ -433,8 +437,26 @@
|
||||
* far because read() returned zero.
|
||||
*/
|
||||
close (fds[0]);
|
||||
+ if (fds[1] == JOB_PROCESS_SCRIPT_FD) {
|
||||
+ int tmp = dup2 (fds[1], fds[0]);
|
||||
+ if (tmp < 0)
|
||||
+ job_process_error_abort (fds[1], JOB_PROCESS_ERROR_DUP, 0);
|
||||
+ close (fds[1]);
|
||||
+ fds[1] = tmp;
|
||||
+ }
|
||||
nih_io_set_cloexec (fds[1]);
|
||||
|
||||
+ /* Move the script fd to special fd 9; the only gotcha is if that
|
||||
+ * would be our error descriptor, but that's handled above.
|
||||
+ */
|
||||
+ if ((script_fd != -1) && (script_fd != JOB_PROCESS_SCRIPT_FD)) {
|
||||
+ int tmp = dup2 (script_fd, JOB_PROCESS_SCRIPT_FD);
|
||||
+ if (tmp < 0)
|
||||
+ job_process_error_abort (fds[1], JOB_PROCESS_ERROR_DUP, 0);
|
||||
+ close (script_fd);
|
||||
+ script_fd = tmp;
|
||||
+ }
|
||||
+
|
||||
/* Become the leader of a new session and process group, shedding
|
||||
* any controlling tty (which we shouldn't have had anyway).
|
||||
*/
|
||||
@@ -664,6 +684,11 @@
|
||||
err->error.number = JOB_PROCESS_ERROR;
|
||||
|
||||
switch (err->type) {
|
||||
+ case JOB_PROCESS_ERROR_DUP:
|
||||
+ err->error.message = NIH_MUST (nih_sprintf (
|
||||
+ err, _("unable to move script fd: %s"),
|
||||
+ strerror (err->errnum)));
|
||||
+ break;
|
||||
case JOB_PROCESS_ERROR_CONSOLE:
|
||||
err->error.message = NIH_MUST (nih_sprintf (
|
||||
err, _("unable to open console: %s"),
|
||||
|
||||
=== modified file 'init/job_process.h'
|
||||
--- init/job_process.h 2009-07-09 11:01:53 +0000
|
||||
+++ init/job_process.h 2011-05-12 19:21:16 +0000
|
||||
@@ -1,5 +1,6 @@
|
||||
/* upstart
|
||||
*
|
||||
+ * Copyright © 2011 Google Inc.
|
||||
* Copyright © 2009 Canonical Ltd.
|
||||
* Author: Scott James Remnant <scott@netsplit.com>.
|
||||
*
|
||||
@@ -32,12 +33,23 @@
|
||||
|
||||
|
||||
/**
|
||||
+ * JOB_PROCESS_SCRIPT_FD:
|
||||
+ *
|
||||
+ * The special fd used to pass the script to the shell process, this can be
|
||||
+ * anything from 3-9 (0-2 are stdin/out/err, 10 and above aren't guaranteed
|
||||
+ * by POSIX).
|
||||
+ **/
|
||||
+#define JOB_PROCESS_SCRIPT_FD 9
|
||||
+
|
||||
+
|
||||
+/**
|
||||
* JobProcessErrorType:
|
||||
*
|
||||
* These constants represent the different steps of process spawning that
|
||||
* can produce an error.
|
||||
**/
|
||||
typedef enum job_process_error_type {
|
||||
+ JOB_PROCESS_ERROR_DUP,
|
||||
JOB_PROCESS_ERROR_CONSOLE,
|
||||
JOB_PROCESS_ERROR_RLIMIT,
|
||||
JOB_PROCESS_ERROR_PRIORITY,
|
||||
@@ -80,7 +92,7 @@
|
||||
int job_process_run (Job *job, ProcessType process);
|
||||
|
||||
pid_t job_process_spawn (JobClass *class, char * const argv[],
|
||||
- char * const *env, int trace)
|
||||
+ char * const *env, int trace, int script_fd)
|
||||
__attribute__ ((warn_unused_result));
|
||||
|
||||
void job_process_kill (Job *job, ProcessType process);
|
||||
|
||||
=== modified file 'init/tests/test_job_process.c'
|
||||
--- init/tests/test_job_process.c 2011-03-16 22:18:22 +0000
|
||||
+++ init/tests/test_job_process.c 2011-05-12 19:21:16 +0000
|
||||
@@ -822,7 +822,7 @@
|
||||
|
||||
class = job_class_new (NULL, "test");
|
||||
|
||||
- pid = job_process_spawn (class, args, NULL, FALSE);
|
||||
+ pid = job_process_spawn (class, args, NULL, FALSE, -1);
|
||||
TEST_GT (pid, 0);
|
||||
|
||||
waitpid (pid, NULL, 0);
|
||||
@@ -860,7 +860,7 @@
|
||||
class = job_class_new (NULL, "test");
|
||||
class->console = CONSOLE_NONE;
|
||||
|
||||
- pid = job_process_spawn (class, args, NULL, FALSE);
|
||||
+ pid = job_process_spawn (class, args, NULL, FALSE, -1);
|
||||
TEST_GT (pid, 0);
|
||||
|
||||
waitpid (pid, NULL, 0);
|
||||
@@ -886,7 +886,7 @@
|
||||
class = job_class_new (NULL, "test");
|
||||
class->chdir = "/tmp";
|
||||
|
||||
- pid = job_process_spawn (class, args, NULL, FALSE);
|
||||
+ pid = job_process_spawn (class, args, NULL, FALSE, -1);
|
||||
TEST_GT (pid, 0);
|
||||
|
||||
waitpid (pid, NULL, 0);
|
||||
@@ -914,7 +914,7 @@
|
||||
|
||||
class = job_class_new (NULL, "test");
|
||||
|
||||
- pid = job_process_spawn (class, args, env, FALSE);
|
||||
+ pid = job_process_spawn (class, args, env, FALSE, -1);
|
||||
TEST_GT (pid, 0);
|
||||
|
||||
waitpid (pid, NULL, 0);
|
||||
@@ -939,7 +939,7 @@
|
||||
|
||||
class = job_class_new (NULL, "test");
|
||||
|
||||
- pid = job_process_spawn (class, args, NULL, FALSE);
|
||||
+ pid = job_process_spawn (class, args, NULL, FALSE, -1);
|
||||
TEST_GT (pid, 0);
|
||||
|
||||
assert0 (waitid (P_PID, pid, &info, WEXITED | WSTOPPED | WCONTINUED));
|
||||
@@ -959,7 +959,7 @@
|
||||
|
||||
class = job_class_new (NULL, "test");
|
||||
|
||||
- pid = job_process_spawn (class, args, NULL, TRUE);
|
||||
+ pid = job_process_spawn (class, args, NULL, TRUE, -1);
|
||||
TEST_GT (pid, 0);
|
||||
|
||||
assert0 (waitid (P_PID, pid, &info, WEXITED | WSTOPPED | WCONTINUED));
|
||||
@@ -988,7 +988,7 @@
|
||||
|
||||
class = job_class_new (NULL, "test");
|
||||
|
||||
- pid = job_process_spawn (class, args, NULL, FALSE);
|
||||
+ pid = job_process_spawn (class, args, NULL, FALSE, -1);
|
||||
TEST_LT (pid, 0);
|
||||
|
||||
err = nih_error_get ();
|
||||
@@ -1013,7 +1013,7 @@
|
||||
args[1] = function;
|
||||
args[2] = NULL;
|
||||
|
||||
- pid = job_process_spawn (class, args, NULL, FALSE);
|
||||
+ pid = job_process_spawn (class, args, NULL, FALSE, -1);
|
||||
TEST_GT (pid, 0);
|
||||
|
||||
/* Ensure process is still running after some period of time.
|
||||
|
||||
@ -1,488 +0,0 @@
|
||||
=== modified file 'init/errors.h'
|
||||
--- init/errors.h 2011-05-05 10:13:49 +0000
|
||||
+++ init/errors.h 2011-05-12 20:42:28 +0000
|
||||
@@ -40,6 +40,7 @@
|
||||
/* Errors while parsing configuration files */
|
||||
PARSE_ILLEGAL_INTERVAL,
|
||||
PARSE_ILLEGAL_EXIT,
|
||||
+ PARSE_ILLEGAL_SIGNAL,
|
||||
PARSE_ILLEGAL_UMASK,
|
||||
PARSE_ILLEGAL_NICE,
|
||||
PARSE_ILLEGAL_OOM,
|
||||
@@ -60,6 +61,7 @@
|
||||
#define ENVIRON_MISMATCHED_BRACES_STR N_("Mismatched braces")
|
||||
#define PARSE_ILLEGAL_INTERVAL_STR N_("Illegal interval, expected number of seconds")
|
||||
#define PARSE_ILLEGAL_EXIT_STR N_("Illegal exit status, expected integer")
|
||||
+#define PARSE_ILLEGAL_SIGNAL_STR N_("Illegal signal status, expected integer")
|
||||
#define PARSE_ILLEGAL_UMASK_STR N_("Illegal file creation mask, expected octal integer")
|
||||
#define PARSE_ILLEGAL_NICE_STR N_("Illegal nice value, expected -20 to 19")
|
||||
#define PARSE_ILLEGAL_OOM_STR N_("Illegal oom adjustment, expected -16 to 15 or 'never'")
|
||||
|
||||
=== modified file 'init/job_class.c'
|
||||
--- init/job_class.c 2011-05-05 10:13:49 +0000
|
||||
+++ init/job_class.c 2011-05-12 20:42:28 +0000
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
+#include <signal.h>
|
||||
|
||||
#include <nih/macros.h>
|
||||
#include <nih/alloc.h>
|
||||
@@ -199,6 +200,7 @@
|
||||
class->task = FALSE;
|
||||
|
||||
class->kill_timeout = JOB_DEFAULT_KILL_TIMEOUT;
|
||||
+ class->kill_signal = SIGTERM;
|
||||
|
||||
class->respawn = FALSE;
|
||||
class->respawn_limit = JOB_DEFAULT_RESPAWN_LIMIT;
|
||||
|
||||
=== modified file 'init/job_class.h'
|
||||
--- init/job_class.h 2011-05-12 19:31:50 +0000
|
||||
+++ init/job_class.h 2011-05-12 20:42:28 +0000
|
||||
@@ -85,6 +85,7 @@
|
||||
* @expect: what to expect before entering the next state after spawned,
|
||||
* @task: start requests are not unblocked until instances have finished,
|
||||
* @kill_timeout: time to wait between sending TERM and KILL signals,
|
||||
+ * @kill_signal: first signal to send (usually SIGTERM),
|
||||
* @respawn: instances should be restarted if main process fails,
|
||||
* @respawn_limit: number of respawns in @respawn_interval that we permit,
|
||||
* @respawn_interval: barrier for @respawn_limit,
|
||||
@@ -129,6 +130,7 @@
|
||||
int task;
|
||||
|
||||
time_t kill_timeout;
|
||||
+ int kill_signal;
|
||||
|
||||
int respawn;
|
||||
int respawn_limit;
|
||||
|
||||
=== modified file 'init/job_process.c'
|
||||
--- init/job_process.c 2011-05-12 19:31:50 +0000
|
||||
+++ init/job_process.c 2011-05-12 20:42:28 +0000
|
||||
@@ -802,9 +802,9 @@
|
||||
* @process: process to be killed.
|
||||
*
|
||||
* This function forces a @job to leave its current state by sending
|
||||
- * @process the TERM signal, and maybe later the KILL signal. The actual
|
||||
- * state changes are performed by job_child_reaper when the process
|
||||
- * has actually terminated.
|
||||
+ * @process the "kill signal" defined signal (TERM by default), and maybe
|
||||
+ * later the KILL signal. The actual state changes are performed by
|
||||
+ * job_child_reaper when the process has actually terminated.
|
||||
**/
|
||||
void
|
||||
job_process_kill (Job *job,
|
||||
@@ -815,15 +815,17 @@
|
||||
nih_assert (job->kill_timer == NULL);
|
||||
nih_assert (job->kill_process = -1);
|
||||
|
||||
- nih_info (_("Sending TERM signal to %s %s process (%d)"),
|
||||
+ nih_info (_("Sending %s signal to %s %s process (%d)"),
|
||||
+ nih_signal_to_name (job->class->kill_signal),
|
||||
job_name (job), process_name (process), job->pid[process]);
|
||||
|
||||
- if (system_kill (job->pid[process], FALSE) < 0) {
|
||||
+ if (system_kill (job->pid[process], job->class->kill_signal) < 0) {
|
||||
NihError *err;
|
||||
|
||||
err = nih_error_get ();
|
||||
if (err->number != ESRCH)
|
||||
- nih_warn (_("Failed to send TERM signal to %s %s process (%d): %s"),
|
||||
+ nih_warn (_("Failed to send %s signal to %s %s process (%d): %s"),
|
||||
+ nih_signal_to_name (job->class->kill_signal),
|
||||
job_name (job), process_name (process),
|
||||
job->pid[process], err->message);
|
||||
nih_free (err);
|
||||
@@ -863,15 +865,17 @@
|
||||
job->kill_timer = NULL;
|
||||
job->kill_process = -1;
|
||||
|
||||
- nih_info (_("Sending KILL signal to %s %s process (%d)"),
|
||||
+ nih_info (_("Sending %s signal to %s %s process (%d)"),
|
||||
+ "KILL",
|
||||
job_name (job), process_name (process), job->pid[process]);
|
||||
|
||||
- if (system_kill (job->pid[process], TRUE) < 0) {
|
||||
+ if (system_kill (job->pid[process], SIGKILL) < 0) {
|
||||
NihError *err;
|
||||
|
||||
err = nih_error_get ();
|
||||
if (err->number != ESRCH)
|
||||
- nih_warn (_("Failed to send KILL signal to %s %s process (%d): %s"),
|
||||
+ nih_warn (_("Failed to send %s signal to %s %s process (%d): %s"),
|
||||
+ "KILL",
|
||||
job_name (job), process_name (process),
|
||||
job->pid[process], err->message);
|
||||
nih_free (err);
|
||||
|
||||
=== modified file 'init/man/init.5'
|
||||
--- init/man/init.5 2011-05-12 19:31:50 +0000
|
||||
+++ init/man/init.5 2011-05-12 20:42:28 +0000
|
||||
@@ -563,10 +563,20 @@
|
||||
.\"
|
||||
.SS Miscellaneous
|
||||
.TP
|
||||
+.B kill signal \fISIGNAL
|
||||
+Specifies the stopping signal,
|
||||
+.I SIGTERM
|
||||
+by default, a job's main process will receive when stopping the
|
||||
+running job.
|
||||
+
|
||||
+.nf
|
||||
+kill signal INT
|
||||
+.fi
|
||||
+.\"
|
||||
+.TP
|
||||
.B kill timeout \fIINTERVAL
|
||||
Specifies the interval between sending the job's main process the
|
||||
-.I SIGTERM
|
||||
-and
|
||||
+"stopping" (see above) and
|
||||
.I SIGKILL
|
||||
signals when stopping the running job.
|
||||
.\"
|
||||
|
||||
=== modified file 'init/parse_job.c'
|
||||
--- init/parse_job.c 2011-05-12 19:31:50 +0000
|
||||
+++ init/parse_job.c 2011-05-12 20:42:28 +0000
|
||||
@@ -1782,6 +1782,7 @@
|
||||
{
|
||||
size_t a_pos, a_lineno;
|
||||
int ret = -1;
|
||||
+ char *endptr;
|
||||
nih_local char *arg = NULL;
|
||||
|
||||
nih_assert (class != NULL);
|
||||
@@ -1799,7 +1800,6 @@
|
||||
|
||||
if (! strcmp (arg, "timeout")) {
|
||||
nih_local char *timearg = NULL;
|
||||
- char *endptr;
|
||||
|
||||
/* Update error position to the timeout value */
|
||||
*pos = a_pos;
|
||||
@@ -1816,14 +1816,40 @@
|
||||
if (errno || *endptr || (class->kill_timeout < 0))
|
||||
nih_return_error (-1, PARSE_ILLEGAL_INTERVAL,
|
||||
_(PARSE_ILLEGAL_INTERVAL_STR));
|
||||
-
|
||||
- ret = nih_config_skip_comment (file, len, &a_pos, &a_lineno);
|
||||
-
|
||||
+ } else if (! strcmp (arg, "signal")) {
|
||||
+ unsigned long status;
|
||||
+ nih_local char *sigarg = NULL;
|
||||
+ int signal;
|
||||
+
|
||||
+ /* Update error position to the exit status */
|
||||
+ *pos = a_pos;
|
||||
+ if (lineno)
|
||||
+ *lineno = a_lineno;
|
||||
+
|
||||
+ sigarg = nih_config_next_arg (NULL, file, len, &a_pos,
|
||||
+ &a_lineno);
|
||||
+
|
||||
+ if (! sigarg)
|
||||
+ goto finish;
|
||||
+
|
||||
+ signal = nih_signal_from_name (sigarg);
|
||||
+ if (signal < 0) {
|
||||
+ errno = 0;
|
||||
+ status = strtoul (sigarg, &endptr, 10);
|
||||
+ if (errno || *endptr || (status > INT_MAX))
|
||||
+ nih_return_error (-1, PARSE_ILLEGAL_SIGNAL,
|
||||
+ _(PARSE_ILLEGAL_SIGNAL_STR));
|
||||
+ }
|
||||
+
|
||||
+ /* Set the signal */
|
||||
+ class->kill_signal = signal;
|
||||
} else {
|
||||
nih_return_error (-1, NIH_CONFIG_UNKNOWN_STANZA,
|
||||
_(NIH_CONFIG_UNKNOWN_STANZA_STR));
|
||||
}
|
||||
|
||||
+ ret = nih_config_skip_comment (file, len, &a_pos, &a_lineno);
|
||||
+
|
||||
finish:
|
||||
*pos = a_pos;
|
||||
if (lineno)
|
||||
|
||||
=== modified file 'init/system.c'
|
||||
--- init/system.c 2010-02-26 15:29:07 +0000
|
||||
+++ init/system.c 2011-05-12 20:42:28 +0000
|
||||
@@ -48,27 +48,21 @@
|
||||
/**
|
||||
* system_kill:
|
||||
* @pid: process id of process,
|
||||
- * @force: force the death.
|
||||
- *
|
||||
- * Kill all processes in the same process group as @pid, which may not
|
||||
- * necessarily be the group leader.
|
||||
- *
|
||||
- * When @force is FALSE, the TERM signal is sent; when it is TRUE, KILL
|
||||
- * is sent instead.
|
||||
+ * @signal: signal to send.
|
||||
+ *
|
||||
+ * Send all processes in the same process group as @pid, which may not
|
||||
+ * necessarily be the group leader the @signal.
|
||||
*
|
||||
* Returns: zero on success, negative value on raised error.
|
||||
**/
|
||||
int
|
||||
system_kill (pid_t pid,
|
||||
- int force)
|
||||
+ int signal)
|
||||
{
|
||||
- int signal;
|
||||
pid_t pgid;
|
||||
|
||||
nih_assert (pid > 0);
|
||||
|
||||
- signal = (force ? SIGKILL : SIGTERM);
|
||||
-
|
||||
pgid = getpgid (pid);
|
||||
|
||||
if (kill (pgid > 0 ? -pgid : pid, signal) < 0)
|
||||
|
||||
=== modified file 'init/system.h'
|
||||
--- init/system.h 2010-02-26 15:29:07 +0000
|
||||
+++ init/system.h 2011-05-12 20:42:28 +0000
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
NIH_BEGIN_EXTERN
|
||||
|
||||
-int system_kill (pid_t pid, int force)
|
||||
+int system_kill (pid_t pid, int signal)
|
||||
__attribute__ ((warn_unused_result));
|
||||
|
||||
int system_setup_console (ConsoleType type, int reset)
|
||||
|
||||
=== modified file 'init/tests/test_job_class.c'
|
||||
--- init/tests/test_job_class.c 2011-05-05 10:13:49 +0000
|
||||
+++ init/tests/test_job_class.c 2011-05-12 20:42:28 +0000
|
||||
@@ -121,6 +121,7 @@
|
||||
TEST_EQ (class->task, FALSE);
|
||||
|
||||
TEST_EQ (class->kill_timeout, 5);
|
||||
+ TEST_EQ (class->kill_signal, SIGTERM);
|
||||
|
||||
TEST_EQ (class->respawn, FALSE);
|
||||
TEST_EQ (class->respawn_limit, 10);
|
||||
|
||||
=== modified file 'init/tests/test_parse_job.c'
|
||||
--- init/tests/test_parse_job.c 2011-05-12 19:31:50 +0000
|
||||
+++ init/tests/test_parse_job.c 2011-05-12 20:42:28 +0000
|
||||
@@ -4799,6 +4799,39 @@
|
||||
}
|
||||
|
||||
|
||||
+ /* Check that a kill stanza with the signal argument and signal,
|
||||
+ * sets the right signal on the jobs class.
|
||||
+ */
|
||||
+ TEST_FEATURE ("with signal and single argument");
|
||||
+ strcpy (buf, "kill signal INT\n");
|
||||
+
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf),
|
||||
+ &pos, &lineno);
|
||||
+
|
||||
+ if (test_alloc_failed) {
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, ENOMEM);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ TEST_EQ (pos, strlen (buf));
|
||||
+ TEST_EQ (lineno, 2);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (job, sizeof (JobClass));
|
||||
+
|
||||
+ TEST_EQ (job->kill_signal, SIGINT);
|
||||
+
|
||||
+ nih_free (job);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
/* Check that the last of multiple kill stanzas is used.
|
||||
*/
|
||||
TEST_FEATURE ("with multiple timeout and single argument stanzas");
|
||||
@@ -4832,6 +4865,37 @@
|
||||
}
|
||||
|
||||
|
||||
+ TEST_FEATURE ("with multiple signal and single argument stanzas");
|
||||
+ strcpy (buf, "kill signal INT\n");
|
||||
+ strcat (buf, "kill signal TERM\n");
|
||||
+
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf),
|
||||
+ &pos, &lineno);
|
||||
+
|
||||
+ if (test_alloc_failed) {
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, ENOMEM);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ TEST_EQ (pos, strlen (buf));
|
||||
+ TEST_EQ (lineno, 3);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (job, sizeof (JobClass));
|
||||
+
|
||||
+ TEST_EQ (job->kill_signal, SIGTERM);
|
||||
+
|
||||
+ nih_free (job);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
/* Check that a kill stanza without an argument results in a syntax
|
||||
* error.
|
||||
*/
|
||||
@@ -4889,6 +4953,25 @@
|
||||
nih_free (err);
|
||||
|
||||
|
||||
+ /* Check that a kill stanza with the timeout argument but no timeout
|
||||
+ * results in a syntax error.
|
||||
+ */
|
||||
+ TEST_FEATURE ("with signal and missing argument");
|
||||
+ strcpy (buf, "kill signal\n");
|
||||
+
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);
|
||||
+
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, NIH_CONFIG_EXPECTED_TOKEN);
|
||||
+ TEST_EQ (pos, 11);
|
||||
+ TEST_EQ (lineno, 1);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+
|
||||
/* Check that a kill timeout stanza with a non-integer argument
|
||||
* results in a syntax error.
|
||||
*/
|
||||
@@ -4965,6 +5048,25 @@
|
||||
nih_free (err);
|
||||
|
||||
|
||||
+ /* Check that a kill signal stanza with an unknown signal argument
|
||||
+ * results in a syntax error.
|
||||
+ */
|
||||
+ TEST_FEATURE ("with signal and unknown signal argument");
|
||||
+ strcpy (buf, "kill signal foo\n");
|
||||
+
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);
|
||||
+
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, PARSE_ILLEGAL_SIGNAL);
|
||||
+ TEST_EQ (pos, 12);
|
||||
+ TEST_EQ (lineno, 1);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+
|
||||
/* Check that a kill stanza with the timeout argument and timeout,
|
||||
* but with an extra argument afterwards results in a syntax
|
||||
* error.
|
||||
@@ -4983,6 +5085,26 @@
|
||||
TEST_EQ (pos, 16);
|
||||
TEST_EQ (lineno, 1);
|
||||
nih_free (err);
|
||||
+
|
||||
+
|
||||
+ /* Check that a kill stanza with the signal argument and signal,
|
||||
+ * but with an extra argument afterwards results in a syntax
|
||||
+ * error.
|
||||
+ */
|
||||
+ TEST_FEATURE ("with signal and extra argument");
|
||||
+ strcpy (buf, "kill signal INT foo\n");
|
||||
+
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);
|
||||
+
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, NIH_CONFIG_UNEXPECTED_TOKEN);
|
||||
+ TEST_EQ (pos, 16);
|
||||
+ TEST_EQ (lineno, 1);
|
||||
+ nih_free (err);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
=== modified file 'init/tests/test_system.c'
|
||||
--- init/tests/test_system.c 2009-06-23 09:29:35 +0000
|
||||
+++ init/tests/test_system.c 2011-05-12 20:42:28 +0000
|
||||
@@ -51,7 +51,7 @@
|
||||
setpgid (pid1, pid1);
|
||||
setpgid (pid2, pid1);
|
||||
|
||||
- ret = system_kill (pid1, FALSE);
|
||||
+ ret = system_kill (pid1, SIGTERM);
|
||||
waitpid (pid1, &status, 0);
|
||||
|
||||
TEST_EQ (ret, 0);
|
||||
@@ -79,7 +79,7 @@
|
||||
setpgid (pid1, pid1);
|
||||
setpgid (pid2, pid1);
|
||||
|
||||
- ret = system_kill (pid1, TRUE);
|
||||
+ ret = system_kill (pid1, SIGKILL);
|
||||
waitpid (pid1, &status, 0);
|
||||
|
||||
TEST_EQ (ret, 0);
|
||||
@@ -114,7 +114,7 @@
|
||||
kill (pid1, SIGTERM);
|
||||
waitpid (pid1, &status, 0);
|
||||
|
||||
- ret = system_kill (pid2, FALSE);
|
||||
+ ret = system_kill (pid2, SIGTERM);
|
||||
waitpid (pid2, &status, 0);
|
||||
|
||||
TEST_EQ (ret, 0);
|
||||
|
||||
=== modified file 'po/ChangeLog'
|
||||
--- po/ChangeLog 2011-03-17 01:03:01 +0000
|
||||
+++ po/ChangeLog 2011-05-12 20:42:28 +0000
|
||||
@@ -1,3 +1,7 @@
|
||||
+2011-05-12 Marc - A. Dahlhaus <mad@wol.de>
|
||||
+
|
||||
+ * POTFILES.in: Add errors.h
|
||||
+
|
||||
2011-03-16 Scott James Remnant <scott@netsplit.com>
|
||||
|
||||
* Makevars.template (COPYRIGHT_HOLDER): Update copyright.
|
||||
|
||||
=== modified file 'po/POTFILES.in'
|
||||
--- po/POTFILES.in 2010-02-04 03:42:29 +0000
|
||||
+++ po/POTFILES.in 2011-05-05 09:06:21 +0000
|
||||
@@ -3,6 +3,7 @@
|
||||
init/conf.c
|
||||
init/control.c
|
||||
init/environ.c
|
||||
+init/errors.h
|
||||
init/event.c
|
||||
init/event_operator.c
|
||||
init/job.c
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
=== modified file 'init/main.c'
|
||||
--- init/main.c 2010-12-13 18:15:24 +0000
|
||||
+++ init/main.c 2011-02-07 22:08:27 +0000
|
||||
@@ -314,6 +315,7 @@
|
||||
if (system_setup_console (CONSOLE_NONE, FALSE) < 0)
|
||||
nih_free (nih_error_get ());
|
||||
|
||||
+ nih_log_set_priority (NIH_LOG_INFO);
|
||||
nih_log_set_logger (logger_kmsg);
|
||||
#endif /* DEBUG */
|
||||
|
||||
@ -1,38 +0,0 @@
|
||||
=== modified file 'init/event_operator.c'
|
||||
--- init/event_operator.c 2010-11-19 14:34:51 +0000
|
||||
+++ init/event_operator.c 2012-08-10 20:16:45 +0000
|
||||
@@ -326,7 +326,7 @@
|
||||
* matches and no such variable.
|
||||
*/
|
||||
if (! (eenv && *eenv))
|
||||
- return FALSE;
|
||||
+ return negate;
|
||||
|
||||
/* Grab the value out by looking for the equals, we don't
|
||||
* care about the name if we're positional and we've already
|
||||
|
||||
=== modified file 'init/tests/test_event_operator.c'
|
||||
--- init/tests/test_event_operator.c 2010-02-04 20:08:59 +0000
|
||||
+++ init/tests/test_event_operator.c 2012-08-10 20:16:17 +0000
|
||||
@@ -763,6 +763,20 @@
|
||||
TEST_FALSE (event_operator_match (oper, event, NULL));
|
||||
|
||||
|
||||
+ /* Check that unknown variable names match when negated. */
|
||||
+ TEST_FEATURE ("with unknown variable in operator");
|
||||
+ event->env = env1;
|
||||
+ event->env[0] = "FRODO=foo";
|
||||
+ event->env[1] = "BILBO=bar";
|
||||
+ event->env[2] = NULL;
|
||||
+
|
||||
+ oper->env = env2;
|
||||
+ oper->env[0] = "MERRY!=baz";
|
||||
+ oper->env[1] = NULL;
|
||||
+
|
||||
+ TEST_TRUE (event_operator_match (oper, event, NULL));
|
||||
+
|
||||
+
|
||||
/* Check that the operator environment may be globs. */
|
||||
TEST_FEATURE ("with globs in operator environment");
|
||||
event->env = env1;
|
||||
|
||||
@ -1,744 +0,0 @@
|
||||
=== modified file 'init/errors.h'
|
||||
--- init/errors.h 2009-06-23 09:29:35 +0000
|
||||
+++ init/errors.h 2011-08-11 20:56:28 +0000
|
||||
@@ -62,7 +62,8 @@
|
||||
#define PARSE_ILLEGAL_EXIT_STR N_("Illegal exit status, expected integer")
|
||||
#define PARSE_ILLEGAL_UMASK_STR N_("Illegal file creation mask, expected octal integer")
|
||||
#define PARSE_ILLEGAL_NICE_STR N_("Illegal nice value, expected -20 to 19")
|
||||
-#define PARSE_ILLEGAL_OOM_STR N_("Illegal oom adjustment, expected -16 to 15 or never")
|
||||
+#define PARSE_ILLEGAL_OOM_STR N_("Illegal oom adjustment, expected -16 to 15 or 'never'")
|
||||
+#define PARSE_ILLEGAL_OOM_SCORE_STR N_("Illegal oom score adjustment, expected -999 to 1000 or 'never'")
|
||||
#define PARSE_ILLEGAL_LIMIT_STR N_("Illegal limit, expected 'unlimited' or integer")
|
||||
#define PARSE_EXPECTED_EVENT_STR N_("Expected event")
|
||||
#define PARSE_EXPECTED_OPERATOR_STR N_("Expected operator")
|
||||
|
||||
=== modified file 'init/job_class.c'
|
||||
--- init/job_class.c 2010-12-14 15:30:06 +0000
|
||||
+++ init/job_class.c 2011-08-11 21:00:44 +0000
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* job_class.c - job class definition handling
|
||||
*
|
||||
- * Copyright © 2010 Canonical Ltd.
|
||||
+ * Copyright © 2011 Canonical Ltd.
|
||||
* Author: Scott James Remnant <scott@netsplit.com>.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -55,48 +55,6 @@
|
||||
#include "com.ubuntu.Upstart.Job.h"
|
||||
|
||||
|
||||
-/**
|
||||
- * JOB_DEFAULT_KILL_TIMEOUT:
|
||||
- *
|
||||
- * The default length of time to wait after sending a process the TERM
|
||||
- * signal before sending the KILL signal if it hasn't terminated.
|
||||
- **/
|
||||
-#define JOB_DEFAULT_KILL_TIMEOUT 5
|
||||
-
|
||||
-/**
|
||||
- * JOB_DEFAULT_RESPAWN_LIMIT:
|
||||
- *
|
||||
- * The default number of times in JOB_DEFAULT_RESPAWN_INTERVAL seconds that
|
||||
- * we permit a process to respawn before stoping it
|
||||
- **/
|
||||
-#define JOB_DEFAULT_RESPAWN_LIMIT 10
|
||||
-
|
||||
-/**
|
||||
- * JOB_DEFAULT_RESPAWN_INTERVAL:
|
||||
- *
|
||||
- * The default number of seconds before resetting the respawn timer.
|
||||
- **/
|
||||
-#define JOB_DEFAULT_RESPAWN_INTERVAL 5
|
||||
-
|
||||
-/**
|
||||
- * JOB_DEFAULT_UMASK:
|
||||
- *
|
||||
- * The default file creation mark for processes.
|
||||
- **/
|
||||
-#define JOB_DEFAULT_UMASK 022
|
||||
-
|
||||
-/**
|
||||
- * JOB_DEFAULT_ENVIRONMENT:
|
||||
- *
|
||||
- * Environment variables to always copy from our own environment, these
|
||||
- * can be overriden in the job definition or by events since they have the
|
||||
- * lowest priority.
|
||||
- **/
|
||||
-#define JOB_DEFAULT_ENVIRONMENT \
|
||||
- "PATH", \
|
||||
- "TERM"
|
||||
-
|
||||
-
|
||||
/* Prototypes for static functions */
|
||||
static void job_class_add (JobClass *class);
|
||||
static int job_class_remove (JobClass *class);
|
||||
@@ -210,8 +168,8 @@
|
||||
class->console = CONSOLE_NONE;
|
||||
|
||||
class->umask = JOB_DEFAULT_UMASK;
|
||||
- class->nice = 0;
|
||||
- class->oom_adj = 0;
|
||||
+ class->nice = JOB_DEFAULT_NICE;
|
||||
+ class->oom_score_adj = JOB_DEFAULT_OOM_SCORE_ADJ;
|
||||
|
||||
for (i = 0; i < RLIMIT_NLIMITS; i++)
|
||||
class->limits[i] = NULL;
|
||||
|
||||
=== modified file 'init/job_class.h'
|
||||
--- init/job_class.h 2010-12-14 15:30:06 +0000
|
||||
+++ init/job_class.h 2011-08-11 20:59:46 +0000
|
||||
@@ -1,6 +1,6 @@
|
||||
/* upstart
|
||||
*
|
||||
- * Copyright © 2010 Canonical Ltd.
|
||||
+ * Copyright © 2011 Canonical Ltd.
|
||||
* Author: Scott James Remnant <scott@netsplit.com>.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -67,6 +67,62 @@
|
||||
|
||||
|
||||
/**
|
||||
+ * JOB_DEFAULT_KILL_TIMEOUT:
|
||||
+ *
|
||||
+ * The default length of time to wait after sending a process the TERM
|
||||
+ * signal before sending the KILL signal if it hasn't terminated.
|
||||
+ **/
|
||||
+#define JOB_DEFAULT_KILL_TIMEOUT 5
|
||||
+
|
||||
+/**
|
||||
+ * JOB_DEFAULT_RESPAWN_LIMIT:
|
||||
+ *
|
||||
+ * The default number of times in JOB_DEFAULT_RESPAWN_INTERVAL seconds that
|
||||
+ * we permit a process to respawn before stoping it
|
||||
+ **/
|
||||
+#define JOB_DEFAULT_RESPAWN_LIMIT 10
|
||||
+
|
||||
+/**
|
||||
+ * JOB_DEFAULT_RESPAWN_INTERVAL:
|
||||
+ *
|
||||
+ * The default number of seconds before resetting the respawn timer.
|
||||
+ **/
|
||||
+#define JOB_DEFAULT_RESPAWN_INTERVAL 5
|
||||
+
|
||||
+/**
|
||||
+ * JOB_DEFAULT_UMASK:
|
||||
+ *
|
||||
+ * The default file creation mark for processes.
|
||||
+ **/
|
||||
+#define JOB_DEFAULT_UMASK 022
|
||||
+
|
||||
+/**
|
||||
+ * JOB_DEFAULT_NICE:
|
||||
+ *
|
||||
+ * The default nice level for processes.
|
||||
+ **/
|
||||
+#define JOB_DEFAULT_NICE 0
|
||||
+
|
||||
+/**
|
||||
+ * JOB_DEFAULT_OOM_SCORE_ADJ:
|
||||
+ *
|
||||
+ * The default OOM score adjustment for processes.
|
||||
+ **/
|
||||
+#define JOB_DEFAULT_OOM_SCORE_ADJ 0
|
||||
+
|
||||
+/**
|
||||
+ * JOB_DEFAULT_ENVIRONMENT:
|
||||
+ *
|
||||
+ * Environment variables to always copy from our own environment, these
|
||||
+ * can be overriden in the job definition or by events since they have the
|
||||
+ * lowest priority.
|
||||
+ **/
|
||||
+#define JOB_DEFAULT_ENVIRONMENT \
|
||||
+ "PATH", \
|
||||
+ "TERM"
|
||||
+
|
||||
+
|
||||
+/**
|
||||
* JobClass:
|
||||
* @entry: list header,
|
||||
* @name: unique name,
|
||||
@@ -93,7 +149,7 @@
|
||||
* @console: how to arrange processes' stdin/out/err file descriptors,
|
||||
* @umask: file mode creation mask,
|
||||
* @nice: process priority,
|
||||
- * @oom_adj: OOM killer adjustment,
|
||||
+ * @oom_score_adj: OOM killer score adjustment,
|
||||
* @limits: resource limits indexed by resource,
|
||||
* @chroot: root directory of process (implies @chdir if not set),
|
||||
* @chdir: working directory of process,
|
||||
@@ -141,7 +197,7 @@
|
||||
|
||||
mode_t umask;
|
||||
int nice;
|
||||
- int oom_adj;
|
||||
+ int oom_score_adj;
|
||||
struct rlimit *limits[RLIMIT_NLIMITS];
|
||||
char *chroot;
|
||||
char *chdir;
|
||||
|
||||
=== modified file 'init/job_process.c'
|
||||
--- init/job_process.c 2011-08-11 20:55:33 +0000
|
||||
+++ init/job_process.c 2011-08-11 21:00:11 +0000
|
||||
@@ -513,16 +513,24 @@
|
||||
|
||||
/* Adjust the process OOM killer priority.
|
||||
*/
|
||||
- if (class->oom_adj) {
|
||||
+ if (class->oom_score_adj != JOB_DEFAULT_OOM_SCORE_ADJ) {
|
||||
+ int oom_value;
|
||||
snprintf (filename, sizeof (filename),
|
||||
- "/proc/%d/oom_adj", getpid ());
|
||||
-
|
||||
+ "/proc/%d/oom_score_adj", getpid ());
|
||||
+ oom_value = class->oom_score_adj;
|
||||
fd = fopen (filename, "w");
|
||||
+ if ((! fd) && (errno == ENOENT)) {
|
||||
+ snprintf (filename, sizeof (filename),
|
||||
+ "/proc/%d/oom_adj", getpid ());
|
||||
+ oom_value = (class->oom_score_adj
|
||||
+ * ((class->oom_score_adj < 0) ? 17 : 15)) / 1000;
|
||||
+ fd = fopen (filename, "w");
|
||||
+ }
|
||||
if (! fd) {
|
||||
nih_error_raise_system ();
|
||||
job_process_error_abort (fds[1], JOB_PROCESS_ERROR_OOM_ADJ, 0);
|
||||
} else {
|
||||
- fprintf (fd, "%d\n", class->oom_adj);
|
||||
+ fprintf (fd, "%d\n", oom_value);
|
||||
|
||||
if (fclose (fd)) {
|
||||
nih_error_raise_system ();
|
||||
|
||||
=== modified file 'init/main.c'
|
||||
--- init/main.c 2011-08-11 20:55:33 +0000
|
||||
+++ init/main.c 2011-08-11 21:00:11 +0000
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
+#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -54,6 +55,7 @@
|
||||
#include "paths.h"
|
||||
#include "events.h"
|
||||
#include "system.h"
|
||||
+#include "job_class.h"
|
||||
#include "job_process.h"
|
||||
#include "event.h"
|
||||
#include "conf.h"
|
||||
@@ -292,6 +294,38 @@
|
||||
NULL));
|
||||
|
||||
|
||||
+ /* Adjust our OOM priority to the default, which will be inherited
|
||||
+ * by all jobs.
|
||||
+ */
|
||||
+ if (JOB_DEFAULT_OOM_SCORE_ADJ) {
|
||||
+ char filename[PATH_MAX];
|
||||
+ int oom_value;
|
||||
+ FILE *fd;
|
||||
+
|
||||
+ snprintf (filename, sizeof (filename),
|
||||
+ "/proc/%d/oom_score_adj", getpid ());
|
||||
+ oom_value = JOB_DEFAULT_OOM_SCORE_ADJ;
|
||||
+ fd = fopen (filename, "w");
|
||||
+ if ((! fd) && (errno == ENOENT)) {
|
||||
+ snprintf (filename, sizeof (filename),
|
||||
+ "/proc/%d/oom_adj", getpid ());
|
||||
+ oom_value = (JOB_DEFAULT_OOM_SCORE_ADJ
|
||||
+ * ((JOB_DEFAULT_OOM_SCORE_ADJ < 0) ? 17 : 15)) / 1000;
|
||||
+ fd = fopen (filename, "w");
|
||||
+ }
|
||||
+ if (! fd) {
|
||||
+ nih_warn ("%s: %s", _("Unable to set default oom score"),
|
||||
+ strerror (errno));
|
||||
+ } else {
|
||||
+ fprintf (fd, "%d\n", oom_value);
|
||||
+
|
||||
+ if (fclose (fd))
|
||||
+ nih_warn ("%s: %s", _("Unable to set default oom score"),
|
||||
+ strerror (errno));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
/* Read configuration */
|
||||
NIH_MUST (conf_source_new (NULL, CONFFILE, CONF_FILE));
|
||||
NIH_MUST (conf_source_new (NULL, CONFDIR, CONF_JOB_DIR));
|
||||
|
||||
=== modified file 'init/man/init.5'
|
||||
--- init/man/init.5 2011-03-15 18:36:57 +0000
|
||||
+++ init/man/init.5 2011-08-11 20:56:28 +0000
|
||||
@@ -1,4 +1,4 @@
|
||||
-.TH init 5 2010-12-14 "Upstart"
|
||||
+.TH init 5 2011-05-12 "Upstart"
|
||||
.\"
|
||||
.SH NAME
|
||||
init \- Upstart init daemon job configuration
|
||||
@@ -500,15 +500,15 @@
|
||||
for more details.
|
||||
.\"
|
||||
.TP
|
||||
-.B oom \fIADJUSTMENT\fR|\fBnever
|
||||
+.B oom score \fIADJUSTMENT\fR|\fBnever
|
||||
Normally the OOM killer regards all processes equally, this stanza
|
||||
advises the kernel to treat this job differently.
|
||||
|
||||
.I ADJUSTMENT
|
||||
may be an integer value from
|
||||
-.I -16
|
||||
+.I -999
|
||||
(very unlikely to be killed by the OOM killer) up to
|
||||
-.I 14
|
||||
+.I 1000
|
||||
(very likely to be killed by the OOM killer). It may also be the special
|
||||
value
|
||||
.B never
|
||||
|
||||
=== modified file 'init/parse_job.c'
|
||||
--- init/parse_job.c 2011-01-17 16:37:54 +0000
|
||||
+++ init/parse_job.c 2011-08-11 20:56:28 +0000
|
||||
@@ -2233,6 +2233,7 @@
|
||||
nih_local char *arg = NULL;
|
||||
char *endptr;
|
||||
size_t a_pos, a_lineno;
|
||||
+ int oom_adj;
|
||||
int ret = -1;
|
||||
|
||||
nih_assert (class != NULL);
|
||||
@@ -2247,12 +2248,37 @@
|
||||
if (! arg)
|
||||
goto finish;
|
||||
|
||||
- if (! strcmp (arg, "never")) {
|
||||
- class->oom_adj = -17;
|
||||
+ if (! strcmp (arg, "score")) {
|
||||
+ nih_local char *scorearg = NULL;
|
||||
+
|
||||
+ /* Update error position to the score value */
|
||||
+ *pos = a_pos;
|
||||
+ if (lineno)
|
||||
+ *lineno = a_lineno;
|
||||
+
|
||||
+ scorearg = nih_config_next_arg (NULL, file, len,
|
||||
+ &a_pos, &a_lineno);
|
||||
+ if (! scorearg)
|
||||
+ goto finish;
|
||||
+
|
||||
+ if (! strcmp (scorearg, "never")) {
|
||||
+ class->oom_score_adj = -1000;
|
||||
+ } else {
|
||||
+ errno = 0;
|
||||
+ class->oom_score_adj = (int)strtol (scorearg, &endptr, 10);
|
||||
+ if (errno || *endptr ||
|
||||
+ (class->oom_score_adj < -1000) ||
|
||||
+ (class->oom_score_adj > 1000))
|
||||
+ nih_return_error (-1, PARSE_ILLEGAL_OOM,
|
||||
+ _(PARSE_ILLEGAL_OOM_SCORE_STR));
|
||||
+ }
|
||||
+ } else if (! strcmp (arg, "never")) {
|
||||
+ class->oom_score_adj = -1000;
|
||||
} else {
|
||||
errno = 0;
|
||||
- class->oom_adj = (int)strtol (arg, &endptr, 10);
|
||||
- if (errno || *endptr || (class->oom_adj < -17) || (class->oom_adj > 15))
|
||||
+ oom_adj = (int)strtol (arg, &endptr, 10);
|
||||
+ class->oom_score_adj = (oom_adj * 1000) / ((oom_adj < 0) ? 17 : 15);
|
||||
+ if (errno || *endptr || (oom_adj < -17) || (oom_adj > 15))
|
||||
nih_return_error (-1, PARSE_ILLEGAL_OOM,
|
||||
_(PARSE_ILLEGAL_OOM_STR));
|
||||
}
|
||||
|
||||
=== modified file 'init/tests/test_job_class.c'
|
||||
--- init/tests/test_job_class.c 2011-03-16 22:42:48 +0000
|
||||
+++ init/tests/test_job_class.c 2011-08-11 20:56:28 +0000
|
||||
@@ -133,7 +133,7 @@
|
||||
|
||||
TEST_EQ (class->umask, 022);
|
||||
TEST_EQ (class->nice, 0);
|
||||
- TEST_EQ (class->oom_adj, 0);
|
||||
+ TEST_EQ (class->oom_score_adj, 0);
|
||||
|
||||
for (i = 0; i < RLIMIT_NLIMITS; i++)
|
||||
TEST_EQ_P (class->limits[i], NULL);
|
||||
|
||||
=== modified file 'init/tests/test_parse_job.c'
|
||||
--- init/tests/test_parse_job.c 2010-12-14 16:20:38 +0000
|
||||
+++ init/tests/test_parse_job.c 2011-08-11 20:56:28 +0000
|
||||
@@ -6161,6 +6161,8 @@
|
||||
nih_free (err);
|
||||
}
|
||||
|
||||
+#define ADJ_TO_SCORE(x) ((x * 1000) / ((x < 0) ? 17 : 15))
|
||||
+
|
||||
void
|
||||
test_stanza_oom (void)
|
||||
{
|
||||
@@ -6198,11 +6200,39 @@
|
||||
|
||||
TEST_ALLOC_SIZE (job, sizeof (JobClass));
|
||||
|
||||
- TEST_EQ (job->oom_adj, 10);
|
||||
-
|
||||
- nih_free (job);
|
||||
- }
|
||||
-
|
||||
+ TEST_EQ (job->oom_score_adj, ADJ_TO_SCORE(10));
|
||||
+
|
||||
+ nih_free (job);
|
||||
+ }
|
||||
+
|
||||
+ TEST_FEATURE ("with positive score argument");
|
||||
+ strcpy (buf, "oom score 100\n");
|
||||
+
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf),
|
||||
+ &pos, &lineno);
|
||||
+
|
||||
+ if (test_alloc_failed) {
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, ENOMEM);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ TEST_EQ (pos, strlen (buf));
|
||||
+ TEST_EQ (lineno, 2);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (job, sizeof (JobClass));
|
||||
+
|
||||
+ TEST_EQ (job->oom_score_adj, 100);
|
||||
+
|
||||
+ nih_free (job);
|
||||
+ }
|
||||
|
||||
/* Check that an oom stanza with a negative timeout results
|
||||
* in it being stored in the job.
|
||||
@@ -6231,7 +6261,36 @@
|
||||
|
||||
TEST_ALLOC_SIZE (job, sizeof (JobClass));
|
||||
|
||||
- TEST_EQ (job->oom_adj, -10);
|
||||
+ TEST_EQ (job->oom_score_adj, ADJ_TO_SCORE(-10));
|
||||
+
|
||||
+ nih_free (job);
|
||||
+ }
|
||||
+
|
||||
+ TEST_FEATURE ("with negative score argument");
|
||||
+ strcpy (buf, "oom score -100\n");
|
||||
+
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf),
|
||||
+ &pos, &lineno);
|
||||
+
|
||||
+ if (test_alloc_failed) {
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, ENOMEM);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ TEST_EQ (pos, strlen (buf));
|
||||
+ TEST_EQ (lineno, 2);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (job, sizeof (JobClass));
|
||||
+
|
||||
+ TEST_EQ (job->oom_score_adj, -100);
|
||||
|
||||
nih_free (job);
|
||||
}
|
||||
@@ -6264,7 +6323,40 @@
|
||||
|
||||
TEST_ALLOC_SIZE (job, sizeof (JobClass));
|
||||
|
||||
- TEST_EQ (job->oom_adj, -17);
|
||||
+ TEST_EQ (job->oom_score_adj, ADJ_TO_SCORE(-17));
|
||||
+
|
||||
+ nih_free (job);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /* Check that an oom score stanza may have the special never
|
||||
+ * argument which stores -1000 in the job.
|
||||
+ */
|
||||
+ TEST_FEATURE ("with never score argument");
|
||||
+ strcpy (buf, "oom score never\n");
|
||||
+
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf),
|
||||
+ &pos, &lineno);
|
||||
+
|
||||
+ if (test_alloc_failed) {
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, ENOMEM);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ TEST_EQ (pos, strlen (buf));
|
||||
+ TEST_EQ (lineno, 2);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (job, sizeof (JobClass));
|
||||
+
|
||||
+ TEST_EQ (job->oom_score_adj, -1000);
|
||||
|
||||
nih_free (job);
|
||||
}
|
||||
@@ -6297,7 +6389,100 @@
|
||||
|
||||
TEST_ALLOC_SIZE (job, sizeof (JobClass));
|
||||
|
||||
- TEST_EQ (job->oom_adj, 10);
|
||||
+ TEST_EQ (job->oom_score_adj, ADJ_TO_SCORE(10));
|
||||
+
|
||||
+ nih_free (job);
|
||||
+ }
|
||||
+
|
||||
+ TEST_FEATURE ("with multiple score stanzas");
|
||||
+ strcpy (buf, "oom score -500\n");
|
||||
+ strcat (buf, "oom score 500\n");
|
||||
+
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf),
|
||||
+ &pos, &lineno);
|
||||
+
|
||||
+ if (test_alloc_failed) {
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, ENOMEM);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ TEST_EQ (pos, strlen (buf));
|
||||
+ TEST_EQ (lineno, 3);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (job, sizeof (JobClass));
|
||||
+
|
||||
+ TEST_EQ (job->oom_score_adj, 500);
|
||||
+
|
||||
+ nih_free (job);
|
||||
+ }
|
||||
+
|
||||
+ /* Check that the last of multiple distinct oom stanzas is
|
||||
+ * used.
|
||||
+ */
|
||||
+ TEST_FEATURE ("with an oom overriding an oom score stanza");
|
||||
+ strcpy (buf, "oom score -10\n");
|
||||
+ strcat (buf, "oom 10\n");
|
||||
+
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf),
|
||||
+ &pos, &lineno);
|
||||
+
|
||||
+ if (test_alloc_failed) {
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, ENOMEM);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ TEST_EQ (pos, strlen (buf));
|
||||
+ TEST_EQ (lineno, 3);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (job, sizeof (JobClass));
|
||||
+
|
||||
+ TEST_EQ (job->oom_score_adj, ADJ_TO_SCORE(10));
|
||||
+
|
||||
+ nih_free (job);
|
||||
+ }
|
||||
+
|
||||
+ TEST_FEATURE ("with an oom score overriding an oom stanza");
|
||||
+ strcpy (buf, "oom -10\n");
|
||||
+ strcat (buf, "oom score 10\n");
|
||||
+
|
||||
+ TEST_ALLOC_FAIL {
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf),
|
||||
+ &pos, &lineno);
|
||||
+
|
||||
+ if (test_alloc_failed) {
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, ENOMEM);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ TEST_EQ (pos, strlen (buf));
|
||||
+ TEST_EQ (lineno, 3);
|
||||
+
|
||||
+ TEST_ALLOC_SIZE (job, sizeof (JobClass));
|
||||
+
|
||||
+ TEST_EQ (job->oom_score_adj, 10);
|
||||
|
||||
nih_free (job);
|
||||
}
|
||||
@@ -6322,6 +6507,25 @@
|
||||
nih_free (err);
|
||||
|
||||
|
||||
+ /* Check that an oom score stanza without an argument results in a
|
||||
+ * syntax error.
|
||||
+ */
|
||||
+ TEST_FEATURE ("with missing score argument");
|
||||
+ strcpy (buf, "oom score\n");
|
||||
+
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);
|
||||
+
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, NIH_CONFIG_EXPECTED_TOKEN);
|
||||
+ TEST_EQ (pos, 9);
|
||||
+ TEST_EQ (lineno, 1);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+
|
||||
/* Check that an oom stanza with an overly large argument results
|
||||
* in a syntax error.
|
||||
*/
|
||||
@@ -6340,6 +6544,21 @@
|
||||
TEST_EQ (lineno, 1);
|
||||
nih_free (err);
|
||||
|
||||
+ TEST_FEATURE ("with overly large score argument");
|
||||
+ strcpy (buf, "oom score 1200\n");
|
||||
+
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);
|
||||
+
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, PARSE_ILLEGAL_OOM);
|
||||
+ TEST_EQ (pos, 10);
|
||||
+ TEST_EQ (lineno, 1);
|
||||
+ nih_free (err);
|
||||
+
|
||||
|
||||
/* Check that an oom stanza with an overly small argument results
|
||||
* in a syntax error.
|
||||
@@ -6359,6 +6578,21 @@
|
||||
TEST_EQ (lineno, 1);
|
||||
nih_free (err);
|
||||
|
||||
+ TEST_FEATURE ("with overly small score argument");
|
||||
+ strcpy (buf, "oom score -1200\n");
|
||||
+
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);
|
||||
+
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, PARSE_ILLEGAL_OOM);
|
||||
+ TEST_EQ (pos, 10);
|
||||
+ TEST_EQ (lineno, 1);
|
||||
+ nih_free (err);
|
||||
+
|
||||
|
||||
/* Check that an oom stanza with a non-integer argument results
|
||||
* in a syntax error.
|
||||
@@ -6378,6 +6612,21 @@
|
||||
TEST_EQ (lineno, 1);
|
||||
nih_free (err);
|
||||
|
||||
+ TEST_FEATURE ("with non-integer score argument");
|
||||
+ strcpy (buf, "oom score foo\n");
|
||||
+
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);
|
||||
+
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, PARSE_ILLEGAL_OOM);
|
||||
+ TEST_EQ (pos, 10);
|
||||
+ TEST_EQ (lineno, 1);
|
||||
+ nih_free (err);
|
||||
+
|
||||
|
||||
/* Check that an oom stanza with a partially numeric argument
|
||||
* results in a syntax error.
|
||||
@@ -6397,6 +6646,21 @@
|
||||
TEST_EQ (lineno, 1);
|
||||
nih_free (err);
|
||||
|
||||
+ TEST_FEATURE ("with alphanumeric score argument");
|
||||
+ strcpy (buf, "oom score 12foo\n");
|
||||
+
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);
|
||||
+
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, PARSE_ILLEGAL_OOM);
|
||||
+ TEST_EQ (pos, 10);
|
||||
+ TEST_EQ (lineno, 1);
|
||||
+ nih_free (err);
|
||||
+
|
||||
|
||||
/* Check that an oom stanza with a priority but with an extra
|
||||
* argument afterwards results in a syntax error.
|
||||
@@ -6415,6 +6679,21 @@
|
||||
TEST_EQ (pos, 7);
|
||||
TEST_EQ (lineno, 1);
|
||||
nih_free (err);
|
||||
+
|
||||
+ TEST_FEATURE ("with extra score argument");
|
||||
+ strcpy (buf, "oom score 500 foo\n");
|
||||
+
|
||||
+ pos = 0;
|
||||
+ lineno = 1;
|
||||
+ job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);
|
||||
+
|
||||
+ TEST_EQ_P (job, NULL);
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ TEST_EQ (err->number, NIH_CONFIG_UNEXPECTED_TOKEN);
|
||||
+ TEST_EQ (pos, 14);
|
||||
+ TEST_EQ (lineno, 1);
|
||||
+ nih_free (err);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@ -1,49 +0,0 @@
|
||||
=== modified file 'init/main.c'
|
||||
--- init/main.c 2011-03-16 22:54:56 +0000
|
||||
+++ init/main.c 2011-08-08 21:09:43 +0000
|
||||
@@ -173,8 +173,23 @@
|
||||
* resetting it to sane defaults unless we're inheriting from another
|
||||
* init process which we know left it in a sane state.
|
||||
*/
|
||||
- if (system_setup_console (CONSOLE_OUTPUT, (! restart)) < 0)
|
||||
- nih_free (nih_error_get ());
|
||||
+ if (system_setup_console (CONSOLE_OUTPUT, (! restart)) < 0) {
|
||||
+ NihError *err;
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ nih_warn ("%s: %s", _("Unable to initialize console, will try /dev/null"),
|
||||
+ err->message);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+ if (system_setup_console (CONSOLE_NONE, FALSE) < 0) {
|
||||
+ err = nih_error_get ();
|
||||
+ nih_fatal ("%s: %s", _("Unable to initialize console as /dev/null"),
|
||||
+ err->message);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
/* Set the PATH environment variable */
|
||||
setenv ("PATH", PATH, TRUE);
|
||||
@@ -316,8 +331,16 @@
|
||||
/* Now that the startup is complete, send all further logging output
|
||||
* to kmsg instead of to the console.
|
||||
*/
|
||||
- if (system_setup_console (CONSOLE_NONE, FALSE) < 0)
|
||||
- nih_free (nih_error_get ());
|
||||
+ if (system_setup_console (CONSOLE_NONE, FALSE) < 0) {
|
||||
+ NihError *err;
|
||||
+
|
||||
+ err = nih_error_get ();
|
||||
+ nih_fatal ("%s: %s", _("Unable to setup standard file descriptors"),
|
||||
+ err->message);
|
||||
+ nih_free (err);
|
||||
+
|
||||
+ exit (1);
|
||||
+ }
|
||||
|
||||
nih_log_set_logger (logger_kmsg);
|
||||
#endif /* DEBUG */
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
# Copyright 1999-2007 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
inherit autotools eutils
|
||||
|
||||
DESCRIPTION="Upstart is an event-based replacement for the init daemon"
|
||||
HOMEPAGE="http://upstart.ubuntu.com/"
|
||||
SRC_URI="http://upstart.ubuntu.com/download/0.6/${P}.tar.bz2"
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 x86 arm"
|
||||
IUSE="examples nls"
|
||||
|
||||
DEPEND=">=dev-libs/expat-2.0.0
|
||||
>=sys-apps/dbus-1.2.16
|
||||
nls? ( sys-devel/gettext )"
|
||||
|
||||
RDEPEND=">=sys-apps/dbus-1.2.16"
|
||||
|
||||
src_unpack() {
|
||||
unpack $A
|
||||
cd "${S}"
|
||||
|
||||
epatch "${FILESDIR}"/${P}-cross-compile.patch # Already upstream
|
||||
epatch "${FILESDIR}"/${P}-cross-compile2.patch # Not upstream @ 1214
|
||||
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
econf --prefix=/ --includedir='${prefix}/usr/include' $(use_enable nls) || die "econf failed"
|
||||
|
||||
emake NIH_DBUS_TOOL=$(which nih-dbus-tool) \
|
||||
|| die "emake failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake DESTDIR="${D}" install || die "make install failed"
|
||||
|
||||
if ! use examples ; then
|
||||
elog "Removing example .conf files."
|
||||
rm "${D}"/etc/init/*.conf
|
||||
fi
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
upstart-0.6.6.ebuild
|
||||
@ -1,48 +0,0 @@
|
||||
# Copyright 1999-2007 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
inherit autotools eutils
|
||||
|
||||
DESCRIPTION="Upstart is an event-based replacement for the init daemon"
|
||||
HOMEPAGE="http://upstart.ubuntu.com/"
|
||||
SRC_URI="http://upstart.ubuntu.com/download/0.6/${P}.tar.gz"
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 x86 arm"
|
||||
IUSE="examples nls upstartdebug"
|
||||
|
||||
DEPEND=">=dev-libs/expat-2.0.0
|
||||
>=sys-apps/dbus-1.2.16
|
||||
nls? ( sys-devel/gettext )
|
||||
>=sys-libs/libnih-1.0.2"
|
||||
|
||||
RDEPEND=">=sys-apps/dbus-1.2.16
|
||||
>=sys-libs/libnih-1.0.2"
|
||||
|
||||
|
||||
src_unpack() {
|
||||
unpack ${A}
|
||||
cd "${S}"
|
||||
if use upstartdebug; then
|
||||
epatch "${FILESDIR}"/upstart-0.6-logger_kmsg.patch
|
||||
fi
|
||||
epatch "${FILESDIR}"/upstart-0.6.6-introspection.patch
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
econf --prefix=/ --includedir='${prefix}/usr/include' \
|
||||
$(use_enable nls) || die "econf failed"
|
||||
|
||||
emake NIH_DBUS_TOOL=$(which nih-dbus-tool) \
|
||||
|| die "emake failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake DESTDIR="${D}" install || die "make install failed"
|
||||
|
||||
if ! use examples ; then
|
||||
elog "Removing example .conf files."
|
||||
rm "${D}"/etc/init/*.conf
|
||||
fi
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
upstart-1.2.ebuild
|
||||
@ -1,71 +0,0 @@
|
||||
# Copyright 1999-2007 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
inherit autotools eutils
|
||||
|
||||
DESCRIPTION="Upstart is an event-based replacement for the init daemon"
|
||||
HOMEPAGE="http://upstart.ubuntu.com/"
|
||||
SRC_URI="http://upstart.at/download/1.x/${P}.tar.gz"
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 x86 arm"
|
||||
IUSE="examples nls upstartdebug"
|
||||
|
||||
DEPEND=">=dev-libs/expat-2.0.0
|
||||
>=sys-apps/dbus-1.2.16
|
||||
nls? ( sys-devel/gettext )
|
||||
>=sys-libs/libnih-1.0.2"
|
||||
|
||||
RDEPEND=">=sys-apps/dbus-1.2.16
|
||||
>=sys-libs/libnih-1.0.2"
|
||||
|
||||
|
||||
src_unpack() {
|
||||
unpack ${A}
|
||||
cd "${S}"
|
||||
|
||||
# 1.3+ has scary user and chroot session support that we just
|
||||
# don't want to adopt yet, so we're sticking with 1.2 for the
|
||||
# near future. Backport some bug fixes from lp:upstart
|
||||
|
||||
# -r 1326 - fix bug when /dev/console cannot be opened
|
||||
# chromium-os:18739
|
||||
epatch "${FILESDIR}"/upstart-1.2-silent-console.patch
|
||||
# -r 1280,1308,1309,1320,1329 - fix shell fd leak (and fix the fix)
|
||||
epatch "${FILESDIR}"/upstart-1.2-fix-shell-redirect.patch
|
||||
# -r 1281,1325,1327,1328 - update to use /proc/oom_score
|
||||
epatch "${FILESDIR}"/upstart-1.2-oom-score.patch
|
||||
# -r 1282 - add "kill signal" stanza (may be useful for us)
|
||||
epatch "${FILESDIR}"/upstart-1.2-kill-signal.patch
|
||||
|
||||
# chromium-os:16450, prevent OOM killer by default
|
||||
epatch "${FILESDIR}"/upstart-1.2-default-oom_score_adj.patch
|
||||
|
||||
# chromium-os:33165, make EXIT_STATUS!=* possible
|
||||
epatch "${FILESDIR}"/upstart-1.2-negate-match.patch
|
||||
|
||||
# Patch to use kmsg at higher verbosity for logging; this is
|
||||
# our own patch because we can't just add --verbose to the
|
||||
# kernel command-line when we need to.
|
||||
if use upstartdebug; then
|
||||
epatch "${FILESDIR}"/upstart-1.2-log-verbosity.patch
|
||||
fi
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
econf --prefix=/ --includedir='${prefix}/usr/include' \
|
||||
$(use_enable nls) || die "econf failed"
|
||||
|
||||
emake NIH_DBUS_TOOL=$(which nih-dbus-tool) \
|
||||
|| die "emake failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake DESTDIR="${D}" install || die "make install failed"
|
||||
|
||||
if ! use examples ; then
|
||||
elog "Removing example .conf files."
|
||||
rm "${D}"/etc/init/*.conf
|
||||
fi
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
AUX ureadahead-0.100.0-11.patch 17869 SHA256 8676da04b1d48aaae46824689b900e964809aace36aa4b07e88dc45022669b6c SHA512 40f47e34d32834c455e032e13538c57ac774b864d6682d2643ba608cc0b0798e93af4d9b161fa9ae4a36b8996b422ddb1fb00a65342422845d914722a1952228 WHIRLPOOL a761244ff59b887fa74163ffe2b95dbaaa5ae151d54b6636d2b543cd755169533b212dbca55bcf1220c57f1c32e8a3551451f35d6b10314fdb703f6b0940f0c1
|
||||
DIST ureadahead-0.100.0.tar.gz 540220 SHA256 d00cfe9051131185cd5b6a439c9f89b51f0d5f1d49cb5bb14676d961a2ecfe99 SHA512 3bf5b0976c2e9404a7ed5e17479f494c60f1bbf28e4071fa80abf45a44ee60dde2b3c6d3a998937dc5c748bea5d0c3bf6e04507b7bb22282fedcc0b26752b4da WHIRLPOOL 9f48a3e07b9ce609af7db6a940ae9f2a63ee948c2c03d12b5b036e8734f00f10e17d177b4e687c81265472cf40f847ae798622a90af4e32a7f737db6624239bc
|
||||
EBUILD ureadahead-0.100.0-r2.ebuild 768 SHA256 7ccb8d8adc013ff8bb34c761d6dca4c84383b3e6bfcd0889f5eceec906540d03 SHA512 c23ee7e80fad830064bc3ffda10a5cfb9b720509c9266e1740dffc3244b77b9afe67e9a1ba8487b908ee95ad651fae6d9a7a78fba092ef2d61046044e635d6ac WHIRLPOOL a3580ddb0a46ac490518a66b4e18810169928de45c7f9d83c5213c720428997f8d0d538189d8b86b77b63ee4d0c6367e5c45a710f0503c5e8a827842cb7f9186
|
||||
@ -1,586 +0,0 @@
|
||||
--- ureadahead-0.100.0.orig/conf/ureadahead-other.conf
|
||||
+++ ureadahead-0.100.0/conf/ureadahead-other.conf
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
description "Read required files in advance (for other mountpoints)"
|
||||
|
||||
-start on mount DEVICE=[/UL]* MOUNTPOINT=/?*
|
||||
+start on mounted DEVICE=[/UL]* MOUNTPOINT=/?*
|
||||
|
||||
# Forks into the background both when reading from disk and when profiling
|
||||
# (HDD mode won't fork, but that's ok because we'll wait for it in spawned).
|
||||
--- ureadahead-0.100.0.orig/man/ureadahead.8
|
||||
+++ ureadahead-0.100.0/man/ureadahead.8
|
||||
@@ -49,7 +49,7 @@
|
||||
has been enabled.
|
||||
|
||||
This is ignored when reading on rotational hard drives, since it's
|
||||
-important for performance reasons not to content with other processes
|
||||
+important for performance reasons not to contend with other processes
|
||||
for I/O.
|
||||
.\"
|
||||
.TP
|
||||
@@ -115,7 +115,7 @@
|
||||
.\"
|
||||
.SH BUGS
|
||||
Report bugs at
|
||||
-.RB < https://launchpad.net/ureadahead/+bugs >
|
||||
+.RB < https://launchpad.net/ubuntu/+source/ureadahead/+bugs >
|
||||
.\"
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2009 Canonical Ltd.
|
||||
--- ureadahead-0.100.0.orig/src/Makefile.am
|
||||
+++ ureadahead-0.100.0/src/Makefile.am
|
||||
@@ -22,6 +22,7 @@
|
||||
file.c file.h \
|
||||
errors.h
|
||||
ureadahead_LDADD = \
|
||||
+ -lrt \
|
||||
$(NIH_LIBS) \
|
||||
$(BLKID_LIBS) \
|
||||
$(EXT2FS_LIBS) \
|
||||
--- ureadahead-0.100.0.orig/src/trace.c
|
||||
+++ ureadahead-0.100.0/src/trace.c
|
||||
@@ -117,17 +117,20 @@
|
||||
int timeout)
|
||||
{
|
||||
int dfd;
|
||||
+ FILE *fp;
|
||||
int unmount = FALSE;
|
||||
int old_sys_open_enabled = 0;
|
||||
int old_open_exec_enabled = 0;
|
||||
int old_uselib_enabled = 0;
|
||||
int old_tracing_enabled = 0;
|
||||
+ int old_buffer_size_kb = 0;
|
||||
struct sigaction act;
|
||||
struct sigaction old_sigterm;
|
||||
struct sigaction old_sigint;
|
||||
struct timeval tv;
|
||||
nih_local PackFile *files = NULL;
|
||||
size_t num_files = 0;
|
||||
+ size_t num_cpus = 0;
|
||||
|
||||
/* Mount debugfs if not already mounted */
|
||||
dfd = open (PATH_DEBUGFS "/tracing", O_RDONLY | O_NOATIME);
|
||||
@@ -148,6 +151,28 @@
|
||||
unmount = TRUE;
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * Count the number of CPUs, default to 1 on error.
|
||||
+ */
|
||||
+ fp = fopen("/proc/cpuinfo", "r");
|
||||
+ if (fp) {
|
||||
+ int line_size=1024;
|
||||
+ char *processor="processor";
|
||||
+ char *line = malloc(line_size);
|
||||
+ if (line) {
|
||||
+ num_cpus = 0;
|
||||
+ while (fgets(line,line_size,fp) != NULL) {
|
||||
+ if (!strncmp(line,processor,strlen(processor)))
|
||||
+ num_cpus++;
|
||||
+ }
|
||||
+ free(line);
|
||||
+ nih_message("Counted %d CPUs\n",num_cpus);
|
||||
+ }
|
||||
+ fclose(fp);
|
||||
+ }
|
||||
+ if (!num_cpus)
|
||||
+ num_cpus = 1;
|
||||
+
|
||||
/* Enable tracing of open() syscalls */
|
||||
if (set_value (dfd, "events/fs/do_sys_open/enable",
|
||||
TRUE, &old_sys_open_enabled) < 0)
|
||||
@@ -165,7 +190,7 @@
|
||||
|
||||
old_uselib_enabled = -1;
|
||||
}
|
||||
- if (set_value (dfd, "buffer_size_kb", 128000, NULL) < 0)
|
||||
+ if (set_value (dfd, "buffer_size_kb", 8192/num_cpus, &old_buffer_size_kb) < 0)
|
||||
goto error;
|
||||
if (set_value (dfd, "tracing_enabled",
|
||||
TRUE, &old_tracing_enabled) < 0)
|
||||
@@ -226,6 +251,13 @@
|
||||
if (read_trace (NULL, dfd, "trace", &files, &num_files) < 0)
|
||||
goto error;
|
||||
|
||||
+ /*
|
||||
+ * Restore the trace buffer size (which has just been read) and free
|
||||
+ * a bunch of memory.
|
||||
+ */
|
||||
+ if (set_value (dfd, "buffer_size_kb", old_buffer_size_kb, NULL) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
/* Unmount the temporary debugfs mount if we mounted it */
|
||||
if (close (dfd)) {
|
||||
nih_error_raise_system ();
|
||||
--- ureadahead-0.100.0.orig/src/Makefile.in
|
||||
+++ ureadahead-0.100.0/src/Makefile.in
|
||||
@@ -295,6 +295,7 @@
|
||||
errors.h
|
||||
|
||||
ureadahead_LDADD = \
|
||||
+ -lrt \
|
||||
$(NIH_LIBS) \
|
||||
$(BLKID_LIBS) \
|
||||
$(EXT2FS_LIBS) \
|
||||
--- ureadahead-0.100.0.orig/src/pack.c
|
||||
+++ ureadahead-0.100.0/src/pack.c
|
||||
@@ -163,6 +163,7 @@
|
||||
unsigned int maj;
|
||||
unsigned int min;
|
||||
char * mount;
|
||||
+ struct stat statbuf;
|
||||
|
||||
/* mount ID */
|
||||
ptr = strtok_r (line, " \t\n", &saveptr);
|
||||
@@ -185,14 +186,6 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
- /* Check whether this is the right device */
|
||||
- if ((sscanf (device, "%d:%d", &maj, &min) < 2)
|
||||
- || (maj != major (dev))
|
||||
- || (min != minor (dev))) {
|
||||
- nih_free (line);
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
/* root */
|
||||
ptr = strtok_r (NULL, " \t\n", &saveptr);
|
||||
if (! ptr) {
|
||||
@@ -206,6 +199,12 @@
|
||||
nih_free (line);
|
||||
continue;
|
||||
}
|
||||
+
|
||||
+ /* Check whether this is the right device */
|
||||
+ if (stat (mount, &statbuf) || statbuf.st_dev != dev) {
|
||||
+ nih_free (line);
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
/* Done, convert the mountpoint to a pack filename */
|
||||
if (fclose (fp) < 0)
|
||||
--- ureadahead-0.100.0.orig/src/values.c
|
||||
+++ ureadahead-0.100.0/src/values.c
|
||||
@@ -57,7 +57,7 @@
|
||||
if (fd < 0)
|
||||
nih_return_system_error (-1);
|
||||
|
||||
- len = read (fd, buf, sizeof buf);
|
||||
+ len = read (fd, buf, sizeof(buf) - 1);
|
||||
if (len < 0) {
|
||||
nih_error_raise_system ();
|
||||
close (fd);
|
||||
@@ -90,7 +90,7 @@
|
||||
nih_return_system_error (-1);
|
||||
|
||||
if (oldvalue) {
|
||||
- len = read (fd, buf, sizeof buf);
|
||||
+ len = read (fd, buf, sizeof(buf) - 1);
|
||||
if (len < 0) {
|
||||
nih_error_raise_system ();
|
||||
close (fd);
|
||||
--- ureadahead-0.100.0.orig/debian/copyright
|
||||
+++ ureadahead-0.100.0/debian/copyright
|
||||
@@ -0,0 +1,17 @@
|
||||
+This is the Ubuntu package of ureadahead.
|
||||
+
|
||||
+Copyright © 2009 Canonical Ltd.
|
||||
+
|
||||
+Licence:
|
||||
+
|
||||
+This program is free software; you can redistribute it and/or modify
|
||||
+it under the terms of the GNU General Public License version 2, as
|
||||
+published by the Free Software Foundation.
|
||||
+
|
||||
+This program is distributed in the hope that it will be useful, but
|
||||
+WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+General Public License for more details.
|
||||
+
|
||||
+On Ubuntu systems, the complete text of the GNU General Public License
|
||||
+can be found in ‘/usr/share/common-licenses/GPL-2’.
|
||||
--- ureadahead-0.100.0.orig/debian/compat
|
||||
+++ ureadahead-0.100.0/debian/compat
|
||||
@@ -0,0 +1 @@
|
||||
+7
|
||||
--- ureadahead-0.100.0.orig/debian/ureadahead.postrm
|
||||
+++ ureadahead-0.100.0/debian/ureadahead.postrm
|
||||
@@ -0,0 +1,61 @@
|
||||
+#!/bin/sh -e
|
||||
+# This script can be called in the following ways:
|
||||
+#
|
||||
+# After the package was removed:
|
||||
+# <postrm> remove
|
||||
+#
|
||||
+# After the package was purged:
|
||||
+# <postrm> purge
|
||||
+#
|
||||
+# After the package was upgraded:
|
||||
+# <old-postrm> upgrade <new-version>
|
||||
+# if that fails:
|
||||
+# <new-postrm> failed-upgrade <old-version>
|
||||
+#
|
||||
+#
|
||||
+# After all of the packages files have been replaced:
|
||||
+# <postrm> disappear <overwriting-package> <version>
|
||||
+#
|
||||
+#
|
||||
+# If preinst fails during install:
|
||||
+# <new-postrm> abort-install
|
||||
+#
|
||||
+# If preinst fails during upgrade of removed package:
|
||||
+# <new-postrm> abort-install <old-version>
|
||||
+#
|
||||
+# If preinst fails during upgrade:
|
||||
+# <new-postrm> abort-upgrade <old-version>
|
||||
+
|
||||
+
|
||||
+# Remove pack file
|
||||
+purge_files()
|
||||
+{
|
||||
+ if [ -f /var/lib/ureadahead/pack ]; then
|
||||
+ rm -f /var/lib/ureadahead/pack /var/lib/ureadahead/*.pack || true
|
||||
+ rmdir /var/lib/ureadahead || true
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+
|
||||
+case "$1" in
|
||||
+ remove)
|
||||
+ ;;
|
||||
+
|
||||
+ purge)
|
||||
+ purge_files
|
||||
+ ;;
|
||||
+
|
||||
+ upgrade|failed-upgrade|disappear)
|
||||
+ ;;
|
||||
+
|
||||
+ abort-install|abort-upgrade)
|
||||
+ ;;
|
||||
+
|
||||
+ *)
|
||||
+ echo "$0 called with unknown argument \`$1'" 1>&2
|
||||
+ exit 1
|
||||
+ ;;
|
||||
+esac
|
||||
+
|
||||
+#DEBHELPER#
|
||||
+exit 0
|
||||
--- ureadahead-0.100.0.orig/debian/ureadahead.dirs
|
||||
+++ ureadahead-0.100.0/debian/ureadahead.dirs
|
||||
@@ -0,0 +1,3 @@
|
||||
+usr/share/apport/package-hooks
|
||||
+var/lib/ureadahead
|
||||
+var/lib/ureadahead/debugfs
|
||||
--- ureadahead-0.100.0.orig/debian/control
|
||||
+++ ureadahead-0.100.0/debian/control
|
||||
@@ -0,0 +1,24 @@
|
||||
+Source: ureadahead
|
||||
+Section: admin
|
||||
+Priority: required
|
||||
+Maintainer: Scott James Remnant <scott@ubuntu.com>
|
||||
+Standards-Version: 3.9.1
|
||||
+Build-Depends: debhelper (>= 7.3.15ubuntu3), pkg-config (>= 0.22), libnih-dev (>= 1.0.0), libblkid-dev (>= 2.16), e2fslibs-dev (>= 1.41)
|
||||
+
|
||||
+Package: ureadahead
|
||||
+Architecture: any
|
||||
+Depends: ${shlibs:Depends}, ${misc:Depends}, upstart (>= 0.6.0)
|
||||
+Conflicts: readahead
|
||||
+Provides: readahead
|
||||
+Replaces: readahead
|
||||
+Description: Read required files in advance
|
||||
+ über-readahead is used during boot to read files in advance of when
|
||||
+ they are needed such that they are already in the page cache,
|
||||
+ improving boot performance.
|
||||
+ .
|
||||
+ Its data files are regenerated on the first boot after install, and
|
||||
+ either monthly thereafter or when packages with init scripts or
|
||||
+ configs are installed or updated.
|
||||
+ .
|
||||
+ ureadahead requires a kernel patch included in the Ubuntu kernel.
|
||||
+
|
||||
--- ureadahead-0.100.0.orig/debian/ureadahead.postinst
|
||||
+++ ureadahead-0.100.0/debian/ureadahead.postinst
|
||||
@@ -0,0 +1,44 @@
|
||||
+#!/bin/sh -e
|
||||
+# This script can be called in the following ways:
|
||||
+#
|
||||
+# After the package was installed:
|
||||
+# <postinst> configure <old-version>
|
||||
+#
|
||||
+# After a trigger is activated:
|
||||
+# <postinst> triggered <trigger-name>...
|
||||
+#
|
||||
+#
|
||||
+# If prerm fails during upgrade or fails on failed upgrade:
|
||||
+# <old-postinst> abort-upgrade <new-version>
|
||||
+#
|
||||
+# If prerm fails during deconfiguration of a package:
|
||||
+# <postinst> abort-deconfigure in-favour <new-package> <version>
|
||||
+# removing <old-package> <version>
|
||||
+#
|
||||
+# If prerm fails during replacement due to conflict:
|
||||
+# <postinst> abort-remove in-favour <new-package> <version>
|
||||
+
|
||||
+
|
||||
+case "$1" in
|
||||
+ configure)
|
||||
+ ;;
|
||||
+
|
||||
+ triggered)
|
||||
+ # Force a reprofile
|
||||
+ if [ -f /var/lib/ureadahead/pack ]; then
|
||||
+ echo "ureadahead will be reprofiled on next reboot"
|
||||
+ rm -f /var/lib/ureadahead/pack /var/lib/ureadahead/*.pack
|
||||
+ fi
|
||||
+ ;;
|
||||
+
|
||||
+ abort-upgrade|abort-deconfigure|abort-remove)
|
||||
+ ;;
|
||||
+
|
||||
+ *)
|
||||
+ echo "$0 called with unknown argument \`$1'" 1>&2
|
||||
+ exit 1
|
||||
+ ;;
|
||||
+esac
|
||||
+
|
||||
+#DEBHELPER#
|
||||
+exit 0
|
||||
--- ureadahead-0.100.0.orig/debian/rules
|
||||
+++ ureadahead-0.100.0/debian/rules
|
||||
@@ -0,0 +1,28 @@
|
||||
+#!/usr/bin/make -f
|
||||
+%:
|
||||
+ dh $@
|
||||
+
|
||||
+
|
||||
+CFLAGS = -Wall -g -fstack-protector -fPIE
|
||||
+LDFLAGS = -Wl,-z,relro -Wl,-z,now -pie
|
||||
+
|
||||
+# Disable optimisations if noopt found in $DEB_BUILD_OPTIONS
|
||||
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
||||
+ CFLAGS += -O0
|
||||
+ LDFLAGS += -Wl,-O0
|
||||
+else
|
||||
+ CFLAGS += -Os
|
||||
+ LDFLAGS += -Wl,-O1
|
||||
+endif
|
||||
+
|
||||
+override_dh_auto_configure:
|
||||
+ dh_auto_configure -- CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
||||
+ --exec-prefix=
|
||||
+
|
||||
+
|
||||
+override_dh_install:
|
||||
+ dh_install
|
||||
+ install -m 644 debian/ureadahead.apport \
|
||||
+ debian/ureadahead/usr/share/apport/package-hooks/ureadahead.py
|
||||
+
|
||||
+version := $(shell sed -e '1{;s|^ureadahead (\(.*\))\ .*|\1|;q;}' debian/changelog)
|
||||
--- ureadahead-0.100.0.orig/debian/ureadahead.triggers
|
||||
+++ ureadahead-0.100.0/debian/ureadahead.triggers
|
||||
@@ -0,0 +1,2 @@
|
||||
+interest /etc/init
|
||||
+interest /etc/init.d
|
||||
--- ureadahead-0.100.0.orig/debian/changelog
|
||||
+++ ureadahead-0.100.0/debian/changelog
|
||||
@@ -0,0 +1,177 @@
|
||||
+ureadahead (0.100.0-11) natty; urgency=low
|
||||
+
|
||||
+ * src/trace.c: leave room for string termination on reads (LP: #485194).
|
||||
+ * man/ureadahead.8: fix typo and update bug reporting URL (LP: #697770).
|
||||
+ * debian/rules: don't bother with /var/lib/ureadahead mode.
|
||||
+
|
||||
+ -- Kees Cook <kees@ubuntu.com> Wed, 16 Mar 2011 17:19:01 -0700
|
||||
+
|
||||
+ureadahead (0.100.0-10) natty; urgency=low
|
||||
+
|
||||
+ * Install /var/lib/ureadahead mode 0700 so other users cannot see
|
||||
+ the debugfs mount point.
|
||||
+
|
||||
+ -- Kees Cook <kees@ubuntu.com> Tue, 22 Feb 2011 12:13:22 -0800
|
||||
+
|
||||
+ureadahead (0.100.0-9) natty; urgency=low
|
||||
+
|
||||
+ [ Bilal Akhtar ]
|
||||
+ * Removed sreadahead transitional package and its postinst, postrm,
|
||||
+ preinst and install files. (LP: #545596)
|
||||
+ * Passed --sourcedir argument to dh_install
|
||||
+ * Removed dh_gencontrol calls for package sreadahead.
|
||||
+
|
||||
+ [ Martin Pitt ]
|
||||
+ * src/Makefile.{am,in}: Add missing -lrt, as pack.c uses clock_gettime.
|
||||
+ Fixes building with gcc 4.5.
|
||||
+ * debian/rules: Revert --sourcedir passing, it's not necessary.
|
||||
+ * debian/rules: Don't install apport hook as executable.
|
||||
+ * debian/copyright: Point to versioned GPL-2 file.
|
||||
+ * debian/control: Bump Standards-Version to 3.9.1.
|
||||
+
|
||||
+ -- Martin Pitt <martin.pitt@ubuntu.com> Fri, 26 Nov 2010 12:29:40 +0100
|
||||
+
|
||||
+ureadahead (0.100.0-8) maverick; urgency=low
|
||||
+
|
||||
+ * Decrease the buffer size to just 8MB, after much testing we don't
|
||||
+ need much more than this since it will be limited by the size of the
|
||||
+ page cache anyway.
|
||||
+
|
||||
+ This is in lieu of a new version of ureadahead for Maverick, which
|
||||
+ while work is ongoing, isn't ready for shipping at this time.
|
||||
+ LP: #600359.
|
||||
+
|
||||
+ -- Scott James Remnant <scott@ubuntu.com> Mon, 20 Sep 2010 18:34:31 +0100
|
||||
+
|
||||
+ureadahead (0.100.0-7) maverick; urgency=low
|
||||
+
|
||||
+ * Count the number of CPUs and divide buffer_size_kb by the number of CPUs.
|
||||
+ Users should watch for instances of "mmiotrace has lost events" in dmesg to make
|
||||
+ sure the trace buffers are not too small. The original value for
|
||||
+ buffer_size_kb was chosen somewhat arbitrarily. Empirical testing
|
||||
+ has shown that its large enough, so we don't actually know where the lower
|
||||
+ boundary lies.
|
||||
+ -LP: #491943
|
||||
+
|
||||
+ -- Tim Gardner <tim.gardner@canonical.com> Fri, 20 Aug 2010 12:19:31 -0600
|
||||
+
|
||||
+ureadahead (0.100.0-6) maverick; urgency=low
|
||||
+
|
||||
+ * Restore buffer_size_kb upon exit, but do it _after_
|
||||
+ the trace buffer has been read. This frees the memory
|
||||
+ consumed by the trace operation (which can be a lot).
|
||||
+ -LP: #501715
|
||||
+
|
||||
+ -- Tim Gardner <tim.gardner@canonical.com> Thu, 22 Jul 2010 04:04:36 -0600
|
||||
+
|
||||
+ureadahead (0.100.0-5) maverick; urgency=low
|
||||
+
|
||||
+ * src/pack.c: Amend mount point detection logic to stat the mount point
|
||||
+ instead of just comparing major/minor versions with /proc/self/mountinfo
|
||||
+ (LP: #570014).
|
||||
+
|
||||
+ -- Chow Loong Jin <hyperair@ubuntu.com> Fri, 25 Jun 2010 13:14:54 +0100
|
||||
+
|
||||
+ureadahead (0.100.0-4.1) lucid; urgency=low
|
||||
+
|
||||
+ * Revert previous upload; had forgotten that the sreadahead package
|
||||
+ contains all the clean-up stuff so we want to keep it for the
|
||||
+ release upgrade after all.
|
||||
+
|
||||
+ -- Scott James Remnant <scott@ubuntu.com> Wed, 17 Feb 2010 12:57:00 +0000
|
||||
+
|
||||
+ureadahead (0.100.0-4) lucid; urgency=low
|
||||
+
|
||||
+ * debian/control: drop sreadahead migration package; dist-upgrade users
|
||||
+ will have ureadahead installed by the standard meta-packages.
|
||||
+
|
||||
+ -- Scott James Remnant <scott@ubuntu.com> Wed, 17 Feb 2010 12:14:09 +0000
|
||||
+
|
||||
+ureadahead (0.100.0-3) lucid; urgency=low
|
||||
+
|
||||
+ * conf/ureadahead-other.conf: Change from "on mount" to "on mounted",
|
||||
+ the former didn't work anyway.
|
||||
+
|
||||
+ -- Scott James Remnant <scott@ubuntu.com> Mon, 21 Dec 2009 23:20:02 +0000
|
||||
+
|
||||
+ureadahead (0.100.0-2) lucid; urgency=low
|
||||
+
|
||||
+ * Put an all-important "--" in the dh_auto_configure invocation so that
|
||||
+ ureadahead is installed into the right path (/sbin)
|
||||
+
|
||||
+ -- Scott James Remnant <scott@ubuntu.com> Tue, 01 Dec 2009 02:25:50 +0000
|
||||
+
|
||||
+ureadahead (0.100.0-1) lucid; urgency=low
|
||||
+
|
||||
+ * New upstream release:
|
||||
+ - Use external libnih
|
||||
+
|
||||
+ * debian/control: Add build-dependency on libnih-dev
|
||||
+ * debian/rules: Fix installation of apport hook.
|
||||
+
|
||||
+ -- Scott James Remnant <scott@ubuntu.com> Sun, 29 Nov 2009 15:24:15 +0000
|
||||
+
|
||||
+ureadahead (0.90.3-2) karmic-proposed; urgency=low
|
||||
+
|
||||
+ * über-readahead is a replacement for sreadahead that should
|
||||
+ significantly improve boot performance on rotational hard drives,
|
||||
+ especially those that had regressed in performance from jaunty to
|
||||
+ karmic.
|
||||
+
|
||||
+ It does this by pre-loading such things as ext2/3/4 inodes and opening
|
||||
+ files in as logical order as possible before loading all blocks in one
|
||||
+ pass across the disk.
|
||||
+
|
||||
+ On SSD, this behaves much as sreadahead used to, replacing that package
|
||||
+ with slightly improved tracing code.
|
||||
+
|
||||
+ This requires the kernel package also found in karmic-proposed.
|
||||
+
|
||||
+ LP: #432089.
|
||||
+
|
||||
+ -- Scott James Remnant <scott@ubuntu.com> Mon, 09 Nov 2009 18:38:51 +0000
|
||||
+
|
||||
+ureadahead (0.90.3-1) karmic; urgency=low
|
||||
+
|
||||
+ * New upstream release:
|
||||
+ - Move ext2fs inode group lookup into the tracing stage, storing the
|
||||
+ groups to preload in the pack, rather than spending time on normal
|
||||
+ boots working it out.
|
||||
+ - Open files in order of inode group (or inode number on non-ext2fs),
|
||||
+ which seems to give a benefit in load time and certainly produces
|
||||
+ better blktrace output.
|
||||
+ - Increase the "too old" check from a month to a year.
|
||||
+ - Fix dump of zero-byte files to not claim a single page.
|
||||
+ - Fix unhandled error output when given an unknown pack file.
|
||||
+ - Don't call ureadhead for the root filesystem twice on boot (the second
|
||||
+ time should only take a few ms, but that's still time)
|
||||
+ - Consider exit status 4 (no pack file for given mount point) normal.
|
||||
+ - Make uselib tracing optional.
|
||||
+
|
||||
+ -- Scott James Remnant <scott@ubuntu.com> Thu, 05 Nov 2009 15:10:06 +0000
|
||||
+
|
||||
+ureadahead (0.90.2-1) karmic; urgency=low
|
||||
+
|
||||
+ * New upstream release:
|
||||
+ - improved SSD mode
|
||||
+ - inode group preload threshold configurable by environment variable
|
||||
+ - default inode group preload threshold changed to 16, because random
|
||||
+ stabbing in the dark suggested it was a good number
|
||||
+ - add a job that profiles extra mountpoints
|
||||
+
|
||||
+ * Remove /etc/cron.monthly/sreadahead too.
|
||||
+ * Add an apport hook to attach a dump of the packs.
|
||||
+
|
||||
+ -- Scott James Remnant <scott@ubuntu.com> Thu, 29 Oct 2009 18:14:51 +0000
|
||||
+
|
||||
+ureadahead (0.90.1-1) karmic; urgency=low
|
||||
+
|
||||
+ * Bug fixes.
|
||||
+
|
||||
+ -- Scott James Remnant <scott@ubuntu.com> Thu, 29 Oct 2009 02:13:38 +0000
|
||||
+
|
||||
+ureadahead (0.90.0-1) karmic; urgency=low
|
||||
+
|
||||
+ * Initial release to ubuntu-boot PPA.
|
||||
+
|
||||
+ -- Scott James Remnant <scott@ubuntu.com> Thu, 29 Oct 2009 01:01:42 +0000
|
||||
--- ureadahead-0.100.0.orig/debian/ureadahead.apport
|
||||
+++ ureadahead-0.100.0/debian/ureadahead.apport
|
||||
@@ -0,0 +1,15 @@
|
||||
+'''apport package hook for ureadahead
|
||||
+
|
||||
+(c) 2009 Canonical Ltd.
|
||||
+Author: Scott James Remnant <scott@ubuntu.com>
|
||||
+'''
|
||||
+
|
||||
+import os
|
||||
+import apport.hookutils
|
||||
+
|
||||
+def add_info(report):
|
||||
+ for f in os.listdir('/var/lib/ureadahead'):
|
||||
+ if f == 'pack':
|
||||
+ report['PackDump'] = apport.hookutils.command_output(['ureadahead', '--dump'])
|
||||
+ elif f.endswith('.pack'):
|
||||
+ report['PackDump'+f[:-5].title()] = apport.hookutils.command_output(['ureadahead', '--dump'])
|
||||
@ -1,36 +0,0 @@
|
||||
# Copyright 1999-2010 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
EAPI=2
|
||||
inherit eutils
|
||||
|
||||
DESCRIPTION="Ureadahead - Read files in advance during boot"
|
||||
HOMEPAGE="https://launchpad.net/ureadahead"
|
||||
SRC_URI="http://launchpad.net/ureadahead/trunk/${PV}/+download/${P}.tar.gz"
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="x86 amd64 arm"
|
||||
|
||||
RDEPEND="sys-apps/util-linux
|
||||
>=sys-fs/e2fsprogs-1.41
|
||||
sys-libs/libnih"
|
||||
|
||||
DEPEND="${RDEPEND}
|
||||
dev-util/pkgconfig
|
||||
sys-devel/gettext"
|
||||
|
||||
src_prepare() {
|
||||
epatch "${FILESDIR}"/${P}-11.patch # Downloaded from upstream
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
econf --sbindir=/sbin
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake DESTDIR="${D}" install || die "emake install failed"
|
||||
rm -r "${D}/etc/init"
|
||||
keepdir /var/lib/ureadahead
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user