Subject: Ultrix compatibility patch: getdirentries(), creat(),
To: None <port-pmax@netbsd.ORG>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: port-pmax
Date: 12/11/1994 17:01:27
The syscall interface for Ultrix and NetBSD's getdirentries() is very
similar; but the Ultrix equivalent of ``struct direct'' has a 16-bit
namelength. In contrast, the NetBSD struct direct has an 8-bit
filetype and an 8-bit name length.  This confuses some Ultrix
binaries.  The following patch changes NetBSD's ultrix compatibility
to use the existing 4.3BSD-compatible compat_43_getdirentries().  The
fix for this is the very last hunk of the following patch.  I really
want to see this hunk installed, because it enables an (old)Ultrix
binary Emacs-18.59 work. (Without this patch, filename completion is
seriously broken.)


Some minor formatting botches are also fixed.  I changed the
documentation-only OBSOL sytem calls to consistently refer to
``7thEdition'' instead of a mix of ``7thEd'' and ``v7''. (Many of them
are probably 6th Edition too, but I think the meaning is clearer if
it's consistent).  These are all in the second hunk, and could be
discarded if someone doesn't like them.

Except, that is, for the one line that reverts to using the
``standard'' NetBSD ioctl(), which is more compatible with Ultrix than
no ioctl() at all.


``|| defined(COMPAT_ULTRIX)'' should probably be added to the relevant
#ifdef's in src/sys/kern/vfs_syscalls.c, too.  (compat_43_getdirentries()
is definitely relevant.)


*** syscalls.master.DIST	Sat Dec  3 03:20:45 1994
--- syscalls.master.dsg	Sun Dec 11 16:27:43 1994
***************
*** 47,54 ****
  4	NOARGS		{ int write(int fd, char *buf, u_int nbyte); }
  5	STD		{ int sun_open(char *path, int flags, int mode); }
  6	NOARGS		{ int close(int fd); }
! 7	UNIMPL	0 old_wait
! 8	STD		{ int sun_creat(char *path, int mode); }
  9	NOARGS		{ int link(char *path, char *link); }
  10	NOARGS		{ int unlink(char *path); }
  11	STD		{ int sun_execv(char *path, char **argp); }
--- 47,54 ----
  4	NOARGS		{ int write(int fd, char *buf, u_int nbyte); }
  5	STD		{ int sun_open(char *path, int flags, int mode); }
  6	NOARGS		{ int close(int fd); }
! 7	UNIMPL		old_wait
! 8	NOARGS		{ int compat_43_creat(char *path, int mode); }
  9	NOARGS		{ int link(char *path, char *link); }
  10	NOARGS		{ int unlink(char *path); }
  11	STD		{ int sun_execv(char *path, char **argp); }
***************
*** 65,104 ****
  22	OBSOL		sun_or_sysV_unmount
  23	NOARGS		{ int setuid(uid_t uid); }
  24	NOARGS		{ uid_t getuid(void); }
! 25	OBSOL		v7 stime
! 26	OBSOL		v7 ptrace
! 27	OBSOL		v7 alarm
! 28	OBSOL		v7 fstat
! 29	OBSOL		v7 pause
! 30	OBSOL		v7 utime
! 31	OBSOL		v7 stty
! 32	OBSOL		v7 gtty
  33	NOARGS		{ int access(char *path, int flags); }
! 34	OBSOL		v7 nice
! 35	OBSOL		v7 ftime
  36	NOARGS		{ int sync(void); }
! 37	NOARGS		{ int kill(int pidd, int signum); }
  38	NOARGS		{ int compat_43_stat(char *path, struct ostat *ub); }
! 39	OBSOL		v7 setpgrp
  40	NOARGS		{ int compat_43_lstat(char *path, struct ostat *ub); }
  41	NOARGS		{ int dup(u_int fd); }
  42	NOARGS		{ int pipe(void); }
