Re: [Lldb-commits] [PATCH] D14182: Centos 5 compile fixes for lldb

2016-05-12 Thread Kamil Rytarowski via lldb-commits
krytarowski resigned from this revision.
krytarowski removed a reviewer: krytarowski.
krytarowski added a comment.

This patch looks dead -- no activity.


Repository:
  rL LLVM

http://reviews.llvm.org/D14182



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D14182: Centos 5 compile fixes for lldb

2015-10-30 Thread Ed Maste via lldb-commits
emaste added a subscriber: emaste.
emaste added a comment.

For future diffs please include additional context (e.g. git diff -U9)


Repository:
  rL LLVM

http://reviews.llvm.org/D14182



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D14182: Centos 5 compile fixes for lldb

2015-10-30 Thread Mark Chandler via lldb-commits
mchandler-blizzard created this revision.
mchandler-blizzard added reviewers: labath, ovyalov.
mchandler-blizzard added a subscriber: lldb-commits.
mchandler-blizzard set the repository for this revision to rL LLVM.
Herald added subscribers: srhines, danalbert, tberghammer.

Adds checks for posix features not present in centos 5

Repository:
  rL LLVM

http://reviews.llvm.org/D14182

Files:
  tools/lldb/include/lldb/Host/linux/Signalfd.h
  tools/lldb/source/Host/common/File.cpp
  tools/lldb/source/Host/linux/HostThreadLinux.cpp
  tools/lldb/source/Host/posix/PipePosix.cpp
  tools/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  tools/lldb/source/Target/ProcessLaunchInfo.cpp
  tools/lldb/source/Utility/PseudoTerminal.cpp

Index: tools/lldb/source/Utility/PseudoTerminal.cpp
===
--- tools/lldb/source/Utility/PseudoTerminal.cpp
+++ tools/lldb/source/Utility/PseudoTerminal.cpp
@@ -32,6 +32,8 @@
 
 pid_t fork(void) { return 0; }
 pid_t setsid(void) { return 0; }
+
+#include 
 #elif defined(__ANDROID_NDK__)
 #include "lldb/Host/android/Android.h"
 int posix_openpt(int flags);
@@ -242,7 +244,10 @@
 pid_t pid = LLDB_INVALID_PROCESS_ID;
 #if !defined(LLDB_DISABLE_POSIX)
 int flags = O_RDWR;
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
 flags |= O_CLOEXEC;
+#endif
 if (OpenFirstAvailableMaster (flags, error_str, error_len))
 {
 // Successfully opened our master pseudo terminal
Index: tools/lldb/source/Target/ProcessLaunchInfo.cpp
===
--- tools/lldb/source/Target/ProcessLaunchInfo.cpp
+++ tools/lldb/source/Target/ProcessLaunchInfo.cpp
@@ -18,6 +18,8 @@
 
 #if !defined(_WIN32)
 #include 
+
+#include 
 #endif
 
 using namespace lldb;
@@ -360,7 +362,7 @@
  __FUNCTION__);
 
 int open_flags = O_RDWR | O_NOCTTY;
-#if !defined(_MSC_VER)
+#if !defined(_MSC_VER) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
 // We really shouldn't be specifying platform specific flags
 // that are intended for a system call in generic code.  But
 // this will have to do for now.
Index: tools/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- tools/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ tools/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -69,6 +69,36 @@
   #define TRAP_HWBKPT 4
 #endif
 
+// Missing defines due to bug: https://sourceware.org/bugzilla/show_bug.cgi?id=4125
+
+#if !HAVE_DECL_ADDR_NO_RANDOMIZE
+  #define ADDR_NO_RANDOMIZE 0x004
+#endif
+
+#ifndef PTRACE_O_TRACECLONE
+  #define PTRACE_O_TRACECLONE0x0008
+#endif
+
+#ifndef PTRACE_O_TRACEEXEC
+  #define PTRACE_O_TRACEEXEC 0x0010
+#endif
+
+#ifndef PTRACE_O_TRACEEXIT
+  #define PTRACE_O_TRACEEXIT 0x0040
+#endif
+
+#ifndef PTRACE_EVENT_CLONE
+  #define PTRACE_EVENT_CLONE 3
+#endif
+
+#ifndef PTRACE_EVENT_EXEC
+  #define PTRACE_EVENT_EXEC  4
+#endif
+
+#ifndef PTRACE_EVENT_EXIT
+  #define PTRACE_EVENT_EXIT  6
+#endif
+
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::process_linux;
Index: tools/lldb/source/Host/posix/PipePosix.cpp
===
--- tools/lldb/source/Host/posix/PipePosix.cpp
+++ tools/lldb/source/Host/posix/PipePosix.cpp
@@ -29,6 +29,8 @@
 #include 
 #include 
 
