lib/nflags-net.c \
lib/nflags_list-net.c
lib_v21_SRCS = lib/syscall_setccaps-v21.hc \
- lib/syscall_setsched-v21.hc
+ lib/syscall_setsched-v21.hc \
+ lib/syscall_rlimitstat.c \
+ lib/syscall_rlimitstat-v21.hc \
+ lib/syscall_resetminmax.c \
+ lib/syscall_resetminmax-v21.hc \
+ lib/syscall_getvci.c \
+ lib/syscall_getvci-v21.hc \
+ lib/syscall_virtstat.c \
+ lib/syscall_virtstat-v21.hc \
+ lib/syscall_ctxstat.c \
+ lib/syscall_ctxstat-v21.hc
if ENSC_HAVE_C99_COMPILER
lib_v13_SRCS += lib/syscall_adddlimit-v13.hc \
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2006 Daniel Hokka Zakrisson <daniel@hozac.com>
+//
+// This program 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; version 2 of the License.
+//
+// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE int
+vc_ctx_stat_v21(xid_t ctx, struct vc_ctx_stat *stat)
+{
+ int ret;
+ struct vcmd_ctx_stat_v0 param;
+
+ ret = vserver(VCMD_ctx_stat, CTX_USER2KERNEL(ctx), ¶m);
+ if (ret)
+ return ret;
+
+ stat->usecnt = param.usecnt;
+ stat->tasks = param.tasks;
+ return 0;
+}
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2006 Daniel Hokka Zakrisson <daniel@hozac.com>
+//
+// This program 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; version 2 of the License.
+//
+// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "virtual.h"
+
+#if defined(VC_ENABLE_API_V21)
+# include "syscall_ctxstat-v21.hc"
+#endif
+
+#if defined(VC_ENABLE_API_V21)
+
+int
+vc_ctx_stat(xid_t ctx, struct vc_ctx_stat *stat)
+{
+ CALL_VC(CALL_VC_V21(vc_ctx_stat, ctx, stat));
+}
+
+#endif
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2006 Daniel Hokka Zakrisson <daniel@hozac.com>
+//
+// This program 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; version 2 of the License.
+//
+// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE int
+vc_get_vci_v21()
+{
+ return vserver(VCMD_get_vci, 0, 0);
+}
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2006 Daniel Hokka Zakrisson <daniel@hozac.com>
+//
+// This program 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; version 2 of the License.
+//
+// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "virtual.h"
+
+#if defined(VC_ENABLE_API_V21)
+# include "syscall_getvci-v21.hc"
+#endif
+
+#if defined(VC_ENABLE_API_V21)
+
+int
+vc_get_vci()
+{
+ CALL_VC(CALL_VC_V21(vc_get_vci));
+}
+
+#endif
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2006 Daniel Hokka Zakrisson <daniel@hozac.com>
+//
+// This program 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; version 2 of the License.
+//
+// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE int
+vc_reset_minmax_v21(xid_t ctx)
+{
+ return vserver(VCMD_reset_minmax, CTX_USER2KERNEL(ctx), 0);
+}
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2006 Daniel Hokka Zakrisson <daniel@hozac.com>
+//
+// This program 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; version 2 of the License.
+//
+// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "virtual.h"
+
+#if defined(VC_ENABLE_API_V21)
+# include "syscall_resetminmax-v21.hc"
+#endif
+
+#if defined(VC_ENABLE_API_V21)
+
+int
+vc_reset_minmax(xid_t ctx)
+{
+ CALL_VC(CALL_VC_V21(vc_reset_minmax, ctx));
+}
+
+#endif
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2006 Daniel Hokka Zakrisson <daniel@hozac.com>
+//
+// This program 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; version 2 of the License.
+//
+// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE int
+vc_rlimit_stat_v21(xid_t ctx, int resource, struct vc_rlimit_stat *stat)
+{
+ struct vcmd_rlimit_stat_v0 param = { .id = resource };
+ int ret;
+
+ ret = vserver(VCMD_rlimit_stat, CTX_USER2KERNEL(ctx), ¶m);
+ if (ret)
+ return ret;
+
+ stat->hits = param.hits;
+ stat->value = param.value;
+ stat->minimum = param.minimum;
+ stat->maximum = param.maximum;
+
+ return 0;
+}
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2006 Daniel Hokka Zakrisson <daniel@hozac.com>
+//
+// This program 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; version 2 of the License.
+//
+// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "virtual.h"
+
+#if defined(VC_ENABLE_API_V21)
+# include "syscall_rlimitstat-v21.hc"
+#endif
+
+#if defined(VC_ENABLE_API_V21)
+
+int
+vc_rlimit_stat(xid_t ctx, int resource, struct vc_rlimit_stat *stat)
+{
+ CALL_VC(CALL_VC_V21(vc_rlimit_stat, ctx, resource, stat));
+}
+
+#endif
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2006 Daniel Hokka Zakrisson <daniel@hozac.com>
+//
+// This program 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; version 2 of the License.
+//
+// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+static inline ALWAYSINLINE int
+vc_virt_stat_v21(xid_t ctx, struct vc_virt_stat *stat)
+{
+ int ret;
+ struct vcmd_virt_stat_v0 param;
+
+ ret = vserver(VCMD_virt_stat, CTX_USER2KERNEL(ctx), ¶m);
+ if (ret)
+ return ret;
+
+#define G(ATTR) stat->ATTR = param.ATTR
+ G(offset);
+ G(uptime);
+ G(nr_threads);
+ G(nr_running);
+ G(nr_uninterruptible);
+ G(nr_onhold);
+ G(nr_forks);
+ G(load[0]);
+ G(load[1]);
+ G(load[2]);
+ return 0;
+}
--- /dev/null
+// $Id$ --*- c++ -*--
+
+// Copyright (C) 2006 Daniel Hokka Zakrisson <daniel@hozac.com>
+//
+// This program 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; version 2 of the License.
+//
+// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "virtual.h"
+
+#if defined(VC_ENABLE_API_V21)
+# include "syscall_virtstat-v21.hc"
+#endif
+
+#if defined(VC_ENABLE_API_V21)
+
+int
+vc_virt_stat(xid_t ctx, struct vc_virt_stat *stat)
+{
+ CALL_VC(CALL_VC_V21(vc_virt_stat, ctx, stat));
+}
+
+#endif
* \returns The versionnumber of the kernel API
*/
int vc_get_version();
+
+ /** \brief Returns the kernel configuration bits
+ * \ingroup syscalls
+ * \returns The kernel configuration bits
+ */
+ int vc_get_vci();
/** \brief Moves current process into a context
* \ingroup syscalls
* \param xid The new context
* \returns 0 on success, -1 on errors */
int vc_ctx_migrate(xid_t xid);
+
+ /** \brief Statistics about a context */
+ struct vc_ctx_stat {
+ uint_least32_t usecnt; ///< number of uses
+ uint_least32_t tasks; ///< number of tasks
+ };
+
+ /** \brief Get some statistics about a context.
+ * \ingroup syscalls
+ *
+ * \param xid The context to get stats about
+ * \param stat Where to store the result
+ *
+ * \returns 0 on success, -1 on errors. */
+ int vc_ctx_stat(xid_t xid, struct vc_ctx_stat /*@out@*/ *stat) VC_ATTR_NONNULL((2));
+
+ /** \brief Contains further statistics about a context. */
+ struct vc_virt_stat {
+ uint_least64_t offset;
+ uint_least32_t uptime;
+ uint_least32_t nr_threads;
+ uint_least32_t nr_running;
+ uint_least32_t nr_uninterruptible;
+ uint_least32_t nr_onhold;
+ uint_least32_t nr_forks;
+ uint_least32_t load[3];
+ };
+
+ /** \brief Get more statistics about a context.
+ * \ingroup syscalls
+ *
+ * \param xid The context to get stats about
+ * \param stat Where to store the result
+ *
+ * \returns 0 on success, -1 on errors. */
+ int vc_virt_stat(xid_t xid, struct vc_virt_stat /*@out@*/ *stat) VC_ATTR_NONNULL((2));
/* rlimit related functions */
uint_least32_t hard; ///< masks the resources supporting a hard limit
};
+ /** \brief Statistics for a resource limit. */
+ struct vc_rlimit_stat {
+ uint_least32_t hits; ///< number of hits on the limit
+ uint_least64_t value; ///< current value
+ uint_least64_t minimum; ///< minimum value observed
+ uint_least64_t maximum; ///< maximum value observed
+ };
+
/** \brief Returns the limits of \a resource.
* \ingroup syscalls
*
struct vc_rlimit const /*@in@*/ *lim) VC_ATTR_NONNULL((3));
int vc_get_rlimit_mask(xid_t xid,
struct vc_rlimit_mask *lim) VC_ATTR_NONNULL((2));
+ /** \brief Returns the current stats of \a resource.
+ * \ingroup syscalls
+ *
+ * \param xid The id of the context
+ * \param resource The resource which will be queried
+ * \param stat The result which will be filled with the stats
+ *
+ * \returns 0 on success, and -1 on errors. */
+ int vc_rlimit_stat(xid_t xid, int resource,
+ struct vc_rlimit_stat /*@out@*/ *stat) VC_ATTR_NONNULL((3));
+ /** \brief Resets the minimum and maximum observed values for all resources.
+ * \ingroup syscalls
+ *
+ * \param xid The id of the context
+ *
+ * \returns 0 on success, and -1 on errors. */
+ int vc_reset_minmax(xid_t xid);
/** \brief Parses a string describing a limit
* \ingroup helper
*