car@trux.UUCP (Chris Rende) (03/11/91)
Nixdorf Targon M35/50 TOS 3.3 (Pyramid 9810 OSx 4.4?) I've been having trouble with one of my ITP's dropping offline recently. No console messages, no messages in the error log - nothing. Since I couldn't find a way to determine the status of an ITP, I wrote the attached simple program. This program shows the status of a given ITP and the major/minor device numbers of the ITP's first tty. Check your /etc/brc (System V system initialization) for which ITP's you are using. Or, do a `ls -lmt /dev/itp*` and use the ITP's which were last modified at the time of your last system boot. car. ----------- shell script "itp" ------------- for i in 40 41 42 43 44 45 do itpstat $i done ----------- C program "itpstat" ------------- /* itpstat.c - Written 03/08/91 by Chris Rende */ /* Last change: 03/08/91 by Chris Rende */ #include <stdio.h> #include <sys/types.h> #include <sys/itpdefs.h> #include <sys/itpcpu.h> #include <sys/ioctl.h> int main(argc,argv) int argc; char *argv[]; { FILE *itp; struct ioctlitp ioctlitp; char name[30]; if (argc!=2) { fprintf(stderr,"Usage: itpstat <itp#>\n"); exit(0); } /* if */ strcpy(name,"/dev/itp"); strcat(name,argv[1]); itp=fopen(name,"r"); if (itp==NULL) { fprintf(stderr,"Can't open itp: '%s'\n",name); perror("itpstat"); exit(1); } /* if */ /* Might do an ITPUPDATE first... */ ioctl(fileno(itp),ITPSTATE,&ioctlitp); printf("itp: %s status: %d",argv[1],ioctlitp.status); if (ioctlitp.status==VIRGIN) printf(" (VIRGIN)"); if (ioctlitp.status==INITED) printf(" (INITED)"); if (ioctlitp.status==RUNNING) printf(" (RUNNING)"); if (ioctlitp.status==BROKEN) printf(" (BROKEN)"); /* printf(" value: %d",ioctlitp.value); */ /* printf(" addr: %d",ioctlitp.addr); */ /* printf("\n"); */ ioctl(fileno(itp),ITPGETDEV,&ioctlitp); /* printf("itp: %s status: %d",argv[1],ioctlitp.status); */ printf(" major: %d minor: %d",(ioctlitp.status&0xff00)>>8,(ioctlitp.status&0xff)); /* printf(" value: %d",ioctlitp.value); */ /* printf(" addr: %d",ioctlitp.addr); */ printf("\n"); fclose(itp); } /* itpstat */ -- Christopher A. Rende Central Cartage (Nixdorf/Pyramid/SysVR2/BSD4.3) uunet!edsews!rphroy!trux!car Multics,DTSS,Unix,Shortwave,Scanners,UnixPC/3B1 trux!car@uunet.uu.net Minix 1.2,PC/XT,Mac+,TRS-80 Model I,1802 ELF trux!ramecs!car "I don't ever remember forgetting anything." - Chris Rende