1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
$NetBSD: patch-aw,v 1.1 2007/03/17 13:44:19 tsutsui Exp $
--- host/posix/posix-serial.c.orig 2006-11-07 06:29:39.000000000 -0500
+++ host/posix/posix-serial.c 2006-11-07 08:23:59.000000000 -0500
@@ -839,6 +839,8 @@
int saved_errno;
int emulate_break;
+ int ignore_fd_in = FALSE;
+
/* initialize: */
filename_in = NULL;
filename_out = NULL;
@@ -915,24 +917,32 @@
/* open the devices: */
fd_in = fd_out = -1;
- if (fd_in < 0
- && !strcmp(filename_in, "-")) {
- fd_in = STDIN_FILENO;
+
+ ignore_fd_in = (strcmp(filename_in,"NONE") == 0);
+
+ if (!ignore_fd_in) {
+ if (fd_in < 0
+ && !strcmp(filename_in, "-")) {
+ fd_in = STDIN_FILENO;
+ }
}
if (fd_out < 0
&& !strcmp(filename_out, "-")) {
fd_out = STDOUT_FILENO;
}
- if (fd_in < 0) {
- if (strcmp(filename_in, filename_out) == 0) {
- fd_in = fd_out = open(filename_in, O_RDWR | O_NONBLOCK);
- }
- else {
- fd_in = open(filename_in, O_RDONLY | O_NONBLOCK);
- }
+
+ if (!ignore_fd_in) {
if (fd_in < 0) {
- tme_output_append_error(_output, "%s", filename_in);
- return (errno);
+ if (strcmp(filename_in, filename_out) == 0) {
+ fd_in = fd_out = open(filename_in, O_RDWR | O_NONBLOCK);
+ }
+ else {
+ fd_in = open(filename_in, O_RDONLY | O_NONBLOCK);
+ }
+ if (fd_in < 0) {
+ tme_output_append_error(_output, "%s", filename_in);
+ return (errno);
+ }
}
}
if (fd_out < 0) {
@@ -962,7 +972,11 @@
tme_mutex_init(&serial->tme_posix_serial_mutex);
tme_cond_init(&serial->tme_posix_serial_cond_writer);
tme_thread_create((tme_thread_t) _tme_posix_serial_th_writer, serial);
- tme_thread_create((tme_thread_t) _tme_posix_serial_th_reader, serial);
+
+ if (!ignore_fd_in) {
+ tme_thread_create((tme_thread_t) _tme_posix_serial_th_reader, serial);
+ }
+
tme_thread_create((tme_thread_t) _tme_posix_serial_th_ctrl, serial);
/* fill the element: */
--- libtme/threads-sjlj.c.orig 2006-11-07 06:50:22.000000000 -0500
+++ libtme/threads-sjlj.c 2006-11-07 07:54:07.000000000 -0500
@@ -833,7 +833,9 @@
if (fd_condition_new != 0) {
/* this thread is now blocking on this fd: */
- assert(tme_sjlj_fd_thread[fd] == NULL);
+
+ /* assert if this fd is already used - unless its stdin */
+ assert(tme_sjlj_fd_thread[fd] == NULL || fd == STDIN_FILENO);
tme_sjlj_fd_thread[fd] = thread;
#ifdef HAVE_GTK
|