aboutsummaryrefslogtreecommitdiffstats
path: root/lib/System/Unix
Commit message (Collapse)AuthorAgeFilesLines
* Merge System into Support.Michael J. Spencer2010-11-2914-2540/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8
* This is the first step in adding sane error handling support to LLVMSystem.Michael J. Spencer2010-11-161-0/+34
| | | | | | | | | | | | | | | | | The system API's will be shifted over to returning an error_code, and returning other return values as out parameters to the function. Code that needs to check error conditions will use the errc enum values which are the same as the posix_errno defines (EBADF, E2BIG, etc...), and are compatable with the error codes in WinError.h due to some magic in system_error. An example would be: if (error_code ec = KillEvil("Java")) { // error_code can be converted to bool. handle_error(ec); } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119360 91177308-0d34-0410-b5e6-96231b3b80d8
* Add method for checking if a path is a symbolic link.Rafael Espindola2010-11-071-0/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118367 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete unused variables.Dan Gohman2010-11-031-3/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118128 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove several unhelpful checks for isValid from sys::Path.Dan Gohman2010-11-031-26/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118127 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't try to enforce MAXPATHLEN in sys::Path for Unix. OS's can checkDan Gohman2010-11-021-4/+6
| | | | | | | limits on their own. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118113 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify.Dan Gohman2010-11-021-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118110 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a copy+pasto.Dan Gohman2010-11-021-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118106 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid manipulating paths in fixed-sized arrays.Dan Gohman2010-11-021-10/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118105 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify this code.Dan Gohman2010-11-021-6/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118102 91177308-0d34-0410-b5e6-96231b3b80d8
* Use '\0' instead of 0 for nul character constants.Dan Gohman2010-11-021-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118096 91177308-0d34-0410-b5e6-96231b3b80d8
* appendSuffix: don't append a dot when the suffix is empty.Mikhail Glushenkov2010-11-021-12/+0
| | | | | | | Additionally, move the implementation of appendSuffix to Path.cpp: it is platform-independent. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118089 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate some temporary std::strings.Dan Gohman2010-11-021-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118086 91177308-0d34-0410-b5e6-96231b3b80d8
* Micro-optimize.Dan Gohman2010-11-021-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118058 91177308-0d34-0410-b5e6-96231b3b80d8
* Make FindProgramByName return paths with slashes unmodified on Windows.Mikhail Glushenkov2010-11-021-2/+2
| | | | | | This makes its behaviour more consistent across platforms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118048 91177308-0d34-0410-b5e6-96231b3b80d8
* Path: Add GetEXESuffix() to complement GetDLLSuffix().Mikhail Glushenkov2010-11-021-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118042 91177308-0d34-0410-b5e6-96231b3b80d8
* Check if ErrMsg is null. This fixes the "not" command.Dan Gohman2010-10-291-6/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117666 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Program::Wait differentiate execution failure due to the fileDan Gohman2010-10-291-7/+10
| | | | | | | being not found from the file being not executable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117664 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Program::Wait provide an error message string for errorsDan Gohman2010-10-291-9/+19
| | | | | | | executing the child process and abnormal child process termination. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117661 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r117582, which reverted r77396. Searching PATH for a stringDan Gohman2010-10-281-1/+1
| | | | | | | | | | | | | which contains slashes is inconsistent with the meaning of PATH on Unix-type platforms, and pretty surprising. If the user has given a specific path to execute and we can't execute it, we should fail and say why. (Apparently the new posix_spawn code doesn't always say why, but that's a separate issue.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117596 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r77396.Mikhail Glushenkov2010-10-281-1/+1
| | | | | | | | | | | | | | Original commit message: On "Unix", if Program::FindProgramByName is given a name containing slashes, just go with it, regardless of whether it looks like it will be executable. This follows the behavior of sh(1) more closely. It's better when behaviour is consistent between platforms. This change also makes FindExecutable() behave as expected on unix-likes (before this commit, it used to always succeed). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117582 91177308-0d34-0410-b5e6-96231b3b80d8
* Trailing whitespace.Mikhail Glushenkov2010-10-281-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117581 91177308-0d34-0410-b5e6-96231b3b80d8
* CrashRecovery: Fix raise() override to actually send the right signal, *cough*.Daniel Dunbar2010-10-081-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116072 91177308-0d34-0410-b5e6-96231b3b80d8
* Correctly check if a path is a directory. Fix by Brian Korver.Evan Cheng2010-10-071-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115991 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an explicit initialization to work around what appears to be a valgrindDaniel Dunbar2010-09-301-1/+3
| | | | | | false positive, at least on Darwin. I haven't filed this, but you can feel free. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115242 91177308-0d34-0410-b5e6-96231b3b80d8
* CrashRecovery/Darwin: Override raise() as well so that crash recovery doesn'tDaniel Dunbar2010-09-221-1/+5
| | | | | | | end up altering the thread on which crashes are done because of its use of Darwin's broken raise() implementation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114558 91177308-0d34-0410-b5e6-96231b3b80d8
* Issue a #error if the host doesn't have an implementation forDan Gohman2010-09-071-0/+2
| | | | | | | GetMainExecutable yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113240 91177308-0d34-0410-b5e6-96231b3b80d8
* Apply a patch from Kees van Reeuwijk to add support for Minix.Dan Gohman2010-09-021-3/+3
| | | | | | | | Minix apparently doesn't like double-slash separators, and there's no apparent need for them here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112844 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an interface for unregistering a file from the FilesToRemove list.Dan Gohman2010-09-011-0/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112705 91177308-0d34-0410-b5e6-96231b3b80d8
* Some fixes for NetBSDAnton Korobeynikov2010-08-311-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112662 91177308-0d34-0410-b5e6-96231b3b80d8
* CrashRecovery/Darwin: On Darwin, raise sends a signal to the main thread insteadDaniel Dunbar2010-08-191-0/+34
| | | | | | | | | of the current thread. This has the unfortunate effect that assert() and abort() will end up bypassing our crash recovery attempts. We work around this for anything in the same linkage unit by just defining our own versions of the assert handler and abort. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111583 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate unnecessary empty string literals.Dan Gohman2010-08-041-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110183 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an erase() method to llvm::ThreadLocal.Owen Anderson2010-07-281-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109686 91177308-0d34-0410-b5e6-96231b3b80d8
* Rather than using an ifdef on the target to zero out fields,Duncan Sands2010-07-141-4/+1
| | | | | | | just use memset to zero the entire struct. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108330 91177308-0d34-0410-b5e6-96231b3b80d8
* improve Path::makeUnique when mkstemp/mktemp are not availableChris Lattner2010-07-121-7/+12
| | | | | | | patch by Lasse Kärkkäinen in PR7404. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108110 91177308-0d34-0410-b5e6-96231b3b80d8
* add some triple for minix, patch by Kees van Reeuwijk from PR7582Chris Lattner2010-07-071-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107785 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out the handler work from SignalHandler into a helper function,Dan Gohman2010-05-271-5/+12
| | | | | | | | | | and change llvm::sys::RunInterruptHandlers to call that function directly instead of calling SignalHandler, because the rest of SignalHandler invokes side effects which aren't appropriate, including raising the signal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104896 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't bother clearing the Magic string when the magic numberDan Gohman2010-05-271-3/+1
| | | | | | | can't be read, since it isn't cleared on other error paths. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104852 91177308-0d34-0410-b5e6-96231b3b80d8
* Add llvm::sys::RunInterruptHandlers(), which runs the registered SIGINT cleanupDaniel Dunbar2010-05-081-1/+3
| | | | | | stuff. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103333 91177308-0d34-0410-b5e6-96231b3b80d8
* This doesn't need SmallVector.h anymore.Dan Gohman2010-04-191-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101790 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix this for std::vectors which don't have .data().Dan Gohman2010-04-191-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101785 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix -Wcast-qual warnings.Dan Gohman2010-04-191-6/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101782 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 91528 and use a std::vector instead, fixing an abuse of std::string.Dan Gohman2010-04-191-10/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101781 91177308-0d34-0410-b5e6-96231b3b80d8
* avoid temporary std::string in non posix_spawn path.Chris Lattner2010-04-181-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101723 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate temporary string.Benjamin Kramer2010-04-181-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101711 91177308-0d34-0410-b5e6-96231b3b80d8
* Properly inherit the environment on darwin where environ is not available ↵Benjamin Kramer2010-04-181-1/+6
| | | | | | for shared libraries. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101710 91177308-0d34-0410-b5e6-96231b3b80d8
* This is horrible. Split the difference, and declare 'environ' on all non-DarwinNick Lewycky2010-04-181-0/+7
| | | | | | | | platforms to unbreak the darwin and linux builds. The BSD folks should feel free to change the #if, if this breaks them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101703 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r101701, Darwin doesn't have 'environ'. Go figure.Nick Lewycky2010-04-181-3/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101702 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix linux build. posix_spawn doesn't inherit the environment by default.Nick Lewycky2010-04-181-1/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101701 91177308-0d34-0410-b5e6-96231b3b80d8
* make Program::Execute use posix_spawn on systems that support it,Chris Lattner2010-04-181-9/+64
| | | | | | | | | | | as it is more efficient than fork/exec. Thanks to Eric for adding the autoconf check. It would be nice if a cmake guru could add a cmake check for posix_spawn as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101693 91177308-0d34-0410-b5e6-96231b3b80d8