#include <grp.h>
/* MinGW64 (_W64) defines these in its _mingw.h. */
-#if defined(__GNUC__) && !defined(_W64)
-#define _ANONYMOUS_UNION
-#define _ANONYMOUS_STRUCT
+#ifndef _ANONYMOUS_UNION
+# define _ANONYMOUS_UNION
+#endif
+#ifndef _ANONYMOUS_STRUCT
+# define _ANONYMOUS_STRUCT
#endif
#include <windows.h>
/* Some versions of compiler define MEMORYSTATUSEX, some don't, so we
g_b_init_set_named_security_info_a = 1;
hm_advapi32 = LoadLibrary ("Advapi32.dll");
s_pfn_Set_Named_Security_InfoA =
- (SetNamedSecurityInfoA_Proc) GetProcAddress (hm_advapi32,
+ (SetNamedSecurityInfoA_Proc) GetProcAddress (hm_advapi32,
"SetNamedSecurityInfoA");
}
if (s_pfn_Set_Named_Security_InfoA == NULL)
return attrs;
}
+int
+w32_memory_info (unsigned long long *totalram, unsigned long long *freeram,
+ unsigned long long *totalswap, unsigned long long *freeswap)
+{
+ MEMORYSTATUS memst;
+ MEMORY_STATUS_EX memstex;
+
+ /* Use GlobalMemoryStatusEx if available, as it can report more than
+ 2GB of memory. */
+ if (global_memory_status_ex (&memstex))
+ {
+ *totalram = memstex.ullTotalPhys;
+ *freeram = memstex.ullAvailPhys;
+ *totalswap = memstex.ullTotalPageFile;
+ *freeswap = memstex.ullAvailPageFile;
+ return 0;
+ }
+ else if (global_memory_status (&memst))
+ {
+ *totalram = memst.dwTotalPhys;
+ *freeram = memst.dwAvailPhys;
+ *totalswap = memst.dwTotalPageFile;
+ *freeswap = memst.dwAvailPageFile;
+ return 0;
+ }
+ else
+ return -1;
+}
+
\f
/* Wrappers for winsock functions to map between our file descriptors
and winsock's handles; also set h_errno for convenience.
int rc;
unsigned flags;
- eassert (pipe2_flags == O_CLOEXEC);
+ eassert (pipe2_flags == (O_BINARY | O_CLOEXEC));
/* make pipe handles non-inheritable; when we spawn a child, we
replace the relevant handle with an inheritable one. Also put
Lisp_Object
network_interface_info (Lisp_Object ifname)
{
+ CHECK_STRING (ifname);
return network_interface_get_info (ifname);
}