Commit Graph

92 Commits

Author SHA1 Message Date
Misha Brukman
f976c856fc Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21422 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 22:55:34 +00:00
Reid Spencer
93b3473478 Provide an implementation of the GetCurrentUserId and GetCurrentGroupId
methods that were recently added to the interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21401 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 16:12:57 +00:00
Reid Spencer
2aafadcc76 For Bug 543:
Standardize the error messages to be in "path: what failed: why" format.
Also attempt to use the correct errno to ThrowErrno in situations where
the errno value is erased by subsequent system calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21385 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 02:50:10 +00:00
Reid Spencer
03aee2e3f2 For Bug 543:
Allow the ThrowErrno function to optionally accept an error number
parameter so that callers can specify the error number to be used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21384 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 02:30:32 +00:00
Misha Brukman
22c46da12b Add FIXME by Markus Oberhumer from bug 545: not checking for "." in $PATH may
result in returning executable files that won't be runnable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21378 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-20 15:42:11 +00:00
Misha Brukman
8177bf8904 Do not mark directories as `executable', we only want program files
Patch by Markus Oberhumer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21377 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-20 15:33:22 +00:00
Misha Brukman
4619c75f64 Ignore dangling symlinks in getDirectoryContents()
Thanks to Markus Oberhumer for the patch!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21370 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-20 04:04:07 +00:00
Reid Spencer
1af69a8131 Be slightly more accurate in an error message.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20397 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-02 05:45:56 +00:00
Chris Lattner
0798056b28 Fix a bug in my previous change to this, which broke the build on sparcs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20184 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-14 21:42:10 +00:00
Chris Lattner
946af52687 If errno is zero strerror_r does not modify the buffer, leaving it unterminated.
This causes garbage to be printed out after error messages.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20165 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-13 22:46:37 +00:00
Chris Lattner
8102fcde4c Fix bugpoint
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19605 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 04:23:22 +00:00
Reid Spencer
62582720e6 Make asctime_r work for HP/UX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19544 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-14 00:50:50 +00:00
Reid Spencer
bccc8abc79 Rename Unix/*.cpp and Win32/*.cpp to have a *.inc suffix so that the silly
gdb debugger doesn't get confused on which file it is reading (the one in
lib/System or the one in lib/System/{Win32,Unix})


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19426 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-09 23:29:00 +00:00
Jeff Cohen
e269a1ac1c Use size_t instead of long to represent memory usage. long is 32 bits
on 64-bit Windows.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19393 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 20:15:57 +00:00
Reid Spencer
a01aade75d Add functions for determining if the stdin/out/err is connected to a
console or not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19233 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-01 22:29:26 +00:00
Reid Spencer
92ced2f16a Fix a compilation error for the case where mallinfo() is not available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19201 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-31 05:53:27 +00:00
Reid Spencer
7c1e2f96cd For PR351:
* Ensure #includes are wrapped with appropriate HAVE_ guards
* Account for variations in time.h and sys/time.h inclusion.
* Add macros for getting wait(2) exit status correctly (per autoconf sugg.)
* Implement ThrowErrno in terms of strerror_r, strerror or none based on
  what is available on the platform.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19161 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-27 06:17:50 +00:00
Reid Spencer
51b9f62462 For PR351:
* Remove redundant #includes that are now in Unix.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19160 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-27 06:17:39 +00:00
Reid Spencer
68fdcc123b For PR351:
* Move implementation of sys::PreventCoreFiles function to this file from
  the now defunct SysConfig abstraction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19159 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-27 06:17:27 +00:00
Reid Spencer
af2f208e7c For PR351:
* Ensure #includes are wrapped with appropriate HAVE_ guards
* Ensure variations in "dirent" structure are accounted for.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19158 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-27 06:17:15 +00:00
Reid Spencer
07c00d3e9f For PR351:
* Ensure #includes are wrapped with appropriate HAVE_ guards
* Consolidate implementation from operating system specific directory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19157 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-27 06:17:03 +00:00
Reid Spencer
cdf54d04c7 For PR351:
* Ensure #includes are wrapped with appropriate HAVE_ guards


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19156 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-27 06:16:52 +00:00
Reid Spencer
d0ae93f022 For PR351:
SysConf abstraction was pointless because it had a single function in it that
pertained only to the current process. So merge it into the Process abstraction
and remove the files completely.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19149 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-27 06:15:14 +00:00
Reid Spencer
69a1616106 For PR351:
Merge implementations of isValid and GetTemporaryDirectory into this file. There
is not any point having the operating system specific files for such little
variation between the Unix family of systems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19134 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-24 06:29:42 +00:00
Reid Spencer
48a1f4237d Remove these files as they are not being included any more. DynamicLibrary
is now implemented via ltdl.cpp which has its own way of dealing with
the different platforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19129 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-24 03:59:46 +00:00
Reid Spencer
78076f6140 Put the CopyFile function explicitly in the sys namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19079 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-21 03:27:08 +00:00
Reid Spencer
8b6628997f Implement GetTimeUsage correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19074 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-20 21:43:33 +00:00
Reid Spencer
ed5e7bf422 Provide a getrusage based implementation of GetTotalMemoryUsage and use
the ru_maxrss field as an approximation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19072 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-20 16:33:37 +00:00
Reid Spencer
bc1ee84001 Consistently use the same #if style. Also, fix a bug testing for sbrk(3)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19071 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-20 16:06:44 +00:00
Reid Spencer
721d9aa060 For PR351:
* Implement GetMallocUsage to get usage of malloc heap
* Implement GetMemoryUsage to get total memory usage of process
* Implement GetTimeUsage to get elapsed/user/system time


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19055 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-20 00:59:28 +00:00
Misha Brukman
210b32b16f * Use "" for LLVM include files, not <>
* llvm/Config/alloca.h already #includes config.h
* Minor readability/stylistic changes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19048 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-20 00:16:38 +00:00
Misha Brukman
6782835604 Use <> for system #include files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19046 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-19 19:27:11 +00:00
Brian Gaeke
5d112c452a Make references to 'struct sigaction' compile under Solaris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19045 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-19 18:58:11 +00:00
Reid Spencer
2a7d9e98ba For PR351:
Move the functionality of RunProgramWithTimeout into the ExecuteAndWait
function: support a timeout and I/O redirects


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19043 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-19 18:00:44 +00:00
Reid Spencer
41394ec672 For PR351:
Add a needed include.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19042 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-19 18:00:32 +00:00
Reid Spencer
00e8930206 Change the signatures of the destroyFile and destroyDirectory methods to
const because they affect the file system, not the Path object.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18973 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-15 23:02:10 +00:00
Reid Spencer
835b6941fd Remove automatic insertion of CFE's lib directory into the bytecode path
because LLVM should be agnostic to the needs of specific front ends.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18968 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-15 22:21:42 +00:00
Reid Spencer
07f9f4e2a4 Fix a file overwrite bug in llvm-ar introduced by changes to
createTemporaryFile semantics where it doesn't create a fully unique name
if the basename doesn't exist. This functionality is now optionally
provided by the boolean reuse_current parameter to createTemporaryFile and
makeUnique. The default values differ because of the way these functions
are used in LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18961 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-15 08:32:45 +00:00
Reid Spencer
c29befb554 For PR351:
* Fix implementation and documentation about LLVMGCCDIR/bytecode-libs
* Add the makeUnique method, replacement for getUniqueFilename in Support.
* Add the sys::CopyFile function, replacement for CopyFile in Support.
* Move GetLLVMConfigDir() into generic code area since its generic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18947 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-15 01:50:13 +00:00
Reid Spencer
e2e2411f40 For PR351:
Implement the new environment pointer for ExecuteAndWait


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18928 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-14 04:18:51 +00:00
Reid Spencer
77cc91deaa For PR351:
Implement three new functions to allow setting access/permission bits on
the file referenced by a path. The makeReadable and makeExecutable methods
replace the FileUtilities MakeFileReadable and MakeFileExecutable
functions. The makeWritable function is new and provided for consistency
since Path has a writable() method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18907 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 19:59:50 +00:00
Reid Spencer
3d595cba33 Remove an always false clause from an if statement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18885 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 07:51:07 +00:00
Alkis Evlogimenos
07941b493d Fix a bug where directory names of length one or less where not set
properly (examples: "", ".", "a").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18883 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 07:41:35 +00:00
Reid Spencer
732f92d56e * Add a std::ostream inserter for sys::Path
* Correct the std::string constructor to take a const reference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18877 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 06:57:15 +00:00
Reid Spencer
1b6b99bffc For PR351: \
* Remove IsLibrary and GetLibraryPath, replaced by FindLibrary in ../Path.cpp \
* Implement GetSystemLibraryPaths and GetBytecodeLibraryPaths, instead of the \
  GetSystemLibraryPath1 and GetSystemLibraryPath2 methods


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18862 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:00:51 +00:00
Reid Spencer
56c3ed854f Make the size() method const
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18852 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 02:58:51 +00:00
Reid Spencer
1fce09125c Path::get -> Path::toString
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18785 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 00:14:15 +00:00
Chris Lattner
194ca80fdb Make this work with the ICC compiler, contributed by Bjørn Wennberg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18626 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 16:10:52 +00:00
Reid Spencer
86ac2dcda1 Fix seriously broken implementation of GetMagicNumber.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18422 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-02 09:09:48 +00:00
Reid Spencer
441cc2ab01 Implement the default constructor which causes the current program to be
opened as if it was a dynamic library so its symbols can be searched too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18341 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-29 10:39:46 +00:00