Finegrainify namespacification
[oota-llvm.git] / lib / Support / SystemUtils.cpp
index e1af3f92cecb7ad6c4b7f1034769a42e698d8fb6..e1a0bd04d4555cdd7d1156b25623dbd7545d9caf 100644 (file)
@@ -1,4 +1,11 @@
 //===- SystemUtils.h - Utilities to do low-level system stuff --*- C++ -*--===//
+// 
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
 //
 // This file contains functions used to do a variety of low-level, often
 // system-specific, tasks.
 #include "Config/sys/wait.h"
 #include "Config/unistd.h"
 #include "Config/errno.h"
+using namespace llvm;
 
 /// isExecutableFile - This function returns true if the filename specified
 /// exists and is executable.
 ///
-bool isExecutableFile(const std::string &ExeFileName) {
+bool llvm::isExecutableFile(const std::string &ExeFileName) {
   struct stat Buf;
   if (stat(ExeFileName.c_str(), &Buf))
     return false;  // Must not be executable!
@@ -42,8 +50,8 @@ bool isExecutableFile(const std::string &ExeFileName) {
 /// directory, nor in the PATH.  If the executable cannot be found, return an
 /// empty string.
 /// 
-std::string FindExecutable(const std::string &ExeName,
-                           const std::string &ProgramPath) {
+std::string llvm::FindExecutable(const std::string &ExeName,
+                                 const std::string &ProgramPath) {
   // First check the directory that bugpoint is in.  We can do this if
   // BugPointPath contains at least one / character, indicating that it is a
   // relative path to bugpoint itself.
@@ -107,11 +115,11 @@ static void RedirectFD(const std::string &File, int FD) {
 /// the calling program if there is an error executing the specified program.
 /// It returns the return value of the program, or -1 if a timeout is detected.
 ///
-int RunProgramWithTimeout(const std::string &ProgramPath, const char **Args,
-                          const std::string &StdInFile,
-                          const std::string &StdOutFile,
-                          const std::string &StdErrFile) {
-
+int llvm::RunProgramWithTimeout(const std::string &ProgramPath,
+                                const char **Args,
+                                const std::string &StdInFile,
+                                const std::string &StdOutFile,
+                                const std::string &StdErrFile) {
   // FIXME: install sigalarm handler here for timeout...
 
   int Child = fork();
@@ -195,9 +203,8 @@ int RunProgramWithTimeout(const std::string &ProgramPath, const char **Args,
 //
 //  This function does not use $PATH to find programs.
 //
-int
-ExecWait (const char * const old_argv[], const char * const old_envp[])
-{
+int llvm::ExecWait(const char * const old_argv[],
+                   const char * const old_envp[]) {
   // Child process ID
   register int child;
 
@@ -264,4 +271,3 @@ ExecWait (const char * const old_argv[], const char * const old_envp[])
   //
   return 1;
 }
-