[Mono-dev] [RFC v2 6/8] serial: Stub implementation for Haiku

Andreas Färber andreas.faerber at web.de
Wed Mar 31 20:27:57 EDT 2010


Haiku has no full serial support, especially no TIOCOUTQ or TIOCM_*.
Provide a no-op implementation similar to null-gc.

v1 -> v2:
* Provide a separate implementation that might be sourced out
  as serial-null.c

This commit is licensed under the MIT X11 license.
---
 support/serial.c |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/support/serial.c b/support/serial.c
index 7968fbb..9214bfc 100644
--- a/support/serial.c
+++ b/support/serial.c
@@ -60,6 +60,76 @@ typedef enum {
 	Rts = 16  /* Request to send */
 } MonoSerialSignal;
 
+#if defined(__HAIKU__)
+
+int
+open_serial (char* devfile)
+{
+	return -1;
+}
+
+int
+close_serial (int unix_fd)
+{
+	return 0;
+}
+
+guint32
+read_serial (int fd, guchar *buffer, int offset, int count)
+{
+	return 0;
+}
+
+int
+write_serial (int fd, guchar *buffer, int offset, int count, int timeout)
+{
+	return 0;
+}
+
+int
+discard_buffer (int fd, gboolean input)
+{
+	return 0;
+}
+
+gint32
+get_bytes_in_buffer (int fd, gboolean input)
+{
+	return 0;
+}
+
+gboolean
+set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, MonoStopBits stopBits, MonoHandshake handshake)
+{
+	return FALSE;
+}
+
+MonoSerialSignal
+get_signals (int fd, gint32 *error)
+{
+	return NoneSignal;
+}
+
+gint32
+set_signal (int fd, MonoSerialSignal signal, gboolean value)
+{
+	return -1;
+}
+
+int
+breakprop (int fd)
+{
+	return -1;
+}
+
+gboolean
+poll_serial (int fd, gint32 *error, int timeout)
+{
+	return FALSE;
+}
+
+#else
+
 int
 open_serial (char* devfile)
 {
@@ -436,6 +506,8 @@ poll_serial (int fd, gint32 *error, int timeout)
 	return (pinfo.revents & POLLIN) != 0 ? 1 : 0;
 }
 
+#endif
+
 /*
  * mono internals should not be used here.
  * this serial stuff needs to be implemented with icalls.
-- 
1.7.0.3



More information about the Mono-devel-list mailing list