+#include 
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -38,7 +40,7 @@
 
 // pipe2 is supported by a limited set of platforms
 // TODO: Add more platforms that support pipe2.
-#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD__ >= 10) || defined(__NetBSD__)
+#if (defined(__linux__) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) || (defined(__FreeBSD__) && __FreeBSD__ >= 10) || defined(__NetBSD__)
 #define PIPE2_SUPPORTED 1
 #else
 #define PIPE2_SUPPORTED 0
@@ -248,13 +250,25 @@
 return Error("Pipe is already opened");
 
 int flags = O_RDONLY | O_NONBLOCK;
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
 if (!child_process_inherit)
 flags |= O_CLOEXEC;
+#endif
 
 Error error;
 int fd = ::open(name.data(), flags);
 if (fd != -1)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+if (!child_process_inherit)
+{
+int oldFlags = fcntl(fd, F_GETFD, 0);
+fcntl(fd, F_SETFD, FD_CLOEXEC|oldFlags);
+}
+#endif
 m_fds[READ] = fd;
+}
 else
 error.SetErrorToErrno();
 
@@ -268,8 +282,11 @@
 return Error("Pipe is already opened");
 
 int flags = O_WRONLY | O_NONBLOCK;
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
 if (!child_process_inherit)
 flags |= O_CLOEXEC;
+#endif
 
 using namespace std::chrono;
 const auto finish_time = Now() + ti

Re: [Lldb-commits] [PATCH] D14182: Centos 5 compile fixes for lldb

2015-10-30 Thread Mark Chandler via lldb-commits
mchandler-blizzard added inline comments.


Comment at: tools/lldb/source/Host/common/File.cpp:301
@@ -299,1 +300,3 @@
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
 if (options & eOpenOptionCloseOnExec)

krytarowski wrote:
> labath wrote:
> > This needs to evaluate to true on non-linux systems.
> > Would `#ifdef O_CLOEXEC` work for you ?
> NetBSD:
> 
> ```
> /usr/include/fcntl.h:#define  O_CLOEXEC   0x0040  /* set close on 
> exec */
> ```
If that is ok by the coding standards im happy to change it to that


Comment at: tools/lldb/source/Host/linux/HostThreadLinux.cpp:33
@@ -32,3 +32,3 @@
 {
-#if (defined(__GLIBC__) && defined(_GNU_SOURCE)) || defined(__ANDROID__)
+#if (defined(__GLIBC__) && defined(_GNU_SOURCE) && __GLIBC__ >= 2 && 
__GLIBC_MINOR__ >= 12) || defined(__ANDROID__)
 ::pthread_setname_np(thread, name.data());

brucem wrote:
> This is probably better done with weak symbols or a check in configure and 
> cmake rather than hard-coding this stuff in the C pre-processor.
> 
If you want to provide code that does that, im happy to change it. 


Comment at: tools/lldb/source/Host/posix/PipePosix.cpp:32
@@ -31,1 +31,3 @@
 
+#include 
+

brucem wrote:
> krytarowski wrote:
> > Is this file just for Linux?
> This file isn't Linux only, so the concerns expressed by Labath are valid 
> here as well.  (The same thing is true of other inclusions of 
> ``.)
I dont have other OS's to build on so not sure. Think @krytarowski comment 
below is the way to go.


Comment at: tools/lldb/source/Host/posix/PipePosix.cpp:254
@@ -251,1 +253,3 @@
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
 if (!child_process_inherit)

