Compare commits
No commits in common. "rawhide" and "f25" have entirely different histories.
6 changed files with 165 additions and 268 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1 +1 @@
|
|||
/acpid-*.tar.xz
|
||||
acpid-*.tar.xz
|
||||
|
|
|
|||
|
|
@ -1,131 +0,0 @@
|
|||
diff --git a/kacpimon/connection_list.c b/kacpimon/connection_list.c
|
||||
index 9b0b0a8..f228186 100644
|
||||
--- a/kacpimon/connection_list.c
|
||||
+++ b/kacpimon/connection_list.c
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
|
||||
#include "connection_list.h"
|
||||
|
||||
@@ -30,9 +31,9 @@
|
||||
/*---------------------------------------------------------------*/
|
||||
/* private objects */
|
||||
|
||||
-#define MAX_CONNECTIONS 100
|
||||
+static int capacity = 0;
|
||||
|
||||
-static struct connection connection_list[MAX_CONNECTIONS];
|
||||
+static struct connection *connection_list = NULL;
|
||||
|
||||
static int nconnections = 0;
|
||||
|
||||
@@ -51,9 +52,19 @@ add_connection(struct connection *p)
|
||||
{
|
||||
if (nconnections < 0)
|
||||
return;
|
||||
- if (nconnections >= MAX_CONNECTIONS) {
|
||||
- printf("add_connection(): Too many connections.\n");
|
||||
- return;
|
||||
+
|
||||
+ /* if the list is full, allocate more space */
|
||||
+ if (nconnections >= capacity) {
|
||||
+ /* no more than 1024 */
|
||||
+ if (capacity > 1024) {
|
||||
+ printf("add_connection(): Too many connections.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* another 20 */
|
||||
+ capacity += 20;
|
||||
+ connection_list =
|
||||
+ realloc(connection_list, sizeof(struct connection) * capacity);
|
||||
}
|
||||
|
||||
if (nconnections == 0)
|
||||
@@ -70,6 +81,30 @@ add_connection(struct connection *p)
|
||||
|
||||
/*---------------------------------------------------------------*/
|
||||
|
||||
+void
|
||||
+delete_all_connections(void)
|
||||
+{
|
||||
+ int i = 0;
|
||||
+
|
||||
+ /* For each connection */
|
||||
+ for (i = 0; i <= get_number_of_connections(); ++i)
|
||||
+ {
|
||||
+ struct connection *p;
|
||||
+
|
||||
+ p = get_connection(i);
|
||||
+
|
||||
+ /* If this connection is invalid, try the next. */
|
||||
+ if (p == 0)
|
||||
+ continue;
|
||||
+
|
||||
+ close(p -> fd);
|
||||
+ }
|
||||
+ free(connection_list);
|
||||
+ connection_list = NULL;
|
||||
+}
|
||||
+
|
||||
+/*---------------------------------------------------------------*/
|
||||
+
|
||||
struct connection *
|
||||
find_connection(int fd)
|
||||
{
|
||||
diff --git a/kacpimon/connection_list.h b/kacpimon/connection_list.h
|
||||
index 1d037cf..a787637 100644
|
||||
--- a/kacpimon/connection_list.h
|
||||
+++ b/kacpimon/connection_list.h
|
||||
@@ -56,4 +56,7 @@ extern const fd_set *get_fdset(void);
|
||||
/* get the highest fd that was added to the list */
|
||||
extern int get_highestfd(void);
|
||||
|
||||
+/* delete all connections, closing the fds */
|
||||
+extern void delete_all_connections(void);
|
||||
+
|
||||
#endif /* CONNECTION_LIST_H__ */
|
||||
diff --git a/kacpimon/kacpimon.c b/kacpimon/kacpimon.c
|
||||
index 1ddb9aa..253d270 100644
|
||||
--- a/kacpimon/kacpimon.c
|
||||
+++ b/kacpimon/kacpimon.c
|
||||
@@ -164,27 +164,6 @@ static void monitor(void)
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
-static void close_all(void)
|
||||
-{
|
||||
- int i = 0;
|
||||
-
|
||||
- /* For each connection */
|
||||
- for (i = 0; i <= get_number_of_connections(); ++i)
|
||||
- {
|
||||
- struct connection *p;
|
||||
-
|
||||
- p = get_connection(i);
|
||||
-
|
||||
- /* If this connection is invalid, try the next. */
|
||||
- if (p == 0)
|
||||
- continue;
|
||||
-
|
||||
- close(p -> fd);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-// ---------------------------------------------------------------
|
||||
-
|
||||
int main(void)
|
||||
{
|
||||
printf("Kernel ACPI Event Monitor...\n");
|
||||
@@ -199,7 +178,7 @@ int main(void)
|
||||
|
||||
printf("Closing files...\n");
|
||||
|
||||
- close_all();
|
||||
+ delete_all_connections();
|
||||
|
||||
printf("Goodbye\n");
|
||||
|
||||
115
acpid.init
Executable file
115
acpid.init
Executable file
|
|
@ -0,0 +1,115 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# /etc/rc.d/init.d/acpid
|
||||
#
|
||||
# Starts the acpi daemon
|
||||
#
|
||||
# chkconfig: 345 26 74
|
||||
# description: Listen and dispatch ACPI events from the kernel
|
||||
# processname: acpid
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: acpid
|
||||
# Required-Start: $syslog $local_fs
|
||||
# Required-Stop: $syslog $local_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: start and stop acpid
|
||||
# Description: Listen and dispatch ACPI events from the kernel
|
||||
### END INIT INFO
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# Source networking configuration.
|
||||
. /etc/sysconfig/acpid
|
||||
|
||||
RETVAL=0
|
||||
|
||||
#
|
||||
# See how we were called.
|
||||
#
|
||||
|
||||
check() {
|
||||
# Check that we're a privileged user
|
||||
[ `id -u` = 0 ] || exit 4
|
||||
|
||||
# Check if acpid is executable
|
||||
test -x /usr/sbin/acpid || exit 5
|
||||
}
|
||||
|
||||
start() {
|
||||
|
||||
check
|
||||
|
||||
# Check if it is already running
|
||||
if [ ! -f /var/lock/subsys/acpid ]; then
|
||||
echo -n $"Starting acpi daemon: "
|
||||
daemon /usr/sbin/acpid $OPTIONS
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/acpid
|
||||
echo
|
||||
fi
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
||||
check
|
||||
|
||||
echo -n $"Stopping acpi daemon: "
|
||||
killproc /usr/sbin/acpid
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/acpid
|
||||
echo
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
|
||||
check
|
||||
|
||||
trap "" SIGHUP
|
||||
action $"Reloading acpi daemon:" killall -HUP acpid
|
||||
RETVAL=$?
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
reload)
|
||||
reload
|
||||
;;
|
||||
force-reload)
|
||||
echo "$0: Unimplemented feature."
|
||||
RETVAL=3
|
||||
;;
|
||||
restart)
|
||||
restart
|
||||
;;
|
||||
condrestart)
|
||||
if [ -f /var/lock/subsys/acpid ]; then
|
||||
restart
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
status acpid
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
|
||||
RETVAL=2
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
|
|
@ -3,7 +3,7 @@ Description=ACPID Listen Socket
|
|||
Documentation=man:acpid(8)
|
||||
|
||||
[Socket]
|
||||
ListenStream=/run/acpid.socket
|
||||
ListenStream=/var/run/acpid.socket
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
|
|
|
|||
181
acpid.spec
181
acpid.spec
|
|
@ -7,39 +7,51 @@
|
|||
|
||||
Summary: ACPI Event Daemon
|
||||
Name: acpid
|
||||
Version: 2.0.34
|
||||
Release: 15%{?dist}
|
||||
License: GPL-2.0-or-later
|
||||
Version: 2.0.28
|
||||
Release: 2%{?dist}
|
||||
License: GPLv2+
|
||||
Group: System Environment/Daemons
|
||||
Source: http://downloads.sourceforge.net/acpid2/%{name}-%{version}.tar.xz
|
||||
Source1: acpid.init
|
||||
Source2: acpid.video.conf
|
||||
Source3: acpid.power.conf
|
||||
Source4: acpid.power.sh
|
||||
Source5: acpid.service
|
||||
Source6: acpid.sysconfig
|
||||
Source7: acpid.socket
|
||||
# https://sourceforge.net/p/acpid2/tickets/14/
|
||||
Patch0: acpid-2.0.32-kacpimon-dynamic-connections.patch
|
||||
%if 0%{?rhel}
|
||||
ExclusiveArch: x86_64 aarch64 riscv64
|
||||
%endif
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
ExclusiveArch: ia64 x86_64 %{ix86} %{arm} aarch64
|
||||
URL: http://sourceforge.net/projects/acpid2/
|
||||
BuildRequires: systemd, gcc
|
||||
BuildRequires: make
|
||||
BuildRequires: systemd
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
Requires(postun): systemd
|
||||
Requires: systemd
|
||||
|
||||
|
||||
%description
|
||||
acpid is a daemon that dispatches ACPI events to user-space programs.
|
||||
|
||||
%if 0%{?fedora} < 23
|
||||
%package sysvinit
|
||||
Summary: ACPI Event Daemon
|
||||
Group: System Environment/Daemons
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires(preun): /sbin/service
|
||||
|
||||
%description sysvinit
|
||||
The acpid-sysvinit contains SysV initscript.
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch -P0 -p1 -b .kacpimon-dynamic-connections
|
||||
|
||||
|
||||
%build
|
||||
%configure
|
||||
make %{?_smp_mflags} CFLAGS="%{optflags} %{?harden}"
|
||||
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
mkdir -p %{buildroot}
|
||||
|
|
@ -51,18 +63,31 @@ mkdir -p %{buildroot}%{_unitdir}
|
|||
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
|
||||
|
||||
chmod 755 %{buildroot}%{_sysconfdir}/acpi/events
|
||||
install -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/acpi/events/videoconf
|
||||
install -p -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/acpi/events/powerconf
|
||||
install -p -m 755 %{SOURCE4} %{buildroot}%{_sysconfdir}/acpi/actions/power.sh
|
||||
install -p -m 644 %{SOURCE5} %{SOURCE7} %{buildroot}%{_unitdir}
|
||||
install -p -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/sysconfig/acpid
|
||||
|
||||
%if 0%{?fedora} < 23
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/rc.d/init.d
|
||||
install -p -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/rc.d/init.d/acpid
|
||||
%endif
|
||||
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc %{_docdir}/%{name}
|
||||
%{_unitdir}/%{name}.service
|
||||
%{_unitdir}/%{name}.socket
|
||||
%dir %{_sysconfdir}/acpi
|
||||
%dir %{_sysconfdir}/acpi/events
|
||||
%dir %{_sysconfdir}/acpi/actions
|
||||
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/acpi/events/videoconf
|
||||
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/acpi/events/powerconf
|
||||
%config(noreplace) %attr(0755,root,root) %{_sysconfdir}/acpi/actions/power.sh
|
||||
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/acpid
|
||||
|
|
@ -73,6 +98,11 @@ install -p -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/sysconfig/acpid
|
|||
%{_mandir}/man8/acpi_listen.8.gz
|
||||
%{_mandir}/man8/kacpimon.8.gz
|
||||
|
||||
%if 0%{?fedora} < 23
|
||||
%files sysvinit
|
||||
%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/acpid
|
||||
%endif
|
||||
|
||||
%pre
|
||||
if [ "$1" = "2" ]; then
|
||||
conflist=`ls %{_sysconfdir}/acpi/events/*.conf 2> /dev/null`
|
||||
|
|
@ -98,130 +128,13 @@ fi
|
|||
/sbin/chkconfig --del acpid >/dev/null 2>&1 || :
|
||||
/bin/systemctl try-restart acpid.service >/dev/null 2>&1 || :
|
||||
|
||||
%if 0%{?fedora} < 23
|
||||
%triggerpostun -n %{name}-sysvinit -- %{name} < 2.0.10-2
|
||||
/sbin/chkconfig --add acpid >/dev/null 2>&1 || :
|
||||
%endif
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Jan 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.34-15
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
|
||||
|
||||
* Wed Jul 23 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.34-14
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
|
||||
|
||||
* Tue Apr 15 2025 Jaroslav Škarvada <jskarvad@redhat.com> - 2.0.34-13
|
||||
- Used exclusiverch on RHEL
|
||||
|
||||
* Thu Apr 3 2025 Jaroslav Škarvada <jskarvad@redhat.com> - 2.0.34-12
|
||||
- Dropped exclusivearch, the package is still useless on POWER (no firmware support
|
||||
yet), but it is required by some dependency
|
||||
Resolves: rhbz#2355763
|
||||
|
||||
* Thu Jan 16 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.34-11
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
|
||||
|
||||
* Mon Aug 12 2024 Jaroslav Škarvada <jskarvad@redhat.com> - 2.0.34-10
|
||||
- Dropped videoconf, obsolete for some time
|
||||
Resolves: rhbz#2296943
|
||||
|
||||
* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.34-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
||||
|
||||
* Fri Feb 23 2024 Songsong Zhang <U2FsdGVkX1@gmail.com> - 2.0.34-8
|
||||
- Add riscv64 support
|
||||
|
||||
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.34-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.34-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Wed Aug 9 2023 Jaroslav Škarvada <jskarvad@redhat.com> - 2.0.34-5
|
||||
- SPDX license fix
|
||||
|
||||
* Wed Aug 9 2023 Jaroslav Škarvada <jskarvad@redhat.com> - 2.0.34-4
|
||||
- Converted license to SPDX
|
||||
|
||||
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.34-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Wed Jan 18 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.34-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Sat Sep 24 2022 Jaroslav Škarvada <jskarvad@redhat.com> - 2.0.34-1
|
||||
- New version
|
||||
Resolves: rhbz#2127331
|
||||
|
||||
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.33-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.33-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Tue Oct 5 2021 Jaroslav Škarvada <jskarvad@redhat.com> - 2.0.33-1
|
||||
- New version
|
||||
Resolves: rhbz#2004773
|
||||
|
||||
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.32-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Thu Jul 01 2021 FeRD (Frank Dana) <ferdnyc@gmail.com> - 2.0.32-6
|
||||
- Updated socket path from /var/run => /run in acpid.socket
|
||||
|
||||
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.32-5
|
||||
- Rebuilt for updated systemd-rpm-macros
|
||||
See https://pagure.io/fesco/issue/2583.
|
||||
|
||||
* Mon Jan 25 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.32-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.32-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.32-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Tue Aug 20 2019 Jaroslav Škarvada <jskarvad@redhat.com> - 2.0.32-1
|
||||
- New version
|
||||
Resolves: rhbz#1742776
|
||||
|
||||
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.30-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.30-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Thu Nov 15 2018 Jaroslav Škarvada <jskarvad@redhat.com> - 2.0.30-2
|
||||
- Dropped sysvinit support
|
||||
|
||||
* Thu Jul 19 2018 Jaroslav Škarvada <jskarvad@redhat.com> - 2.0.30-1
|
||||
- New version
|
||||
Resolves: rhbz#1602974
|
||||
|
||||
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.29-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Thu Apr 19 2018 Jaroslav Škarvada <jskarvad@redhat.com> - 2.0.29-1
|
||||
- New version
|
||||
Resolves: rhbz#1568392
|
||||
|
||||
* Mon Feb 19 2018 Ondřej Lysoněk <olysonek@redhat.com> - 2.0.28-8
|
||||
- Add gcc to BuildRequires
|
||||
|
||||
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.28-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Thu Aug 31 2017 Jaroslav Škarvada <jskarvad@redhat.com> - 2.0.28-6
|
||||
- Switched kacpimon to dynamic connections (increased max connections
|
||||
from 20 to 1024)
|
||||
Resolves: rhbz#1450980
|
||||
- Consolidated new line delimiters
|
||||
|
||||
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.28-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
||||
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.28-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.28-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||
|
||||
* Wed Jan 18 2017 Ondřej Lysoněk <olysonek@redhat.com> - 2.0.28-2
|
||||
- Fixed obtaining process list in power.sh to avoid SELinux denials
|
||||
Resolves: rhbz#1408457
|
||||
|
|
|
|||
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
SHA512 (acpid-2.0.34.tar.xz) = 2bf92295b55bb44fe83074b3e0c1ae639f63edaeea84b2184ae95b38852be40f380d5413110b8c0fcb2efc2ec01bf4764e1dcb97022fc724bebbfc35c0b63c81
|
||||
0432407b5ff75ae8e08afb43052fde2b acpid-2.0.28.tar.xz
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue