X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fwin32_replacements.c;h=27d074e4d47d63b8aae8f85c4fdb3a6d9c159970;hp=41706382ad83b7c4c9fca3344071e52826011a49;hb=3bb3e3c3806a121686cec80c56f2718c714915ef;hpb=4f9ccdbed3ee79171d0b861c4ba93b54ce8feaac diff --git a/src/win32_replacements.c b/src/win32_replacements.c index 41706382..27d074e4 100644 --- a/src/win32_replacements.c +++ b/src/win32_replacements.c @@ -37,6 +37,7 @@ #include "wimlib/file_io.h" #include "wimlib/glob.h" #include "wimlib/error.h" +#include "wimlib/wildcard.h" #include "wimlib/util.h" /* Replacement for POSIX fsync() */ @@ -57,7 +58,7 @@ err: return -1; } -/* Use the Win32 API to get the number of processors */ +/* Use the Win32 API to get the number of processors. */ unsigned win32_get_number_of_processors(void) { @@ -66,6 +67,17 @@ win32_get_number_of_processors(void) return sysinfo.dwNumberOfProcessors; } +/* Use the Win32 API to get the amount of available memory. */ +u64 +win32_get_avail_memory(void) +{ + MEMORYSTATUSEX status = { + .dwLength = sizeof(status), + }; + GlobalMemoryStatusEx(&status); + return status.ullTotalPhys; +} + /* Replacement for POSIX-2008 realpath(). Warning: partial functionality only * (resolved_path must be NULL). Also I highly doubt that GetFullPathName * really does the right thing under all circumstances. */ @@ -299,6 +311,7 @@ pwrite(int fd, const void *buf, size_t count, off_t offset) return do_pread_or_pwrite(fd, (void*)buf, count, offset, true); } +#if 0 /* Dumb Windows implementation of writev(). It writes the vectors one at a * time. */ ssize_t writev(int fd, const struct iovec *iov, int iovcnt) @@ -323,6 +336,7 @@ ssize_t writev(int fd, const struct iovec *iov, int iovcnt) } return total_bytes_written; } +#endif int win32_get_file_and_vol_ids(const wchar_t *path, u64 *ino_ret, u64 *dev_ret)