krytarowski wrote:
> Stop breaking NetBSD.
:(


Repository:
  rL LLVM

http://reviews.llvm.org/D14182



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D14182: Centos 5 compile fixes for lldb

2015-10-29 Thread Kamil Rytarowski via lldb-commits
krytarowski added inline comments.


Comment at: tools/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:72
@@ -71,1 +71,3 @@
 
+// Missing defines due to bug: 
https://sourceware.org/bugzilla/show_bug.cgi?id=4125
+

brucem wrote:
> This bug was fixed in 2007, over 8 years ago ... at what point do we stop 
> carrying around this baggage?
Few defines aren't much of entanglement. RHEL5 is still supported upstream 
(till 2017).

https://en.wikipedia.org/wiki/Red_Hat_Enterprise_Linux#Product_life_cycle


Repository:
  rL LLVM

http://reviews.llvm.org/D14182



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D14182: Centos 5 compile fixes for lldb

2015-10-29 Thread Kamil Rytarowski via lldb-commits
krytarowski added inline comments.


Comment at: tools/lldb/source/Host/posix/PipePosix.cpp:43
@@ -40,3 +42,3 @@
 // TODO: Add more platforms that support pipe2.
-#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD__ >= 10) || 
defined(__NetBSD__)
+#if (defined(__linux__) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) || 
(defined(__FreeBSD__) && __FreeBSD__ >= 10) || defined(__NetBSD__)
 #define PIPE2_SUPPORTED 1

How about moving `PIPE2_SUPPORTED` to `include/lldb/Host/*/Config.h`? It could 
be renamed to `LLDB_CONFIG_PIPE2_SUPPORTED`. Feel free to include in the Linux 
configuration headers needed to detect Linux version.


Repository:
  rL LLVM

http://reviews.llvm.org/D14182



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D14182: Centos 5 compile fixes for lldb

2015-10-29 Thread Bruce Mitchener via lldb-commits
brucem added a subscriber: brucem.
brucem requested changes to this revision.
brucem added a reviewer: brucem.


Comment at: tools/lldb/source/Host/linux/HostThreadLinux.cpp:33
@@ -32,3 +32,3 @@
 {
-#if (defined(__GLIBC__) && defined(_GNU_SOURCE)) || defined(__ANDROID__)
+#if (defined(__GLIBC__) && defined(_GNU_SOURCE) && __GLIBC__ >= 2 && 
__GLIBC_MINOR__ >= 12) || defined(__ANDROID__)
 ::pthread_setname_np(thread, name.data());

This is probably better done with weak symbols or a check in configure and 
cmake rather than hard-coding this stuff in the C pre-processor.



Comment at: tools/lldb/source/Host/posix/PipePosix.cpp:32
@@ -31,1 +31,3 @@
 
+#include 
+

krytarowski wrote:
> Is this file just for Linux?
This file isn't Linux only, so the concerns expressed by Labath are valid here 
as well.  (The same thing is true of other inclusions of ``.)


Comment at: tools/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:72
@@ -71,1 +71,3 @@
 
+// Missing defines due to bug: 
https://sourceware.org/bugzilla/show_bug.cgi?id=4125
+

This bug was fixed in 2007, over 8 years ago ... at what point do we stop 
carrying around this baggage?


Repository:
  rL LLVM

http://reviews.llvm.org/D14182



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D14182: Centos 5 compile fixes for lldb

2015-10-29 Thread Kamil Rytarowski via lldb-commits
krytarowski requested changes to this revision.
krytarowski added a reviewer: krytarowski.


Comment at: tools/lldb/source/Host/posix/PipePosix.cpp:32
@@ -31,1 +31,3 @@
 
+#include 
+

Is this file just for Linux?


Comment at: tools/lldb/source/Host/posix/PipePosix.cpp:254
@@ -251,1 +253,3 @@
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
 if (!child_process_inherit)

Stop breaking NetBSD.


Repository:
  rL LLVM

http://reviews.llvm.org/D14182



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D14182: Centos 5 compile fixes for lldb

2015-10-29 Thread Kamil Rytarowski via lldb-commits
krytarowski added a subscriber: krytarowski.


Comment at: tools/lldb/source/Host/common/File.cpp:301
@@ -299,1 +300,3 @@
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
 if (options & eOpenOptionCloseOnExec)

labath wrote:
> This needs to evaluate to true on non-linux systems.
> Would `#ifdef O_CLOEXEC` work for you ?
NetBSD:

```
/usr/include/fcntl.h:#defineO_CLOEXEC   0x0040  /* set close on 
exec */
```


Repository:
  rL LLVM

http://reviews.llvm.org/D14182



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D14182: Centos 5 compile fixes for lldb

2015-10-29 Thread Pavel Labath via lldb-commits
labath requested changes to this revision.
labath added a comment.
This revision now requires changes to proceed.

Thanks for the patch. Looks good, but we need to make sure things continue to 
work on non-linux systems...



Comment at: tools/lldb/source/Host/common/File.cpp:301
@@ -299,1 +300,3 @@
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
 if (options & eOpenOptionCloseOnExec)

This needs to evaluate to true on non-linux systems.
Would `#ifdef O_CLOEXEC` work for you ?


Repository:
  rL LLVM

http://reviews.llvm.org/D14182



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits