*/
#include <config.h>
+#include <unistd.h>
#include "virnetdevbandwidth.h"
#include "vircommand.h"
goto cleanup;
}
+ if (geteuid() != 0) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("Network bandwidth tuning is not available"
+ " in session mode"));
+ return -1;
+ }
+
virNetDevBandwidthClear(ifname);
if (bandwidth->in && bandwidth->in->average) {
virstringtest \
virportallocatortest \
sysinfotest \
- virnetdevbandwidthtest \
virkmodtest \
vircapstest \
domaincapstest \
test_programs += secretxml2xmltest
if WITH_LINUX
-test_programs += virusbtest
+test_programs += virusbtest \
+ virnetdevbandwidthtest \
+ $(NULL)
endif WITH_LINUX
test_scripts = \
endif WITH_DBUS
if WITH_LINUX
-test_libraries += virusbmock.la
+test_libraries += virusbmock.la \
+ virnetdevbandwidthmock.la \
+ $(NULL)
endif WITH_LINUX
if WITH_TESTS
commandhelper_LDFLAGS = -static
-virnetdevbandwidthtest_SOURCES = \
- virnetdevbandwidthtest.c testutils.h testutils.c
-virnetdevbandwidthtest_LDADD = $(LDADDS) $(LIBXML_LIBS)
virkmodtest_SOURCES = \
virkmodtest.c testutils.h testutils.c
virusbtest.c testutils.h testutils.c
virusbtest_LDADD = $(LDADDS)
+virnetdevbandwidthtest_SOURCES = \
+ virnetdevbandwidthtest.c testutils.h testutils.c
+virnetdevbandwidthtest_LDADD = $(LDADDS) $(LIBXML_LIBS)
+
virusbmock_la_SOURCES = virusbmock.c
virusbmock_la_CFLAGS = $(AM_CFLAGS)
virusbmock_la_LDFLAGS = -module -avoid-version \
-rpath /evil/libtool/hack/to/force/shared/lib/creation
+
+virnetdevbandwidthmock_la_SOURCES = \
+ virnetdevbandwidthmock.c
+virnetdevbandwidthmock_la_CFLAGS = $(AM_CFLAGS)
+virnetdevbandwidthmock_la_LDFLAGS = -module -avoid-version \
+ -rpath /evil/libtool/hack/to/force/shared/lib/creation
+
else ! WITH_LINUX
- EXTRA_DIST += virusbtest.c virusbmock.c
+ EXTRA_DIST += virusbtest.c virusbmock.c \
+ virnetdevbandwidthtest.c virnetdevbandwidthmock.c
endif ! WITH_LINUX
if WITH_DBUS
--- /dev/null
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Erik Skultety <eskultet@redhat.com>
+ */
+
+#include <config.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+uid_t geteuid(void)
+{
+ return 0;
+}