From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 19 22:42:38 2005 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9034016A420 for ; Mon, 19 Dec 2005 22:42:38 +0000 (GMT) (envelope-from apelisse@gmail.com) Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8CB7343D8B for ; Mon, 19 Dec 2005 22:42:15 +0000 (GMT) (envelope-from apelisse@gmail.com) Received: by nproxy.gmail.com with SMTP id l35so406306nfa for ; Mon, 19 Dec 2005 14:42:13 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=cYo1gKThUJTbtgtpGg/7zuuqIllTApuEPeh1MoDan6prLLa0GClEUtAODrhJQsqXwKruu99Q0Eb+iTsU/9yLPf2rAnr3MJmSv7E7ay+SzF+fmSOezyGs3hoKHeRlMnuSDmfyM+6fh4aYIwMwg0h+N5GsncMBdANjpKdf7SgWmvM= Received: by 10.48.254.11 with SMTP id b11mr281963nfi; Mon, 19 Dec 2005 14:42:13 -0800 (PST) Received: by 10.48.30.15 with HTTP; Mon, 19 Dec 2005 14:42:13 -0800 (PST) Message-ID: <61c746830512191442y16277c71ob7cda1c4958cd1e1@mail.gmail.com> Date: Mon, 19 Dec 2005 23:42:13 +0100 From: Antoine Pelisse To: Vladimir Kushnir In-Reply-To: <200509030220.18239.vkushnir@i.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_26700_12188695.1135032133250" References: <20050903004621.L1919@kushnir1.kiev.ua> <1125699211.808.9.camel@synergy.charterpipeline.net.lan> <200509030220.18239.vkushnir@i.kiev.ua> X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: hackers@freebsd.org, Pascal Hofstee Subject: Re: libmap.conf: mapping directories? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2005 22:42:38 -0000 ------=_Part_26700_12188695.1135032133250 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline The patch attached is implementing a freebsd32 prefix thing like we do for the linux compatibility. It would be nice if you could try it and report me any errors or bugs you may find. The patch is meant to be applied against current and might work on the 6- branch. It won't be enough and some file-moving would be needed to make it work correctly as there is still nothing in the /compat/ia32 directory afaik. I mean that it would be interesting to move the freebsd32 libs and other compatibility files in that folder. Best Regards, Antoine ------=_Part_26700_12188695.1135032133250 Content-Type: application/octet-stream; name=freebsd32prefix-current.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="freebsd32prefix-current.patch" diff -ru sys.old/compat/freebsd32/freebsd32_file.c sys/compat/freebsd32/freebsd32_file.c --- sys.old/compat/freebsd32/freebsd32_file.c Mon Dec 19 23:15:56 2005 +++ sys/compat/freebsd32/freebsd32_file.c Fri Dec 9 21:37:03 2005 @@ -0,0 +1,268 @@ +/*- + * Copyright (c) 2005 Antoine Pelisse + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include + +#include "opt_compat.h" + +#include +#include +#include + +#include +#include +#include + +int +freebsd32_open(struct thread *td, struct freebsd32_open_args *args) +{ + int error; + char *path; + + if (args->flags & O_CREAT) + CONVPATHCREAT(td, args->path, &path); + else + CONVPATHEXIST(td, args->path, &path); + + error = kern_open(td, path, UIO_SYSSPACE, args->flags, args->mode); + FREEPATH(path); + return (error); +} + +int +freebsd32_access(struct thread *td, struct freebsd32_access_args *args) +{ + int error; + char *path; + + CONVPATHEXIST(td, args->path, &path); + + error = kern_access(td, path, UIO_SYSSPACE, args->flags); + FREEPATH(path); + return (error); +} + +int +freebsd32_eaccess(struct thread *td, struct freebsd32_eaccess_args *args) +{ + int error; + char *path; + + CONVPATHEXIST(td, args->path, &path); + + error = kern_eaccess(td, path, UIO_SYSSPACE, args->flags); + FREEPATH(path); + return (error); +} + +int +freebsd32_unlink(struct thread *td, struct freebsd32_unlink_args *args) +{ + int error; + char *path; + + CONVPATHEXIST(td, args->path, &path); + + error = kern_unlink(td, path, UIO_SYSSPACE); + FREEPATH(path); + return (error); +} + +int +freebsd32_chdir(struct thread *td, struct freebsd32_chdir_args *args) +{ + int error; + char *path; + + CONVPATHEXIST(td, args->path, &path); + + error = kern_chdir(td, path, UIO_SYSSPACE); + FREEPATH(path); + return (error); +} + +int +freebsd32_chmod(struct thread *td, struct freebsd32_chmod_args *args) +{ + int error; + char *path; + + CONVPATHEXIST(td, args->path, &path); + + error = kern_chmod(td, path, UIO_SYSSPACE, args->mode); + FREEPATH(path); + return (error); +} + +int +freebsd32_lchmod(struct thread *td, struct freebsd32_lchmod_args *args) +{ + int error; + char *path; + + CONVPATHEXIST(td, args->path, &path); + + error = kern_lchmod(td, path, UIO_SYSSPACE, args->mode); + FREEPATH(path); + return (error); +} + +int +freebsd32_mknod(struct thread *td, struct freebsd32_mknod_args *args) +{ + int error; + char *path; + + CONVPATHCREAT(td, args->path, &path); + + error = kern_mknod(td, path, UIO_SYSSPACE, args->mode, args->dev); + FREEPATH(path); + return (error); +} + +int +freebsd32_mkdir(struct thread *td, struct freebsd32_mkdir_args *args) +{ + int error; + char *path; + + CONVPATHCREAT(td, args->path, &path); + + error = kern_mkdir(td, path, UIO_SYSSPACE, args->mode); + FREEPATH(path); + return (error); +} + +int +freebsd32_rmdir(struct thread *td, struct freebsd32_rmdir_args *args) +{ + int error; + char *path; + + CONVPATHEXIST(td, args->path, &path); + + error = kern_rmdir(td, path, UIO_SYSSPACE); + FREEPATH(path); + return (error); +} + +int +freebsd32_rename(struct thread *td, struct freebsd32_rename_args *args) +{ + int error; + char *frompath, *topath; + + CONVPATHEXIST(td, args->from, &frompath); + error = freebsd32_convpath(td, args->to, UIO_USERSPACE, &topath, 1); + if (topath == NULL) { + FREEPATH(frompath); + return (error); + } + + error = kern_rename(td, frompath, topath, UIO_SYSSPACE); + FREEPATH(frompath); + FREEPATH(topath); + return (error); +} + +int +freebsd32_symlink(struct thread *td, struct freebsd32_symlink_args *args) +{ + int error; + char *path, *link; + + CONVPATHEXIST(td, args->path, &path); + error = freebsd32_convpath(td, args->link, UIO_USERSPACE, &link, 1); + if (link == NULL) { + FREEPATH(path); + return (error); + } + + error = kern_symlink(td, path, link, UIO_SYSSPACE); + FREEPATH(path); + FREEPATH(link); + return (error); +} + +int +freebsd32_readlink(struct thread *td, struct freebsd32_readlink_args *args) +{ + int error; + char *path; + + CONVPATHEXIST(td, args->path, &path); + + error = kern_readlink(td, path, UIO_SYSSPACE, args->buf, UIO_USERSPACE, + args->count); + FREEPATH(path); + return (error); +} + +int +freebsd32_link(struct thread *td, struct freebsd32_link_args *args) +{ + int error; + char *path, *link; + + CONVPATHEXIST(td, args->path, &path); + error = freebsd32_convpath(td, args->link, UIO_USERSPACE, &link, 1); + if (link == NULL) { + FREEPATH(path); + return (error); + } + + error = kern_link(td, path, link, UIO_SYSSPACE); + FREEPATH(path); + FREEPATH(link); + return (error); +} + +int +freebsd32_chown(struct thread *td, struct freebsd32_chown_args *args) +{ + int error; + char *path; + + CONVPATHEXIST(td, args->path, &path); + + error = kern_chown(td, path, UIO_SYSSPACE, args->uid, args->gid); + FREEPATH(path); + return (error); +} + +int +freebsd32_lchown(struct thread *td, struct freebsd32_lchown_args *args) +{ + int error; + char *path; + + CONVPATHEXIST(td, args->path, &path); + + error = kern_lchown(td, path, UIO_SYSSPACE, args->uid, args->gid); + FREEPATH(path); + return (error); +} diff -ru sys.old/compat/freebsd32/freebsd32_misc.c sys/compat/freebsd32/freebsd32_misc.c --- sys.old/compat/freebsd32/freebsd32_misc.c Mon Dec 19 23:15:56 2005 +++ sys/compat/freebsd32/freebsd32_misc.c Fri Dec 9 21:37:03 2005 @@ -1205,6 +1205,9 @@ struct timeval32 s32[2]; struct timeval s[2], *sp; int error; + char *path; + + CONVPATHEXIST(td, uap->path, &path); if (uap->tptr != NULL) { error = copyin(uap->tptr, s32, sizeof(s32)); @@ -1217,7 +1220,10 @@ sp = s; } else sp = NULL; - return (kern_utimes(td, uap->path, UIO_USERSPACE, sp, UIO_SYSSPACE)); + + error = kern_utimes(td, path, UIO_SYSSPACE, sp, UIO_SYSSPACE); + FREEPATH(path); + return (error); } int @@ -1274,8 +1280,12 @@ struct statfs32 s32; struct statfs s; int error; + char *path; - error = kern_statfs(td, uap->path, UIO_USERSPACE, &s); + CONVPATHEXIST(td, uap->path, &path); + + error = kern_statfs(td, path, UIO_SYSSPACE, &s); + FREEPATH(path); if (error) return (error); copy_statfs(&s, &s32); @@ -1390,11 +1400,15 @@ int freebsd32_truncate(struct thread *td, struct freebsd32_truncate_args *uap) { - struct truncate_args ap; + int error; + char *path; - ap.path = uap->path; - ap.length = (uap->lengthlo | ((off_t)uap->lengthhi << 32)); - return (truncate(td, &ap)); + CONVPATHEXIST(td, uap->path, &path); + + error = kern_truncate(td, path, UIO_SYSSPACE, + (uap->lengthlo | ((off_t)uap->lengthhi << 32))); + FREEPATH(path); + return (error); } int @@ -1490,8 +1504,12 @@ struct stat sb; struct stat32 sb32; int error; + char *path; - error = kern_stat(td, uap->path, UIO_USERSPACE, &sb); + CONVPATHEXIST(td, uap->path, &path); + + error = kern_stat(td, path, UIO_SYSSPACE, &sb); + FREEPATH(path); if (error) return (error); copy_stat(&sb, &sb32); @@ -1520,8 +1538,12 @@ struct stat sb; struct stat32 sb32; int error; + char *path; + + CONVPATHEXIST(td, uap->path, &path); - error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb); + error = kern_lstat(td, path, UIO_SYSSPACE, &sb); + FREEPATH(path); if (error) return (error); copy_stat(&sb, &sb32); diff -ru sys.old/compat/freebsd32/freebsd32_proto.h sys/compat/freebsd32/freebsd32_proto.h --- sys.old/compat/freebsd32/freebsd32_proto.h Mon Dec 19 23:15:56 2005 +++ sys/compat/freebsd32/freebsd32_proto.h Fri Dec 9 21:50:29 2005 @@ -32,12 +32,41 @@ #define PADR_(t) 0 #endif +struct freebsd32_open_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; +}; struct freebsd32_wait4_args { char pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)]; char status_l_[PADL_(int *)]; int * status; char status_r_[PADR_(int *)]; char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)]; char rusage_l_[PADL_(struct rusage32 *)]; struct rusage32 * rusage; char rusage_r_[PADR_(struct rusage32 *)]; }; +struct freebsd32_link_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char link_l_[PADL_(char *)]; char * link; char link_r_[PADR_(char *)]; +}; +struct freebsd32_unlink_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; +}; +struct freebsd32_chdir_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; +}; +struct freebsd32_mknod_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; + char dev_l_[PADL_(int)]; int dev; char dev_r_[PADR_(int)]; +}; +struct freebsd32_chmod_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; +}; +struct freebsd32_chown_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char uid_l_[PADL_(int)]; int uid; char uid_r_[PADR_(int)]; + char gid_l_[PADL_(int)]; int gid; char gid_r_[PADR_(int)]; +}; struct freebsd32_recvmsg_args { char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)]; char msg_l_[PADL_(struct msghdr32 *)]; struct msghdr32 * msg; char msg_r_[PADR_(struct msghdr32 *)]; @@ -56,6 +85,10 @@ char from_l_[PADL_(u_int32_t)]; u_int32_t from; char from_r_[PADR_(u_int32_t)]; char fromlenaddr_l_[PADL_(u_int32_t)]; u_int32_t fromlenaddr; char fromlenaddr_r_[PADR_(u_int32_t)]; }; +struct freebsd32_access_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; +}; struct ofreebsd32_sigpending_args { register_t dummy; }; @@ -63,6 +96,15 @@ char ss_l_[PADL_(struct sigaltstack32 *)]; struct sigaltstack32 * ss; char ss_r_[PADR_(struct sigaltstack32 *)]; char oss_l_[PADL_(struct sigaltstack32 *)]; struct sigaltstack32 * oss; char oss_r_[PADR_(struct sigaltstack32 *)]; }; +struct freebsd32_symlink_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char link_l_[PADL_(char *)]; char * link; char link_r_[PADR_(char *)]; +}; +struct freebsd32_readlink_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)]; + char count_l_[PADL_(int)]; int count; char count_r_[PADR_(int)]; +}; struct freebsd32_execve_args { char fname_l_[PADL_(char *)]; char * fname; char fname_r_[PADR_(char *)]; char argv_l_[PADL_(u_int32_t *)]; u_int32_t * argv; char argv_r_[PADR_(u_int32_t *)]; @@ -106,6 +148,17 @@ char tv_l_[PADL_(struct timeval32 *)]; struct timeval32 * tv; char tv_r_[PADR_(struct timeval32 *)]; char tzp_l_[PADL_(struct timezone *)]; struct timezone * tzp; char tzp_r_[PADR_(struct timezone *)]; }; +struct freebsd32_rename_args { + char from_l_[PADL_(char *)]; char * from; char from_r_[PADR_(char *)]; + char to_l_[PADL_(char *)]; char * to; char to_r_[PADR_(char *)]; +}; +struct freebsd32_mkdir_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; +}; +struct freebsd32_rmdir_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; +}; struct freebsd32_utimes_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; char tptr_l_[PADL_(struct timeval32 *)]; struct timeval32 * tptr; char tptr_r_[PADR_(struct timeval32 *)]; @@ -220,6 +273,15 @@ char rqtp_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * rqtp; char rqtp_r_[PADR_(const struct timespec32 *)]; char rmtp_l_[PADL_(struct timespec32 *)]; struct timespec32 * rmtp; char rmtp_r_[PADR_(struct timespec32 *)]; }; +struct freebsd32_lchown_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char uid_l_[PADL_(int)]; int uid; char uid_r_[PADR_(int)]; + char gid_l_[PADL_(int)]; int gid; char gid_r_[PADR_(int)]; +}; +struct freebsd32_lchmod_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)]; +}; struct freebsd32_preadv_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; char iovp_l_[PADL_(struct iovec32 *)]; struct iovec32 * iovp; char iovp_r_[PADR_(struct iovec32 *)]; @@ -244,6 +306,10 @@ char nevents_l_[PADL_(int)]; int nevents; char nevents_r_[PADR_(int)]; char timeout_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * timeout; char timeout_r_[PADR_(const struct timespec32 *)]; }; +struct freebsd32_eaccess_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; +}; struct freebsd32_sendfile_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)]; @@ -272,11 +338,21 @@ char oucp_l_[PADL_(struct freebsd32_ucontext *)]; struct freebsd32_ucontext * oucp; char oucp_r_[PADR_(struct freebsd32_ucontext *)]; char ucp_l_[PADL_(const struct freebsd32_ucontext *)]; const struct freebsd32_ucontext * ucp; char ucp_r_[PADR_(const struct freebsd32_ucontext *)]; }; +int freebsd32_open(struct thread *, struct freebsd32_open_args *); int freebsd32_wait4(struct thread *, struct freebsd32_wait4_args *); +int freebsd32_link(struct thread *, struct freebsd32_link_args *); +int freebsd32_unlink(struct thread *, struct freebsd32_unlink_args *); +int freebsd32_chdir(struct thread *, struct freebsd32_chdir_args *); +int freebsd32_mknod(struct thread *, struct freebsd32_mknod_args *); +int freebsd32_chmod(struct thread *, struct freebsd32_chmod_args *); +int freebsd32_chown(struct thread *, struct freebsd32_chown_args *); int freebsd32_recvmsg(struct thread *, struct freebsd32_recvmsg_args *); int freebsd32_sendmsg(struct thread *, struct freebsd32_sendmsg_args *); int freebsd32_recvfrom(struct thread *, struct freebsd32_recvfrom_args *); +int freebsd32_access(struct thread *, struct freebsd32_access_args *); int freebsd32_sigaltstack(struct thread *, struct freebsd32_sigaltstack_args *); +int freebsd32_symlink(struct thread *, struct freebsd32_symlink_args *); +int freebsd32_readlink(struct thread *, struct freebsd32_readlink_args *); int freebsd32_execve(struct thread *, struct freebsd32_execve_args *); int freebsd32_setitimer(struct thread *, struct freebsd32_setitimer_args *); int freebsd32_getitimer(struct thread *, struct freebsd32_getitimer_args *); @@ -286,6 +362,9 @@ int freebsd32_readv(struct thread *, struct freebsd32_readv_args *); int freebsd32_writev(struct thread *, struct freebsd32_writev_args *); int freebsd32_settimeofday(struct thread *, struct freebsd32_settimeofday_args *); +int freebsd32_rename(struct thread *, struct freebsd32_rename_args *); +int freebsd32_mkdir(struct thread *, struct freebsd32_mkdir_args *); +int freebsd32_rmdir(struct thread *, struct freebsd32_rmdir_args *); int freebsd32_utimes(struct thread *, struct freebsd32_utimes_args *); int freebsd32_adjtime(struct thread *, struct freebsd32_adjtime_args *); int freebsd32_semsys(struct thread *, struct freebsd32_semsys_args *); @@ -306,10 +385,13 @@ int freebsd32_clock_settime(struct thread *, struct freebsd32_clock_settime_args *); int freebsd32_clock_getres(struct thread *, struct freebsd32_clock_getres_args *); int freebsd32_nanosleep(struct thread *, struct freebsd32_nanosleep_args *); +int freebsd32_lchown(struct thread *, struct freebsd32_lchown_args *); +int freebsd32_lchmod(struct thread *, struct freebsd32_lchmod_args *); int freebsd32_preadv(struct thread *, struct freebsd32_preadv_args *); int freebsd32_pwritev(struct thread *, struct freebsd32_pwritev_args *); int freebsd32_modstat(struct thread *, struct freebsd32_modstat_args *); int freebsd32_kevent(struct thread *, struct freebsd32_kevent_args *); +int freebsd32_eaccess(struct thread *, struct freebsd32_eaccess_args *); int freebsd32_sendfile(struct thread *, struct freebsd32_sendfile_args *); int freebsd32_sigaction(struct thread *, struct freebsd32_sigaction_args *); int freebsd32_sigreturn(struct thread *, struct freebsd32_sigreturn_args *); diff -ru sys.old/compat/freebsd32/freebsd32_syscall.h sys/compat/freebsd32/freebsd32_syscall.h --- sys.old/compat/freebsd32/freebsd32_syscall.h Mon Dec 19 23:15:56 2005 +++ sys/compat/freebsd32/freebsd32_syscall.h Fri Dec 9 21:50:29 2005 @@ -11,18 +11,18 @@ #define FREEBSD32_SYS_fork 2 #define FREEBSD32_SYS_read 3 #define FREEBSD32_SYS_write 4 -#define FREEBSD32_SYS_open 5 +#define FREEBSD32_SYS_freebsd32_open 5 #define FREEBSD32_SYS_close 6 #define FREEBSD32_SYS_freebsd32_wait4 7 /* 8 is obsolete old creat */ -#define FREEBSD32_SYS_link 9 -#define FREEBSD32_SYS_unlink 10 +#define FREEBSD32_SYS_freebsd32_link 9 +#define FREEBSD32_SYS_freebsd32_unlink 10 /* 11 is obsolete execv */ -#define FREEBSD32_SYS_chdir 12 +#define FREEBSD32_SYS_freebsd32_chdir 12 #define FREEBSD32_SYS_fchdir 13 -#define FREEBSD32_SYS_mknod 14 -#define FREEBSD32_SYS_chmod 15 -#define FREEBSD32_SYS_chown 16 +#define FREEBSD32_SYS_freebsd32_mknod 14 +#define FREEBSD32_SYS_freebsd32_chmod 15 +#define FREEBSD32_SYS_freebsd32_chown 16 #define FREEBSD32_SYS_break 17 /* 18 is old freebsd32_getfsstat */ /* 19 is obsolete olseek */ @@ -39,7 +39,7 @@ #define FREEBSD32_SYS_accept 30 #define FREEBSD32_SYS_getpeername 31 #define FREEBSD32_SYS_getsockname 32 -#define FREEBSD32_SYS_access 33 +#define FREEBSD32_SYS_freebsd32_access 33 #define FREEBSD32_SYS_chflags 34 #define FREEBSD32_SYS_fchflags 35 #define FREEBSD32_SYS_sync 36 @@ -61,8 +61,8 @@ #define FREEBSD32_SYS_ioctl 54 #define FREEBSD32_SYS_reboot 55 #define FREEBSD32_SYS_revoke 56 -#define FREEBSD32_SYS_symlink 57 -#define FREEBSD32_SYS_readlink 58 +#define FREEBSD32_SYS_freebsd32_symlink 57 +#define FREEBSD32_SYS_freebsd32_readlink 58 #define FREEBSD32_SYS_freebsd32_execve 59 #define FREEBSD32_SYS_umask 60 #define FREEBSD32_SYS_chroot 61 @@ -129,7 +129,7 @@ /* 125 is obsolete orecvfrom */ #define FREEBSD32_SYS_setreuid 126 #define FREEBSD32_SYS_setregid 127 -#define FREEBSD32_SYS_rename 128 +#define FREEBSD32_SYS_freebsd32_rename 128 /* 129 is obsolete otruncate */ /* 130 is obsolete ftruncate */ #define FREEBSD32_SYS_flock 131 @@ -137,8 +137,8 @@ #define FREEBSD32_SYS_sendto 133 #define FREEBSD32_SYS_shutdown 134 #define FREEBSD32_SYS_socketpair 135 -#define FREEBSD32_SYS_mkdir 136 -#define FREEBSD32_SYS_rmdir 137 +#define FREEBSD32_SYS_freebsd32_mkdir 136 +#define FREEBSD32_SYS_freebsd32_rmdir 137 #define FREEBSD32_SYS_freebsd32_utimes 138 /* 139 is obsolete 4.2 sigreturn */ #define FREEBSD32_SYS_freebsd32_adjtime 140 @@ -209,9 +209,9 @@ #define FREEBSD32_SYS_rfork 251 #define FREEBSD32_SYS_openbsd_poll 252 #define FREEBSD32_SYS_issetugid 253 -#define FREEBSD32_SYS_lchown 254 +#define FREEBSD32_SYS_freebsd32_lchown 254 #define FREEBSD32_SYS_getdents 272 -#define FREEBSD32_SYS_lchmod 274 +#define FREEBSD32_SYS_freebsd32_lchmod 274 #define FREEBSD32_SYS_netbsd_lchown 275 #define FREEBSD32_SYS_lutimes 276 #define FREEBSD32_SYS_netbsd_msync 277 @@ -280,7 +280,7 @@ #define FREEBSD32_SYS_extattr_get_fd 372 #define FREEBSD32_SYS_extattr_delete_fd 373 #define FREEBSD32_SYS___setugid 374 -#define FREEBSD32_SYS_eaccess 376 +#define FREEBSD32_SYS_freebsd32_eaccess 376 #define FREEBSD32_SYS_nmount 378 #define FREEBSD32_SYS_kse_exit 379 #define FREEBSD32_SYS_kse_wakeup 380 diff -ru sys.old/compat/freebsd32/freebsd32_syscalls.c sys/compat/freebsd32/freebsd32_syscalls.c --- sys.old/compat/freebsd32/freebsd32_syscalls.c Mon Dec 19 23:15:56 2005 +++ sys/compat/freebsd32/freebsd32_syscalls.c Fri Dec 9 21:50:29 2005 @@ -12,18 +12,18 @@ "fork", /* 2 = fork */ "read", /* 3 = read */ "write", /* 4 = write */ - "open", /* 5 = open */ + "freebsd32_open", /* 5 = freebsd32_open */ "close", /* 6 = close */ "freebsd32_wait4", /* 7 = freebsd32_wait4 */ "obs_old", /* 8 = obsolete old creat */ - "link", /* 9 = link */ - "unlink", /* 10 = unlink */ + "freebsd32_link", /* 9 = freebsd32_link */ + "freebsd32_unlink", /* 10 = freebsd32_unlink */ "obs_execv", /* 11 = obsolete execv */ - "chdir", /* 12 = chdir */ + "freebsd32_chdir", /* 12 = freebsd32_chdir */ "fchdir", /* 13 = fchdir */ - "mknod", /* 14 = mknod */ - "chmod", /* 15 = chmod */ - "chown", /* 16 = chown */ + "freebsd32_mknod", /* 14 = freebsd32_mknod */ + "freebsd32_chmod", /* 15 = freebsd32_chmod */ + "freebsd32_chown", /* 16 = freebsd32_chown */ "break", /* 17 = break */ "old.freebsd32_getfsstat", /* 18 = old freebsd32_getfsstat */ "obs_olseek", /* 19 = obsolete olseek */ @@ -40,7 +40,7 @@ "accept", /* 30 = accept */ "getpeername", /* 31 = getpeername */ "getsockname", /* 32 = getsockname */ - "access", /* 33 = access */ + "freebsd32_access", /* 33 = freebsd32_access */ "chflags", /* 34 = chflags */ "fchflags", /* 35 = fchflags */ "sync", /* 36 = sync */ @@ -64,8 +64,8 @@ "ioctl", /* 54 = ioctl */ "reboot", /* 55 = reboot */ "revoke", /* 56 = revoke */ - "symlink", /* 57 = symlink */ - "readlink", /* 58 = readlink */ + "freebsd32_symlink", /* 57 = freebsd32_symlink */ + "freebsd32_readlink", /* 58 = freebsd32_readlink */ "freebsd32_execve", /* 59 = freebsd32_execve */ "umask", /* 60 = umask */ "chroot", /* 61 = chroot */ @@ -135,7 +135,7 @@ "obs_orecvfrom", /* 125 = obsolete orecvfrom */ "setreuid", /* 126 = setreuid */ "setregid", /* 127 = setregid */ - "rename", /* 128 = rename */ + "freebsd32_rename", /* 128 = freebsd32_rename */ "obs_otruncate", /* 129 = obsolete otruncate */ "obs_ftruncate", /* 130 = obsolete ftruncate */ "flock", /* 131 = flock */ @@ -143,8 +143,8 @@ "sendto", /* 133 = sendto */ "shutdown", /* 134 = shutdown */ "socketpair", /* 135 = socketpair */ - "mkdir", /* 136 = mkdir */ - "rmdir", /* 137 = rmdir */ + "freebsd32_mkdir", /* 136 = freebsd32_mkdir */ + "freebsd32_rmdir", /* 137 = freebsd32_rmdir */ "freebsd32_utimes", /* 138 = freebsd32_utimes */ "obs_4.2", /* 139 = obsolete 4.2 sigreturn */ "freebsd32_adjtime", /* 140 = freebsd32_adjtime */ @@ -261,7 +261,7 @@ "rfork", /* 251 = rfork */ "openbsd_poll", /* 252 = openbsd_poll */ "issetugid", /* 253 = issetugid */ - "lchown", /* 254 = lchown */ + "freebsd32_lchown", /* 254 = freebsd32_lchown */ "#255", /* 255 = nosys */ "#256", /* 256 = nosys */ "#257", /* 257 = nosys */ @@ -281,7 +281,7 @@ "#271", /* 271 = nosys */ "getdents", /* 272 = getdents */ "#273", /* 273 = nosys */ - "lchmod", /* 274 = lchmod */ + "freebsd32_lchmod", /* 274 = freebsd32_lchmod */ "netbsd_lchown", /* 275 = netbsd_lchown */ "lutimes", /* 276 = lutimes */ "netbsd_msync", /* 277 = netbsd_msync */ @@ -383,7 +383,7 @@ "extattr_delete_fd", /* 373 = extattr_delete_fd */ "__setugid", /* 374 = __setugid */ "#375", /* 375 = nfsclnt */ - "eaccess", /* 376 = eaccess */ + "freebsd32_eaccess", /* 376 = freebsd32_eaccess */ "#377", /* 377 = afs_syscall */ "nmount", /* 378 = nmount */ "kse_exit", /* 379 = kse_exit */ diff -ru sys.old/compat/freebsd32/freebsd32_sysent.c sys/compat/freebsd32/freebsd32_sysent.c --- sys.old/compat/freebsd32/freebsd32_sysent.c Mon Dec 19 23:15:56 2005 +++ sys/compat/freebsd32/freebsd32_sysent.c Fri Dec 9 21:50:29 2005 @@ -37,18 +37,18 @@ { SYF_MPSAFE | 0, (sy_call_t *)fork, AUE_NULL }, /* 2 = fork */ { SYF_MPSAFE | AS(read_args), (sy_call_t *)read, AUE_NULL }, /* 3 = read */ { SYF_MPSAFE | AS(write_args), (sy_call_t *)write, AUE_NULL }, /* 4 = write */ - { SYF_MPSAFE | AS(open_args), (sy_call_t *)open, AUE_NULL }, /* 5 = open */ + { SYF_MPSAFE | AS(freebsd32_open_args), (sy_call_t *)freebsd32_open, AUE_NULL }, /* 5 = freebsd32_open */ { SYF_MPSAFE | AS(close_args), (sy_call_t *)close, AUE_NULL }, /* 6 = close */ { SYF_MPSAFE | AS(freebsd32_wait4_args), (sy_call_t *)freebsd32_wait4, AUE_NULL }, /* 7 = freebsd32_wait4 */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 8 = obsolete old creat */ - { SYF_MPSAFE | AS(link_args), (sy_call_t *)link, AUE_NULL }, /* 9 = link */ - { SYF_MPSAFE | AS(unlink_args), (sy_call_t *)unlink, AUE_NULL }, /* 10 = unlink */ + { SYF_MPSAFE | AS(freebsd32_link_args), (sy_call_t *)freebsd32_link, AUE_NULL }, /* 9 = freebsd32_link */ + { SYF_MPSAFE | AS(freebsd32_unlink_args), (sy_call_t *)freebsd32_unlink, AUE_NULL }, /* 10 = freebsd32_unlink */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 11 = obsolete execv */ - { SYF_MPSAFE | AS(chdir_args), (sy_call_t *)chdir, AUE_NULL }, /* 12 = chdir */ + { SYF_MPSAFE | AS(freebsd32_chdir_args), (sy_call_t *)freebsd32_chdir, AUE_NULL }, /* 12 = freebsd32_chdir */ { SYF_MPSAFE | AS(fchdir_args), (sy_call_t *)fchdir, AUE_NULL }, /* 13 = fchdir */ - { SYF_MPSAFE | AS(mknod_args), (sy_call_t *)mknod, AUE_NULL }, /* 14 = mknod */ - { SYF_MPSAFE | AS(chmod_args), (sy_call_t *)chmod, AUE_NULL }, /* 15 = chmod */ - { SYF_MPSAFE | AS(chown_args), (sy_call_t *)chown, AUE_NULL }, /* 16 = chown */ + { SYF_MPSAFE | AS(freebsd32_mknod_args), (sy_call_t *)freebsd32_mknod, AUE_NULL }, /* 14 = freebsd32_mknod */ + { SYF_MPSAFE | AS(freebsd32_chmod_args), (sy_call_t *)freebsd32_chmod, AUE_NULL }, /* 15 = freebsd32_chmod */ + { SYF_MPSAFE | AS(freebsd32_chown_args), (sy_call_t *)freebsd32_chown, AUE_NULL }, /* 16 = freebsd32_chown */ { SYF_MPSAFE | AS(obreak_args), (sy_call_t *)obreak, AUE_NULL }, /* 17 = break */ { compat4(SYF_MPSAFE | AS(freebsd4_freebsd32_getfsstat_args),freebsd32_getfsstat), AUE_NULL }, /* 18 = old freebsd32_getfsstat */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 19 = obsolete olseek */ @@ -65,7 +65,7 @@ { SYF_MPSAFE | AS(accept_args), (sy_call_t *)accept, AUE_NULL }, /* 30 = accept */ { SYF_MPSAFE | AS(getpeername_args), (sy_call_t *)getpeername, AUE_NULL }, /* 31 = getpeername */ { SYF_MPSAFE | AS(getsockname_args), (sy_call_t *)getsockname, AUE_NULL }, /* 32 = getsockname */ - { SYF_MPSAFE | AS(access_args), (sy_call_t *)access, AUE_NULL }, /* 33 = access */ + { SYF_MPSAFE | AS(freebsd32_access_args), (sy_call_t *)freebsd32_access, AUE_NULL }, /* 33 = freebsd32_access */ { SYF_MPSAFE | AS(chflags_args), (sy_call_t *)chflags, AUE_NULL }, /* 34 = chflags */ { SYF_MPSAFE | AS(fchflags_args), (sy_call_t *)fchflags, AUE_NULL }, /* 35 = fchflags */ { SYF_MPSAFE | 0, (sy_call_t *)sync, AUE_NULL }, /* 36 = sync */ @@ -89,8 +89,8 @@ { SYF_MPSAFE | AS(ioctl_args), (sy_call_t *)ioctl, AUE_NULL }, /* 54 = ioctl */ { SYF_MPSAFE | AS(reboot_args), (sy_call_t *)reboot, AUE_NULL }, /* 55 = reboot */ { SYF_MPSAFE | AS(revoke_args), (sy_call_t *)revoke, AUE_NULL }, /* 56 = revoke */ - { SYF_MPSAFE | AS(symlink_args), (sy_call_t *)symlink, AUE_NULL }, /* 57 = symlink */ - { SYF_MPSAFE | AS(readlink_args), (sy_call_t *)readlink, AUE_NULL }, /* 58 = readlink */ + { SYF_MPSAFE | AS(freebsd32_symlink_args), (sy_call_t *)freebsd32_symlink, AUE_NULL }, /* 57 = freebsd32_symlink */ + { SYF_MPSAFE | AS(freebsd32_readlink_args), (sy_call_t *)freebsd32_readlink, AUE_NULL }, /* 58 = freebsd32_readlink */ { SYF_MPSAFE | AS(freebsd32_execve_args), (sy_call_t *)freebsd32_execve, AUE_NULL }, /* 59 = freebsd32_execve */ { SYF_MPSAFE | AS(umask_args), (sy_call_t *)umask, AUE_NULL }, /* 60 = umask */ { SYF_MPSAFE | AS(chroot_args), (sy_call_t *)chroot, AUE_NULL }, /* 61 = chroot */ @@ -160,7 +160,7 @@ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 125 = obsolete orecvfrom */ { SYF_MPSAFE | AS(setreuid_args), (sy_call_t *)setreuid, AUE_NULL }, /* 126 = setreuid */ { SYF_MPSAFE | AS(setregid_args), (sy_call_t *)setregid, AUE_NULL }, /* 127 = setregid */ - { SYF_MPSAFE | AS(rename_args), (sy_call_t *)rename, AUE_NULL }, /* 128 = rename */ + { SYF_MPSAFE | AS(freebsd32_rename_args), (sy_call_t *)freebsd32_rename, AUE_NULL }, /* 128 = freebsd32_rename */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 129 = obsolete otruncate */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 130 = obsolete ftruncate */ { SYF_MPSAFE | AS(flock_args), (sy_call_t *)flock, AUE_NULL }, /* 131 = flock */ @@ -168,8 +168,8 @@ { SYF_MPSAFE | AS(sendto_args), (sy_call_t *)sendto, AUE_NULL }, /* 133 = sendto */ { SYF_MPSAFE | AS(shutdown_args), (sy_call_t *)shutdown, AUE_NULL }, /* 134 = shutdown */ { SYF_MPSAFE | AS(socketpair_args), (sy_call_t *)socketpair, AUE_NULL }, /* 135 = socketpair */ - { SYF_MPSAFE | AS(mkdir_args), (sy_call_t *)mkdir, AUE_NULL }, /* 136 = mkdir */ - { SYF_MPSAFE | AS(rmdir_args), (sy_call_t *)rmdir, AUE_NULL }, /* 137 = rmdir */ + { SYF_MPSAFE | AS(freebsd32_mkdir_args), (sy_call_t *)freebsd32_mkdir, AUE_NULL }, /* 136 = freebsd32_mkdir */ + { SYF_MPSAFE | AS(freebsd32_rmdir_args), (sy_call_t *)freebsd32_rmdir, AUE_NULL }, /* 137 = freebsd32_rmdir */ { SYF_MPSAFE | AS(freebsd32_utimes_args), (sy_call_t *)freebsd32_utimes, AUE_NULL }, /* 138 = freebsd32_utimes */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 139 = obsolete 4.2 sigreturn */ { SYF_MPSAFE | AS(freebsd32_adjtime_args), (sy_call_t *)freebsd32_adjtime, AUE_NULL }, /* 140 = freebsd32_adjtime */ @@ -286,7 +286,7 @@ { SYF_MPSAFE | AS(rfork_args), (sy_call_t *)rfork, AUE_NULL }, /* 251 = rfork */ { SYF_MPSAFE | AS(openbsd_poll_args), (sy_call_t *)openbsd_poll, AUE_NULL }, /* 252 = openbsd_poll */ { SYF_MPSAFE | 0, (sy_call_t *)issetugid, AUE_NULL }, /* 253 = issetugid */ - { SYF_MPSAFE | AS(lchown_args), (sy_call_t *)lchown, AUE_NULL }, /* 254 = lchown */ + { SYF_MPSAFE | AS(freebsd32_lchown_args), (sy_call_t *)freebsd32_lchown, AUE_NULL }, /* 254 = freebsd32_lchown */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 255 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 256 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 257 = nosys */ @@ -306,7 +306,7 @@ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 271 = nosys */ { SYF_MPSAFE | AS(getdents_args), (sy_call_t *)getdents, AUE_NULL }, /* 272 = getdents */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 273 = nosys */ - { SYF_MPSAFE | AS(lchmod_args), (sy_call_t *)lchmod, AUE_NULL }, /* 274 = lchmod */ + { SYF_MPSAFE | AS(freebsd32_lchmod_args), (sy_call_t *)freebsd32_lchmod, AUE_NULL }, /* 274 = freebsd32_lchmod */ { SYF_MPSAFE | AS(lchown_args), (sy_call_t *)lchown, AUE_NULL }, /* 275 = netbsd_lchown */ { SYF_MPSAFE | AS(lutimes_args), (sy_call_t *)lutimes, AUE_NULL }, /* 276 = lutimes */ { SYF_MPSAFE | AS(msync_args), (sy_call_t *)msync, AUE_NULL }, /* 277 = netbsd_msync */ @@ -408,7 +408,7 @@ { AS(extattr_delete_fd_args), (sy_call_t *)extattr_delete_fd, AUE_NULL }, /* 373 = extattr_delete_fd */ { SYF_MPSAFE | AS(__setugid_args), (sy_call_t *)__setugid, AUE_NULL }, /* 374 = __setugid */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 375 = nfsclnt */ - { SYF_MPSAFE | AS(eaccess_args), (sy_call_t *)eaccess, AUE_NULL }, /* 376 = eaccess */ + { SYF_MPSAFE | AS(freebsd32_eaccess_args), (sy_call_t *)freebsd32_eaccess, AUE_NULL }, /* 376 = freebsd32_eaccess */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 377 = afs_syscall */ { AS(nmount_args), (sy_call_t *)nmount, AUE_NULL }, /* 378 = nmount */ { SYF_MPSAFE | 0, (sy_call_t *)kse_exit, AUE_NULL }, /* 379 = kse_exit */ diff -ru sys.old/compat/freebsd32/freebsd32_util.c sys/compat/freebsd32/freebsd32_util.c --- sys.old/compat/freebsd32/freebsd32_util.c Mon Dec 19 23:15:56 2005 +++ sys/compat/freebsd32/freebsd32_util.c Fri Dec 9 21:37:03 2005 @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2005 Antoine Pelisse + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include + +#include "opt_compat.h" + +#include +#include + +#include + +const char freebsd32_path[] = "/compat/ia32"; + +int +freebsd32_convpath(struct thread *td, char *path, enum uio_seg pathseg, + char **pbuf, int cflag) +{ + + return (kern_alternate_path(td, freebsd32_path, path, pathseg, pbuf, + cflag)); +} diff -ru sys.old/compat/freebsd32/freebsd32_util.h sys/compat/freebsd32/freebsd32_util.h --- sys.old/compat/freebsd32/freebsd32_util.h Mon Dec 19 23:15:56 2005 +++ sys/compat/freebsd32/freebsd32_util.h Fri Dec 9 21:37:03 2005 @@ -32,9 +32,10 @@ #include #include - #include +#include #include +#include #include struct freebsd32_ps_strings { @@ -47,6 +48,22 @@ #if defined(__amd64__) || defined(__ia64__) #include #endif + +int freebsd32_convpath(struct thread *, char *, enum uio_seg, char **, int); + +#define CONVPATH(td, upath, pathp, creat) \ + do { \ + int _error; \ + \ + _error = freebsd32_convpath(td, upath, UIO_USERSPACE, \ + pathp, creat); \ + if (*(pathp) == NULL) \ + return (_error); \ + } while (0) + +#define CONVPATHEXIST(td, upath, pathp) CONVPATH(td, upath, pathp, 0) +#define CONVPATHCREAT(td, upath, pathp) CONVPATH(td, upath, pathp, 1) +#define FREEPATH(path) free(path, M_TEMP) #define FREEBSD32_PS_STRINGS \ (FREEBSD32_USRSTACK - sizeof(struct freebsd32_ps_strings)) diff -ru sys.old/compat/freebsd32/syscalls.master sys/compat/freebsd32/syscalls.master --- sys.old/compat/freebsd32/syscalls.master Mon Dec 19 23:15:56 2005 +++ sys/compat/freebsd32/syscalls.master Fri Dec 9 21:49:32 2005 @@ -58,20 +58,22 @@ size_t nbyte); } 4 AUE_NULL MNOPROTO { ssize_t write(int fd, const void *buf, \ size_t nbyte); } -5 AUE_NULL MNOPROTO { int open(char *path, int flags, \ +5 AUE_NULL MSTD { int freebsd32_open(char *path, int flags, \ int mode); } 6 AUE_NULL MNOPROTO { int close(int fd); } 7 AUE_NULL MSTD { int freebsd32_wait4(int pid, int *status, \ int options, struct rusage32 *rusage); } 8 AUE_NULL OBSOL old creat -9 AUE_NULL MNOPROTO { int link(char *path, char *link); } -10 AUE_NULL MNOPROTO { int unlink(char *path); } +9 AUE_NULL MSTD { int freebsd32_link(char *path, char *link); } +10 AUE_NULL MSTD { int freebsd32_unlink(char *path); } 11 AUE_NULL OBSOL execv -12 AUE_NULL MNOPROTO { int chdir(char *path); } -13 AUE_NULL MNOPROTO { int fchdir(int fd); } -14 AUE_NULL MNOPROTO { int mknod(char *path, int mode, int dev); } -15 AUE_NULL MNOPROTO { int chmod(char *path, int mode); } -16 AUE_NULL MNOPROTO { int chown(char *path, int uid, int gid); } +12 AUE_NULL MSTD { int freebsd32_chdir(char *path); } +13 AUE_NULL MNOPROTO { int fchdir(int fd); } +14 AUE_NULL MSTD { int freebsd32_mknod(char *path, int mode, \ + int dev); } +15 AUE_NULL MSTD { int freebsd32_chmod(char *path, int mode); } +16 AUE_NULL MSTD { int freebsd32_chown(char *path, int uid, \ + int gid); } 17 AUE_NULL MNOPROTO { int obreak(char *nsize); } break \ obreak_args int 18 AUE_NULL MCOMPAT4 { int freebsd32_getfsstat( \ @@ -101,10 +103,10 @@ int *alen); } 32 AUE_NULL MNOPROTO { int getsockname(int fdes, caddr_t asa, \ int *alen); } -33 AUE_NULL MNOPROTO { int access(char *path, int flags); } -34 AUE_NULL MNOPROTO { int chflags(char *path, int flags); } -35 AUE_NULL MNOPROTO { int fchflags(int fd, int flags); } -36 AUE_NULL MNOPROTO { int sync(void); } +33 AUE_NULL MSTD { int freebsd32_access(char *path, int flags); } +34 AUE_NULL MNOPROTO { int chflags(char *path, int flags); } +35 AUE_NULL MNOPROTO { int fchflags(int fd, int flags); } +36 AUE_NULL MNOPROTO { int sync(void); } 37 AUE_NULL MNOPROTO { int kill(int pid, int signum); } 38 AUE_NULL UNIMPL ostat 39 AUE_NULL MNOPROTO { pid_t getppid(void); } @@ -133,15 +135,16 @@ 54 AUE_NULL MNOPROTO { int ioctl(int fd, u_long com, \ caddr_t data); } 55 AUE_NULL MNOPROTO { int reboot(int opt); } -56 AUE_NULL MNOPROTO { int revoke(char *path); } -57 AUE_NULL MNOPROTO { int symlink(char *path, char *link); } -58 AUE_NULL MNOPROTO { int readlink(char *path, char *buf, \ - int count); } +56 AUE_NULL MNOPROTO { int revoke(char *path); } +57 AUE_NULL MSTD { int freebsd32_symlink(char *path, \ + char *link); } +58 AUE_NULL MSTD { int freebsd32_readlink(char *path, \ + char *buf, int count); } 59 AUE_NULL MSTD { int freebsd32_execve(char *fname, \ u_int32_t *argv, u_int32_t *envv); } 60 AUE_NULL MNOPROTO { int umask(int newmask); } umask \ umask_args int -61 AUE_NULL MNOPROTO { int chroot(char *path); } +61 AUE_NULL MNOPROTO { int chroot(char *path); } 62 AUE_NULL OBSOL ofstat 63 AUE_NULL OBSOL ogetkerninfo 64 AUE_NULL OBSOL ogetpagesize @@ -190,7 +193,7 @@ struct timeval32 *tv); } ; XXX need to override for big-endian - little-endian should work fine. 94 AUE_NULL UNIMPL setdopt -95 AUE_NULL MNOPROTO { int fsync(int fd); } +95 AUE_NULL MNOPROTO { int fsync(int fd); } 96 AUE_NULL MNOPROTO { int setpriority(int which, int who, \ int prio); } 97 AUE_NULL MNOPROTO { int socket(int domain, int type, \ @@ -235,24 +238,24 @@ 122 AUE_NULL MSTD { int freebsd32_settimeofday( \ struct timeval32 *tv, \ struct timezone *tzp); } -123 AUE_NULL MNOPROTO { int fchown(int fd, int uid, int gid); } -124 AUE_NULL MNOPROTO { int fchmod(int fd, int mode); } +123 AUE_NULL MNOPROTO { int fchown(int fd, int uid, int gid); } +124 AUE_NULL MNOPROTO { int fchmod(int fd, int mode); } 125 AUE_NULL OBSOL orecvfrom 126 AUE_NULL MNOPROTO { int setreuid(int ruid, int euid); } 127 AUE_NULL MNOPROTO { int setregid(int rgid, int egid); } -128 AUE_NULL MNOPROTO { int rename(char *from, char *to); } +128 AUE_NULL MSTD { int freebsd32_rename(char *from, char *to); } 129 AUE_NULL OBSOL otruncate 130 AUE_NULL OBSOL ftruncate 131 AUE_NULL MNOPROTO { int flock(int fd, int how); } -132 AUE_NULL MNOPROTO { int mkfifo(char *path, int mode); } +132 AUE_NULL MNOPROTO { int mkfifo(char *path, int mode); } 133 AUE_NULL MNOPROTO { int sendto(int s, caddr_t buf, \ size_t len, int flags, caddr_t to, \ int tolen); } 134 AUE_NULL MNOPROTO { int shutdown(int s, int how); } 135 AUE_NULL MNOPROTO { int socketpair(int domain, int type, \ int protocol, int *rsv); } -136 AUE_NULL MNOPROTO { int mkdir(char *path, int mode); } -137 AUE_NULL MNOPROTO { int rmdir(char *path); } +136 AUE_NULL MSTD { int freebsd32_mkdir(char *path, int mode); } +137 AUE_NULL MSTD { int freebsd32_rmdir(char *path); } 138 AUE_NULL MSTD { int freebsd32_utimes(char *path, \ struct timeval32 *tptr); } 139 AUE_NULL OBSOL 4.2 sigreturn @@ -289,7 +292,7 @@ struct statfs32 *buf); } 159 AUE_NULL UNIMPL nosys 160 AUE_NULL UNIMPL nosys -161 AUE_NULL MNOPROTO { int getfh(char *fname, \ +161 AUE_NULL MNOPROTO { int getfh(char *fname, \ struct fhandle *fhp); } 162 AUE_NULL MNOPROTO { int getdomainname(char *domainname, \ int len); } @@ -451,7 +454,8 @@ 252 AUE_NULL MNOPROTO { int openbsd_poll(struct pollfd *fds, \ u_int nfds, int timeout); } 253 AUE_NULL MNOPROTO { int issetugid(void); } -254 AUE_NULL MNOPROTO { int lchown(char *path, int uid, int gid); } +254 AUE_NULL MSTD { int freebsd32_lchown(char *path, int uid, \ + int gid); } 255 AUE_NULL UNIMPL nosys 256 AUE_NULL UNIMPL nosys 257 AUE_NULL UNIMPL nosys @@ -469,20 +473,21 @@ 269 AUE_NULL UNIMPL nosys 270 AUE_NULL UNIMPL nosys 271 AUE_NULL UNIMPL nosys -272 AUE_NULL MNOPROTO { int getdents(int fd, char *buf, \ +272 AUE_NULL MNOPROTO { int getdents(int fd, char *buf, \ size_t count); } 273 AUE_NULL UNIMPL nosys -274 AUE_NULL MNOPROTO { int lchmod(char *path, mode_t mode); } +274 AUE_NULL MSTD { int freebsd32_lchmod(char *path, \ + mode_t mode); } 275 AUE_NULL MNOPROTO { int lchown(char *path, uid_t uid, \ gid_t gid); } netbsd_lchown \ lchown_args int -276 AUE_NULL MNOPROTO { int lutimes(char *path, \ +276 AUE_NULL MNOPROTO { int lutimes(char *path, \ struct timeval *tptr); } 277 AUE_NULL MNOPROTO { int msync(void *addr, size_t len, \ int flags); } netbsd_msync msync_args int -278 AUE_NULL MNOPROTO { int nstat(char *path, struct nstat *ub); } +278 AUE_NULL MNOPROTO { int nstat(char *path, struct nstat *ub); } 279 AUE_NULL MNOPROTO { int nfstat(int fd, struct nstat *sb); } -280 AUE_NULL MNOPROTO { int nlstat(char *path, struct nstat *ub); } +280 AUE_NULL MNOPROTO { int nlstat(char *path, struct nstat *ub); } 281 AUE_NULL UNIMPL nosys 282 AUE_NULL UNIMPL nosys 283 AUE_NULL UNIMPL nosys @@ -510,9 +515,9 @@ 297 AUE_NULL MCOMPAT4 { int freebsd32_fhstatfs( \ const struct fhandle *u_fhp, \ struct statfs32 *buf); } -298 AUE_NULL MNOPROTO { int fhopen(const struct fhandle *u_fhp, \ +298 AUE_NULL MNOPROTO { int fhopen(const struct fhandle *u_fhp, \ int flags); } -299 AUE_NULL MNOPROTO { int fhstat(const struct fhandle *u_fhp, \ +299 AUE_NULL MNOPROTO { int fhstat(const struct fhandle *u_fhp, \ struct stat *sb); } ; syscall numbers for FreeBSD 300 AUE_NULL MNOPROTO { int modnext(int modid); } @@ -545,7 +550,7 @@ 323 AUE_NULL OBSOL thr_wakeup 324 AUE_NULL MNOPROTO { int mlockall(int how); } 325 AUE_NULL MNOPROTO { int munlockall(void); } -326 AUE_NULL MNOPROTO { int __getcwd(u_char *buf, u_int buflen); } +326 AUE_NULL MNOPROTO { int __getcwd(u_char *buf, u_int buflen); } 327 AUE_NULL MNOPROTO { int sched_setparam (pid_t pid, \ const struct sched_param *param); } @@ -568,7 +573,7 @@ u_int32_t offsetlo, u_int32_t offsethi, \ size_t nbytes, struct sf_hdtr *hdtr, \ off_t *sbytes, int flags); } -337 AUE_NULL MNOPROTO { int kldsym(int fileid, int cmd, \ +337 AUE_NULL MNOPROTO { int kldsym(int fileid, int cmd, \ void *data); } 338 AUE_NULL MNOPROTO { int jail(struct jail *jail); } 339 AUE_NULL UNIMPL pioctl @@ -642,26 +647,27 @@ const char *attrname); } 374 AUE_NULL MNOPROTO { int __setugid(int flag); } 375 AUE_NULL UNIMPL nfsclnt -376 AUE_NULL MNOPROTO { int eaccess(char *path, int flags); } +376 AUE_NULL MSTD { int freebsd32_eaccess(char *path, \ + int flags); } 377 AUE_NULL UNIMPL afs_syscall 378 AUE_NULL NOPROTO { int nmount(struct iovec *iovp, \ unsigned int iovcnt, int flags); } -379 AUE_NULL MNOPROTO { int kse_exit(void); } -380 AUE_NULL MNOPROTO { int kse_wakeup(struct kse_mailbox *mbx); } -381 AUE_NULL MNOPROTO { int kse_create(struct kse_mailbox *mbx, \ +379 AUE_NULL MNOPROTO { int kse_exit(void); } +380 AUE_NULL MNOPROTO { int kse_wakeup(struct kse_mailbox *mbx); } +381 AUE_NULL MNOPROTO { int kse_create(struct kse_mailbox *mbx, \ int newgroup); } -382 AUE_NULL MNOPROTO { int kse_thr_interrupt( \ +382 AUE_NULL MNOPROTO { int kse_thr_interrupt( \ struct kse_thr_mailbox *tmbx); } -383 AUE_NULL MNOPROTO { int kse_release(void); } +383 AUE_NULL MNOPROTO { int kse_release(void); } 384 AUE_NULL UNIMPL __mac_get_proc 385 AUE_NULL UNIMPL __mac_set_proc 386 AUE_NULL UNIMPL __mac_get_fd 387 AUE_NULL UNIMPL __mac_get_file 388 AUE_NULL UNIMPL __mac_set_fd 389 AUE_NULL UNIMPL __mac_set_file -390 AUE_NULL MNOPROTO { int kenv(int what, const char *name, \ +390 AUE_NULL MNOPROTO { int kenv(int what, const char *name, \ char *value, int len); } -391 AUE_NULL MNOPROTO { int lchflags(const char *path, int flags); } +391 AUE_NULL MNOPROTO { int lchflags(const char *path, int flags); } 392 AUE_NULL MNOPROTO { int uuidgen(struct uuid *store, \ int count); } 393 AUE_NULL MSTD { int freebsd32_sendfile(int fd, int s, \ @@ -669,12 +675,12 @@ size_t nbytes, struct sf_hdtr *hdtr, \ off_t *sbytes, int flags); } 394 AUE_NULL UNIMPL mac_syscall -395 AUE_NULL MNOPROTO { int getfsstat(struct statfs *buf, \ +395 AUE_NULL MNOPROTO { int getfsstat(struct statfs *buf, \ long bufsize, int flags); } -396 AUE_NULL MNOPROTO { int statfs(char *path, \ +396 AUE_NULL MNOPROTO { int statfs(char *path, \ struct statfs *buf); } -397 AUE_NULL MNOPROTO { int fstatfs(int fd, struct statfs *buf); } -398 AUE_NULL MNOPROTO { int fhstatfs(const struct fhandle *u_fhp, \ +397 AUE_NULL MNOPROTO { int fstatfs(int fd, struct statfs *buf); } +398 AUE_NULL MNOPROTO { int fhstatfs(const struct fhandle *u_fhp, \ struct statfs *buf); } 399 AUE_NULL UNIMPL nosys ; XXX implement these? diff -ru sys.old/conf/files.amd64 sys/conf/files.amd64 --- sys.old/conf/files.amd64 Mon Dec 19 23:15:56 2005 +++ sys/conf/files.amd64 Fri Dec 9 21:37:03 2005 @@ -204,9 +204,11 @@ amd64/ia32/ia32_signal.c optional compat_ia32 amd64/ia32/ia32_sigtramp.S optional compat_ia32 amd64/ia32/ia32_syscall.c optional compat_ia32 +compat/freebsd32/freebsd32_file.c optional compat_ia32 compat/freebsd32/freebsd32_misc.c optional compat_ia32 compat/freebsd32/freebsd32_syscalls.c optional compat_ia32 compat/freebsd32/freebsd32_sysent.c optional compat_ia32 +compat/freebsd32/freebsd32_util.c optional compat_ia32 compat/ia32/ia32_sysvec.c optional compat_ia32 kern/imgact_elf32.c optional compat_ia32 # diff -ru sys.old/conf/files.ia64 sys/conf/files.ia64 --- sys.old/conf/files.ia64 Mon Dec 19 23:15:56 2005 +++ sys/conf/files.ia64 Fri Dec 9 21:37:03 2005 @@ -28,9 +28,11 @@ no-obj no-implicit-rule before-depend \ clean "ukbdmap.h" # +compat/freebsd32/freebsd32_file.c optional compat_ia32 compat/freebsd32/freebsd32_misc.c optional compat_ia32 compat/freebsd32/freebsd32_syscalls.c optional compat_ia32 compat/freebsd32/freebsd32_sysent.c optional compat_ia32 +compat/freebsd32/freebsd32_util.c optional compat_ia32 compat/ia32/ia32_sysvec.c optional compat_ia32 contrib/ia64/libuwx/src/uwx_bstream.c standard contrib/ia64/libuwx/src/uwx_context.c standard diff -ru sys.old/kern/vfs_syscalls.c sys/kern/vfs_syscalls.c --- sys.old/kern/vfs_syscalls.c Mon Dec 19 23:15:56 2005 +++ sys/kern/vfs_syscalls.c Fri Dec 9 21:37:03 2005 @@ -1908,18 +1908,25 @@ int flags; } */ *uap; { + + return (kern_eaccess(td, uap->path, UIO_USERSPACE, uap->flags)); +} + +int +kern_eaccess(struct thread *td, char *path, enum uio_seg pathseg, int flags) +{ struct nameidata nd; struct vnode *vp; int vfslocked; int error; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE, UIO_USERSPACE, - uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE, pathseg, + path, td); if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; vfslocked = NDHASGIANT(&nd); - error = vn_access(vp, uap->flags, td->td_ucred, td); + error = vn_access(vp, flags, td->td_ucred, td); NDFREE(&nd, NDF_ONLY_PNBUF); vput(vp); VFS_UNLOCK_GIANT(vfslocked); @@ -2521,16 +2528,23 @@ int mode; } */ *uap; { + + return (kern_lchmod(td, uap->path, UIO_USERSPACE, uap->mode)); +} + +int +kern_lchmod(struct thread *td, char *path, enum uio_seg pathseg, int mode) +{ int error; struct nameidata nd; int vfslocked; - NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, pathseg, path, td); if ((error = namei(&nd)) != 0) return (error); vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfmode(td, nd.ni_vp, uap->mode); + error = setfmode(td, nd.ni_vp, mode); vrele(nd.ni_vp); VFS_UNLOCK_GIANT(vfslocked); return (error); ------=_Part_26700_12188695.1135032133250--