whm@bocklin.UUCP (10/24/85)
I recently tried installing IBIS on some Suns with 2.0 and ran into a couple of problems. The most serious problem encountered dealt with reading directories. We don't have the source for 2.0 yet, but from adb it looks like readdir() is essentially just a front-end for getdirentries(). Since it looks like getdirentries was added for the NFS, I elected to ignore it for the moment and just get readdir et. al working based on the sources supplied with IBIS. It turns out that Sun changed the _dirdesc structure described in dir(5) to have some extra fields and also changed the buffer element from char dd_buf[DIRBLKSIZ]; to char *dd_buf; So, when compiling the IBIS code with the Sun header files, dd_buf ends up being a null pointer. I added code to opendir to malloc DIRBLKSIZ bytes and assign the pointer to dd_buf, and code to closedir to free the block. Here are the new versions. /* * open a directory. */ DIR * opendir(name) char *name; { register DIR *dirp; register int fd; if ((fd = open(name, 0)) == -1) return NULL; if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) { close (fd); return NULL; } dirp->dd_fd = fd; dirp->dd_loc = 0; >>#ifdef sun >> if ((dirp->dd_buf = (char *)malloc(DIRBLKSIZ)) == NULL) { >> close (fd); >> return NULL; >> } >>#endif sun return dirp; } /* * close a directory. */ void closedir(dirp) register DIR *dirp; { close(dirp->dd_fd); dirp->dd_fd = -1; dirp->dd_loc = 0; >>#ifdef sun >> free(dirp->dd_buf); >>#endif sun free(dirp); } I hacked the missing definition of DIRBLKSIZ on the Suns by wildly using -DDIRBLKSIZE=512 as needed. This makes things such as ls and "cp -r" work and it also makes getwd() work. (The broken getwd() makes references such as "sunhost:." not work.) rcsh sort of works, but it core dumps a lot. I haven't gotten a chance to investigate this yet and may put it on hold until we get the Sun 2.0 sources. The version of diff supplied with IBIS core dumps on the Suns, but I also found that Sun's diff from 1.1 (source, that is) dumps out even when the IBIS routines are not linked in, so I'm going to wait on the 2.0 source before investigating this further. I'd be interested in hearing from anyone else who has brought up IBIS on 2.0 Suns. I'm particularly interested in hearing from anyone who has gotten rcsh fully working. Bill Mitchell whm%arizona@csnet-relay {ihnp4,noao,mcnc,utah-cs}!arizona!whm