/* Common functions */
+#ifdef __linux__
static int
virResctrlLockInternal(int op)
{
return virResctrlLockInternal(LOCK_EX);
}
+#else
+
+static inline int
+virResctrlLockWrite(void)
+{
+ virReportSystemError(ENOSYS, "%s",
+ _("resctrlfs not supported on this platform"));
+ return -1;
+}
+
+#endif
+
+
+
static int
virResctrlUnlock(int fd)
if (fd == -1)
return 0;
+#ifdef __linux__
/* The lock gets unlocked by closing the fd, which we need to do anyway in
* order to clean up properly */
if (VIR_CLOSE(fd) < 0) {
virReportSystemError(errno, "%s", _("Cannot unlock resctrlfs"));
return -1;
}
+#endif /* ! __linux__ */
return 0;
}
}
+#ifdef __linux__
+
int
virResctrlGetInfo(virResctrlInfoPtr resctrl)
{
return ret;
}
+#else /* ! __linux__ */
+
+int
+virResctrlGetInfo(virResctrlInfoPtr resctrl ATTRIBUTE_UNUSED)
+{
+ virReportSystemError(ENOSYS, "%s",
+ _("Cache tune not supported on this platform"));
+ return -1;
+}
+
+#endif /* ! __linux__ */
+
int
virResctrlInfoGetCache(virResctrlInfoPtr resctrl,
}
+#ifdef __linux__
+
static int
virResctrlAllocUpdateMask(virResctrlAllocPtr resctrl,
unsigned int level,
return virBitmapCopy(a_type->masks[cache], mask);
}
+#endif
+
static int
virResctrlAllocUpdateSize(virResctrlAllocPtr resctrl,
}
+#ifdef __linux__
+
static int
virResctrlAllocParseProcessCache(virResctrlInfoPtr resctrl,
virResctrlAllocPtr alloc,
goto cleanup;
}
+#else /* ! __linux__ */
+
+virResctrlAllocPtr
+virResctrlAllocGetUnused(virResctrlInfoPtr resctrl ATTRIBUTE_UNUSED)
+{
+ virReportSystemError(ENOSYS, "%s",
+ _("Cache tune not supported on this platform"));
+ return NULL;
+}
+#endif /* ! __linux__ */
static int
virResctrlAllocSetMask(virResctrlAllocPerTypePtr a_type,