aboutsummaryrefslogtreecommitdiff
path: root/gdb/rdi-share/unixcomm.c
diff options
context:
space:
mode:
authorFernando Nasser <fnasser@redhat.com>2000-02-25 16:37:32 +0000
committerFernando Nasser <fnasser@redhat.com>2000-02-25 16:37:32 +0000
commit608d5915ac07fc506d7f0fc33af11e3ca4f5c35f (patch)
tree5475f732f17b3263bc2c8ba8ac11094e591c73cb /gdb/rdi-share/unixcomm.c
parent084e9a84fa98131f2cab8f9b276645e8e5abdd1e (diff)
downloadgdb-608d5915ac07fc506d7f0fc33af11e3ca4f5c35f.zip
gdb-608d5915ac07fc506d7f0fc33af11e3ca4f5c35f.tar.gz
gdb-608d5915ac07fc506d7f0fc33af11e3ca4f5c35f.tar.bz2
2000-02-25 Fernando Nasser <fnasser@cygnus.com>
From: Thomas Zenker <thz@Lennartz-electronic.DE> * rdi-share/hsys.c: to compile under 4.4BSD derived systems (FreeBSD, NetBSD...) sys_errlist should not be declared in hsys.c. NEED_SYSERRLIST is set already by configure, so we can use it. * rdi-share/unixcomm.c: 4.4BSD derived systems define BSD, but are posix compliant and we should not work with the old compatibility stuff. Because of that I undef BSD in case of FBSD etc and include sys/ioctl to get the flags. * rdi-share/unixcomm.c: If the TIOCEXCL flags exists set serial line for exclusive use.
Diffstat (limited to 'gdb/rdi-share/unixcomm.c')
-rw-r--r--gdb/rdi-share/unixcomm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/rdi-share/unixcomm.c b/gdb/rdi-share/unixcomm.c
index 708387b..6891c0d 100644
--- a/gdb/rdi-share/unixcomm.c
+++ b/gdb/rdi-share/unixcomm.c
@@ -36,6 +36,11 @@
#include <sys/types.h>
#include <sys/time.h>
+#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (bsdi)
+#undef BSD
+#include <sys/ioctl.h>
+#endif
+
#ifdef sun
# include <sys/ioccom.h>
# ifdef __svr4__
@@ -253,6 +258,13 @@ extern int Unix_OpenSerial(const char *name)
perror("open");
return -1;
}
+#ifdef TIOCEXCL
+ if (ioctl(serpfd, TIOCEXCL) < 0) {
+ close(serpfd);
+ perror("ioctl: TIOCEXCL");
+ return -1;
+ }
+#endif
return 0;
}