+ uint_least32_t min; ///< masks the resources supporting a minimum limit
+ uint_least32_t soft; ///< masks the resources supporting a soft limit
+ uint_least32_t hard; ///< masks the resources supporting a hard limit
+ };
+
+ /** \brief Returns the limits supported by the kernel */
+ int vc_get_rlimit_mask(xid_t xid,
+ struct vc_rlimit_mask /*@out@*/ *lim) VC_ATTR_NONNULL((2));
+
+ /** \brief The limits of a resources.
+ *
+ * This is a triple consisting of a minimum, soft and hardlimit. */
+ struct vc_rlimit {
+ vc_limit_t min; ///< the guaranted minimum of a resources
+ vc_limit_t soft; ///< the softlimit of a resource
+ vc_limit_t hard; ///< the absolute hardlimit of a resource
+ };
+
+ /** \brief Returns the limits of \a resource.
+ * \ingroup syscalls
+ *
+ * \param xid The id of the context
+ * \param resource The resource which will be queried
+ * \param lim The result which will be filled with the limits
+ *
+ * \returns 0 on success, and -1 on errors. */
+ int vc_get_rlimit(xid_t xid, int resource,
+ struct vc_rlimit /*@out@*/ *lim) VC_ATTR_NONNULL((3));
+ /** \brief Sets the limits of \a resource.
+ * \ingroup syscalls
+ *
+ * \param xid The id of the context
+ * \param resource The resource which will be queried
+ * \param lim The new limits
+ *
+ * \returns 0 on success, and -1 on errors. */
+ int vc_set_rlimit(xid_t xid, int resource,
+ struct vc_rlimit const /*@in@*/ *lim) VC_ATTR_NONNULL((3));
+
+ /** \brief Statistics for a resource limit. */
+ struct vc_rlimit_stat {
+ uint_least32_t hits; ///< number of hits on the limit
+ vc_limit_t value; ///< current value
+ vc_limit_t minimum; ///< minimum value observed
+ vc_limit_t maximum; ///< maximum value observed
+ };
+
+ /** \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 of 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
+ *
+ * This function parses \a str and interprets special words like \p "inf"
+ * or suffixes. Valid suffixes are
+ * - \p k ... 1000
+ * - \p m ... 1000000
+ * - \p K ... 1024
+ * - \p M ... 1048576
+ *
+ * \param str The string which shall be parsed
+ * \param res Will be filled with the interpreted value; in errorcase,
+ * this value is undefined.
+ *
+ * \returns \a true, iff the string \a str could be parsed. \a res will
+ * be filled with the interpreted value in this case.
+ *
+ * \pre \a str!=0 && \a res!=0
+ */
+ bool vc_parseLimit(char const /*@in@*/ *str, vc_limit_t /*@out@*/ *res) VC_ATTR_NONNULL((1,2));
+
+
+ /* network context */
+ struct vc_nx_info {
+ nid_t nid;
+ };
+
+ nid_t vc_get_task_nid(pid_t pid);
+ int vc_get_nx_info(nid_t nid, struct vc_nx_info *) VC_ATTR_NONNULL((2));
+
+ struct vc_net_addr {
+ uint16_t vna_type;
+ uint16_t vna_flags;
+ uint16_t vna_prefix;
+ uint16_t vna_parent;
+ union {
+ struct {
+ struct in_addr ip;
+ struct in_addr mask;
+ } ipv4;
+ struct {
+ struct in6_addr ip;
+ struct in6_addr mask;
+ } ipv6;
+ } u;
+#define vna_v4_ip u.ipv4.ip
+#define vna_v4_mask u.ipv4.mask
+#define vna_v6_ip u.ipv6.ip
+#define vna_v6_mask u.ipv6.mask
+ };
+
+ struct vc_net_flags {
+ uint_least64_t flagword;
+ uint_least64_t mask;
+ };
+
+ nid_t vc_net_create(nid_t nid);
+ int vc_net_migrate(nid_t nid);
+
+ int vc_net_add(nid_t nid, struct vc_net_addr const *info);
+ int vc_net_remove(nid_t nid, struct vc_net_addr const *info);
+
+ int vc_get_nflags(nid_t, struct vc_net_flags *);
+ int vc_set_nflags(nid_t, struct vc_net_flags const *);
+
+ struct vc_net_caps {
+ uint_least64_t ncaps;
+ uint_least64_t cmask;
+ };
+
+ int vc_get_ncaps(nid_t, struct vc_net_caps *);
+ int vc_set_ncaps(nid_t, struct vc_net_caps const *);
+
+
+ /* iattr related functions */
+
+ int vc_set_iattr(char const *filename, xid_t xid,
+ uint_least32_t flags, uint_least32_t mask) VC_ATTR_NONNULL((1));
+
+ int vc_fset_iattr(int fd, xid_t xid,
+ uint_least32_t flags, uint_least32_t mask);
+
+ /** \brief Returns information about attributes and assigned context of a file.
+ * \ingroup syscalls
+ *
+ * This function returns the VC_IATTR_XXX flags and about the assigned
+ * context of a file. To request an information, the appropriate bit in
+ * \c mask must be set and the corresponding parameter (\a xid or \a
+ * flags) must not be NULL.
+ *
+ * E.g. to receive the assigned context, the \c VC_IATTR_XID bit must be
+ * set in \a mask, and \a xid must point to valid memory.
+ *
+ * Possible flags are \c VC_IATTR_ADMIN, \c VC_IATTR_WATCH , \c VC_IATTR_HIDE,
+ * \c VC_IATTR_BARRIER, \c VC_IATTR_IUNLINK and \c VC_IATTR_IMMUTABLE.
+ *
+ * \param filename The name of the file whose attributes shall be determined.
+
+ * \param xid When non-zero and the VC_IATTR_XID bit is set in \a mask,
+ * the assigned context of \a filename will be stored there.
+ * \param flags When non-zero, a bitmask of current attributes will be
+ * stored there. These attributes must be requested explicitly
+ * by setting the appropriate bit in \a mask
+ * \param mask Points to a bitmask which tells which attributes shall be
+ * determined. On return, it will masquerade the attributes
+ * which were determined.
+ *
+ * \pre mask!=0 && !((*mask&VC_IATTR_XID) && xid==0) && !((*mask&~VC_IATTR_XID) && flags==0) */
+ int vc_get_iattr(char const *filename, xid_t * /*@null@*/ xid,
+ uint_least32_t * /*@null@*/ flags,
+ uint_least32_t * /*@null@*/ mask) VC_ATTR_NONNULL((1));
+
+ int vc_fget_iattr(int fd, xid_t * /*@null@*/ xid,
+ uint_least32_t * /*@null@*/ flags,
+ uint_least32_t * /*@null@*/ mask) VC_ATTR_NONNULL((4));
+
+ /** \brief Returns the context of \c filename
+ * \ingroup syscalls
+ *
+ * This function calls vc_get_iattr() with appropriate arguments to
+ * determine the context of \c filename. In error-case or when no context
+ * is assigned, \c VC_NOCTX will be returned. To differ between both cases,
+ * \c errno must be examined.
+ *
+ * \b WARNING: this function can modify \c errno although no error happened.
+ *
+ * \param filename The file to check
+ * \returns The assigned context, or VC_NOCTX when an error occured or no
+ * such assignment exists. \c errno will be 0 in the latter case */
+ xid_t vc_getfilecontext(char const *filename) VC_ATTR_NONNULL((1));
+
+
+ /* vhi related functions */
+ typedef enum { vcVHI_CONTEXT, vcVHI_SYSNAME, vcVHI_NODENAME,
+ vcVHI_RELEASE, vcVHI_VERSION, vcVHI_MACHINE,
+ vcVHI_DOMAINNAME } vc_uts_type;
+
+ int vc_set_vhi_name(xid_t xid, vc_uts_type type,
+ char const *val, size_t len) VC_ATTR_NONNULL((3));
+ int vc_get_vhi_name(xid_t xid, vc_uts_type type,
+ char *val, size_t len) VC_ATTR_NONNULL((3));
+
+ /* namespace related functions */
+ int vc_enter_namespace(xid_t xid, uint_least64_t mask);
+ int vc_set_namespace(xid_t xid, uint_least64_t mask);
+ int vc_cleanup_namespace();
+ uint_least64_t vc_get_space_mask();
+
+
+ /* disk limit related things */
+ struct vc_ctx_dlimit {
+ uint_least32_t space_used;
+ uint_least32_t space_total;
+ uint_least32_t inodes_used;
+ uint_least32_t inodes_total;
+ uint_least32_t reserved;