* Thu May 13 2021 Miroslav Rezanina <mrezanin@redhat.com> - 6.0.0-2
- kvm-Remove-message-with-running-VM-count.patch [bz#1914461] - kvm-Remove-SPICE-and-QXL-from-x86_64-rh-devices.mak.patch [bz#1906168] - kvm-spec-file-build-qemu-kvm-without-SPICE-and-QXL.patch [bz#1906168] - kvm-spec-file-Obsolete-qemu-kvm-ui-spice.patch [bz#1906168] - Resolves: bz#1914461 (Remove KVM guest count and limit info message) - Resolves: bz#1906168 ([RHEL-9] qemu-kvm spec-file: Do not BuildRequire spice)
This commit is contained in:
parent
28609d56cc
commit
93c38bfc16
@ -1 +0,0 @@
|
|||||||
DEVPATH=="*/kvm", ACTION=="change", RUN+="/lib/udev/udev-kvm-check $env{COUNT} $env{EVENT}"
|
|
43
kvm-Remove-SPICE-and-QXL-from-x86_64-rh-devices.mak.patch
Normal file
43
kvm-Remove-SPICE-and-QXL-from-x86_64-rh-devices.mak.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
From c51bf45304812b4da010bdd3db1b1d59c44af4ee Mon Sep 17 00:00:00 2001
|
||||||
|
From: Uri Lublin <uril@redhat.com>
|
||||||
|
Date: Tue, 27 Apr 2021 18:37:09 +0300
|
||||||
|
Subject: [PATCH 2/4] Remove SPICE and QXL from x86_64-rh-devices.mak
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
RH-Author: Uri Lublin (uril)
|
||||||
|
RH-MergeRequest: 3: Build qemu-kvm without SPICE and QXL
|
||||||
|
RH-Commit: [1/3] 8f6186049d22c3a6e1bfb1cf2bfe88a8fc8c2271
|
||||||
|
RH-Bugzilla: 1906168
|
||||||
|
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||||
|
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
||||||
|
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||||
|
RH-Acked-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||||
|
---
|
||||||
|
default-configs/devices/x86_64-rh-devices.mak | 2 --
|
||||||
|
1 file changed, 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/default-configs/devices/x86_64-rh-devices.mak b/default-configs/devices/x86_64-rh-devices.mak
|
||||||
|
index 9f41400530..d09c138fc6 100644
|
||||||
|
--- a/default-configs/devices/x86_64-rh-devices.mak
|
||||||
|
+++ b/default-configs/devices/x86_64-rh-devices.mak
|
||||||
|
@@ -60,7 +60,6 @@ CONFIG_PFLASH_CFI01=y
|
||||||
|
CONFIG_PVPANIC_ISA=y
|
||||||
|
CONFIG_PXB=y
|
||||||
|
CONFIG_Q35=y
|
||||||
|
-CONFIG_QXL=y
|
||||||
|
CONFIG_RTL8139_PCI=y
|
||||||
|
CONFIG_SCSI=y
|
||||||
|
CONFIG_SERIAL=y
|
||||||
|
@@ -70,7 +69,6 @@ CONFIG_SEV=y
|
||||||
|
CONFIG_SGA=y
|
||||||
|
CONFIG_SMBIOS=y
|
||||||
|
CONFIG_SMBUS_EEPROM=y
|
||||||
|
-CONFIG_SPICE=y
|
||||||
|
CONFIG_TEST_DEVICES=y
|
||||||
|
CONFIG_USB=y
|
||||||
|
CONFIG_USB_EHCI=y
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
@ -2,7 +2,6 @@
|
|||||||
%global SLOF_gittagcommit 899d9883
|
%global SLOF_gittagcommit 899d9883
|
||||||
|
|
||||||
%global have_usbredir 1
|
%global have_usbredir 1
|
||||||
%global have_spice 1
|
|
||||||
%global have_opengl 1
|
%global have_opengl 1
|
||||||
%global have_fdt 0
|
%global have_fdt 0
|
||||||
%global have_gluster 1
|
%global have_gluster 1
|
||||||
@ -27,7 +26,6 @@
|
|||||||
%ifarch x86_64
|
%ifarch x86_64
|
||||||
%global kvm_target x86_64
|
%global kvm_target x86_64
|
||||||
%else
|
%else
|
||||||
%global have_spice 0
|
|
||||||
%global have_opengl 0
|
%global have_opengl 0
|
||||||
%global have_gluster 0
|
%global have_gluster 0
|
||||||
%endif
|
%endif
|
||||||
@ -53,9 +51,6 @@
|
|||||||
#Versions of various parts:
|
#Versions of various parts:
|
||||||
|
|
||||||
%global requires_all_modules \
|
%global requires_all_modules \
|
||||||
%if %{have_spice} \
|
|
||||||
Requires: %{name}-ui-spice = %{epoch}:%{version}-%{release} \
|
|
||||||
%endif \
|
|
||||||
%if %{have_opengl} \
|
%if %{have_opengl} \
|
||||||
Requires: %{name}-ui-opengl = %{epoch}:%{version}-%{release} \
|
Requires: %{name}-ui-opengl = %{epoch}:%{version}-%{release} \
|
||||||
%endif \
|
%endif \
|
||||||
@ -70,7 +65,7 @@ Requires: %{name}-block-ssh = %{epoch}:%{version}-%{release}
|
|||||||
Summary: QEMU is a machine emulator and virtualizer
|
Summary: QEMU is a machine emulator and virtualizer
|
||||||
Name: qemu-kvm
|
Name: qemu-kvm
|
||||||
Version: 6.0.0
|
Version: 6.0.0
|
||||||
Release: 1%{?rcversion}%{?dist}
|
Release: 2%{?rcversion}%{?dist}
|
||||||
# Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped
|
# Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped
|
||||||
Epoch: 15
|
Epoch: 15
|
||||||
License: GPLv2 and GPLv2+ and CC-BY
|
License: GPLv2 and GPLv2+ and CC-BY
|
||||||
@ -102,8 +97,6 @@ Source30: kvm-s390x.conf
|
|||||||
Source31: kvm-x86.conf
|
Source31: kvm-x86.conf
|
||||||
Source32: qemu-pr-helper.service
|
Source32: qemu-pr-helper.service
|
||||||
Source33: qemu-pr-helper.socket
|
Source33: qemu-pr-helper.socket
|
||||||
Source34: 81-kvm-rhel.rules
|
|
||||||
Source35: udev-kvm-check.c
|
|
||||||
Source36: README.tests
|
Source36: README.tests
|
||||||
|
|
||||||
|
|
||||||
@ -122,6 +115,8 @@ Patch0015: 0015-Use-qemu-kvm-in-documentation-instead-of-qemu-system.patch
|
|||||||
Patch0016: 0016-virtio-scsi-Reject-scsi-cd-if-data-plane-enabled-RHE.patch
|
Patch0016: 0016-virtio-scsi-Reject-scsi-cd-if-data-plane-enabled-RHE.patch
|
||||||
Patch0017: 0017-BZ1653590-Require-at-least-64kiB-pages-for-downstrea.patch
|
Patch0017: 0017-BZ1653590-Require-at-least-64kiB-pages-for-downstrea.patch
|
||||||
Patch0018: 0018-block-Versioned-x-blockdev-reopen-API-with-feature-f.patch
|
Patch0018: 0018-block-Versioned-x-blockdev-reopen-API-with-feature-f.patch
|
||||||
|
# For bz#1906168 - [RHEL-9] qemu-kvm spec-file: Do not BuildRequire spice
|
||||||
|
Patch19: kvm-Remove-SPICE-and-QXL-from-x86_64-rh-devices.mak.patch
|
||||||
|
|
||||||
BuildRequires: wget
|
BuildRequires: wget
|
||||||
BuildRequires: rpm-build
|
BuildRequires: rpm-build
|
||||||
@ -146,13 +141,6 @@ BuildRequires: usbredir-devel >= 0.7.1
|
|||||||
%endif
|
%endif
|
||||||
BuildRequires: texinfo
|
BuildRequires: texinfo
|
||||||
BuildRequires: python3-sphinx
|
BuildRequires: python3-sphinx
|
||||||
%if %{have_spice}
|
|
||||||
BuildRequires: spice-protocol >= 0.12.12
|
|
||||||
BuildRequires: spice-server-devel >= 0.12.8
|
|
||||||
BuildRequires: libcacard-devel
|
|
||||||
# For smartcard NSS support
|
|
||||||
BuildRequires: nss-devel
|
|
||||||
%endif
|
|
||||||
BuildRequires: libseccomp-devel >= 2.4.0
|
BuildRequires: libseccomp-devel >= 2.4.0
|
||||||
# For network block driver
|
# For network block driver
|
||||||
BuildRequires: libcurl-devel
|
BuildRequires: libcurl-devel
|
||||||
@ -272,6 +260,12 @@ Requires: usbredir >= 0.7.1
|
|||||||
Requires: libfdt >= 1.6.0
|
Requires: libfdt >= 1.6.0
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
# Since SPICE is removed from RHEL-9, the following Obsoletes:
|
||||||
|
# removes qemu-kvm-ui-spice for upgrades from RHEL-8
|
||||||
|
# The "<= {version}" assumes RHEL-9 version >= RHEL-8 version (in
|
||||||
|
# other words RHEL-9 rebases are done together/before RHEL-8 ones)
|
||||||
|
Obsoletes: qemu-kvm-ui-spice <= %{version}
|
||||||
|
|
||||||
%description -n qemu-kvm-core
|
%description -n qemu-kvm-core
|
||||||
qemu-kvm is an open source virtualizer that provides hardware
|
qemu-kvm is an open source virtualizer that provides hardware
|
||||||
emulation for the KVM hypervisor. qemu-kvm acts as a virtual
|
emulation for the KVM hypervisor. qemu-kvm acts as a virtual
|
||||||
@ -398,19 +392,6 @@ Install this package if you want to access remote disks using
|
|||||||
the Secure Shell (SSH) protocol.
|
the Secure Shell (SSH) protocol.
|
||||||
|
|
||||||
|
|
||||||
%if %{have_spice}
|
|
||||||
%package ui-spice
|
|
||||||
Summary: QEMU spice support
|
|
||||||
Requires: %{name}-common%{?_isa} = %{epoch}:%{version}-%{release}
|
|
||||||
%if %{have_opengl}
|
|
||||||
Requires: %{name}-ui-opengl%{?_isa} = %{epoch}:%{version}-%{release}
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%description ui-spice
|
|
||||||
This package provides spice support.
|
|
||||||
%endif
|
|
||||||
|
|
||||||
|
|
||||||
%if %{have_opengl}
|
%if %{have_opengl}
|
||||||
%package ui-opengl
|
%package ui-opengl
|
||||||
Summary: QEMU opengl support
|
Summary: QEMU opengl support
|
||||||
@ -642,10 +623,6 @@ pushd %{qemu_kvm_build}
|
|||||||
--enable-seccomp \
|
--enable-seccomp \
|
||||||
--enable-slirp=system \
|
--enable-slirp=system \
|
||||||
--enable-snappy \
|
--enable-snappy \
|
||||||
%if 0%{have_spice}
|
|
||||||
--enable-smartcard \
|
|
||||||
--enable-spice \
|
|
||||||
%endif
|
|
||||||
--enable-system \
|
--enable-system \
|
||||||
--enable-tcg \
|
--enable-tcg \
|
||||||
--enable-tools \
|
--enable-tools \
|
||||||
@ -707,7 +684,6 @@ make V=1 %{?_smp_mflags} $buildldflags
|
|||||||
cp -a %{kvm_target}-softmmu/qemu-system-%{kvm_target} qemu-kvm
|
cp -a %{kvm_target}-softmmu/qemu-system-%{kvm_target} qemu-kvm
|
||||||
|
|
||||||
gcc %{SOURCE6} $RPM_OPT_FLAGS $RPM_LD_FLAGS -o ksmctl
|
gcc %{SOURCE6} $RPM_OPT_FLAGS $RPM_LD_FLAGS -o ksmctl
|
||||||
gcc %{SOURCE35} $RPM_OPT_FLAGS $RPM_LD_FLAGS -o udev-kvm-check
|
|
||||||
%endif
|
%endif
|
||||||
popd
|
popd
|
||||||
|
|
||||||
@ -761,8 +737,6 @@ mkdir -p $RPM_BUILD_ROOT%{testsdir}/tests/acceptance
|
|||||||
mkdir -p $RPM_BUILD_ROOT%{testsdir}/tests/qemu-iotests
|
mkdir -p $RPM_BUILD_ROOT%{testsdir}/tests/qemu-iotests
|
||||||
mkdir -p $RPM_BUILD_ROOT%{testsdir}/scripts/qmp
|
mkdir -p $RPM_BUILD_ROOT%{testsdir}/scripts/qmp
|
||||||
|
|
||||||
install -p -m 0755 udev-kvm-check $RPM_BUILD_ROOT%{_udevdir}
|
|
||||||
install -p -m 0644 %{SOURCE34} $RPM_BUILD_ROOT%{_udevrulesdir}
|
|
||||||
|
|
||||||
install -m 0644 scripts/dump-guest-memory.py \
|
install -m 0644 scripts/dump-guest-memory.py \
|
||||||
$RPM_BUILD_ROOT%{_datadir}/%{name}
|
$RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||||
@ -911,8 +885,6 @@ rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/opensbi-riscv64-generic-fw_dynamic.*
|
|||||||
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/qemu-nsis.bmp
|
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/qemu-nsis.bmp
|
||||||
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/npcm7xx_bootrom.bin
|
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/npcm7xx_bootrom.bin
|
||||||
|
|
||||||
rm -rf ${RPM_BUILD_ROOT}%{_libdir}/qemu-kvm/ui-spice-app.so
|
|
||||||
|
|
||||||
# Remove virtfs-proxy-helper files
|
# Remove virtfs-proxy-helper files
|
||||||
rm -rf ${RPM_BUILD_ROOT}%{_libexecdir}/virtfs-proxy-helper
|
rm -rf ${RPM_BUILD_ROOT}%{_libexecdir}/virtfs-proxy-helper
|
||||||
rm -rf ${RPM_BUILD_ROOT}%{_mandir}/man1/virtfs-proxy-helper*
|
rm -rf ${RPM_BUILD_ROOT}%{_mandir}/man1/virtfs-proxy-helper*
|
||||||
@ -1122,8 +1094,6 @@ sh %{_sysconfdir}/sysconfig/modules/kvm.modules &> /dev/null || :
|
|||||||
%config(noreplace) %{_sysconfdir}/sysconfig/ksm
|
%config(noreplace) %{_sysconfdir}/sysconfig/ksm
|
||||||
%{_unitdir}/ksmtuned.service
|
%{_unitdir}/ksmtuned.service
|
||||||
%{_sbindir}/ksmtuned
|
%{_sbindir}/ksmtuned
|
||||||
%{_udevdir}/udev-kvm-check
|
|
||||||
%{_udevrulesdir}/81-kvm-rhel.rules
|
|
||||||
%ghost %{_sysconfdir}/kvm
|
%ghost %{_sysconfdir}/kvm
|
||||||
%config(noreplace) %{_sysconfdir}/ksmtuned.conf
|
%config(noreplace) %{_sysconfdir}/ksmtuned.conf
|
||||||
%dir %{_sysconfdir}/%{name}
|
%dir %{_sysconfdir}/%{name}
|
||||||
@ -1245,17 +1215,6 @@ sh %{_sysconfdir}/sysconfig/modules/kvm.modules &> /dev/null || :
|
|||||||
%files block-ssh
|
%files block-ssh
|
||||||
%{_libdir}/qemu-kvm/block-ssh.so
|
%{_libdir}/qemu-kvm/block-ssh.so
|
||||||
|
|
||||||
%if 0%{have_spice}
|
|
||||||
%files ui-spice
|
|
||||||
%{_libdir}/qemu-kvm/hw-usb-smartcard.so
|
|
||||||
%{_libdir}/qemu-kvm/audio-spice.so
|
|
||||||
%{_libdir}/qemu-kvm/ui-spice-core.so
|
|
||||||
%{_libdir}/qemu-kvm/chardev-spice.so
|
|
||||||
%ifarch x86_64
|
|
||||||
%{_libdir}/qemu-kvm/hw-display-qxl.so
|
|
||||||
%endif
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%if 0%{have_opengl}
|
%if 0%{have_opengl}
|
||||||
%files ui-opengl
|
%files ui-opengl
|
||||||
%{_libdir}/qemu-kvm/ui-egl-headless.so
|
%{_libdir}/qemu-kvm/ui-egl-headless.so
|
||||||
@ -1264,6 +1223,16 @@ sh %{_sysconfdir}/sysconfig/modules/kvm.modules &> /dev/null || :
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu May 13 2021 Miroslav Rezanina <mrezanin@redhat.com> - 6.0.0-2
|
||||||
|
- kvm-Remove-message-with-running-VM-count.patch [bz#1914461]
|
||||||
|
- kvm-Remove-SPICE-and-QXL-from-x86_64-rh-devices.mak.patch [bz#1906168]
|
||||||
|
- kvm-spec-file-build-qemu-kvm-without-SPICE-and-QXL.patch [bz#1906168]
|
||||||
|
- kvm-spec-file-Obsolete-qemu-kvm-ui-spice.patch [bz#1906168]
|
||||||
|
- Resolves: bz#1914461
|
||||||
|
(Remove KVM guest count and limit info message)
|
||||||
|
- Resolves: bz#1906168
|
||||||
|
([RHEL-9] qemu-kvm spec-file: Do not BuildRequire spice)
|
||||||
|
|
||||||
* Fri Apr 30 2021 Miroslav Rezanina <mrezanin@redhat.com> - 6.0.0-1
|
* Fri Apr 30 2021 Miroslav Rezanina <mrezanin@redhat.com> - 6.0.0-1
|
||||||
- Rebase to QEMU 6.0
|
- Rebase to QEMU 6.0
|
||||||
- Resolves: bz#1872569
|
- Resolves: bz#1872569
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
elf:
|
elf:
|
||||||
exclude_path:(^/usr/share/qemu-kvm/s390-ccw.img$)|(^/usr/share/qemu-kvm/s390-netboot.img$)
|
exclude_path:(.*s390-ccw.img.*)|(.*s390-netboot.img.*)
|
||||||
inspections:
|
inspections:
|
||||||
badfuncs: off
|
badfuncs: off
|
||||||
|
|
||||||
|
155
udev-kvm-check.c
155
udev-kvm-check.c
@ -1,155 +0,0 @@
|
|||||||
/*
|
|
||||||
* udev-kvm-check.c
|
|
||||||
*
|
|
||||||
* Copyright 2018 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* This is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <syslog.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define DEFAULT 0
|
|
||||||
#define FACILITY "kvm"
|
|
||||||
#define SYSCONFIG_KVM "/etc/sysconfig/kvm"
|
|
||||||
|
|
||||||
#define COUNT_MSG \
|
|
||||||
"%d %s now active"
|
|
||||||
|
|
||||||
int get_threshold_from_file(FILE *fp)
|
|
||||||
{
|
|
||||||
static const char key[] = "THRESHOLD=";
|
|
||||||
int pos = 0;
|
|
||||||
int thres;
|
|
||||||
int ch;
|
|
||||||
|
|
||||||
start:
|
|
||||||
/* State START - at beginning of line, search for beginning of "THRESHOLD="
|
|
||||||
* string.
|
|
||||||
*/
|
|
||||||
ch = getc(fp);
|
|
||||||
if (ch == EOF) {
|
|
||||||
return DEFAULT;
|
|
||||||
}
|
|
||||||
if (isspace(ch)) {
|
|
||||||
goto start;
|
|
||||||
}
|
|
||||||
if (ch == 'T') {
|
|
||||||
pos = 1;
|
|
||||||
goto key;
|
|
||||||
}
|
|
||||||
goto eol;
|
|
||||||
|
|
||||||
eol:
|
|
||||||
/* State EOL - loop until end of line */
|
|
||||||
ch = getc(fp);
|
|
||||||
if (ch == EOF) {
|
|
||||||
return DEFAULT;
|
|
||||||
}
|
|
||||||
if (ch == '\n') {
|
|
||||||
goto start;
|
|
||||||
}
|
|
||||||
goto eol;
|
|
||||||
|
|
||||||
key:
|
|
||||||
/* State KEY - match "THRESHOLD=" string, go to THRESHOLD if found */
|
|
||||||
ch = getc(fp);
|
|
||||||
if (ch == EOF) {
|
|
||||||
return DEFAULT;
|
|
||||||
}
|
|
||||||
if (ch == key[pos]) {
|
|
||||||
pos++;
|
|
||||||
if (key[pos] == 0) {
|
|
||||||
goto threshold;
|
|
||||||
} else {
|
|
||||||
goto key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
goto eol;
|
|
||||||
|
|
||||||
threshold:
|
|
||||||
/* State THRESHOLD - parse number using fscanf, expect comment or space
|
|
||||||
* or EOL.
|
|
||||||
*/
|
|
||||||
ch = getc(fp);
|
|
||||||
if (ch == EOF) {
|
|
||||||
return DEFAULT;
|
|
||||||
}
|
|
||||||
if (!isdigit(ch)) {
|
|
||||||
goto eol;
|
|
||||||
}
|
|
||||||
ungetc(ch, fp);
|
|
||||||
if (fscanf(fp, "%d", &thres) != 1) {
|
|
||||||
return DEFAULT;
|
|
||||||
}
|
|
||||||
ch = getc(fp);
|
|
||||||
if (ch == '#' || ch == EOF || ch == '\n' || isspace(ch)) {
|
|
||||||
return thres;
|
|
||||||
}
|
|
||||||
goto eol;
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_threshold()
|
|
||||||
{
|
|
||||||
FILE *fp = fopen(SYSCONFIG_KVM, "r");
|
|
||||||
int val;
|
|
||||||
|
|
||||||
if (!fp) {
|
|
||||||
return DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
val = get_threshold_from_file(fp);
|
|
||||||
fclose (fp);
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *guest(int count)
|
|
||||||
{
|
|
||||||
return (count == 1 ? "guest" : "guests");
|
|
||||||
}
|
|
||||||
|
|
||||||
void emit_count_message(int count)
|
|
||||||
{
|
|
||||||
openlog(FACILITY, LOG_CONS, LOG_USER);
|
|
||||||
syslog(LOG_INFO, COUNT_MSG, count, guest(count));
|
|
||||||
closelog();
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
int count, threshold;
|
|
||||||
|
|
||||||
if (argc < 3)
|
|
||||||
exit(1);
|
|
||||||
|
|
||||||
count = atoi(argv[1]);
|
|
||||||
threshold = get_threshold();
|
|
||||||
|
|
||||||
if (!strcmp(argv[2], "create")) {
|
|
||||||
if (threshold == 0 || count > threshold) {
|
|
||||||
emit_count_message(count);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (count >= threshold) {
|
|
||||||
emit_count_message(count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user