aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Smith <kensmith@FreeBSD.org>2005-01-14 00:07:56 +0000
committerKen Smith <kensmith@FreeBSD.org>2005-01-14 00:07:56 +0000
commit01ca612ace5f76c6e7eb834efd44e10cc6f0ab9c (patch)
treed1fcffbc0c6aca353fd0cf0496695ea891be9b36
parent56fa421a154b3cab219cfba19fb96486c291abb1 (diff)
downloadsrc-01ca612ace5f76c6e7eb834efd44e10cc6f0ab9c.tar.gz
src-01ca612ace5f76c6e7eb834efd44e10cc6f0ab9c.zip
MFS of some Linux emulation fixes. From the log message of the MFC:
kensmith 2005-01-12 16:34:55 UTC FreeBSD src repository Modified files: (Branch: RELENG_4) lib/libc/gen errlst.c lib/libc/sys intro.2 sys/nfs nfs_subs.c sys/sys errno.h sys/i386/linux linux_dummy.c linux_machdep.c syscalls.master Log: This is a partial MFC of the current RELENG_5 Linux emulation, which became necessary due to the plans for using linux_base-8 for the 4.11 release. Among other things running "/compat/linux/bin/ls -l" dumped core because it tried to use completely non-existent system calls. We don't actually implement the system calls it's trying to use but we at least need to have something in place that returns an error code. Things being added: - wrapper for mmap2(2) from sys/compat/linux/linux_machdep.c v1.31 sys/compat/linux/linux_dummy.c v1.35 - add dummy entries for fadvise64(2) and *xattr(2) family of syscalls from sys/compat/linux/linux_dummy.c v1.37 - add ENOATTR error code because that is what the *xattr(2) family of syscalls returns, which in turn required tweaking the error code translation table in the NFS server code[1]. - add $FreeBSD$ token to lib/libc/gen/errlst.c so it passes pre-commit check script... [1] Noticed by rwatson. Requested by: nectar Reviewed by: nectar, sobomax, re@ Tested by: nectar, ceri Versions being MFS-ed: src/lib/libc/gen/errlst.c 1.2.2.1 src/lib/libc/sys/intro.2 1.21.2.8 and 1.21.2.9 src/sys/i386/linux/linux_dummy.c 1.21.2.9 src/sys/i386/linux/linux_machdep.c 1.6.2.6 src/sys/i386/linux/syscalls.master 1.30.2.9 src/sys/nfs/nfs_subs.c 1.90.2.4 src/sys/sys/errno.h 1.14.2.3 Approved by: re (scottl)
Notes
Notes: svn path=/releng/4.11/; revision=140209
-rw-r--r--lib/libc/gen/errlst.c3
-rw-r--r--lib/libc/sys/intro.24
-rw-r--r--sys/i386/linux/linux_dummy.c24
-rw-r--r--sys/i386/linux/linux_machdep.c77
-rw-r--r--sys/i386/linux/syscalls.master47
-rw-r--r--sys/nfs/nfs_subs.c2
-rw-r--r--sys/sys/errno.h3
7 files changed, 133 insertions, 27 deletions
diff --git a/lib/libc/gen/errlst.c b/lib/libc/gen/errlst.c
index a64379416675..4d66fbebdbd2 100644
--- a/lib/libc/gen/errlst.c
+++ b/lib/libc/gen/errlst.c
@@ -29,6 +29,8 @@
* 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.
+ *
+ * $FreeBSD$
*/
#if defined(LIBC_SCCS) && !defined(lint)
@@ -143,6 +145,7 @@ const char *const sys_errlist[] = {
"Value too large to be stored in data type", /* 84 - EOVERFLOW */
"Operation canceled", /* 85 - ECANCELED */
"Illegal byte sequence", /* 86 - EILSEQ */
+ "Attribute not found", /* 87 - ENOATTR */
};
int errno;
const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]);
diff --git a/lib/libc/sys/intro.2 b/lib/libc/sys/intro.2
index 936923d0072f..6ef163e5e580 100644
--- a/lib/libc/sys/intro.2
+++ b/lib/libc/sys/intro.2
@@ -32,7 +32,7 @@
.\" @(#)intro.2 8.5 (Berkeley) 2/27/95
.\" $FreeBSD$
.\"
-.Dd February 27, 1995
+.Dd January 12, 2005
.Dt INTRO 2
.Os
.Sh NAME
@@ -451,6 +451,8 @@ The scheduled operation was canceled.
While decoding a multibyte character the function came along an
invalid or an incomplete sequence of bytes or the given wide
character is invalid.
+.It Er 87 ENOATTR Em "Attribute not found" .
+The specified extended attribute does not exist.
.El
.Sh DEFINITIONS
.Bl -tag -width Ds
diff --git a/sys/i386/linux/linux_dummy.c b/sys/i386/linux/linux_dummy.c
index fd91f356fed0..c344cd9bd18f 100644
--- a/sys/i386/linux/linux_dummy.c
+++ b/sys/i386/linux/linux_dummy.c
@@ -64,10 +64,32 @@ DUMMY(rt_sigqueueinfo);
DUMMY(capget);
DUMMY(capset);
DUMMY(sendfile);
-DUMMY(mmap2);
DUMMY(truncate64);
DUMMY(setfsuid);
DUMMY(setfsgid);
DUMMY(pivot_root);
DUMMY(mincore);
+DUMMY(fadvise64);
DUMMY(madvise);
+
+#define DUMMY_XATTR(s) \
+int \
+linux_ ## s ## xattr( \
+ struct proc *p, struct linux_ ## s ## xattr_args *arg) \
+{ \
+ \
+ return (ENOATTR); \
+}
+DUMMY_XATTR(set);
+DUMMY_XATTR(lset);
+DUMMY_XATTR(fset);
+DUMMY_XATTR(get);
+DUMMY_XATTR(lget);
+DUMMY_XATTR(fget);
+DUMMY_XATTR(list);
+DUMMY_XATTR(llist);
+DUMMY_XATTR(flist);
+DUMMY_XATTR(remove);
+DUMMY_XATTR(lremove);
+DUMMY_XATTR(fremove);
+
diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c
index 0ccffb5df9bf..3c903f6fa4ff 100644
--- a/sys/i386/linux/linux_machdep.c
+++ b/sys/i386/linux/linux_machdep.c
@@ -380,18 +380,33 @@ struct l_mmap_argv {
#define STACK_SIZE (2 * 1024 * 1024)
#define GUARD_SIZE (4 * PAGE_SIZE)
+static int linux_mmap_common(struct proc *, struct l_mmap_argv *);
+
+int
+linux_mmap2(struct proc *p, struct linux_mmap2_args *args)
+{
+ struct l_mmap_argv linux_args;
+
+#ifdef DEBUG
+ if (ldebug(mmap2))
+ printf(ARGS(mmap2, "%p, %d, %d, 0x%08x, %d, %d"),
+ (void *)args->addr, args->len, args->prot,
+ args->flags, args->fd, args->pgoff);
+#endif
+
+ linux_args.addr = (l_caddr_t)args->addr;
+ linux_args.len = args->len;
+ linux_args.prot = args->prot;
+ linux_args.flags = args->flags;
+ linux_args.fd = args->fd;
+ linux_args.pos = args->pgoff * PAGE_SIZE;
+
+ return (linux_mmap_common(p, &linux_args));
+}
+
int
linux_mmap(struct proc *p, struct linux_mmap_args *args)
{
- struct mmap_args /* {
- caddr_t addr;
- size_t len;
- int prot;
- int flags;
- int fd;
- long pad;
- off_t pos;
- } */ bsd_args;
int error;
struct l_mmap_argv linux_args;
@@ -406,18 +421,34 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args)
linux_args.flags, linux_args.fd, linux_args.pos);
#endif
+ return (linux_mmap_common(p, &linux_args));
+}
+
+int
+linux_mmap_common(struct proc *p, struct l_mmap_argv *linux_args)
+{
+ struct mmap_args /* {
+ caddr_t addr;
+ size_t len;
+ int prot;
+ int flags;
+ int fd;
+ long pad;
+ off_t pos;
+ } */ bsd_args;
+
bsd_args.flags = 0;
- if (linux_args.flags & LINUX_MAP_SHARED)
+ if (linux_args->flags & LINUX_MAP_SHARED)
bsd_args.flags |= MAP_SHARED;
- if (linux_args.flags & LINUX_MAP_PRIVATE)
+ if (linux_args->flags & LINUX_MAP_PRIVATE)
bsd_args.flags |= MAP_PRIVATE;
- if (linux_args.flags & LINUX_MAP_FIXED)
+ if (linux_args->flags & LINUX_MAP_FIXED)
bsd_args.flags |= MAP_FIXED;
- if (linux_args.flags & LINUX_MAP_ANON)
+ if (linux_args->flags & LINUX_MAP_ANON)
bsd_args.flags |= MAP_ANON;
else
bsd_args.flags |= MAP_NOSYNC;
- if (linux_args.flags & LINUX_MAP_GROWSDOWN) {
+ if (linux_args->flags & LINUX_MAP_GROWSDOWN) {
bsd_args.flags |= MAP_STACK;
/* The linux MAP_GROWSDOWN option does not limit auto
@@ -442,7 +473,7 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args)
*/
/* This gives us TOS */
- bsd_args.addr = linux_args.addr + linux_args.len;
+ bsd_args.addr = linux_args->addr + linux_args->len;
if (bsd_args.addr > p->p_vmspace->vm_maxsaddr) {
/* Some linux apps will attempt to mmap
@@ -465,8 +496,8 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args)
}
/* This gives us our maximum stack size */
- if (linux_args.len > STACK_SIZE - GUARD_SIZE)
- bsd_args.len = linux_args.len;
+ if (linux_args->len > STACK_SIZE - GUARD_SIZE)
+ bsd_args.len = linux_args->len;
else
bsd_args.len = STACK_SIZE - GUARD_SIZE;
@@ -478,16 +509,16 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args)
*/
bsd_args.addr -= bsd_args.len;
} else {
- bsd_args.addr = linux_args.addr;
- bsd_args.len = linux_args.len;
+ bsd_args.addr = linux_args->addr;
+ bsd_args.len = linux_args->len;
}
- bsd_args.prot = linux_args.prot | PROT_READ; /* always required */
- if (linux_args.flags & LINUX_MAP_ANON)
+ bsd_args.prot = linux_args->prot | PROT_READ; /* always required */
+ if (linux_args->flags & LINUX_MAP_ANON)
bsd_args.fd = -1;
else
- bsd_args.fd = linux_args.fd;
- bsd_args.pos = linux_args.pos;
+ bsd_args.fd = linux_args->fd;
+ bsd_args.pos = linux_args->pos;
bsd_args.pad = 0;
#ifdef DEBUG
diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master
index c7355e7e2971..d8732a66538d 100644
--- a/sys/i386/linux/syscalls.master
+++ b/sys/i386/linux/syscalls.master
@@ -338,3 +338,50 @@
l_uint count); }
221 STD LINUX { int linux_fcntl64(l_uint fd, l_uint cmd, \
l_ulong arg); }
+222 UNIMPL
+223 UNIMPL
+224 UNIMPL LINUX linux_gettid
+225 UNIMPL LINUX linux_readahead
+226 STD LINUX { int linux_setxattr(void); }
+227 STD LINUX { int linux_lsetxattr(void); }
+228 STD LINUX { int linux_fsetxattr(void); }
+229 STD LINUX { int linux_getxattr(void); }
+230 STD LINUX { int linux_lgetxattr(void); }
+231 STD LINUX { int linux_fgetxattr(void); }
+232 STD LINUX { int linux_listxattr(void); }
+233 STD LINUX { int linux_llistxattr(void); }
+234 STD LINUX { int linux_flistxattr(void); }
+235 STD LINUX { int linux_removexattr(void); }
+236 STD LINUX { int linux_lremovexattr(void); }
+237 STD LINUX { int linux_fremovexattr(void); }
+238 UNIMPL LINUX linux_tkill
+239 UNIMPL LINUX linux_sendfile64
+240 UNIMPL LINUX linux_futex
+241 UNIMPL LINUX linux_sched_setaffinity
+242 UNIMPL LINUX linux_sched_getaffinity
+243 UNIMPL LINUX linux_set_thread_area
+244 UNIMPL LINUX linux_get_thread_area
+245 UNIMPL LINUX linux_io_setup
+246 UNIMPL LINUX linux_io_destroy
+247 UNIMPL LINUX linux_io_getevents
+248 UNIMPL LINUX linux_io_submit
+249 UNIMPL LINUX linux_io_cancel
+250 STD LINUX { int linux_fadvise64(void); }
+251 UNIMPL
+252 NOPROTO LINUX { void sys_exit(int rval); } exit_group \
+ sys_exit_args void
+253 UNIMPL LINUX linux_lookup_dcookie
+254 UNIMPL LINUX linux_epoll_create
+255 UNIMPL LINUX linux_epoll_ctl
+256 UNIMPL LINUX linux_epoll_wait
+257 UNIMPL LINUX linux_remap_file_pages
+258 UNIMPL LINUX linux_set_tid_address
+259 UNIMPL LINUX linux_timer_create
+260 UNIMPL LINUX linux_timer_settime
+261 UNIMPL LINUX linux_timer_gettime
+262 UNIMPL LINUX linux_timer_getoverrun
+263 UNIMPL LINUX linux_timer_delete
+264 UNIMPL LINUX linux_clock_settime
+265 UNIMPL LINUX linux_clock_gettime
+266 UNIMPL LINUX linux_clock_getres
+267 UNIMPL LINUX linux_clock_nanosleep
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index 7b4f7f46e43a..4d877dcc05c2 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -204,7 +204,7 @@ static u_char nfsrv_v2errmap[ELAST] = {
NFSERR_IO, NFSERR_IO, NFSERR_IO, NFSERR_IO, NFSERR_IO,
NFSERR_IO, NFSERR_IO, NFSERR_IO, NFSERR_IO, NFSERR_IO,
NFSERR_IO, NFSERR_IO, NFSERR_IO, NFSERR_IO, NFSERR_IO,
- NFSERR_IO /* << Last is 86 */
+ NFSERR_IO, NFSERR_IO /* << Last is 87 */
};
/*
diff --git a/sys/sys/errno.h b/sys/sys/errno.h
index b09c56f75d85..7f274d91d975 100644
--- a/sys/sys/errno.h
+++ b/sys/sys/errno.h
@@ -167,7 +167,8 @@ __END_DECLS
#define EOVERFLOW 84 /* Value too large to be stored in data type */
#define ECANCELED 85 /* Operation canceled */
#define EILSEQ 86 /* Illegal byte sequence */
-#define ELAST 86 /* Must be equal largest errno */
+#define ENOATTR 87 /* Attribute not found */
+#define ELAST 87 /* Must be equal largest errno */
#endif /* _POSIX_SOURCE */