mirror of
https://github.com/open-simh/simh.git
synced 2026-01-11 23:53:30 +00:00
Fixed conditions when error messages are displayed while processing do commands
This commit is contained in:
parent
6def9ed6a8
commit
df98a0583c
76
scp.c
76
scp.c
@ -62,7 +62,7 @@
|
||||
17-Aug-08 RMS Revert RUN/BOOT to standard, rather than powerup, reset
|
||||
25-Jul-08 JDB DO cmd missing params now default to null string
|
||||
29-Jun-08 JDB DO cmd sub_args now allows "\\" to specify literal backslash
|
||||
04-Jun-08 JDB Label the patch delta more clearly
|
||||
04-Jun-08 JDB label the patch delta more clearly
|
||||
31-Mar-08 RMS Fixed bug in local/global register search (Mark Pizzolato)
|
||||
Fixed bug in restore of RO units (Mark Pizzolato)
|
||||
06-Feb-08 RMS Added SET/SHO/NO BR with default argument
|
||||
@ -218,6 +218,7 @@
|
||||
|
||||
#include "sim_defs.h"
|
||||
#include "sim_rev.h"
|
||||
#include "sim_ether.h"
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
@ -714,6 +715,7 @@ static CTAB cmd_table[] = {
|
||||
"sh{ow} <dev> SHOW show device SHOW commands\n"
|
||||
"sh{ow} <dev> {arg,...} show device parameters\n"
|
||||
"sh{ow} <unit> {arg,...} show unit parameters\n"
|
||||
"sh{ow} ethernet show ethernet devices\n"
|
||||
"sh{ow} on show on condition actions\n" },
|
||||
{ "DO", &do_cmd, 1,
|
||||
"do {-V} {-O} {-E} {-Q} <file> {arg,arg...}\b"
|
||||
@ -767,7 +769,7 @@ int setenv(const char *envname, const char *envval, int overwrite)
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
char cbuf[CBUFSIZE], gbuf[CBUFSIZE], *cptr;
|
||||
char cbuf[CBUFSIZE], gbuf[CBUFSIZE], *cptr, *cptr2;
|
||||
char nbuf[PATH_MAX + 7];
|
||||
int32 i, sw;
|
||||
t_bool lookswitch;
|
||||
@ -803,6 +805,7 @@ for (i = 1; i < argc; i++) { /* loop thru args */
|
||||
}
|
||||
} /* end for */
|
||||
sim_quiet = sim_switches & SWMASK ('Q'); /* -q means quiet */
|
||||
sim_on_inherit = sim_switches & SWMASK ('O'); /* -o means inherit on state */
|
||||
|
||||
AIO_INIT; /* init Asynch I/O */
|
||||
if (sim_vm_init != NULL) /* call once only */
|
||||
@ -847,10 +850,14 @@ if (sim_dflt_dev == NULL) /* if no default */
|
||||
sim_dflt_dev = sim_devices[0];
|
||||
|
||||
cptr = getenv("HOME");
|
||||
if (cptr == NULL)
|
||||
if (cptr == NULL) {
|
||||
cptr = getenv("HOMEPATH");
|
||||
cptr2 = getenv("HOMEDRIVE");
|
||||
}
|
||||
else
|
||||
cptr2 = NULL;
|
||||
if (cptr && sizeof (nbuf) > strlen (cptr) + strlen ("/simh.ini") + 1) {
|
||||
sprintf(nbuf, "%s%ssimh.ini", cptr, strchr (cptr, '/') ? "/" : "\\");
|
||||
sprintf(nbuf, "\"%s%s%ssimh.ini\"", cptr2 ? cptr2 : "", cptr, strchr (cptr, '/') ? "/" : "\\");
|
||||
stat = do_cmd (-1, nbuf) & ~SCPE_NOMESSAGE; /* simh.ini proc cmd file */
|
||||
}
|
||||
if (stat == SCPE_OPENERR)
|
||||
@ -861,7 +868,7 @@ else if (*argv[0]) { /* sim name arg? */
|
||||
char *np; /* "path.ini" */
|
||||
nbuf[0] = '"'; /* starting " */
|
||||
strncpy (nbuf + 1, argv[0], PATH_MAX + 1); /* copy sim name */
|
||||
if (np = match_ext (nbuf, "EXE")) /* remove .exe */
|
||||
if ((np = match_ext (nbuf, "EXE"))) /* remove .exe */
|
||||
*np = 0;
|
||||
strcat (nbuf, ".ini\""); /* add .ini" */
|
||||
stat = do_cmd (-1, nbuf); /* proc cmd file */
|
||||
@ -870,7 +877,7 @@ else if (*argv[0]) { /* sim name arg? */
|
||||
stat = SCPE_BARE_STATUS(stat); /* remove possible flag */
|
||||
|
||||
while (stat != SCPE_EXIT) { /* in case exit */
|
||||
if (cptr = sim_brk_getact (cbuf, CBUFSIZE)) /* pending action? */
|
||||
if ((cptr = sim_brk_getact (cbuf, CBUFSIZE))) /* pending action? */
|
||||
printf ("sim> %s\n", cptr); /* echo */
|
||||
else if (sim_vm_read != NULL) { /* sim routine? */
|
||||
printf ("sim> "); /* prompt */
|
||||
@ -887,7 +894,7 @@ while (stat != SCPE_EXIT) { /* in case exit */
|
||||
fprintf (sim_log, "sim> %s\n", cptr);
|
||||
cptr = get_glyph (cptr, gbuf, 0); /* get command glyph */
|
||||
sim_switches = 0; /* init switches */
|
||||
if (cmdp = find_cmd (gbuf)) /* lookup command */
|
||||
if ((cmdp = find_cmd (gbuf))) /* lookup command */
|
||||
stat = cmdp->action (cmdp->arg, cptr); /* if found, exec */
|
||||
else stat = SCPE_UNK;
|
||||
stat_nomessage = stat & SCPE_NOMESSAGE; /* extract possible message supression flag */
|
||||
@ -895,7 +902,7 @@ while (stat != SCPE_EXIT) { /* in case exit */
|
||||
stat = SCPE_BARE_STATUS(stat); /* remove possible flag */
|
||||
sim_last_cmd_stat = stat; /* save command error status */
|
||||
if ((stat >= SCPE_BASE) && (!stat_nomessage)) { /* error? */
|
||||
if (cmdp->message)
|
||||
if (cmdp->message) /* special message handler? */
|
||||
cmdp->message (NULL, stat);
|
||||
else {
|
||||
printf ("%s\n", sim_error_text (stat));
|
||||
@ -963,7 +970,7 @@ if (*cptr) {
|
||||
cptr = get_glyph (cptr, gbuf, 0);
|
||||
if (*cptr)
|
||||
return SCPE_2MARG;
|
||||
if (cmdp = find_cmd (gbuf)) {
|
||||
if ((cmdp = find_cmd (gbuf))) {
|
||||
fputs (cmdp->help, stdout);
|
||||
if (sim_log)
|
||||
fputs (cmdp->help, sim_log);
|
||||
@ -1167,7 +1174,7 @@ do {
|
||||
sim_switches = 0; /* init switches */
|
||||
sim_gotofile = fpin;
|
||||
sim_do_echo = echo;
|
||||
if (cmdp = find_cmd (gbuf)) { /* lookup command */
|
||||
if ((cmdp = find_cmd (gbuf))) { /* lookup command */
|
||||
if (cmdp->action == &return_cmd) /* RETURN command? */
|
||||
break; /* done! */
|
||||
if (cmdp->action == &do_cmd) { /* DO command? */
|
||||
@ -1216,8 +1223,8 @@ do {
|
||||
fprintf (sim_log, "%s> %s\n", do_position(), ocptr);
|
||||
}
|
||||
}
|
||||
if ((flag <= 0) && /* report error if in cmdline/init file */
|
||||
(stat >= SCPE_BASE) && !stat_nomessage) {
|
||||
if ((staying || (flag <= 0)) && /* if not exiting or in cmdline/init file */
|
||||
(stat >= SCPE_BASE) && !stat_nomessage) { /* report error */
|
||||
if (cmdp->message) { /* special message handler */
|
||||
cmdp->message ((!echo && !sim_quiet) ? ocptr : NULL, stat);
|
||||
}
|
||||
@ -1817,18 +1824,18 @@ if (*cptr == 0) /* must be more */
|
||||
return SCPE_2FARG;
|
||||
cptr = get_glyph (cptr, gbuf, 0); /* get glob/dev/unit */
|
||||
|
||||
if (dptr = find_dev (gbuf)) { /* device match? */
|
||||
if ((dptr = find_dev (gbuf))) { /* device match? */
|
||||
uptr = dptr->units; /* first unit */
|
||||
ctbr = set_dev_tab; /* global table */
|
||||
lvl = MTAB_VDV; /* device match */
|
||||
}
|
||||
else if (dptr = find_unit (gbuf, &uptr)) { /* unit match? */
|
||||
else if ((dptr = find_unit (gbuf, &uptr))) { /* unit match? */
|
||||
if (uptr == NULL) /* invalid unit */
|
||||
return SCPE_NXUN;
|
||||
ctbr = set_unit_tab; /* global table */
|
||||
lvl = MTAB_VUN; /* unit match */
|
||||
}
|
||||
else if (gcmdp = find_ctab (set_glob_tab, gbuf)) /* global? */
|
||||
else if ((gcmdp = find_ctab (set_glob_tab, gbuf))) /* global? */
|
||||
return gcmdp->action (gcmdp->arg, cptr); /* do the rest */
|
||||
else return SCPE_NXDEV; /* no match */
|
||||
if (*cptr == 0) /* must be more */
|
||||
@ -1836,7 +1843,7 @@ if (*cptr == 0) /* must be more */
|
||||
|
||||
while (*cptr != 0) { /* do all mods */
|
||||
cptr = get_glyph (svptr = cptr, gbuf, ','); /* get modifier */
|
||||
if (cvptr = strchr (gbuf, '=')) /* = value? */
|
||||
if ((cvptr = strchr (gbuf, '='))) /* = value? */
|
||||
*cvptr++ = 0;
|
||||
for (mptr = dptr->modifiers; mptr && (mptr->mask != 0); mptr++) {
|
||||
if ((mptr->mstring) && /* match string */
|
||||
@ -1849,7 +1856,7 @@ while (*cptr != 0) { /* do all mods */
|
||||
if (mptr->valid) { /* validation rtn? */
|
||||
if (cvptr && (mptr->mask & MTAB_NC)) {
|
||||
get_glyph_nc (svptr, gbuf, ',');
|
||||
if (cvptr = strchr (gbuf, '='))
|
||||
if ((cvptr = strchr (gbuf, '=')))
|
||||
*cvptr++ = 0;
|
||||
}
|
||||
r = mptr->valid (uptr, mptr->match, cvptr, mptr->desc);
|
||||
@ -1882,7 +1889,7 @@ while (*cptr != 0) { /* do all mods */
|
||||
} /* end if match */
|
||||
} /* end for */
|
||||
if (!mptr || (mptr->mask == 0)) { /* no match? */
|
||||
if (glbr = find_c1tab (ctbr, gbuf)) { /* global match? */
|
||||
if ((glbr = find_c1tab (ctbr, gbuf))) { /* global match? */
|
||||
r = glbr->action (dptr, uptr, glbr->arg, cvptr); /* do global */
|
||||
if (r != SCPE_OK)
|
||||
return r;
|
||||
@ -2056,6 +2063,7 @@ static SHTAB show_glob_tab[] = {
|
||||
{ "DEBUG", &sim_show_debug, 0 }, /* deprecated */
|
||||
{ "THROTTLE", &sim_show_throt, 0 },
|
||||
{ "ASYNCH", &sim_show_asynch, 0 },
|
||||
{ "ETHERNET", ð_show_devices, 0 },
|
||||
{ "ON", &show_on, 0 },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
@ -2077,15 +2085,15 @@ GET_SWITCHES (cptr); /* get switches */
|
||||
if (*cptr == 0) /* must be more */
|
||||
return SCPE_2FARG;
|
||||
cptr = get_glyph (cptr, gbuf, 0); /* get next glyph */
|
||||
if (shptr = find_shtab (show_glob_tab, gbuf)) /* global? */
|
||||
if ((shptr = find_shtab (show_glob_tab, gbuf))) /* global? */
|
||||
return shptr->action (ofile, NULL, NULL, shptr->arg, cptr);
|
||||
|
||||
if (dptr = find_dev (gbuf)) { /* device match? */
|
||||
if ((dptr = find_dev (gbuf))) { /* device match? */
|
||||
uptr = dptr->units; /* first unit */
|
||||
shtb = show_dev_tab; /* global table */
|
||||
lvl = MTAB_VDV; /* device match */
|
||||
}
|
||||
else if (dptr = find_unit (gbuf, &uptr)) { /* unit match? */
|
||||
else if ((dptr = find_unit (gbuf, &uptr))) { /* unit match? */
|
||||
if (uptr == NULL) /* invalid unit */
|
||||
return SCPE_NXUN;
|
||||
if (uptr->flags & UNIT_DIS) /* disabled? */
|
||||
@ -2105,7 +2113,7 @@ if (dptr->modifiers == NULL) /* any modifiers? */
|
||||
|
||||
while (*cptr != 0) { /* do all mods */
|
||||
cptr = get_glyph (cptr, gbuf, ','); /* get modifier */
|
||||
if (cvptr = strchr (gbuf, '=')) /* = value? */
|
||||
if ((cvptr = strchr (gbuf, '='))) /* = value? */
|
||||
*cvptr++ = 0;
|
||||
for (mptr = dptr->modifiers; mptr->mask != 0; mptr++) {
|
||||
if (((mptr->mask & MTAB_XTD)? /* right level? */
|
||||
@ -2124,7 +2132,7 @@ while (*cptr != 0) { /* do all mods */
|
||||
} /* end if */
|
||||
} /* end for */
|
||||
if (mptr->mask == 0) { /* no match? */
|
||||
if (shptr = find_shtab (shtb, gbuf)) /* global match? */
|
||||
if ((shptr = find_shtab (shtb, gbuf))) /* global match? */
|
||||
shptr->action (ofile, dptr, uptr, shptr->arg, cptr);
|
||||
else return SCPE_ARG;
|
||||
} /* end if */
|
||||
@ -2579,7 +2587,7 @@ if (sim_brk_types == 0)
|
||||
return SCPE_NOFNC;
|
||||
if ((dptr == NULL) || (uptr == NULL))
|
||||
return SCPE_IERR;
|
||||
if (aptr = strchr (cptr, ';')) { /* ;action? */
|
||||
if ((aptr = strchr (cptr, ';'))) { /* ;action? */
|
||||
if (flg != SSH_ST) /* only on SET */
|
||||
return SCPE_ARG;
|
||||
*aptr++ = 0; /* separate strings */
|
||||
@ -3618,6 +3626,8 @@ else {
|
||||
return r;
|
||||
}
|
||||
|
||||
/* run command message handler */
|
||||
|
||||
void
|
||||
run_cmd_message (const char *unechoed_cmdline, t_stat r)
|
||||
{
|
||||
@ -4002,7 +4012,7 @@ if (rptr->flags & REG_RO)
|
||||
if (flag & EX_I) {
|
||||
cptr = read_line (gbuf, CBUFSIZE, stdin);
|
||||
if (sim_log)
|
||||
fprintf (sim_log, (cptr? "%s\n": "\n"), cptr);
|
||||
fprintf (sim_log, "%s\n", cptr? cptr: "");
|
||||
if (cptr == NULL) /* force exit */
|
||||
return 1;
|
||||
if (*cptr == 0) /* success */
|
||||
@ -4220,7 +4230,7 @@ if (dptr == NULL)
|
||||
if (flag & EX_I) {
|
||||
cptr = read_line (gbuf, CBUFSIZE, stdin);
|
||||
if (sim_log)
|
||||
fprintf (sim_log, (cptr? "%s\n": "\n"), cptr);
|
||||
fprintf (sim_log, "%s\n", cptr? cptr: "");
|
||||
if (cptr == NULL) /* force exit */
|
||||
return 1;
|
||||
if (*cptr == 0) /* success */
|
||||
@ -4602,7 +4612,7 @@ if ((cptr == NULL) || (*cptr == 0))
|
||||
return SCPE_ARG;
|
||||
strncpy (gbuf, cptr, CBUFSIZE);
|
||||
addrp = gbuf; /* default addr */
|
||||
if (portp = strchr (gbuf, ':')) /* x:y? split */
|
||||
if ((portp = strchr (gbuf, ':'))) /* x:y? split */
|
||||
*portp++ = 0;
|
||||
else if (strchr (gbuf, '.')) /* x.y...? */
|
||||
portp = NULL;
|
||||
@ -4685,7 +4695,7 @@ DEVICE *dptr;
|
||||
|
||||
if (uptr == NULL) /* arg error? */
|
||||
return NULL;
|
||||
if (dptr = find_dev (cptr)) { /* exact match? */
|
||||
if ((dptr = find_dev (cptr))) { /* exact match? */
|
||||
if (qdisable (dptr)) /* disabled? */
|
||||
return NULL;
|
||||
*uptr = dptr->units; /* unit 0 */
|
||||
@ -4765,7 +4775,7 @@ REG *rptr, *srptr = NULL;
|
||||
for (i = 0; (dptr = sim_devices[i]) != 0; i++) { /* all dev */
|
||||
if (dptr->flags & DEV_DIS) /* skip disabled */
|
||||
continue;
|
||||
if (rptr = find_reg (cptr, optr, dptr)) { /* found? */
|
||||
if ((rptr = find_reg (cptr, optr, dptr))) { /* found? */
|
||||
if (srptr) /* ambig? err */
|
||||
return NULL;
|
||||
srptr = rptr; /* save reg */
|
||||
@ -4983,15 +4993,15 @@ const char logstr[] = "|&^", cmpstr[] = "=!><";
|
||||
logval = cmpval = 0;
|
||||
if (*cptr == 0) /* check for clause */
|
||||
return NULL;
|
||||
for (logop = cmpop = -1; c = *cptr++; ) { /* loop thru clauses */
|
||||
if (sptr = strchr (logstr, c)) { /* check for mask */
|
||||
for (logop = cmpop = -1; (c = *cptr++); ) { /* loop thru clauses */
|
||||
if ((sptr = strchr (logstr, c))) { /* check for mask */
|
||||
logop = (int32)(sptr - logstr);
|
||||
logval = strtotv (cptr, &tptr, radix);
|
||||
if (cptr == tptr)
|
||||
return NULL;
|
||||
cptr = tptr;
|
||||
}
|
||||
else if (sptr = strchr (cmpstr, c)) { /* check for boolop */
|
||||
else if ((sptr = strchr (cmpstr, c))) { /* check for boolop */
|
||||
cmpop = (int32)(sptr - cmpstr);
|
||||
if (*cptr == '=') {
|
||||
cmpop = cmpop + strlen (cmpstr);
|
||||
@ -5683,7 +5693,7 @@ while (isspace (*sim_brk_act[sim_do_depth])) /* skip spaces */
|
||||
sim_brk_act[sim_do_depth]++;
|
||||
if (*sim_brk_act[sim_do_depth] == 0) /* now empty? */
|
||||
return (sim_brk_act[sim_do_depth] = NULL);
|
||||
if (ep = strchr (sim_brk_act[sim_do_depth], ';')) { /* cmd delimiter? */
|
||||
if ((ep = strchr (sim_brk_act[sim_do_depth], ';'))) { /* cmd delimiter? */
|
||||
lnt = ep - sim_brk_act[sim_do_depth]; /* cmd length */
|
||||
memcpy (buf, sim_brk_act[sim_do_depth], lnt + 1); /* copy with ; */
|
||||
buf[lnt] = 0; /* erase ; */
|
||||
|
||||
76
sim_ether.c
76
sim_ether.c
@ -637,6 +637,25 @@ char* eth_getname_byname(char* name, char* temp)
|
||||
return (found ? temp : NULL);
|
||||
}
|
||||
|
||||
char* eth_getdesc_byname(char* name, char* temp)
|
||||
{
|
||||
ETH_LIST list[ETH_MAX_DEVICE];
|
||||
int count = eth_devices(ETH_MAX_DEVICE, list);
|
||||
size_t n;
|
||||
int i, found;
|
||||
|
||||
found = 0;
|
||||
n = strlen(name);
|
||||
for (i=0; i<count && !found; i++) {
|
||||
if ((n == strlen(list[i].name)) &&
|
||||
(eth_strncasecmp(name, list[i].name, n) == 0)) {
|
||||
found = 1;
|
||||
strcpy(temp, list[i].desc);
|
||||
}
|
||||
}
|
||||
return (found ? temp : NULL);
|
||||
}
|
||||
|
||||
void eth_zero(ETH_DEV* dev)
|
||||
{
|
||||
/* set all members to NULL OR 0 */
|
||||
@ -644,6 +663,28 @@ void eth_zero(ETH_DEV* dev)
|
||||
dev->reflections = -1; /* not established yet */
|
||||
}
|
||||
|
||||
static ETH_DEV **eth_open_devices = NULL;
|
||||
static int eth_open_device_count = 0;
|
||||
|
||||
static void _eth_add_to_open_list (ETH_DEV* dev)
|
||||
{
|
||||
eth_open_devices = realloc(eth_open_devices, (eth_open_device_count+1)*sizeof(*eth_open_devices));
|
||||
eth_open_devices[eth_open_device_count++] = dev;
|
||||
}
|
||||
|
||||
static void _eth_remove_from_open_list (ETH_DEV* dev)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i=0; i<eth_open_device_count; ++i)
|
||||
if (eth_open_devices[i] == dev) {
|
||||
for (j=i+1; j<eth_open_device_count; ++j)
|
||||
eth_open_devices[j-1] = eth_open_devices[j];
|
||||
--eth_open_device_count;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
t_stat eth_show (FILE* st, UNIT* uptr, int32 val, void* desc)
|
||||
{
|
||||
ETH_LIST list[ETH_MAX_DEVICE];
|
||||
@ -661,11 +702,29 @@ t_stat eth_show (FILE* st, UNIT* uptr, int32 val, void* desc)
|
||||
for (i=0, min=0; i<number; i++)
|
||||
if ((len = strlen(list[i].name)) > min) min = len;
|
||||
for (i=0; i<number; i++)
|
||||
fprintf(st," %2d %-*s (%s)\n", i, (int)min, list[i].name, list[i].desc);
|
||||
fprintf(st," %2d %-*s (%s)\n", i, (int)min, list[i].name, list[i].desc);
|
||||
}
|
||||
if (eth_open_device_count) {
|
||||
int i;
|
||||
char desc[ETH_DEV_DESC_MAX], *d;
|
||||
|
||||
fprintf(st,"Open ETH Devices:\n");
|
||||
for (i=0; i<eth_open_device_count; i++) {
|
||||
d = eth_getdesc_byname(eth_open_devices[i]->name, desc);
|
||||
if (d)
|
||||
fprintf(st, " %-7s%s (%s)\n", eth_open_devices[i]->dptr->name, eth_open_devices[i]->name, d);
|
||||
else
|
||||
fprintf(st, " %-7s%s\n", eth_open_devices[i]->dptr->name, eth_open_devices[i]->name);
|
||||
}
|
||||
}
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
t_stat eth_show_devices (FILE* st, DEVICE *dptr, UNIT* uptr, int32 val, char* desc)
|
||||
{
|
||||
return eth_show (st, uptr, val, desc);
|
||||
}
|
||||
|
||||
t_stat ethq_init(ETH_QUE* que, int max)
|
||||
{
|
||||
/* create dynamic queue if it does not exist */
|
||||
@ -1335,7 +1394,7 @@ static void eth_get_nic_hw_addr(ETH_DEV* dev, char *devname)
|
||||
for (i=0; patterns[i] && (0 == dev->have_host_nic_phy_addr); ++i) {
|
||||
snprintf(command, sizeof(command)-1, "ifconfig %s | %s >NIC.hwaddr", devname, patterns[i]);
|
||||
system(command);
|
||||
if (f = fopen("NIC.hwaddr", "r")) {
|
||||
if (NULL != (f = fopen("NIC.hwaddr", "r"))) {
|
||||
while (0 == dev->have_host_nic_phy_addr) {
|
||||
if (fgets(command, sizeof(command)-1, f)) {
|
||||
char *p1, *p2;
|
||||
@ -1521,7 +1580,7 @@ sim_debug(dev->dbit, dev->dptr, "Writer Thread Starting\n");
|
||||
pthread_mutex_lock (&dev->writer_lock);
|
||||
while (dev->handle) {
|
||||
pthread_cond_wait (&dev->writer_cond, &dev->writer_lock);
|
||||
while (request = dev->write_requests) {
|
||||
while (NULL != (request = dev->write_requests)) {
|
||||
/* Pull buffer off request list */
|
||||
dev->write_requests = request->next;
|
||||
pthread_mutex_unlock (&dev->writer_lock);
|
||||
@ -1800,6 +1859,7 @@ if (dev->eth_api == ETH_API_PCAP) {
|
||||
ioctl(pcap_fileno(dev->handle), BIOCIMMEDIATE, &v);
|
||||
}
|
||||
#endif
|
||||
_eth_add_to_open_list (dev);
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
@ -1829,11 +1889,11 @@ pthread_mutex_destroy (&dev->writer_lock);
|
||||
pthread_cond_destroy (&dev->writer_cond);
|
||||
if (1) {
|
||||
struct write_request *buffer;
|
||||
while (buffer = dev->write_buffers) {
|
||||
while (NULL != (buffer = dev->write_buffers)) {
|
||||
dev->write_buffers = buffer->next;
|
||||
free(buffer);
|
||||
}
|
||||
while (buffer = dev->write_requests) {
|
||||
while (NULL != (buffer = dev->write_requests)) {
|
||||
dev->write_requests = buffer->next;
|
||||
free(buffer);
|
||||
}
|
||||
@ -1862,7 +1922,7 @@ if (sim_log) fprintf (sim_log, msg, dev->name);
|
||||
/* clean up the mess */
|
||||
free(dev->name);
|
||||
eth_zero(dev);
|
||||
|
||||
_eth_remove_from_open_list (dev);
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
@ -2086,10 +2146,10 @@ if (!dev) return SCPE_UNATT;
|
||||
|
||||
/* Get a buffer */
|
||||
pthread_mutex_lock (&dev->writer_lock);
|
||||
if (request = dev->write_buffers)
|
||||
if (NULL != (request = dev->write_buffers))
|
||||
dev->write_buffers = request->next;
|
||||
pthread_mutex_unlock (&dev->writer_lock);
|
||||
if (!request)
|
||||
if (NULL == request)
|
||||
request = malloc(sizeof(*request));
|
||||
|
||||
/* Copy buffer contents */
|
||||
|
||||
@ -288,8 +288,10 @@ uint32 eth_crc32(uint32 crc, const void* vbuf, size_t len); /* Compute Ethernet
|
||||
|
||||
void eth_packet_trace (ETH_DEV* dev, const uint8 *msg, int len, char* txt); /* trace ethernet packet header+crc */
|
||||
void eth_packet_trace_ex (ETH_DEV* dev, const uint8 *msg, int len, char* txt, int detail, uint32 reason); /* trace ethernet packet */
|
||||
t_stat eth_show (FILE* st, UNIT* uptr, /* show ethernet devices */
|
||||
int32 val, void* desc);
|
||||
t_stat eth_show (FILE* st, UNIT* uptr, /* show ethernet devices */
|
||||
int32 val, void* desc);
|
||||
t_stat eth_show_devices (FILE* st, DEVICE *dptr, /* show ethernet devices */
|
||||
UNIT* uptr, int32 val, char* desc);
|
||||
void eth_show_dev (FILE*st, ETH_DEV* dev); /* show ethernet device state */
|
||||
|
||||
void eth_mac_fmt (ETH_MAC* add, char* buffer); /* format ethernet mac address */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user