! 43	OBSOL		v7 times
  44	NOARGS		{ int profil(caddr_t samples, u_int size, \
  			    u_int offset, u_int scale); }
! 45	UNIMPL	0 nosys
! 46	OBSOL		v7 setgid
  47	NOARGS		{ gid_t getgid(void); }
  48	UNIMPL		sun_ssig
  49	UNIMPL		reserved for USG
  50	UNIMPL		reserved for USG
  51	NOARGS		{ int acct(char *path); }
! 52	UNIMPL	0 nosys
! 53	UNIMPL	0 syslock
! 54	UNIMPL		{ int sunos_ioctl(int fd, u_long com, caddr_t data); }
! 
  55	NOARGS		{ int reboot(int opt); }
! 56	UNIMPL		7thedition  mpxchan
  57	NOARGS		{ int symlink(char *path, char *link); }
  58	NOARGS		{ int readlink(char *path, char *buf, int count); }
  59	NOARGS		{ int execve(char *path, char **argp, char **envp); }
--- 65,103 ----
  22	OBSOL		sun_or_sysV_unmount
  23	NOARGS		{ int setuid(uid_t uid); }
  24	NOARGS		{ uid_t getuid(void); }
! 25	OBSOL		7thEdition stime
! 26	OBSOL		7thEdition ptrace
! 27	OBSOL		7thEdition alarm
! 28	OBSOL		7thEdition fstat
! 29	OBSOL		7thEdition pause
! 30	OBSOL		7thEdition utime
! 31	OBSOL		7thEdition stty
! 32	OBSOL		7thEdition gtty
  33	NOARGS		{ int access(char *path, int flags); }
! 34	OBSOL		7thEdition nice
! 35	OBSOL		7thEdition ftime
  36	NOARGS		{ int sync(void); }
! 37	NOARGS		{ int kill(int pid, int signum); }
  38	NOARGS		{ int compat_43_stat(char *path, struct ostat *ub); }
! 39	OBSOL		7thEdition setpgrp
  40	NOARGS		{ int compat_43_lstat(char *path, struct ostat *ub); }
  41	NOARGS		{ int dup(u_int fd); }
  42	NOARGS		{ int pipe(void); }
! 43	OBSOL		7thEdition times
  44	NOARGS		{ int profil(caddr_t samples, u_int size, \
  			    u_int offset, u_int scale); }
! 45	UNIMPL		nosys
! 46	OBSOL		7thEdition setgid
  47	NOARGS		{ gid_t getgid(void); }
  48	UNIMPL		sun_ssig
  49	UNIMPL		reserved for USG
  50	UNIMPL		reserved for USG
  51	NOARGS		{ int acct(char *path); }
! 52	UNIMPL		nosys
! 53	UNIMPL		syslock
! 54	NOARGS		{ int ioctl(int fd, u_long com, caddr_t data); }
  55	NOARGS		{ int reboot(int opt); }
! 56	UNIMPL		7thEdition mpxchan
  57	NOARGS		{ int symlink(char *path, char *link); }
  58	NOARGS		{ int readlink(char *path, char *buf, int count); }
  59	NOARGS		{ int execve(char *path, char **argp, char **envp); }
***************
*** 220,226 ****
  #else
  158	UNIMPL
  #endif
! 159	NOARGS		{ int getdirentries(int fd, char *buf, u_int count, \
  			    long *basep); }
  160	STD		{ int sun_statfs(char *path, struct sunos_statfs *buf); }
  161	STD		{ int sun_fstatfs(int fd, struct sunos_statfs *buf); }
--- 219,225 ----
  #else
  158	UNIMPL
  #endif
! 159	NOARGS		{ int compat_43_getdirentries(int fd, char *buf, u_int count, \
  			    long *basep); }
  160	STD		{ int sun_statfs(char *path, struct sunos_statfs *buf); }
  161	STD		{ int sun_fstatfs(int fd, struct sunos_statfs *buf); }