src/win32


Log

Author Commit Date CI Message
Edward Thomson 1560b580 2017-08-15T10:35:47 Merge pull request #4288 from pks-t/pks/include-fixups Include fixups
Edward Thomson bc35fd4b 2017-07-18T14:44:29 win32: provide fast-path for retrying filesystem operations When using the `do_with_retries` macro for retrying filesystem operations in the posix emulation layer, allow the remediation function to return `GIT_RETRY`, meaning that the error was believed to be remediated, and the operation should be retried immediately, without a sleep. This is a slightly more general solution to the problem fixed in #4312.
Carson Howard 1bcdaba2 2017-07-18T14:47:28 fixed win32 p_unlink retry sleep issue Fixed an issue where the retry logic on p_unlink sleeps before it tries setting a file to write mode causing unnecessary slowdown.
Patrick Steinhardt 0c7f49dd 2017-06-30T13:39:01 Make sure to always include "common.h" first Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
Patrick Steinhardt 459fb8fe 2017-06-30T15:35:46 win32: fix circular include deps with w32_crtdbg The current order of declarations and includes between "common.h" and "w32_crtdbg_stacktrace.h" is rather complicated. Both header files make use of things defined in the other one and are thus circularly dependent on each other. This makes it currently impossible to compile the "w32_crtdbg_stacktrace.c" file when including "common.h" inside of "w32_crtdbg_stacktrace.h". We can disentangle the mess by moving declaration of the inline crtdbg functions into the "w32_crtdbg_stacktrace.h" file and adding additional includes inside of it, such that all required functions are available to it. This allows us to break the dependency cycle.
Edward Thomson 86536c7e 2017-04-17T15:40:03 win32: `remediation` not `cleanup` The `remediation` function is run in the retry loop in order to attempt to fix any problems that the prior run encountered. There is nothing "cleaned up". Clarify the name.
Edward Thomson 89d403cc 2017-04-05T09:50:12 win32: enable `p_utimes` for readonly files Instead of failing to set the timestamp of a read-only file (like any object file), set it writable temporarily to update the timestamp.
Edward Thomson 7ece9065 2017-04-03T23:07:16 win32: make posix emulation retries configurable POSIX emulation retries should be configurable so that tests can disable them. In particular, maniacally threading tests may end up trying to open locked files and need retries, which will slow continuous integration tests significantly.
Edward Thomson 1069ad3c 2017-04-03T23:05:53 win32: do not inherit file descriptors
Sven Strickroth d5e6ca1e 2017-01-14T18:39:32 Allow to configure default file share mode for opening files This can prevent FILE_SHARED_VIOLATIONS when used in tools such as TortoiseGit TGitCache and FILE_SHARE_DELETE, because files can be opened w/o being locked any more. Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth 92d5a637 2017-01-14T17:15:50 win32: deduplicate code: use p_open in p_creat Signed-off-by: Sven Strickroth <email@cs-ware.de>
Sven Strickroth ef5cfcdb 2017-01-14T18:20:59 win32: use CreateFile in p_open Signed-off-by: Sven Strickroth <email@cs-ware.de>
Edward Thomson fbc6910f 2017-04-01T13:25:14 win32: teach p_open about do_with_retries
Edward Thomson a0f67e4a 2017-04-01T13:19:51 win32: teach p_unlink about do_with_retries
Edward Thomson 8a4e1513 2017-04-01T00:23:03 win32: make p_rename use do_with_retries
Edward Thomson cc8d9a29 2017-04-01T10:44:17 win32: introduce `do_with_retries` macro Provide a macro that will allow us to run a function with posix-like return values multiple times in a retry loop, with an optional cleanup function called between invocations.
Edward Thomson dcaa9099 2017-03-29T23:54:47 win32: map windows error codes to errno Introduce mapping from windows error codes to errno values. This allows us to replace our calls to the Windows posix emulation functions with calls to the Win32 APIs for more fine-grained control over the emulation. These mappings match the Windows CRT's mappings for its posix emulation as they were described to me.
Edward Thomson fcb322f5 2017-03-31T23:39:33 Merge remote-tracking branch 'origin/pr/3790' into win32_posix
Edward Thomson e6ed0d2f 2016-12-13T11:31:38 odb_loose: fsync tests Introduce a simple counter that `p_fsync` implements. This is useful for ensuring that `p_fsync` is called when we expect it to be, for example when we have enabled an odb backend to perform `fsync`s when writing objects.
Edward Thomson 909d5494 2016-12-29T12:25:15 giterr_set: consistent error messages Error messages should be sentence fragments, and therefore: 1. Should not begin with a capital letter, 2. Should not conclude with punctuation, and 3. Should not end a sentence and begin a new one
Boris Barbulovski 9af59f5d 2016-12-06T03:08:52 Properly pass `wchar *` type to giterr_set
Boris Barbulovski 86364af9 2016-11-20T11:30:45 Properly pass `wchar *` type to giterr_set
Edward Thomson 82f15896 2016-11-18T07:19:22 threads: introduce `git_thread_exit` Introduce `git_thread_exit`, which will allow threads to terminate at an arbitrary time, returning a `void *`. On Windows, this means that we need to store the current `git_thread` in TLS, so that we can set its `return` value when terminating. We cannot simply use `ExitThread`, since Win32 returns `DWORD`s from threads; we return `void *`.
Arthur Schreiber ab96ca55 2016-10-06T13:15:31 Make sure we use the `C` locale for `regcomp` on macOS.
Patrick Steinhardt aab266c9 2016-06-20T20:07:33 threads: add platform-independent thread initialization function
Patrick Steinhardt 8aaa9fb6 2016-06-20T18:21:42 win32: rename pthread.{c,h} to thread.{c,h} The old pthread-file did re-implement the pthreads API with exact symbol matching. As the thread-abstraction has now been split up between Unix- and Windows-specific files within the `git_` namespace to avoid symbol-clashes between libgit2 and pthreads, the rewritten wrappers have nothing to do with pthreads anymore. Rename the Windows-specific pthread-files to honor this change.
Patrick Steinhardt a342e870 2016-06-20T18:28:00 threads: remove now-useless typedefs
Patrick Steinhardt 4f10c1e6 2016-06-20T19:40:45 threads: remove unused function pthread_num_processors_np The function pthread_num_processors_np is currently unused and superseded by the function `git_online_cpus`. Remove the function.
Patrick Steinhardt 6551004f 2016-06-20T17:49:47 threads: split up OS-dependent rwlock code
Patrick Steinhardt 139bffa0 2016-06-20T17:20:13 threads: split up OS-dependent thread-condition code
Patrick Steinhardt 20d078df 2016-06-20T19:48:19 threads: remove unused function pthread_cond_broadcast
Patrick Steinhardt 1c135405 2016-06-20T17:07:14 threads: split up OS-dependent mutex code
Patrick Steinhardt faebc1c6 2016-06-20T17:44:04 threads: split up OS-dependent thread code
Tyler Church 32269b15 2016-05-18T09:33:17 Add retries to win32 p_unlink and p_open.
Carlos Martín Nieto 87c18197 2016-03-16T19:05:11 Split the page size from the mmap alignment While often similar, these are not the same on Windows. We want to use the page size on Windows for the pools, but for mmap we need to use the allocation granularity as the alignment. On the other platforms these values remain the same.
Edward Thomson 3d6a42d1 2016-02-25T11:23:19 nsec: support NDK's crazy nanoseconds Android NDK does not have a `struct timespec` in its `struct stat` for nanosecond support, instead it has a single nanosecond member inside the struct stat itself. We will use that and use a macro to expand to the `st_mtim` / `st_mtimespec` definition on other systems (much like the existing `st_mtime` backcompat definition).
Carlos Martín Nieto b85d0afd 2016-02-18T15:11:02 Merge pull request #3606 from ethomson/drop_xp win32: drop xp support in WideCharToMultiByte
Edward Thomson c4d23928 2016-02-11T15:41:07 fstat: use our custom `stat`
Edward Thomson 35439f59 2016-02-11T12:24:21 win32: introduce p_timeval that isn't stupid Windows defines `timeval` with `long`, which we cannot sanely cope with. Instead, use a custom timeval struct.
Edward Thomson 494e61b8 2016-02-09T17:44:59 win32: drop xp support in WideCharToMultiByte
Jacques Germishuys e78e8fae 2015-11-20T20:22:38 Make stat.st_size a __int64 not a uint64_t
Carlos Martín Nieto 75a0ccf5 2015-11-12T19:53:09 Merge pull request #3170 from CmdrMoozy/nsec_fix git_index_entry__init_from_stat: set nsec fields in entry stats
Carlos Martín Nieto 8c7c5fa5 2015-10-20T17:42:42 config: add a ProgramData level This is where portable git stores the global configuration which we can use to adhere to it even though git isn't quite installed on the system.
Axel Rasmussen c7b17fb5 2015-10-01T18:01:32 Merge branch 'master' into nsec_fix_next
Edward Thomson 92a47824 2015-09-22T23:10:56 win32: propogate filename too long errors
Axel Rasmussen 360dd4da 2015-06-23T10:02:48 win32: define our own POSIX struct stat, and support USE_NSEC
Edward Thomson e164ddb1 2015-09-17T12:23:19 win32: return EACCES in `p_lstat` Don't coalesce all errors into ENOENT. At least identify EACCES. All callers should be handling this case already, as the POSIX `lstat` will return this.
Edward Thomson aa06ecaf 2015-08-28T19:30:08 Merge pull request #3352 from ethomson/hidden win32: ensure hidden files can be staged
John Haley eba784d2 2015-08-05T10:19:06 Fix duplicate basenames to support older VS With Visual Studio versions 2008 and older they ignore the full path to files and only check the basename of the file to find a collision. Additionally, having duplicate basenames can break other build tools like GYP. This fixes https://github.com/libgit2/libgit2/issues/3356
Edward Thomson bdec3363 2015-08-03T17:48:33 win32: ensure hidden files can be staged
Carlos Martín Nieto ea445e06 2015-07-07T00:48:17 Merge pull request #3288 from ethomson/getenv git__getenv: utf-8 aware env reader
Edward Thomson e069c621 2015-07-02T09:25:48 git__getenv: utf-8 aware env reader Introduce `git__getenv` which is a UTF-8 aware `getenv` everywhere. Make `cl_getenv` use this to keep consistent memory handling around return values (free everywhere, as opposed to only some platforms).
Jeff Hostetler 827b954e 2015-06-28T06:56:02 Reserve aux_id 0; sort leaks by aux_id. Fix cmp.
Jeff Hostetler 93b42728 2015-06-09T14:38:30 Include stacktrace summary in memory leak output.
Edward Thomson 121c3171 2015-06-16T15:18:04 Introduce p_utimes and p_futimes Provide functionality to set the time on a filesystem entry, using utimes or futimes on POSIX type systems or SetFileTime on Win32.
Edward Thomson cd39e4e2 2015-04-29T18:12:51 git_buf_put_w: introduce utf16->utf8 conversion
Edward Thomson f63a1b72 2015-04-29T17:23:02 git_path_diriter: use FindFirstFile in win32 Using FindFirstFile and FindNextFile in win32 allows us to use the directory information that is returned, instead of us having to get the file attributes all over again, which is a distinct cost savings on win32.
Edward Thomson 35c1d207 2015-04-29T14:03:20 git_win32_path_dirload_with_stat: removed
Edward Thomson 544139f5 2015-04-28T16:39:47 win32: keep full path for realpath usage
Edward Thomson c074d7a4 2015-04-28T12:24:08 win32: mimic git_path_dirload_with_stat closely
Edward Thomson b3f6cef0 2015-04-28T11:16:42 dirload: loop conditional; less path mangling
Edward Thomson e05531dd 2015-04-27T18:02:06 win32 dirload: don't heap allocate DIR structure
Edward Thomson f3c444b8 2015-04-27T17:47:51 win32: abstract file attributes -> struct stat fn
J Wyman 1920ee4e 2015-03-26T18:10:24 Improvements to status performance on Windows. Changed win32/path_w32.c to utilize NTFS' FindFirst..FindNext data instead of doing an lstat per file. Avoiding unnecessary directory opens and file scans reduces IO, improving overall performance. Effect is magnified due to NTFS being a kernel mode file system (as opposed to user mode).
Jeff Hostetler 06c985d8 2015-04-18T09:07:48 Rename routine to free TLS data
Jeff Hostetler 55c5f756 2015-04-17T09:30:22 Attempt to fix Windows TLS memory leak.
Edward Thomson 523526e5 2015-03-18T18:25:14 win32 resource: allow custom comments field in DLL
Matti Virolainen 78c34af0 2015-03-06T12:23:14 Use secure API if available.
Tony Kelman 04c5a9c0 2015-03-05T19:42:54 Add some missing definitions for mingw.org these shouldn't be necessary if _WIN32_WINNT >= _WIN32_WINNT_VISTA
Tony Kelman 1a7ea63d 2015-03-05T17:11:17 Move definitions of strcasecmp and strncasecmp to msvc-compat.h should cut down on compiler warnings with mingw
Carlos Martín Nieto bdf0e734 2015-03-04T14:55:56 Merge pull request #2932 from jeffhostetler/jeffhostetler/big_clone_crash Fix crash in git_clone on extremely large repos
Jeff Hostetler d8be5087 2015-03-03T13:35:10 Change ifdef for MINGW32.
Jeff Hostetler 7e9b21aa 2015-02-27T08:54:48 Fix p_ftruncate to handle big files for git_clone
Edward Thomson bf1476f1 2015-03-02T10:35:26 win32: add the patch level to the .dll fileversion Win32 DLLs have four fields for the version number (major, minor, teeny, patch). If a consumer wants to build a custom DLL, it may be useful to set the patchlevel version number in the DLL. This value only affects the DLL version number, it does not affect the resultant "version number", which remains major.minor.teeny.
Carlos Martín Nieto a7fa970f 2015-02-15T05:13:50 Merge pull request #2895 from ethomson/alloc_overflow allocations: test for overflow of requested size
Edward Thomson f1453c59 2015-02-12T12:19:37 Make our overflow check look more like gcc/clang's Make our overflow checking look more like gcc and clang's, so that we can substitute it out with the compiler instrinsics on platforms that support it. This means dropping the ability to pass `NULL` as an out parameter. As a result, the macros also get updated to reflect this as well.
Edward Thomson 527ed59a 2015-02-13T09:18:49 win32: limit the mode to `_wopen`/`_waccess` Win32 generally ignores Unix-like mode bits that don't make any sense on the platform (eg `0644` makes no sense to Windows). But WINE complains loudly when presented with POSIXy bits. Remove them. (Thanks @phkelley)
Edward Thomson 2884cc42 2015-02-11T09:39:38 overflow checking: don't make callers set oom Have the ALLOC_OVERFLOW testing macros also simply set_oom in the case where a computation would overflow, so that callers don't need to.
Edward Thomson 3603cb09 2015-02-10T23:13:49 git__*allocarray: safer realloc and malloc Introduce git__reallocarray that checks the product of the number of elements and element size for overflow before allocation. Also introduce git__mallocarray that behaves like calloc, but without the `c`. (It does not zero memory, for those truly worried about every cycle.)
Edward Thomson 392702ee 2015-02-09T23:41:13 allocations: test for overflow of requested size Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
Edward Thomson 3c68bfcd 2015-02-04T18:24:31 stat: don't remove trailing '/' from root on win32 `p_stat` calls `git_win32_path_from_utf8`, which canonicalizes the path. Do not further try to modify the path, else we trim the trailing slash from a root directory and try to access `C:` instead of `C:/`.
Jacques Germishuys a1daec3c 2014-12-29T18:11:33 Undef stat first
Carlos Martín Nieto 629417bd 2014-12-19T08:08:47 Fix ming32 compilation We need to know what wchar_t and MAX_PATH are. Including common.h takes care of that for us.
Edward Thomson a64119e3 2014-11-25T18:13:00 checkout: disallow bad paths on win32 Disallow: 1. paths with trailing dot 2. paths with trailing space 3. paths with trailing colon 4. paths that are 8.3 short names of .git folders ("GIT~1") 5. paths that are reserved path names (COM1, LPT1, etc). 6. paths with reserved DOS characters (colons, asterisks, etc) These paths would (without \\?\ syntax) be elided to other paths - for example, ".git." would be written as ".git". As a result, writing these paths literally (using \\?\ syntax) makes them hard to operate with from the shell, Windows Explorer or other tools. Disallow these.
Edward Thomson cceae9a2 2014-12-01T13:09:58 win32: use NT-prefixed "\\?\" paths When turning UTF-8 paths into UCS-2 paths for Windows, always use the \\?\-prefixed paths. Because this bypasses the system's path canonicalization, handle the canonicalization functions ourselves. We must: 1. always use a backslash as a directory separator 2. only use a single backslash between directories 3. not rely on the system to translate "." and ".." in paths 4. remove trailing backslashes, except at the drive root (C:\)
Carlos Martín Nieto 177a29d8 2014-10-27T10:39:45 Merge commit 'refs/pull/2366/head' of github.com:libgit2/libgit2
Edward Thomson 8d45b469 2014-10-11T14:34:24 p_lstat win32: don't canonicalize volume mounts A reparse point that is an IO_REPARSE_TAG_MOUNT_POINT could be a junction or an actual filesystem mount point. (Who knew?) If it's the latter, its reparse point will report the actual volume information \??\Volume{GUID}\ and we should not attempt to dereference that further, instead readlink should report EINVAL since it's not a symlink / junction and its original path was canonical. Yes, really.
Jacques Germishuys 07d03d31 2014-07-13T16:40:51 Introduce some consistency in definition/declaration ordering
Jacques Germishuys c983604e 2014-07-12T14:44:21 Consistently use p_snprintf
Jacques Germishuys 2f795d8f 2014-07-12T14:45:56 Cleanup portability/compatibility layer * Removes mingw-compat.h * Cleans up separation of compiler/platform idiosyncrasies * Unifies mingw/msvc stat structures and functions * (Tries to) hide more compiler specific implementation details (even in our internal API)
Jacques Germishuys 59ceb432 2014-07-05T21:27:47 Define IO_REPARSE_TAG_SYMLINK if its not defined by WinNT.h
Jacques Germishuys 72090514 2014-07-05T21:27:21 Secure CRT is only available from Visual Studio 2005+
Jacques Germishuys cde32d4d 2014-07-05T21:25:55 Variadic macros is only available from Visual Studio 2005+
Jacques Germishuys ab864e9c 2014-07-05T21:25:20 _stat64 is a function, __stat64 is the structure
Carlos Martín Nieto 461da57a 2014-06-23T17:32:30 Merge remote-tracking branch 'upstream/cmn/filebuf-atomic-unlock'
Philip Kelley 1b4e29b7 2014-06-07T13:56:39 React to review feedback
Philip Kelley fb591767 2014-06-07T12:51:48 Win32: Fix object::cache::threadmania test on x64
Carlos Martín Nieto e58281aa 2014-04-04T14:40:38 filebuf: make unlocking atomic When renaming a lock file to its final location, we need to make sure that it is replaced atomically. We currently have a workaround for Windows by removing the target file. This means that the target file, which may be a ref or a packfile, may cease to exist for a short wile, which shold be avoided. Implement the workaround only in Windows, by making sure that the file we want to replace is writable.
Albert Meltzer 62e562f9 2014-05-18T07:54:41 Fix compiler warning (git_off_t cast to size_t). Use size_t for page size, instead of long. Check result of sysconf. Use size_t for page offset so no cast to size_t (second arg to p_mmap). Use mod instead div/mult pair, so no cast to size_t is necessary.
Vicent Marti 138af337 2014-05-19T12:20:31 Merge pull request #2303 from jacquesg/mingw-lseek WIP: Windows fixes