}
#endif // F_SETLKW
-#ifdef _WIN
+#ifdef WIN
void fsync (int fd)
{
HANDLE h = (HANDLE) _get_osfhandle (fd);
return -1;
}
-int hm_set_fanspeed_with_device_id_xnvctrl (const uint device_id, const int fanspeed)
-{
- if (data.hm_device[device_id].fan_set_supported == 1)
- {
- if (data.hm_xnvctrl)
- {
- if (set_fan_speed_target (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, fanspeed) != 0) return -1;
-
- return 0;
- }
- }
-
- return -1;
-}
-
int hm_set_fanspeed_with_device_id_adl (const uint device_id, const int fanspeed, const int fanpolicy)
{
if (data.hm_device[device_id].fan_set_supported == 1)
return -1;
}
+int hm_set_fanspeed_with_device_id_nvapi (const uint device_id, const int fanspeed, const int fanpolicy)
+{
+ if (data.hm_device[device_id].fan_set_supported == 1)
+ {
+ if (data.hm_nvapi)
+ {
+ NV_GPU_COOLER_LEVELS CoolerLevels = { 0 };
+
+ CoolerLevels.Version = GPU_COOLER_LEVELS_VER | sizeof (NV_GPU_COOLER_LEVELS);
+
+ CoolerLevels.Levels[0].Level = fanspeed;
+ CoolerLevels.Levels[0].Policy = fanpolicy;
+
+ if (hm_NvAPI_GPU_SetCoolerLevels (data.hm_nvapi, data.hm_device[device_id].nvapi, 0, &CoolerLevels) != NVAPI_OK) return -1;
+
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+int hm_set_fanspeed_with_device_id_xnvctrl (const uint device_id, const int fanspeed)
+{
+ if (data.hm_device[device_id].fan_set_supported == 1)
+ {
+ if (data.hm_xnvctrl)
+ {
+ if (set_fan_speed_target (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, fanspeed) != 0) return -1;
+
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
#endif // HAVE_HWMON
/**
void set_cpu_affinity (char *cpu_affinity)
{
- #ifdef WIN
+ #ifdef _WIN
DWORD_PTR aff_mask = 0;
#elif _POSIX
cpu_set_t cpuset;
if (cpu_id == 0)
{
- #ifdef WIN
+ #ifdef _WIN
aff_mask = 0;
#elif _POSIX
CPU_ZERO (&cpuset);
exit (-1);
}
- #ifdef WIN
+ #ifdef _WIN
aff_mask |= 1 << (cpu_id - 1);
#elif _POSIX
CPU_SET ((cpu_id - 1), &cpuset);
free (devices);
}
- #ifdef WIN
+ #ifdef _WIN
SetProcessAffinityMask (GetCurrentProcess (), aff_mask);
SetThreadAffinityMask (GetCurrentThread (), aff_mask);
#elif _POSIX
dictstat_t *d1 = (dictstat_t *) s1;
dictstat_t *d2 = (dictstat_t *) s2;
- #ifdef LINUX
+ #ifdef _POSIX
d2->stat.st_atim = d1->stat.st_atim;
#else
d2->stat.st_atime = d1->stat.st_atime;