Hello everybody,

I am Marco, a student of computer engineering at Politecnico di
Milano. In the past two days I have played with the llvm source tree
and I managed to build on my laptop(with Linux) lldb. Today after an
update of the source tree I noticed that the build was broken, or at
least It was on Linux.

The first problem I got It was due to the use of O_SHLOCK and O_EXLOCK flags in
source/Host/common/File.cpp . These two flags are not available on
Linux and after a little search on the Internet I came out with the
little patch attached that should fix the problem.

The second problem I got It is due to the use of fcntl with the
F_GETPATH flag to retrieve the file name from a descriptor. AFAIK this
functionality it's not available on Linux at the moment. Any
suggestions on how to proceed?

Looking forward to getting feedback from you.

Best regards,
Marco

-- 
Marco Minutoli

"If A is success in life, then A equals x plus y plus z. Work is x;
y is play; and z is keeping your mouth shut." --A. Einstein
Index: source/Host/common/File.cpp
===================================================================
--- source/Host/common/File.cpp	(revision 125137)
+++ source/Host/common/File.cpp	(working copy)
@@ -12,6 +12,10 @@
 
 #include <fcntl.h>
 
+#ifdef __linux__
+#include <sys/file.h>
+#endif
+
 #include "lldb/Core/Error.h"
 #include "lldb/Host/FileSpec.h"
 
@@ -59,12 +63,14 @@
     
     if (options & eOpenOptionTruncate)
         oflag |= O_TRUNC;
-    
+
+#ifndef __linux__
     if (options & eOpenOptionSharedLock)
         oflag |= O_SHLOCK;
 
     if (options & eOpenOptionExclusiveLock)
         oflag |= O_EXLOCK;
+#endif
 
     mode_t mode = 0;
     if (permissions & ePermissionsUserRead)     mode |= S_IRUSR;
@@ -78,6 +84,15 @@
     if (permissions & ePermissionsWorldExecute) mode |= S_IXOTH;
 
     m_file_desc = ::open(path, oflag, mode);
+
+#ifdef __linux__
+    if (options & eOpenOptionSharedLock)
+        ::flock(m_file_desc, LOCK_SH);
+
+    if (options & eOpenOptionExclusiveLock)
+        ::flock(m_file_desc, LOCK_EX);
+#endif
+
     if (m_file_desc == -1)
         error.SetErrorToErrno();
     
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to