Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!apple!agate!dog.ee.lbl.gov!me10.lbl.gov!milburn From: milburn@me10.lbl.gov (John Milburn) Newsgroups: comp.sys.hp Subject: Re: BSD and HPUX, The Questions Continue... Message-ID: <12814@dog.ee.lbl.gov> Date: 4 May 91 19:18:45 GMT References: <1991May3.155830.19814@alchemy.chem.utoronto.ca> Reply-To: JEMilburn@lbl.gov (John Milburn) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 234 X-Local-Date: Sat, 4 May 91 12:18:45 PDT In his article Mike Peterson writes: >We too are considering switching to a 720/730, coming from the Apollo >BSD environment. I have been using a 720 for the past few days, and >these items are of concern. Any pointers/responses appreciated. I can help some on a couple of these. I've deleted the questions I will not comment on. >Major problems with f77 compiler using -O: >I found 2 routines which give incorrect numerical results with >-O (but no compiler complaints). This is not good news, although I Please post code fragments so that the hp folks can look into it. >Other problems in no particular order: >- no 'renice' command. Yes. Appended to this message is the source to a program called 'setnice' which was posted here last year. You might have to make some minor definition changes for the s700. The header of that message is also attached. >- my script which runs all my test jobs sequentially just died in the middle > with "Missing name for redirect", yet rerunning it worked fine > (looks like a flaky 'csh' to me). Bad variable definition? Please send the script with the problem. I have never seen this on s300. >- vi doesn't redraw the screen properly in rlogin sessions from > xterms (xterm is not recognized as a valid terminal type, > so I was using vt100 on the 720). Working from a real vt100 does > work properly, so it might be just a matter of supplying a terminfo > file for an xterm. Perhaps you didn't install the fileset with all the terminfo definitions. If not, creating a custom description is simple. Just use tic(1M). Here is my xterm def. I think it is unmodified from the one hp supplies. You can rename it, changing the lines and columns definitions, to get a variety of definitions. (Or, just use resize to change the environment variables.) xterm|vs100|xterm terminal emulator, am, xenl, km, cols#80, it#8, lines#65, bel=^G, cr=\r, csr=\E[%i%p1%d;%p2%dr, tbc=\E[3g, clear=\E[H\E[2J, el=\E[K, ed=\E[J, cup=\E[%i%p1%d;%p2%dH, cud1=\n, home=\E[H, cub1=\b, cuf1=\E[C, cuu1=\E[A, dch1=\E[P, dl1=\E[M, blink=@, bold=\E[1m, rev=\E[7m, smso=\E[7m, sgr0=\E[m, rmso=\E[m, ich1=\E[@, il1=\E[L, kbs=\b, kcud1=\EOB, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kcub1=\EOD, kcuf1=\EOC, kcuu1=\EOA, rmkx=\E[?1l\E>, smkx=\E[?1h\E=, dch=\E[%p1%dP, dl=\E[%p1%dM, cud=\E[%p1%dB, ich=\E[%p1%d@, il=\E[%p1%dL, cub=\E[%p1%dD, cuf=\E[%p1%dC, cuu=\E[%p1%dA, rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, rs2=@kf1=\EOP, rc=\E8, sc=\E7, ind=\n, ri=\EM, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m, hts=\EH, ht=\t, >- rlogin does not handle flow control properly (an issue for rlogins > from a terminal server where you can have multiple sessions). Please describe this problem in more detail. >- no BSD printing! Sure there is. HP just tries to make it work in their own environment. You can easily print to a remote printer by creating a remote device using lpadmin. For instance, to create an entry to allow printing to an imagen served by dp3.lbl.gov, I issue the following: /usr/lib/lpadmin -pip11 -mrmodel -v/dev/null -orc -ocmrcmodel -osmrsmodel \ -ormdp4 -orpip11 -ob3 The /usr/bin/lpr script hp provides is completely brain damaged, so we wrote our own. Also, the supplied model script is incomplete, and has been modified. None of this takes much work. Setting up a local server can also be done using rlpdaemon. Basically, the mechanism has been changed, but the functionality is there. >- limited user licenses (we regulary have more than 16 users logged in > to our central mail/compute server); I didn't know anyone sold such > restricted UNIXs these days. Agreed. This can be a real pain in the ass. Hope some of this helps, -jem The setnice stuff: ---------------------------- #From: mck@hpcuhc.HP.COM (Doug McKenzie) Newsgroups: comp.sys.hp Subject: Re: Any "renice" type function for HP-UX Date: 18 Apr 90 17:31:56 GMT Organization: Hewlett Packard, Cupertino >A bit of warning: the posted version seems to be specific to the series 800 >machines. Doug, maybe you want to post the series 300 version also? Yes, I sure would, I've gotten some email asking for it. I don't have a S300 version of renice, but I have another S800 source ("setnice.c") that does essentially the same thing as renice, and seemed easier to modify for the S300. (The reason the S300 and S800 versions are different, is that they access /dev/kmem, which has machine (and release) dependent idiosyncracies.) Anyway here is setnice.c. No makefile, no Series [38]00 dependencies, just cc setnice.c -o setnice and "chmod 4755 setnice" (as root). Standard warning: this isn't an official HP posting. Global warning: Beware of the "open house" effect (i.e. setuid programs). Doug McKenzie HP-UX Support mck@hpcugsya.hp.com ---------------------------- /* setnice nice -pid: set nice value of a process that is running */ #include #include #include #include #include #include #include #include int kmem, nproc; /* kmem descriptor, size of proc table */ struct proc *proc; /* pointer to proc structure */ struct nlist nl[] = { /* name list entry */ #ifdef hp9000s300 { "_proc" } , { "_nproc"} , #else hp9000s800 { "proc" } , { "nproc" } , #endif { NULL } }; main( argc,argv ) int argc; char **argv; { struct proc proc_entry; register int i, pid; char nice; if (argc != 3 || argv[2][0] != '-'){ fprintf (stderr, "usage: %s nice_value -pid\n", argv[0]); exit (1); } nice = atoi (argv[1]); if (nice < 0 || nice > 40){ fprintf (stderr, "nice_value must be between 0 and 40\n"); exit (1); } argv[2]++; pid = atoi(argv[2]); init_stuff(); readkmem (nl[1].n_value, &nproc, sizeof(nproc)); readkmem (nl[0].n_value, &proc, sizeof (proc)); for ( i=0; i < nproc; i++ ) { readkmem( &proc[i], (char *) &proc_entry, sizeof(proc_entry)); if (proc_entry.p_stat != 0 && proc_entry.p_pid == pid){ writekmem (&proc[i].p_nice, &nice, sizeof (nice)); break; } } if (i == nproc){ fprintf (stderr, "%d: No such process\n", pid); exit (1); } } init_stuff() { if (( kmem = open ("/dev/kmem",O_RDWR)) == -1 ) { perror ("couldn't open /dev/kmem"); exit (-1); } if ( nlist ("/hp-ux",nl) == -1 ) { perror("nlist"); exit (-1); } if ( nl[0].n_type == 0 ) { fprintf( stderr,"nlist[0] failed\n"); exit (-1); } if ( nl[1].n_type == 0 ) { fprintf( stderr,"nlist[1] failed\n"); exit (-1); } } readkmem (offset, buf, size ) long offset; char *buf; int size; { if ( lseek (kmem, offset, 0) == -1 ) { perror ( "lseek" ); exit (-1); } if ( read( kmem,buf,size) != size ) { perror ("can't read from kmem\n"); exit( -1 ); } } writekmem (offset, buf, size) long offset; char *buf; int size; { if (lseek (kmem, offset, 0) == -1){ perror ("lseek"); exit (1); } if (write (kmem, buf, size) != size){ perror ("can't write to kmem\n"); exit (1); } } ----------------Cut Here--------------- -- John Milburn milburn@me10.lbl.gov (415) 486-6969 "Work FOR? I don't work FOR anybody... I'm just having fun." - The Doctor