Path: utzoo!utgpu!water!watmath!clyde!att-cb!att-ih!pacbell!ames!ll-xn!oberon!skat.usc.edu!purdy From: purdy@skat.usc.edu (Tim Purdy) Newsgroups: comp.os.vms Subject: Dot H files #2 request Message-ID: <7521@oberon.USC.EDU> Date: 9 Mar 88 06:32:53 GMT Sender: news@oberon.USC.EDU Reply-To: purdy@skat.usc.edu (Tim Purdy) Organization: University Computing Services, U.S.C. Lines: 112 Hi! I posted recently an article about not having certain .h files on our VMS system, which are needed by a UNIX written C program. I thank all who replied, but I think I needed to be more specific. Mind now that I'll probably have to use RMS functions for the following, but I have NO experience programming with these! Well, here goes: -- Our system does not have a times.h file in the syslib. Does any- one know how to extract the user-time and system-time elapsed for a process? Namely I need something that returns from the times structure tms_utime and tms_stime. -- Is there a VMS substitute for the system() function? I need to send mail from a program to a user, UNIX C handles this nicely, but is there someway of doing it on VMS? -- Is there also a substitute for the link() function, something other than access? Our system doesn't seem to support create() either-- which seems to be the closest substitute. -- Can vfork() substitute for fork()? -- Now for a real doozy: there are a few calls made by two programs for the VERY UNIX dependent library function ioctl.h. a) one section of code uses ioctl to flush inputted characters from a buffer, heres the code: char cc; int ic; do /* if keyboard input buffer is too big, flush some of it */ { ioctl(0,FIONREAD,&ic); if (ic>5) read(0,&cc,1); } while (ic>5); The following are the sections of code that ioctl.h references for the above section of code: /* * Ioctl's have the command encoded in the lower word, * and the size of any in or out parameters in the upper * word. The high 2 bits of the upper word are used * to encode the in/out status of the parameter; for now * we restrict parameters to at most 128 bytes. */ #define FIONREAD _IOR(f, 127, int) /* get number of bytes to read */ #define _IOR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y) #define IOCPARM_MASK 0x7f /* parameter must be < 128 bytes */ #define IOC_OUT 0x40000000 /* copy out parameters */ Does anyone have any idea what might be going in the ioctl code? b) The next bit of code is from another program using ioctl.h. Again could anyone give me some insight as to what might be going on? Below is the pertinent code: #ifndef BSD #define CBREAK RAW /* V7 has no CBREAK */ #endif #define doraw(_a) (_a.sg_flags |= CBREAK,_a.sg_flags &= ~ECHO) #define unraw(_a) (_a.sg_flags &= ~CBREAK,_a.sg_flags |= ECHO) static struct sgttyb ttx; /* storage for the tty modes */ /* * scbr() Function to set cbreak -echo for the terminal * * like: system("stty cbreak -echo") */ scbr() { gtty(0,&ttx); doraw(ttx); stty(0,&ttx); } /* * sncbr() Function to set -cbreak echo for the terminal * * like: system("stty -cbreak echo") */ sncbr() { gtty(0,&ttx); unraw(ttx); stty(0,&ttx); } The ioctl.h code is: #define CBREAK 0x00000002 /* half-cooked mode */ #define RAW 0x00000020 /* no i/o processing */ #define _SGTTYB_ struct sgttyb { char sg_ispeed; /* input speed */ char sg_ospeed; /* output speed */ char sg_erase; /* erase character */ char sg_kill; /* kill character */ short sg_flags; /* mode flags */ }; Any clues or ideas will be GREATLY appreciated, mainly 'cause I'm clueless. Thanx in advance! -- Tim Purdy *:^) Arpa: purdy%skat.usc.edu@usc-oberon.arpa Uucp: ihnp4!sdcrdcf!usc-oberon!skat!purdy