kern/73165: getting rid of COMPAT_43 dependancy

Divacky Roman xdivac02 at stud.fit.vutbr.cz
Wed Oct 27 00:20:19 PDT 2004


The following reply was made to PR kern/73165; it has been noted by GNATS.

From: Divacky Roman <xdivac02 at stud.fit.vutbr.cz>
To: freebsd-gnats-submit at FreeBSD.org
Cc:  
Subject: Re: kern/73165: getting rid of COMPAT_43 dependancy
Date: Wed, 27 Oct 2004 09:18:33 +0200

 sorry for messing... I include the patch once more (the previous one was
 distorted by mozilla mailer), you can also get the mail on:
 hysteria.sk/~neologism/comp.patch
 
 diff -urN /sys/compat/linux/linux_socket.c src/compat/linux/linux_socket.c
 --- sys/compat/linux/linux_socket.c	Tue Aug 24 22:21:21 2004
 +++ sys/compat/linux/linux_socket.c	Wed Oct 27 08:45:35 2004
 @@ -33,8 +33,8 @@
  #include "opt_compat.h"
  #include "opt_inet6.h"
  
 -#ifndef COMPAT_43
 -#error "Unable to compile Linux-emulator due to missing COMPAT_43 option!"
 +#ifndef COMPAT_43FORLIN
 +#error "Unable to compile Linux-emulator due to missing COMPAT_43FORLIN option!"
  #endif
  
  #include <sys/param.h>
 diff -urN /sys/conf/options src/conf/options
 --- sys/conf/options	Thu Sep 23 10:34:50 2004
 +++ sys/conf/options	Wed Oct 27 08:45:35 2004
 @@ -62,6 +62,7 @@
  CODA_COMPAT_5	opt_coda.h
  COMPAT_43	opt_compat.h
  COMPAT_FREEBSD4	opt_compat.h
 +COMPAT_43FORLIN	opt_compat.h
  COMPILING_LINT	opt_global.h
  CONSPEED	opt_comconsole.h
  CY_PCI_FASTINTR
 diff -urN /sys/i386/linux/linux_sysvec.c src/i386/linux/linux_sysvec.c
 --- sys/i386/linux/linux_sysvec.c	Thu Jul 15 10:26:05 2004
 +++ sys/i386/linux/linux_sysvec.c	Wed Oct 27 08:45:35 2004
 @@ -32,8 +32,8 @@
  /* XXX we use functions that might not exist. */
  #include "opt_compat.h"
  
 -#ifndef COMPAT_43
 -#error "Unable to compile Linux-emulator due to missing COMPAT_43 option!"
 +#ifndef COMPAT_43FORLIN
 +#error "Unable to compile Linux-emulator due to missing COMPAT_43FORLIN option!"
  #endif
  
  #include <sys/param.h>
 diff -urN /sys/kern/kern_xxx.c src/kern/kern_xxx.c
 --- sys/kern/kern_xxx.c	Fri Oct 22 14:10:50 2004
 +++ sys/kern/kern_xxx.c	Wed Oct 27 08:45:35 2004
 @@ -74,7 +74,9 @@
  	mtx_unlock(&Giant);
  	return(error);
  }
 +#endif /* COMPAT_43 */
  
 +#if defined(COMPAT_43) || defined(COMPAT_43FORLIN)
  #ifndef _SYS_SYSPROTO_H_
  struct sethostname_args {
  	char	*hostname;
 @@ -101,7 +103,9 @@
  	mtx_unlock(&Giant);
  	return (error);
  }
 +#endif /* COMPAT_43 || COMPAT_43FORLIN */
  
 +#ifdef COMPAT_43
  #ifndef _SYS_SYSPROTO_H_
  struct ogethostid_args {
  	int	dummy;
 @@ -120,9 +124,7 @@
  	*(long *)(td->td_retval) = hostid;
  	return (0);
  }
 -#endif /* COMPAT_43 */
  
 -#ifdef COMPAT_43
  #ifndef _SYS_SYSPROTO_H_
  struct osethostid_args {
  	long	hostid;
 diff -urN /sys/kern/uipc_syscalls.c src/kern/uipc_syscalls.c
 --- sys/kern/uipc_syscalls.c	Mon Oct 25 01:45:01 2004
 +++ sys/kern/uipc_syscalls.c	Wed Oct 27 08:46:00 2004
 @@ -137,7 +137,7 @@
  /*
   * System call interface to the socket abstraction.
   */
 -#if defined(COMPAT_43)
 +#if defined(COMPAT_43) || defined(COMPAT_43FORLIN)
  #define COMPAT_OLDSOCK
  #endif
  
 diff -urN /sys/kern/vfs_syscalls.c src/kern/vfs_syscalls.c
 --- sys/kern/vfs_syscalls.c	Mon Jul 26 09:24:03 2004
 +++ sys/kern/vfs_syscalls.c	Wed Oct 27 08:45:35 2004
 @@ -1898,7 +1898,7 @@
  	return (error);
  }
  
 -#if defined(COMPAT_43)
 +#if defined(COMPAT_43) || defined(COMPAT_43FORLIN)
  /*
   * Get file status; this version follows links.
   */
 @@ -1934,7 +1934,38 @@
  	error = copyout(&osb, uap->ub, sizeof (osb));
  	return (error);
  }
 +/*
 + * Convert from an old to a new stat structure.
 + */
 +void
 +cvtstat(st, ost)
 +	struct stat *st;
 +	struct ostat *ost;
 +{
 +
 +	ost->st_dev = st->st_dev;
 +	ost->st_ino = st->st_ino;
 +	ost->st_mode = st->st_mode;
 +	ost->st_nlink = st->st_nlink;
 +	ost->st_uid = st->st_uid;
 +	ost->st_gid = st->st_gid;
 +	ost->st_rdev = st->st_rdev;
 +	if (st->st_size < (quad_t)1 << 32)
 +		ost->st_size = st->st_size;
 +	else
 +		ost->st_size = -2;
 +	ost->st_atime = st->st_atime;
 +	ost->st_mtime = st->st_mtime;
 +	ost->st_ctime = st->st_ctime;
 +	ost->st_blksize = st->st_blksize;
 +	ost->st_blocks = st->st_blocks;
 +	ost->st_flags = st->st_flags;
 +	ost->st_gen = st->st_gen;
 +}
 +
 +#endif /* COMPAT_43 || COMPAT_43FORLIN */
  
 +#ifdef COMPAT_43
  /*
   * Get file status; this version does not follow links.
   */
 @@ -1973,34 +2004,6 @@
  	return (error);
  }
  
 -/*
 - * Convert from an old to a new stat structure.
 - */
 -void
 -cvtstat(st, ost)
 -	struct stat *st;
 -	struct ostat *ost;
 -{
 -
 -	ost->st_dev = st->st_dev;
 -	ost->st_ino = st->st_ino;
 -	ost->st_mode = st->st_mode;
 -	ost->st_nlink = st->st_nlink;
 -	ost->st_uid = st->st_uid;
 -	ost->st_gid = st->st_gid;
 -	ost->st_rdev = st->st_rdev;
 -	if (st->st_size < (quad_t)1 << 32)
 -		ost->st_size = st->st_size;
 -	else
 -		ost->st_size = -2;
 -	ost->st_atime = st->st_atime;
 -	ost->st_mtime = st->st_mtime;
 -	ost->st_ctime = st->st_ctime;
 -	ost->st_blksize = st->st_blksize;
 -	ost->st_blocks = st->st_blocks;
 -	ost->st_flags = st->st_flags;
 -	ost->st_gen = st->st_gen;
 -}
  #endif /* COMPAT_43 */
  
  /*
 @@ -3003,7 +3006,9 @@
  	nuap.length = uap->length;
  	return (truncate(td, &nuap));
  }
 +#endif /* COMPAT_43 */
  
 +#if defined(COMPAT_43) || defined(COMPAT_43FORLIN)
  /*
   * Truncate a file given a file descriptor.
   */
 @@ -3031,7 +3036,7 @@
  	nuap.length = uap->length;
  	return (ftruncate(td, &nuap));
  }
 -#endif /* COMPAT_43 */
 +#endif /* COMPAT_43 || COMPAT_43FORLIN */
  
  /*
   * Sync an open file.
 diff -urN /sys/modules/linux/Makefile src/modules/linux/Makefile
 --- sys/modules/linux/Makefile	Wed Nov 19 06:08:26 2003
 +++ sys/modules/linux/Makefile	Wed Oct 27 08:45:35 2004
 @@ -39,9 +39,6 @@
  linux_genassym.o: linux_genassym.c linux.h @ machine
  	${CC} -c ${CFLAGS:N-fno-common} ${.IMPSRC}
  
 -opt_compat.h:
 -	echo "#define COMPAT_43 1" > opt_compat.h
 -
  opt_inet6.h:
  	echo "#define INET6 1" > opt_inet6.h
  
 diff -urN /sys/sys/sysproto.h src/sys/sysproto.h
 --- sys/sys/sysproto.h	Sat Oct 23 22:01:32 2004
 +++ sys/sys/sysproto.h	Wed Oct 27 08:45:35 2004
 @@ -1655,10 +1655,6 @@
  	char offset_l_[PADL_(long)]; long offset; char offset_r_[PADR_(long)];
  	char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];
  };
 -struct ostat_args {
 -	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
 -	char ub_l_[PADL_(struct ostat *)]; struct ostat * ub; char ub_r_[PADR_(struct ostat *)];
 -};
  struct olstat_args {
  	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
  	char ub_l_[PADL_(struct ostat *)]; struct ostat * ub; char ub_r_[PADR_(struct ostat *)];
 @@ -1694,10 +1690,17 @@
  	char hostname_l_[PADL_(char *)]; char * hostname; char hostname_r_[PADR_(char *)];
  	char len_l_[PADL_(u_int)]; u_int len; char len_r_[PADR_(u_int)];
  };
 +#endif	/* COMPAT_43 */
 +#if defined(COMPAT_43) || defined(COMPAT_43FORLIN)
  struct sethostname_args {
  	char hostname_l_[PADL_(char *)]; char * hostname; char hostname_r_[PADR_(char *)];
  	char len_l_[PADL_(u_int)]; u_int len; char len_r_[PADR_(u_int)];
  };
 +
 +struct ostat_args {
 +	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
 +	char ub_l_[PADL_(struct ostat *)]; struct ostat * ub; char ub_r_[PADR_(struct ostat *)];
 +};
  struct osend_args {
  	char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
  	char buf_l_[PADL_(caddr_t)]; caddr_t buf; char buf_r_[PADR_(caddr_t)];
 @@ -1710,9 +1713,34 @@
  	char len_l_[PADL_(int)]; int len; char len_r_[PADR_(int)];
  	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
  };
 +struct orecvmsg_args {
 +	char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
 +	char msg_l_[PADL_(struct omsghdr *)]; struct omsghdr * msg; char msg_r_[PADR_(struct omsghdr *)];
 +	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
 +};
 +struct osendmsg_args {
 +	char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
 +	char msg_l_[PADL_(caddr_t)]; caddr_t msg; char msg_r_[PADR_(caddr_t)];
 +	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
 +};
 +struct ogetpeername_args {
 +	char fdes_l_[PADL_(int)]; int fdes; char fdes_r_[PADR_(int)];
 +	char asa_l_[PADL_(caddr_t)]; caddr_t asa; char asa_r_[PADR_(caddr_t)];
 +	char alen_l_[PADL_(int *)]; int * alen; char alen_r_[PADR_(int *)];
 +};
 +struct oftruncate_args {
 +	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
 +	char length_l_[PADL_(long)]; long length; char length_r_[PADR_(long)];
 +};
 +#endif /* COMPAT_43 || COMPAT_43FORLIN */
 +#ifdef COMPAT_43
  struct osigreturn_args {
  	char sigcntxp_l_[PADL_(struct osigcontext *)]; struct osigcontext * sigcntxp; char sigcntxp_r_[PADR_(struct osigcontext *)];
  };
 +struct osigstack_args {
 +	char nss_l_[PADL_(struct sigstack *)]; struct sigstack * nss; char nss_r_[PADR_(struct sigstack *)];
 +	char oss_l_[PADL_(struct sigstack *)]; struct sigstack * oss; char oss_r_[PADR_(struct sigstack *)];
 +};
  struct osigvec_args {
  	char signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)];
  	char nsv_l_[PADL_(struct sigvec *)]; struct sigvec * nsv; char nsv_r_[PADR_(struct sigvec *)];
 @@ -1725,35 +1753,14 @@
  	char mask_l_[PADL_(int)]; int mask; char mask_r_[PADR_(int)];
  };
  struct osigsuspend_args {
 -	char mask_l_[PADL_(osigset_t)]; osigset_t mask; char mask_r_[PADR_(osigset_t)];
 -};
 -struct osigstack_args {
 -	char nss_l_[PADL_(struct sigstack *)]; struct sigstack * nss; char nss_r_[PADR_(struct sigstack *)];
 -	char oss_l_[PADL_(struct sigstack *)]; struct sigstack * oss; char oss_r_[PADR_(struct sigstack *)];
 -};
 -struct orecvmsg_args {
 -	char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
 -	char msg_l_[PADL_(struct omsghdr *)]; struct omsghdr * msg; char msg_r_[PADR_(struct omsghdr *)];
 -	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
 -};
 -struct osendmsg_args {
 -	char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
 -	char msg_l_[PADL_(caddr_t)]; caddr_t msg; char msg_r_[PADR_(caddr_t)];
 -	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
 +	char mask_l_[PADL_(osigset_t)]; 
 +	osigset_t mask; 
 +	char mask_r_[PADR_(osigset_t)];
  };
  struct otruncate_args {
  	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
  	char length_l_[PADL_(long)]; long length; char length_r_[PADR_(long)];
  };
 -struct oftruncate_args {
 -	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
 -	char length_l_[PADL_(long)]; long length; char length_r_[PADR_(long)];
 -};
 -struct ogetpeername_args {
 -	char fdes_l_[PADL_(int)]; int fdes; char fdes_r_[PADR_(int)];
 -	char asa_l_[PADL_(caddr_t)]; caddr_t asa; char asa_r_[PADR_(caddr_t)];
 -	char alen_l_[PADL_(int *)]; int * alen; char alen_r_[PADR_(int *)];
 -};
  struct osethostid_args {
  	char hostid_l_[PADL_(long)]; long hostid; char hostid_r_[PADR_(long)];
  };
 @@ -1777,7 +1784,6 @@
  };
  int	ocreat(struct thread *, struct ocreat_args *);
  int	olseek(struct thread *, struct olseek_args *);
 -int	ostat(struct thread *, struct ostat_args *);
  int	olstat(struct thread *, struct olstat_args *);
  int	osigaction(struct thread *, struct osigaction_args *);
  int	osigprocmask(struct thread *, struct osigprocmask_args *);
 @@ -1788,31 +1794,35 @@
  int	ommap(struct thread *, struct ommap_args *);
  int	owait(struct thread *, struct owait_args *);
  int	ogethostname(struct thread *, struct gethostname_args *);
 -int	osethostname(struct thread *, struct sethostname_args *);
 +#endif	/* COMPAT_43 */
 +#if defined(COMPAT_43) || defined(COMPAT_43FORLIN)
  int	oaccept(struct thread *, struct accept_args *);
 -int	osend(struct thread *, struct osend_args *);
 +int	oftruncate(struct thread *, struct oftruncate_args *);
 +int	ogetpeername(struct thread *, struct ogetpeername_args *);
 +int	ogetsockname(struct thread *, struct getsockname_args *);
  int	orecv(struct thread *, struct orecv_args *);
 +int	orecvfrom(struct thread *, struct recvfrom_args *);
 +int	orecvmsg(struct thread *, struct orecvmsg_args *);
 +int	osend(struct thread *, struct osend_args *);
 +int	osendmsg(struct thread *, struct osendmsg_args *);
 +int	osethostname(struct thread *, struct sethostname_args *);
 +int	ostat(struct thread *, struct ostat_args *);
 +#endif /* COMPAT_43 || COMPAT_43FORLIN */
 +#ifdef COMPAT_43
  int	osigreturn(struct thread *, struct osigreturn_args *);
  int	osigvec(struct thread *, struct osigvec_args *);
  int	osigblock(struct thread *, struct osigblock_args *);
  int	osigsetmask(struct thread *, struct osigsetmask_args *);
  int	osigsuspend(struct thread *, struct osigsuspend_args *);
  int	osigstack(struct thread *, struct osigstack_args *);
 -int	orecvmsg(struct thread *, struct orecvmsg_args *);
 -int	osendmsg(struct thread *, struct osendmsg_args *);
 -int	orecvfrom(struct thread *, struct recvfrom_args *);
  int	otruncate(struct thread *, struct otruncate_args *);
 -int	oftruncate(struct thread *, struct oftruncate_args *);
 -int	ogetpeername(struct thread *, struct ogetpeername_args *);
  int	ogethostid(struct thread *, struct ogethostid_args *);
  int	osethostid(struct thread *, struct osethostid_args *);
  int	ogetrlimit(struct thread *, struct ogetrlimit_args *);
  int	osetrlimit(struct thread *, struct osetrlimit_args *);
  int	okillpg(struct thread *, struct okillpg_args *);
  int	oquota(struct thread *, struct oquota_args *);
 -int	ogetsockname(struct thread *, struct getsockname_args *);
  int	ogetdirentries(struct thread *, struct ogetdirentries_args *);
 -
  #endif /* COMPAT_43 */
  
  


More information about the freebsd-bugs mailing list