This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/7] gdbserver, common: conditionally include the unistd.h
- From: Mircea Gherzan <mircea dot gherzan at intel dot com>
- To: tromey at redhat dot com, palves at redhat dot com, jan dot kratochvil at redhat dot com
- Cc: gdb-patches at sourceware dot org, Mircea Gherzan <mircea dot gherzan at intel dot com>
- Date: Thu, 27 Jun 2013 10:43:36 +0200
- Subject: [PATCH 1/7] gdbserver, common: conditionally include the unistd.h
- References: <1372322622-3216-1-git-send-email-mircea dot gherzan at intel dot com>
2013-06-25 Mircea Gherzan <mircea.gherzan@intel.com>
* common/agent.c: Conditionally include unistd.h.
gdbserver/
* hostio.c: Conditionally include unistd.h and define PATH_MAX
if unistd.h is not available.
* tracepoint.h: Conditionally include unistd.h.
Signed-off-by: Mircea Gherzan <mircea.gherzan@intel.com>
---
gdb/common/agent.c | 2 ++
gdb/gdbserver/hostio.c | 7 +++++++
gdb/gdbserver/tracepoint.c | 2 ++
3 files changed, 11 insertions(+)
diff --git a/gdb/common/agent.c b/gdb/common/agent.c
index 99cef4f..bbf5c4c 100644
--- a/gdb/common/agent.c
+++ b/gdb/common/agent.c
@@ -26,7 +26,9 @@
#endif
#include <string.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include "agent.h"
#include "filestuff.h"
diff --git a/gdb/gdbserver/hostio.c b/gdb/gdbserver/hostio.c
index df94d31..3cf93db 100644
--- a/gdb/gdbserver/hostio.c
+++ b/gdb/gdbserver/hostio.c
@@ -23,7 +23,14 @@
#include <fcntl.h>
#include <limits.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
+
+/* PATH_MAX is defined in unistd.h, which might not be available. */
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
extern int remote_debug;
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 5c0dec7..c0dea5b 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -22,7 +22,9 @@
#include <ctype.h>
#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <sys/time.h>
#include <stddef.h>
#include <inttypes.h>
--
1.7.12.4