metcalf@masala.lcs.mit.edu (Chris Metcalf) (03/17/91)
This set of patches provides support for HCX/UX 3.0 as an X11 client. There are a few things about HCX/UX that make it a little odd: 1. read() with FNDELAY and no data returns 0, errno 0 2. ffs(0) == -1 instead of 0 (and this one was hard to deduce!) Problem 1 is partially solved with -DSUNSYSV in XlibInt.c, but it turns out that since HCX can *never* distinguish EOF from "no data ready" in NDELAY, one has to turn off NDELAY to do a forced read such as _XRead(). I added this conditionalized on -DBAD_NDELAY. Problem 2 is solved by pulling in just ffs() out of sysV/Berklib.c. HCX also has some System V features layered onto the basic BSDness. In particular, lint and ld don't have quite the usual flags, and it has the SysV-ism of collapsing whitespace with cpp. xload also requires a chunk of mods in get_load.c, as it reads longs from /unix; also, in yet another attempt to be SysV-ish, it forces the user to check *both* type and value for zero in the nlist structure to see if the variable wasn't found. Finally, xman needed a few #ifdefs to support the MacII-like /usr/catman structure (some of the man stuff may be unique to our site). Note that you can build this with gcc if you like; I built gcc under HCX/UX with almost no problems (I had to hack gcc to output a .file directive, but other than that it's been very robust). In any case, use these patches in good health. Chris Metcalf MIT Laboratory for Computer Science *** /dev/null Thu Mar 7 18:25:59 1991 --- config/hcx.cf Thu Mar 7 18:52:11 1991 *************** *** 0 **** --- 1,39 ---- + /* + * SET VERSION NUMBERS BEFORE MAKING MAKEFILES + */ + + #define OSName HCX/UX3.0 + #define OSMajorVersion 3 + #define OSMinorVersion 0 + + /**/# operating system: OSName + + /***************************************************************************** + * Platform-specfic parameters * + *****************************************************************************/ + + /* If we feel like it. No big deal. */ + #define HasGcc NO + + /* Might as well. */ + #define StripInstalledPrograms YES + + /* read() returns 0 in nonblocking mode when no data is available... */ + /* note that -DSUNSYSV helps but not enough; we *never* see an EOF that way */ + #define ConnectionFlags -DTCPCONN -DUNIXCONN -DBAD_NDELAY + + /* ffs() returns -1 instead of 0 when passed a 0. So we just arrange + to use the X11 System V Berklib library, but we have added an #ifdef + on "hcx" to it so we only use it for ffs() */ + #define NeedBerklibInXlib YES + + /* we do have some goodies in our libc.a */ + #define HasPutenv YES + #define HasBsearch YES + #define HasNdbm YES + + /* HCX lint is very SysV-ish */ + #define LintLibFlag -o + #define LintOpts -ax + + /* ld doesn't understand the -X option */ + #define LdCombineFlags -r *** /tmp/,RCSt1023823 Thu Mar 7 19:51:02 1991 --- config/imakemdep.h Mon Mar 4 23:12:07 1991 *************** *** 66,72 **** * all colons). One way to tell if you need this is to see whether or not * your Makefiles have no tabs in them and lots of @@ strings. */ ! #if defined(sun) || defined(SYSV) #define FIXUP_CPP_WHITESPACE #endif --- 66,72 ---- * all colons). One way to tell if you need this is to see whether or not * your Makefiles have no tabs in them and lots of @@ strings. */ ! #if defined(sun) || defined(hcx) || defined(SYSV) #define FIXUP_CPP_WHITESPACE #endif *************** *** 214,219 **** --- 214,222 ---- #endif #ifdef CMU {"CMU", "1"}, + #endif + #ifdef hcx + {"hcx", "1"}, #endif /* add any additional symbols before this line */ {NULL, NULL} *** /tmp/,RCSt1023832 Thu Mar 7 19:51:15 1991 --- config/Imake.tmpl Tue Mar 5 01:57:04 1991 *************** *** 65,70 **** --- 65,77 ---- #define VaxArchitecture #endif + #ifdef hcx + #define MacroIncludeFile <hcx.cf> + #define MacroFile hcx.cf + #undef hcx + #define HcxArchitecture + #endif + #ifdef sun #define MacroIncludeFile <sun.cf> #define MacroFile sun.cf *** /tmp/,RCSt1a01932 Fri Mar 8 00:15:44 1991 --- lib/X/XlibInt.c Thu Mar 7 23:47:25 1991 *************** *** 77,83 **** --- 77,91 ---- */ while (size) { errno = 0; + #ifdef BAD_NDELAY + if (fcntl(dpy->fd, F_SETFL, 0)) + perror("clear NDELAY"); + #endif BAD_NDELAY write_stat = WriteToServer(dpy->fd, bufindex, (int) todo); + #ifdef BAD_NDELAY + if (fcntl(dpy->fd, F_SETFL, O_NDELAY)) + perror("set NDELAY"); + #endif BAD_NDELAY if (write_stat >= 0) { size -= write_stat; todo = size; *************** *** 209,217 **** --- 217,233 ---- if ((dpy->flags & XlibDisplayIOError) || size == 0) return; errno = 0; + #ifdef BAD_NDELAY + if (fcntl(dpy->fd, F_SETFL, 0)) + perror("clear NDELAY"); + #endif BAD_NDELAY while ((bytes_read = ReadFromServer(dpy->fd, data, (int)size)) != size) { + #ifdef BAD_NDELAY + if (fcntl(dpy->fd, F_SETFL, O_NDELAY)) + perror("set NDELAY"); + #endif BAD_NDELAY if (bytes_read > 0) { size -= bytes_read; data += bytes_read; *************** *** 394,402 **** --- 410,426 ---- return; } #endif + #ifdef BAD_NDELAY + if (fcntl(dpy->fd, F_SETFL, 0)) + perror("clear NDELAY"); + #endif BAD_NDELAY errno = 0; while ((bytes_read = ReadvFromServer (dpy->fd, iov, 2)) != size) { + #ifdef BAD_NDELAY + if (fcntl(dpy->fd, F_SETFL, O_NDELAY)) + perror("set NDELAY"); + #endif BAD_NDELAY if (bytes_read > 0) { size -= bytes_read; if ((iov[0].iov_len -= bytes_read) < 0) { *************** *** 503,509 **** InsertIOV (pad, padsize) errno = 0; ! if ((len = WritevToServer(dpy->fd, iov, i)) >= 0) { skip += len; total -= len; todo = total; --- 527,542 ---- InsertIOV (pad, padsize) errno = 0; ! #ifdef BAD_NDELAY ! if (fcntl(dpy->fd, F_SETFL, 0)) ! perror("clear NDELAY"); ! #endif BAD_NDELAY ! len = WritevToServer(dpy->fd, iov, i); ! #ifdef BAD_NDELAY ! if (fcntl(dpy->fd, F_SETFL, O_NDELAY)) ! perror("set NDELAY"); ! #endif BAD_NDELAY ! if (len >= 0) { skip += len; total -= len; todo = total; *** /tmp/,RCSt1023892 Thu Mar 7 19:56:29 1991 --- lib/X/sysV/Berklib.c Thu Mar 7 18:43:34 1991 *************** *** 11,16 **** --- 11,19 ---- * included so that some clients can compile. */ + /* All HCX/UX needs out of this file is ffs() */ + #ifndef hcx + bcopy (b1, b2, length) register unsigned char *b1, *b2; register length; *************** *** 48,53 **** --- 51,57 ---- } } + #endif /* Find the first set bit * i.e. least signifigant 1 bit: *************** *** 73,78 **** --- 77,84 ---- return i; } + #ifndef hcx + char * index (s, c) char *s, c; *************** *** 221,224 **** --- 227,231 ---- ); } } + #endif #endif *** /tmp/,RCSt1023841 Thu Mar 7 19:51:37 1991 --- clients/xload/get_load.c Thu Mar 7 19:11:53 1991 *************** *** 95,100 **** --- 95,104 ---- }; #endif /* macII */ + #ifdef hcx + #include <sys/param.h> + #endif /* hcx */ + #if defined(UTEK) || defined(alliant) #define FSCALE 100.0 #endif *************** *** 232,237 **** --- 236,245 ---- #define KERNEL_FILE "/dynix" #endif /* sequent */ + #ifdef hcx + #define KERNEL_FILE "/unix" + #endif /* hcx */ + /* * provide default for everyone else */ *************** *** 357,363 **** --- 365,375 ---- * will happen to you. (I have a hard time believing the value will * ever really be zero anyway). CDP 5/17/89. */ + #ifdef hcx + if (namelist[LOADAV].n_type == 0 && + #else if (namelist[LOADAV].n_type == 0 || + #endif /* hcx */ namelist[LOADAV].n_value == 0) { xload_error("cannot get name list from", KERNEL_FILE); exit(-1); *************** *** 379,385 **** (void) lseek(kmem, loadavg_seek, 0); #endif /* macII */ ! #if defined(sun) || defined (UTEK) || defined(sequent) || defined(alliant) { long temp; (void) read(kmem, (char *)&temp, sizeof(long)); --- 391,397 ---- (void) lseek(kmem, loadavg_seek, 0); #endif /* macII */ ! #if defined(sun) || defined (UTEK) || defined(sequent) || defined(alliant) || defined(hcx) { long temp; (void) read(kmem, (char *)&temp, sizeof(long)); *** /tmp/,RCSt1a01695 Thu Mar 7 21:18:20 1991 --- clients/xman/defs.h Thu Mar 7 21:06:41 1991 *************** *** 86,92 **** * The command filters for the manual and apropos searches. */ ! #if ( defined(hpux) || defined(macII) || defined(CRAY) ) # define NO_MANPATH_SUPPORT #endif --- 86,92 ---- * The command filters for the manual and apropos searches. */ ! #if ( defined(hpux) || defined(macII) || defined(CRAY) || defined(hcx) ) # define NO_MANPATH_SUPPORT #endif *************** *** 118,126 **** #define MAN "man" ! #if ( defined(macII) || defined(CRAY) ) /* ! * The Apple and Cray folks put the preformatted pages in the "man" * directories, what a bunch of BOZOs. */ # define CAT MAN --- 118,126 ---- #define MAN "man" ! #if ( defined(macII) || defined(CRAY) || defined(hcx) ) /* ! * The Apple, Cray, and HCX folks put the preformatted pages in the "man" * directories, what a bunch of BOZOs. */ # define CAT MAN *************** *** 161,168 **** --- 161,172 ---- #ifdef macII # define MANDIR "/usr/catman/u_man:/usr/catman/a_man" #else + #ifdef hcx + # define MANDIR "/usr/catman/local_man:/usr/catman/u_man:/usr/catman/a_man:/usr/catman/p_man:/usr/catman/ada_man" + #else # define MANDIR "/usr/man" #endif + #endif #define INDENT 15 #define TYP20STR "MMMMMMMMMMMMMMMMMMMM" *************** *** 175,181 **** * Compression Definitions. */ ! #if defined( macII ) # define COMPRESSION_EXTENSION "z" # define UNCOMPRESS_FORMAT "pcat %s > %s" # define NO_COMPRESS /* mac can't handle using pack as a filter and --- 179,185 ---- * Compression Definitions. */ ! #if defined( macII ) || defined( hcx ) # define COMPRESSION_EXTENSION "z" # define UNCOMPRESS_FORMAT "pcat %s > %s" # define NO_COMPRESS /* mac can't handle using pack as a filter and