summaryrefslogtreecommitdiff
path: root/src/posix.h
Commit message (Collapse)AuthorAgeFilesLines
* git_path: introduce 'git_path_diriter'Edward Thomson2015-05-011-1/+0
| | | | | Introduce a new `git_path_diriter` that can iterate directories efficiently for each platform.
* Merge commit 'refs/pull/2366/head' of github.com:libgit2/libgit2Carlos Martín Nieto2014-10-271-0/+2
|\
| * Fix compiler warning (git_off_t cast to size_t).Albert Meltzer2014-05-191-0/+2
| | | | | | | | | | | | 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.
* | Can read large file larger than 2GB on WindowsLinquize2014-08-101-1/+1
| |
* | Cleanup portability/compatibility layerJacques Germishuys2014-08-051-28/+46
|/ | | | | | | * 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)
* indexer: mmap fixes for Windowscmn/indexer-mmapCarlos Martín Nieto2014-05-171-1/+1
| | | | | | | | | | | Windows has its own ftruncate() called _chsize_s(). p_mkstemp() is changed to use p_open() so we can make sure we open for writing; the addition of exclusive create is a good thing to do regardless, as we want a temporary path for ourselves. Lastly, MSVC doesn't quite know how to add two numbers if one of them is a void pointer, so let's alias it to unsigned char.C
* indexer: use mmap for writingCarlos Martín Nieto2014-05-171-0/+1
| | | | | | 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.
* Check for EWOULDBLOCK as well as EAGAIN on write.brian m. carlson2014-02-161-0/+9
| | | | | | | | | | | | | On some systems, notably HP PA-RISC systems running Linux or HP-UX, EWOULDBLOCK and EAGAIN are not the same value. POSIX (and these OSes) allow EWOULDBLOCK to occur on write(2) (and send(2), etc.), so check explicitly for this case as well as EAGAIN by defining and using a macro GIT_ISBLOCKED that considers both. The macro is necessary because MSYS does not provide EWOULDBLOCK and compilation fails if an attempt is made to use it unconditionally. On most systems, where the two values are the same, the compiler will simply optimize this check out and it will have no effect.
* Split p_strlen into its own headerCarlos Martín Nieto2014-02-051-12/+1
| | | | | | | | | We need this from util.h and posix.h, but the latter includes common.h which includes util.h, which means p_strlen is not defined by the time we get to git__strndup(). Split the definition on p_strlen() off into its own header so we can use it in util.h.
* Use our strnlen on MacOS for backward compatRussell Belfer2014-01-031-2/+6
| | | | | | Apparently MacOS didn't have strnlen on 10.6 and earlier. To avoid having linking problems on older versions, we'll just use our internal version.
* posix: Solaris doesn't have strnlen eitherAlessandro Ghedini2013-11-271-1/+6
|
* Fix typo in documentationLinquize2013-09-221-1/+1
|
* Use time(2) to get the timeEdward Thomson2013-08-191-4/+0
| | | | | | We didn't use the added precision in gettimeofday, so remove it. This prevents us from having an unnecessary reimplementation on win32.
* Fixes to safely reading the indexEdward Thomson2013-08-081-0/+4
| | | | | Avoid wrapping around extension size when reading, avoid walking off the end of the buffer when reading names.
* Add O_CLOEXEC to open callsRussell Belfer2013-06-221-0/+3
|
* Make tree iterator handle icase equivalenceRussell Belfer2013-03-081-2/+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.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Always use internal fnmatch, not systemRussell Belfer2012-10-151-0/+1
|
* Add template dir and set gid to repo initRussell Belfer2012-08-221-0/+7
| | | | | | | | | | | | | | | | | 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.
* amigaos: Add missing includeVicent Marti2012-06-241-0/+1
|
* amigaos: CleanupVicent Marti2012-06-221-4/+28
|
* More changes resulting from pull requestChris Young2012-06-141-2/+3
|
* Updates from comments on OS4 compatibility pull request ↵Chris Young2012-06-141-1/+6
| | | | http://github.com/libgit2/libgit2/pull/766
* Merge remote-tracking branch 'source/development' into developmentChris Young2012-06-131-0/+9
|\
| * Fix mingw32 (Travis) build.Ben Straub2012-06-111-0/+1
| |
| * Rename posix wrappers with 'p_' prefix.Ben Straub2012-06-061-0/+8
| |
* | Make this more generic and mergeable.Chris Young2012-06-131-1/+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<--
* | OS4 compatibilityChris Young2012-06-081-1/+5
|/
* compat: make p_open able to accept optional mode when passing the O_CREAT flagnulltoken2012-05-071-1/+1
| | | | This has the nice side effect of making test_attr_repo__staging_properly_normalizes_line_endings_according_to_gitattributes_directives() test pass again on Windows. This test started to fail after commit 674a198 was applied.
* Fix warnings on 64-bit windows buildsRussell Belfer2012-04-171-0/+8
| | | | | This fixes all the warnings on win64 except those in deps, which come from the regex code.
* Update diff to use iteratorsRussell Belfer2012-03-021-0/+2
| | | | | | | | | | | | | 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.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* Implement p_renameCarlos Martín Nieto2011-11-071-0/+1
| | | | | | Move the callers of git_futils_mv_atomic to use p_rename. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* fileops/repository: create (most) directories with 0777 permissionsBrodie Rao2011-10-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To further match how Git behaves, this change makes most of the directories libgit2 creates in a git repo have a file mode of 0777. Specifically: - Intermediate directories created with git_futils_mkpath2file() have 0777 permissions. This affects odb_loose, reflog, and refs. - The top level folder for bare repos is created with 0777 permissions. - The top level folder for non-bare repos is created with 0755 permissions. - /objects/info/, /objects/pack/, /refs/heads/, and /refs/tags/ are created with 0777 permissions. Additionally, the following changes have been made: - fileops functions that create intermediate directories have grown a new dirmode parameter. The only exception to this is filebuf's lock_file(), which unconditionally creates intermediate directories with 0777 permissions when GIT_FILEBUF_FORCE is set. - The test runner now sets the umask to 0 before running any tests. This ensurses all file mode checks are consistent across systems. - t09-tree.c now does a directory permissions check. I've avoided adding this check to other tests that might reuse existing directories from the prefabricated test repos. Because they're checked into the repo, they have 0755 permissions. - Other assorted directories created by tests have 0777 permissions.
* fileops/posix: replace usage of "int mode" with "mode_t mode"Brodie Rao2011-10-141-1/+1
| | | | | Note: Functions exported from fileops take const mode_t, while the underlying POSIX wrappers take mode_t.
* Revert "Rewrite getenv to use Win32 version on Windows"Vicent Marti2011-09-271-1/+0
| | | | This reverts commit e1b86444676b70154bf8ab450d429bdef57a8276.
* Implment p_access and use it in git_fileutils_existsCarlos Martín Nieto2011-09-231-0/+1
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Rewrite getenv to use Win32 version on WindowsPaul Betts2011-09-211-0/+1
|
* Rewrite p_* functions to use Unicode and marshal to UTF8 internallyPaul Betts2011-09-191-5/+12
|
* Cleanup legal dataVicent Marti2011-09-191-1/+4
| | | | | | | | | | 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.
* posix: Fix undeclared prototypeVicent Marti2011-08-301-7/+9
|
* posix: declare 'buf' argument of p_write() as constKirill A. Shutemov2011-07-251-1/+1
| | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* fileops: CleanupVicent Marti2011-07-051-0/+54
Cleaned up the structure of the whole OS-abstraction layer. fileops.c now contains a set of utility methods for file management used by the library. These are abstractions on top of the original POSIX calls. There's a new file called `posix.c` that contains emulations/reimplementations of all the POSIX calls the library uses. These are prefixed with `p_`. There's a specific posix file for each platform (win32 and unix). All the path-related methods have been moved from `utils.c` to `path.c` and have their own prefix.