summaryrefslogtreecommitdiff
path: root/src/unix
Commit message (Collapse)AuthorAgeFilesLines
* Split the page size from the mmap alignmentcmn/pool-limitCarlos Martín Nieto2016-03-161-0/+5
| | | | | | | | 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.
* nsec: support NDK's crazy nanosecondsEdward Thomson2016-02-251-0/+12
| | | | | | | | 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).
* map: use `giterr_set` internallyEdward Thomson2016-02-231-1/+1
| | | | | | Use the `giterr_set` function, which actually supports `GITERR_OS`. The `giterr_set_str` function is exposed for external users and will not append the operating system's error message.
* win32: introduce p_timeval that isn't stupidEdward Thomson2016-02-121-1/+3
| | | | | Windows defines `timeval` with `long`, which we cannot sanely cope with. Instead, use a custom timeval struct.
* p_futimes: support using futimens when availableEdward Thomson2015-09-301-1/+14
|
* posix compat: include sys/stat.h for mingwEdward Thomson2015-06-301-0/+1
|
* Fixed Xcode 6.1 build warningsPierre-Olivier Latour2015-06-171-0/+1
|
* Introduce p_utimes and p_futimesEdward Thomson2015-06-161-1/+3
| | | | | | Provide functionality to set the time on a filesystem entry, using utimes or futimes on POSIX type systems or SetFileTime on Win32.
* crlf: tick the index forward to work around racy-git behaviourCarlos Martín Nieto2015-06-161-0/+1
| | | | | | | | | | | | In order to avoid racy-git, we zero out the file size for entries with the same timestamp as the index (or during the initial checkout). This is the case in a couple of crlf tests, as the code is fast enough to do everything in the same second. As we know that we do not perform the modification just after writing out the index, which is what this is designed to work around, tick the mtime of the index file such that it doesn't agree with the files anymore, and we do not zero out these entries.
* git_path: introduce 'git_path_diriter'Edward Thomson2015-05-011-0/+1
| | | | | Introduce a new `git_path_diriter` that can iterate directories efficiently for each platform.
* Fix segmentation fault observed on OpenBSD/sparc64cmn/mmap-readableStefan Sperling2014-11-031-4/+2
| | | | | A non-readable mapping of a file causes an access violation in the pack tests. Always use PROT_READ to work around this.
* Merge commit 'refs/pull/2366/head' of github.com:libgit2/libgit2Carlos Martín Nieto2014-10-271-2/+8
|\
| * Fix compiler warning (git_off_t cast to size_t).Albert Meltzer2014-05-191-2/+8
| | | | | | | | | | | | 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.
* | Introduce some consistency in definition/declaration orderingJacques Germishuys2014-08-051-4/+3
| |
* | Move p_realpath logic to realpath.cJacques Germishuys2014-08-052-14/+9
| |
* | Cleanup portability/compatibility layerJacques Germishuys2014-08-051-1/+22
| | | | | | | | | | | | | | * 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)
* | Fix unix/posix.h include guardJacques Germishuys2014-07-131-2/+2
|/
* indexer: use mmap for writingCarlos Martín Nieto2014-05-171-0/+6
| | | | | | Some OSs cannot keep their ideas about file content straight when mixing standard IO with file mapping. As we use mmap for reading from the packfile, let's make writing to the pack file use mmap.
* Win32: UTF-8 <-> WCHAR conversion overhaulPhilip Kelley2014-04-191-1/+0
|
* Test cancel from indexer progress callbackRussell Belfer2013-12-111-1/+1
| | | | | | | | | | | | | | | This adds tests that try canceling an indexer operation from within the progress callback. After writing the tests, I wanted to run this under valgrind and had a number of errors in that situation because mmap wasn't working. I added a CMake option to force emulation of mmap and consolidated the Amiga-specific code into that new place (so we don't actually need separate Amiga code now, just have to turn on -DNO_MMAP). Additionally, I made the indexer code propagate error codes more reliably than it used to.
* Add missing prototype for p_realpath().Jasper Lievisse Adriaanse2013-04-221-0/+2
|
* Fix compilation on OpenBSDCarlos Martín Nieto2013-04-151-1/+1
|
* Make tree iterator handle icase equivalenceRussell Belfer2013-03-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | There is a serious bug in the previous tree iterator implementation. If case insensitivity resulted in member elements being equivalent to one another, and those member elements were trees, then the children of the colliding elements would be processed in sequence instead of in a single flattened list. This meant that the tree iterator was not truly acting like a case-insensitive list. This completely reworks the tree iterator to manage lists with case insensitive equivalence classes and advance through the items in a unified manner in a single sorted frame. It is possible that at a future date we might want to update this to separate the case insensitive and case sensitive tree iterators so that the case sensitive one could be a minimal amount of code and the insensitive one would always know what it needed to do without checking flags. But there would be so much shared code between the two, that I'm not sure it that's a win. For now, this gets what we need. More tests are needed, though.
* Fix p_realpath on OpenBSDCarlos Martín Nieto2013-01-292-1/+36
| | | | | | OpenBSD's realpath(3) doesn't require the last part of the path to exist. Override p_realpath in this OS to bring it in line with the library's assumptions.
* update copyrightsEdward Thomson2013-01-082-2/+2
|
* Add POSIX compat lstat() variant for win32Russell Belfer2012-11-141-0/+3
| | | | | | | | | | The existing p_lstat implementation on win32 is not quite POSIX compliant when setting errno to ENOTDIR. This adds an option to make is be compliant so that code (such as checkout) that cares to have separate behavior for ENOTDIR can use it portably. This also contains a couple of other minor cleanups in the posix_w32.c implementations to avoid unnecessary work.
* Move inet_pton to posix platform-compatibility layerEduardo Bart2012-11-071-0/+1
|
* Always use internal fnmatch, not systemRussell Belfer2012-10-151-7/+0
|
* posix: Always set a default mapping modeVicent Marti2012-08-261-0/+2
|
* Some cleanup suggested during reviewRussell Belfer2012-08-221-1/+0
| | | | | | | | | | This cleans up a number of items suggested during code review with @vmg, including: * renaming "outside repo" config API to `git_config_open_default` * killing the `git_config_open_global` API * removing the `git_` prefix from the static functions in fileops * removing some unnecessary functionality from the "cp" command
* Add template dir and set gid to repo initRussell Belfer2012-08-221-0/+1
| | | | | | | | | | | | | | | | | This extends git_repository_init_ext further with support for initializing the repository from an external template directory and with support for the "create shared" type flags that make a set GID repository directory. This also adds tests for much of the new functionality to the existing `repo/init.c` test suite. Also, this adds a bunch of new utility functions including a very general purpose `git_futils_mkdir` (with the ability to make paths and to chmod the paths post-creation) and a file tree copying function `git_futils_cp_r`. Also, this includes some new path functions that were useful to keep the code simple.
* Merge branch 'development' into cloneBen Straub2012-07-172-1/+3
|\
| * Make this more generic and mergeable.Chris Young2012-06-131-17/+1
| | | | | | | | | | | | | | | | | | Needs AmigaOS.cmake now from CMake package at OS4Depot, or contents below: --8<-- SET(AMIGA 1) SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") --8<--
| * Actually do the mmap... unsurprisingly, this makes the indexer work on SFSChris Young2012-06-121-4/+4
| | | | | | | | | | On RAM: the .idx and .pack files become links to a .lock and the original download respectively. Assume some feature (such as record locking) supported by SFS but not JXFS or RAM: is required.
| * Basic mmap/munmap compatiblityChris Young2012-06-101-3/+16
| |
| * no fnmatch.hChris Young2012-06-071-1/+1
| |
| * Merge remote-tracking branch 'source/development' into update-testChris Young2012-06-072-25/+50
| |\ | | | | | | | | | | | | | | | | | | Merging main libgit2! Conflicts: CMakeLists.txt src/unix/map.c
| * | Assume this is irrelevant for nowChris Young2012-06-051-2/+6
| | |
* | | Checkout: handle symlinks.Ben Straub2012-07-161-0/+1
| |/ |/| | | Includes unfinished win32 implementation.
* | Fix readdir_r() usage for SolarisScott J. Goldman2012-05-121-0/+2
| | | | | | | | | | | | | | | | On Solaris, struct dirent is defined differently than Linux. The field containing the path name is of size 0, rather than NAME_MAX. So, we need to use a properly sized buffer on Solaris to avoid a stack overflow. Also fix some DIR* leaks on cleanup.
* | Hook up Windows compat fnmatch() for SolarisScott J. Goldman2012-05-101-2/+6
| | | | | | | | | | | | | | | | Since Solaris does not support some of the same flags as glibc fnmatch(), we just use the implementation we have for Windows. Now that it's no longer a windows-specific thing, I moved it into compat/ instead of win32/
* | Resolve comments from pull requestRussell Belfer2012-03-131-2/+1
| | | | | | | | | | | | | | This converts the map validation function into a macro, tweaks the GITERR_OS system error automatic appending, and adds a tentative new error access API and some quick unit tests for both the old and new error APIs.
* | Migrate ODB files to new error handlingRussell Belfer2012-03-121-23/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This migrates odb.c, odb_loose.c, odb_pack.c and pack.c to the new style of error handling. Also got the unix and win32 versions of map.c. There are some minor changes to other files but no others were completely converted. This also contains an update to filebuf so that a zeroed out filebuf will not think that the fd (== 0) is actually open (and inadvertently call close() on fd 0 if cleaned up). Lastly, this was built and tested on win32 and contains a bunch of fixes for the win32 build which was pretty broken.
* | Update diff to use iteratorsRussell Belfer2012-03-021-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This is a major reorganization of the diff code. This changes the diff functions to use the iterators for traversing the content. This allowed a lot of code to be simplified. Also, this moved the functions relating to outputting a diff into a new file (diff_output.c). This includes a number of other changes - adding utility functions, extending iterators, etc. plus more tests for the diff code. This also takes the example diff.c program much further in terms of emulating git-diff command line options.
* | Fix readdir usage across platformsRussell Belfer2012-02-231-0/+1
| | | | | | | | | | | | This fixes the missing readdir_r from win32 and fixes other platforms to always use the reentrant readdir_r form for reading directory contents.
* | Update Copyright headerschu2012-02-132-2/+2
| | | | | | | | Signed-off-by: schu <schu-github@schulog.org>
* | Create cross-platform setenvPaul Betts2011-09-191-0/+1
| |
* | Cleanup legal dataVicent Marti2011-09-192-0/+12
| | | | | | | | | | | | | | | | | | | | 1. The license header is technically not valid if it doesn't have a copyright signature. 2. The COPYING file has been updated with the different licenses used in the project. 3. The full GPLv2 header in each file annoys me.
* | compat: Move `mkstemp` to the POSIX compat layerVicent Marti2011-08-301-0/+1
| |
* | posix: Properly handle `snprintf` in all platformsVicent Marti2011-08-181-0/+1
| |