From a76ef70a1469a892f712549afda41511220462cf Mon Sep 17 00:00:00 2001 From: Stu Grossman Date: Fri, 3 Feb 1995 19:35:54 +0000 Subject: * core.c (dis_asm_read_memory), defs.h, gdbtk.c (gdb_disassemble), top.c : Get rid of dis_asm_read_memory_hook. We can now call the disassemblers directly and have no need for this hook anymore. * defs.h, printcmd.c: Make print_insn be static. * ser-go32.c (dos_comisr): Make this 8 bit clean. * (dos_open dos_close): Allow multiple opens to the same device. Use a ref count to prevent unwanted deallocations. * sparcl-tdep.c: Put #ifdefs around all socket stuff to make GO32 happy. * (sparclite_ops): Switch to download_stratum. * target.h (enum strata): Move download_stratum before process_stratum so that executable targets get pushed on top of download targets. --- gdb/ser-go32.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'gdb/ser-go32.c') diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c index a1c0b6e..b4a7591 100644 --- a/gdb/ser-go32.c +++ b/gdb/ser-go32.c @@ -196,6 +196,7 @@ static struct dos_ttystate { int base; int irq; + int refcnt; struct intrupt *intrupt; int fifo; int baudrate; @@ -311,7 +312,7 @@ dos_comisr (irq) port->oflo++; } - if (dos_putc (c & 0x7f, port) < 0) + if (dos_putc (c, port) < 0) { COUNT (CNT_ORUN); } @@ -474,11 +475,11 @@ dos_open (scb, name) fd = name[3] - '1'; port = &ports[fd]; - if (port->intrupt) + if (port->refcnt++ > 0) { - /* already open (EBUSY not defined!) */ - errno = EACCES; - return -1; + /* Device already opened another user. Just point at it. */ + scb->fd = fd; + return 0; } /* force access to ID reg */ @@ -559,6 +560,10 @@ dos_close (scb) return; port = &ports[scb->fd]; + + if (port->refcnt-- > 1) + return; + if (!(intrupt = port->intrupt)) return; -- cgit v1.1