[Lldb-commits] [lldb] r125152 - in /lldb/trunk: include/lldb/Host/File.h include/lldb/Host/freebsd/Config.h include/lldb/Host/linux/Config.h include/lldb/Host/macosx/Config.h include/lldb/Host/mingw/Config.h source/Host/common/File.cpp

Greg Clayton gclayton at apple.com
Tue Feb 8 17:16:44 PST 2011


Author: gclayton
Date: Tue Feb  8 19:16:43 2011
New Revision: 125152

URL: http://llvm.org/viewvc/llvm-project?rev=125152&view=rev
Log:
Pull support for the shared and exclusive lock since this wasn't available
on linux. And conditionalize the availablility of the fcntl() command 
F_GETPATH.


Modified:
    lldb/trunk/include/lldb/Host/File.h
    lldb/trunk/include/lldb/Host/freebsd/Config.h
    lldb/trunk/include/lldb/Host/linux/Config.h
    lldb/trunk/include/lldb/Host/macosx/Config.h
    lldb/trunk/include/lldb/Host/mingw/Config.h
    lldb/trunk/source/Host/common/File.cpp

Modified: lldb/trunk/include/lldb/Host/File.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/File.h?rev=125152&r1=125151&r2=125152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/File.h (original)
+++ lldb/trunk/include/lldb/Host/File.h Tue Feb  8 19:16:43 2011
@@ -35,9 +35,7 @@
         eOpenOptionAppend               = (1u << 2),    // Don't truncate file when opening, append to end of file
         eOpenOptionNonBlocking          = (1u << 3),    // File reads
         eOpenOptionCanCreate            = (1u << 4),    // Create file if doesn't already exist
-        eOpenOptionCanCreateNewOnly     = (1u << 5),    // Can create file only if it doesn't already exist
-        eOpenOptionSharedLock           = (1u << 6),    // Open file and get shared lock
-        eOpenOptionExclusiveLock        = (1u << 7)     // Open file and get exclusive lock
+        eOpenOptionCanCreateNewOnly     = (1u << 5)    // Can create file only if it doesn't already exist
     };
     
     enum Permissions

Modified: lldb/trunk/include/lldb/Host/freebsd/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/freebsd/Config.h?rev=125152&r1=125151&r2=125152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/freebsd/Config.h (original)
+++ lldb/trunk/include/lldb/Host/freebsd/Config.h Tue Feb  8 19:16:43 2011
@@ -25,4 +25,6 @@
 
 //#define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1
 
+//#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1
+
 #endif // #ifndef liblldb_Platform_Config_h_
\ No newline at end of file

Modified: lldb/trunk/include/lldb/Host/linux/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/Config.h?rev=125152&r1=125151&r2=125152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/linux/Config.h (original)
+++ lldb/trunk/include/lldb/Host/linux/Config.h Tue Feb  8 19:16:43 2011
@@ -25,4 +25,6 @@
 
 //#define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1
 
+//#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1
+
 #endif // #ifndef liblldb_Platform_Config_h_

Modified: lldb/trunk/include/lldb/Host/macosx/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/macosx/Config.h?rev=125152&r1=125151&r2=125152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/macosx/Config.h (original)
+++ lldb/trunk/include/lldb/Host/macosx/Config.h Tue Feb  8 19:16:43 2011
@@ -25,4 +25,6 @@
 
 #define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1
 
+#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1
+
 #endif // #ifndef liblldb_Platform_Config_h_

Modified: lldb/trunk/include/lldb/Host/mingw/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/mingw/Config.h?rev=125152&r1=125151&r2=125152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/mingw/Config.h (original)
+++ lldb/trunk/include/lldb/Host/mingw/Config.h Tue Feb  8 19:16:43 2011
@@ -25,4 +25,6 @@
 
 //#define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1
 
+//#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1
+
 #endif // #ifndef liblldb_Platform_Config_h_

Modified: lldb/trunk/source/Host/common/File.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=125152&r1=125151&r2=125152&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/File.cpp (original)
+++ lldb/trunk/source/Host/common/File.cpp Tue Feb  8 19:16:43 2011
@@ -13,6 +13,7 @@
 #include <fcntl.h>
 
 #include "lldb/Core/Error.h"
+#include "lldb/Host/Config.h"
 #include "lldb/Host/FileSpec.h"
 
 using namespace lldb;
@@ -202,13 +203,6 @@
     if (options & eOpenOptionCanCreateNewOnly)
         oflag |= O_CREAT | O_EXCL;
     
-    
-    if (options & eOpenOptionSharedLock)
-        oflag |= O_SHLOCK;
-
-    if (options & eOpenOptionExclusiveLock)
-        oflag |= O_EXLOCK;
-
     mode_t mode = 0;
     if (permissions & ePermissionsUserRead)     mode |= S_IRUSR;
     if (permissions & ePermissionsUserWrite)    mode |= S_IWUSR;
@@ -262,6 +256,7 @@
 File::GetFileSpec (FileSpec &file_spec) const
 {
     Error error;
+#ifdef LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED
     if (IsValid ())
     {
         char path[PATH_MAX];
@@ -271,7 +266,12 @@
             file_spec.SetFile (path, false);
     }
     else 
+    {
         error.SetErrorString("invalid file handle");
+    }
+#else
+    error.SetErrorString ("fcntl (fd, F_GETPATH, ...) is not supported on this platform");
+#endif
 
     if (error.Fail())
         file_spec.Clear();





More information about the lldb-commits mailing list