summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix/Process.inc
Commit message (Collapse)AuthorAgeFilesLines
* Remove all checking for the various terminfo headers (term.h andChandler Carruth2013-08-121-24/+10
| | | | | | | | | | | | | | | | curses.h). Finding these headers is next to impossible. For example, on Debian systems libtinfo-dev provides the terminfo reading library we want, but *not* term.h. For the header, you have to use libncurses-dev. And libncursesw-dev provides a *different* term.h in a different location! These headers aren't worth it. We want two functions the signatures of which are clearly spec'ed in sys-v and other documentation. Just declare them ourselves and call them. This should fix some debian builders and provide better support for "minimal" debian systems that do want color autodetection. llvm-svn: 188165
* Target a minimal terminfo library rather than necessarily a full cursesChandler Carruth2013-08-121-11/+25
| | | | | | | | | | | | | | | | | | | | library for color support detection. This still will use a curses library if that is all we have available on the system. This change tries to use a smaller subset of the curses library, specifically the subset that is on some systems split off into a separate library. For example, if you install ncurses configured --with-tinfo, a 'libtinfo' is install that provides just the terminfo querying functionality. That library is now used instead of curses when it is available. This happens to fix a build error on systems with that library because when we tried to link ncurses into the binary, we didn't pull tinfo in as well. =] It should also provide an easy path for supporting the NetBSD libterminfo library, but as I don't have access to a NetBSD system I'm leaving adding that support to those folks. llvm-svn: 188160
* Add support for linking against a curses library when available andChandler Carruth2013-08-071-10/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | using it to detect whether or not a terminal supports colors. This replaces a particularly egregious hack that merely compared the TERM environment variable to "dumb". That doesn't really translate to a reasonable experience for users that have actually ensured their terminal's capabilities are accurately reflected. This makes testing a terminal for color support somewhat more expensive, but it is called very rarely anyways. The important fast path when the output is being piped somewhere is already in place. The global lock may seem excessive, but the spec for calling into curses is *terrible*. The whole library is terrible, and I spent quite a bit of time looking for a better way of doing this before convincing myself that this was the fundamentally correct way to behave. The damage of the curses library is very narrowly confined, and we continue to use raw escape codes for actually manipulating the colors which is a much sane system than directly using curses here (IMO). If this causes trouble for folks, please let me know. I've tested it on Linux and will watch the bots carefully. I've also worked to account for the variances of curses interfaces that I could finde documentation for, but that may not have been sufficient. llvm-svn: 187874
* Remove MSan hack that is no longer needed.Evgeniy Stepanov2013-06-201-2/+0
| | | | llvm-svn: 184428
* Workaround an MSan false positive.Evgeniy Stepanov2013-02-141-0/+2
| | | | llvm-svn: 175156
* Eric thought that Darwin was right to use -1 consistently rather thanChandler Carruth2013-01-051-1/+1
| | | | | | | | | | | leaving this undefined, and despite the sentence in the standard that seems to require it, I'll cede the point and assume its a bug in the wording. Other parts of POSIX regularly allow for things to be -1 instead of undefined, this should too. Makes things more consistent too. This should have to real impact for folks though. llvm-svn: 171574
* Try to suppress the use of clock_gettime on Darwin which apparantlyChandler Carruth2013-01-051-1/+1
| | | | | | | | | | | | | | | | | defines _POSIX_CPUTIME but doesn't support the clock_* functions. I don't test the value of _POSIX_CPUTIME because the spec merely says that if it is defined, the CPU-specific timers are available, whereas it says that _POSIX_TIMERS must be defined and defined to a value greater than zero. However, this may not work, as the POSIX spec clearly states: "If the symbolic constant _POSIX_CPUTIME is defined, then the symbolic constant _POSIX_TIMERS shall also be defined by the implementation to have the value 200112L." If this doesn't work, I'll add more hacks for Darwin. llvm-svn: 171565
* Add time getters to the process interface for requesting the elapsedChandler Carruth2013-01-041-22/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wall time, user time, and system time since a process started. For walltime, we currently use TimeValue's interface and a global initializer to compute a close approximation of total process runtime. For user time, this adds support for an somewhat more precise timing mechanism -- clock_gettime with the CLOCK_PROCESS_CPUTIME_ID clock selected. For system time, we have to do a full getrusage call to extract the system time from the OS. This is expensive but unavoidable. In passing, clean up the implementation of the old APIs and fix some latent bugs in the Windows code. This might have manifested on Windows ARM systems or other systems with strange 64-bit integer behavior. The old API for this both user time and system time simultaneously from a single getrusage call. While this results in fewer system calls, it also results in a lower precision user time and if only user time is desired, it introduces a higher overhead. It may be worthwhile to switch some of the pass timers to not track system time and directly track user and wall time. The old API also tracked walltime in a confusing way -- it just set it to the current walltime rather than providing any measure of wall time since the process started the way buth user and system time are tracked. The new API is more consistent here. The plan is to eventually implement these methods for a *child* process by using the wait3(2) system call to populate an rusage struct representing the whole subprocess execution. That way, after waiting on a child process its stats will become accurate and cheap to query. llvm-svn: 171551
* Flesh out a page size accessor in the new API.Chandler Carruth2012-12-311-4/+7
| | | | | | | | Implement the old API in terms of the new one. This simplifies the implementation on Windows which can now re-use the self_process's once initialization. llvm-svn: 171330
* Remove an unused function in the old Process interface.Chandler Carruth2012-12-311-20/+0
| | | | llvm-svn: 171327
* Switch this code to a more idiomatic double using namespace directive.Chandler Carruth2012-12-311-1/+1
| | | | | | | | Fix a truly odd namespace qualifier that was flat out wrong in the process. The fully qualified namespace would have been llvm::sys::TimeValue, llvm::TimeValue makes no sense. llvm-svn: 171292
* Begin sketching out the process interface.Chandler Carruth2012-12-311-0/+6
| | | | | | | | | | | | | | | | | | | | | | | The coding style used here is not LLVM's style because this is modeled after a Boost interface and thus done in the style of a candidate C++ standard library interface. I'll probably end up proposing it as a standard C++ library if it proves to be reasonably portable and useful. This is just the most basic parts of the interface -- getting the process ID out of it. However, it helps sketch out some of the boiler plate such as the base class, derived class, shared code, and static factory function. It also introduces a unittest so that I can incrementally ensure this stuff works. However, I've not even compiled this code for Windows yet. I'll try to fix any Windows fallout from the bots, and if I can't fix it I'll revert and get someone on Windows to help out. There isn't a lot more that is mandatory, so soon I'll switch to just stubbing out the Windows side and get Michael Spencer to help with implementation as he can test it directly. llvm-svn: 171289
* Add support for the OpenBSD for Bitrig.Eric Christopher2012-08-061-3/+4
| | | | | | Patch by David Hill. llvm-svn: 161344
* Process: Add sys::Process::FileDescriptorHasColors().Daniel Dunbar2012-07-201-6/+8
| | | | llvm-svn: 160557
* [Support] Fix sys::GetRandomNumber() to always use a high quality seed.Daniel Dunbar2012-05-081-5/+15
| | | | llvm-svn: 156414
* Unix/Process.inc: Give more useful random seed to srand. Workaround for PR12743.NAKAMURA Takumi2012-05-061-1/+14
| | | | llvm-svn: 156252
* Support/Process: Move llvm::sys::Process::GetRandomNumber() from Process.cpp ↵NAKAMURA Takumi2012-05-061-0/+9
| | | | | | | to Unix/Process.inc. FIXME: GetRandomNumber() is not implemented in Win32. llvm-svn: 156251
* Reapply 'Add reverseColor to raw_ostream'.Benjamin Kramer2012-04-161-0/+4
| | | | | | | To be used in printing unprintable source in clang diagnostics. Patch by Seth Cantrell, with a minor fix for mingw by me. llvm-svn: 154805
* Revert r154800 which breaks windows builders.Argyrios Kyrtzidis2012-04-161-4/+0
| | | | llvm-svn: 154802
* Add reverseColor to raw_ostream.Argyrios Kyrtzidis2012-04-161-0/+4
| | | | | | | To be used in printing unprintable source in clang diagnostics. Patch by Seth Cantrell! llvm-svn: 154800
* Fix the build under Debian GNU/Hurd.Sylvestre Ledru2012-04-111-2/+2
| | | | | | Thanks to Pino Toscano for the patch llvm-svn: 154500
* Remove SetWorkingDirectory from the Process interface. Nothing in LLVMChandler Carruth2012-01-151-4/+0
| | | | | | | | | | | | or Clang is using this, and it would be hard to use it correctly given the thread hostility of the function. Also, it never checked the return which is rather dangerous with chdir. If someone was in fact using this, please let me know, as well as what the usecase actually is so that I can add it back and make it more correct and secure to use. (That said, it's never going to be "safe" per-se, but we could at least document the risks...) llvm-svn: 148211
* sys::Process: Add a SetWorkingDirectory method.Daniel Dunbar2011-09-231-0/+4
| | | | llvm-svn: 140433
* Merge System into Support.Michael J. Spencer2010-11-291-0/+295
llvm-svn: 120298
OpenPOWER on IntegriCloud