summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2000-11-01 19:48:35 +0000
committerobrien <obrien@FreeBSD.org>2000-11-01 19:48:35 +0000
commitc4a9f49ba81d429e0feff56ed0c369ee75bab7b1 (patch)
treed039f70072813e8e96b52f7181c2fac067d06538 /sys
parent3b7fec2c029d84c4e95227989dcc1ab64814798e (diff)
downloadFreeBSD-src-c4a9f49ba81d429e0feff56ed0c369ee75bab7b1.zip
FreeBSD-src-c4a9f49ba81d429e0feff56ed0c369ee75bab7b1.tar.gz
The MI/MD split wasn't perfect and the MI files need hacks for the
AlphaLinux compat bits. This will be better cleaned up soon. Agreed to what ever was necessary by: marcel
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/linux/linux_file.c18
-rw-r--r--sys/compat/linux/linux_ioctl.c19
-rw-r--r--sys/compat/linux/linux_ipc.c4
-rw-r--r--sys/compat/linux/linux_ipc.h2
-rw-r--r--sys/compat/linux/linux_misc.c40
-rw-r--r--sys/compat/linux/linux_signal.c33
-rw-r--r--sys/compat/linux/linux_signal.h2
-rw-r--r--sys/compat/linux/linux_socket.c6
-rw-r--r--sys/compat/linux/linux_stats.c41
-rw-r--r--sys/compat/linux/linux_util.h17
10 files changed, 156 insertions, 26 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 66e80c6..8fe7978 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -45,9 +45,14 @@
#include <sys/tty.h>
#include <machine/../linux/linux.h>
+#ifdef __alpha__
+#include <linux_proto.h>
+#else
#include <machine/../linux/linux_proto.h>
+#endif
#include <compat/linux/linux_util.h>
+#ifndef __alpha__
int
linux_creat(struct proc *p, struct linux_creat_args *args)
{
@@ -70,6 +75,7 @@ linux_creat(struct proc *p, struct linux_creat_args *args)
bsd_open_args.flags = O_WRONLY | O_CREAT | O_TRUNC;
return open(p, &bsd_open_args);
}
+#endif /*!__alpha__*/
int
linux_open(struct proc *p, struct linux_open_args *args)
@@ -254,7 +260,7 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args)
return error;
linux_to_bsd_flock(&linux_flock, bsd_flock);
fcntl_args.cmd = F_GETLK;
- fcntl_args.arg = (int)bsd_flock;
+ fcntl_args.arg = (long)bsd_flock;
error = fcntl(p, &fcntl_args);
if (error)
return error;
@@ -268,7 +274,7 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args)
return error;
linux_to_bsd_flock(&linux_flock, bsd_flock);
fcntl_args.cmd = F_SETLK;
- fcntl_args.arg = (int)bsd_flock;
+ fcntl_args.arg = (long)bsd_flock;
return fcntl(p, &fcntl_args);
case LINUX_F_SETLKW:
@@ -277,7 +283,7 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args)
return error;
linux_to_bsd_flock(&linux_flock, bsd_flock);
fcntl_args.cmd = F_SETLKW;
- fcntl_args.arg = (int)bsd_flock;
+ fcntl_args.arg = (long)bsd_flock;
return fcntl(p, &fcntl_args);
case LINUX_F_GETOWN:
@@ -315,6 +321,7 @@ linux_lseek(struct proc *p, struct linux_lseek_args *args)
return error;
}
+#ifndef __alpha__
int
linux_llseek(struct proc *p, struct linux_llseek_args *args)
{
@@ -341,6 +348,7 @@ linux_llseek(struct proc *p, struct linux_llseek_args *args)
p->p_retval[0] = 0;
return 0;
}
+#endif /*!__alpha__*/
struct linux_dirent {
@@ -353,6 +361,7 @@ struct linux_dirent {
#define LINUX_RECLEN(de,namlen) \
ALIGN((((char *)&(de)->dname - (char *)de) + (namlen) + 1))
+#ifndef __alpha__
int
linux_readdir(struct proc *p, struct linux_readdir_args *args)
{
@@ -363,6 +372,7 @@ linux_readdir(struct proc *p, struct linux_readdir_args *args)
lda.count = 1;
return linux_getdents(p, &lda);
}
+#endif /*!__alpha__*/
int
linux_getdents(struct proc *p, struct linux_getdents_args *args)
@@ -819,6 +829,7 @@ linux_getcwd(struct proc *p, struct linux_getcwd_args *args)
return (error);
}
+#ifndef __alpha__
int
linux_fdatasync(p, uap)
struct proc *p;
@@ -829,6 +840,7 @@ linux_fdatasync(p, uap)
bsd.fd = uap->fd;
return fsync(p, &bsd);
}
+#endif /*!__alpha__*/
int
linux_pread(p, uap)
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index e41d2ff..3efd91a 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -51,8 +51,18 @@
#include <sys/disklabel.h>
#include <machine/../linux/linux.h>
+#ifdef __alpha__
+#include <linux_proto.h>
+#else
#include <machine/../linux/linux_proto.h>
+#endif
+
+#include <linux_proto.h>
+#ifdef __alpha__
+#include <machine/../linux/linux_ioctl.h>
+#else
#include <compat/linux/linux_ioctl.h>
+#endif
#include <compat/linux/linux_mib.h>
#include <compat/linux/linux_util.h>
@@ -120,8 +130,15 @@ struct linux_termio {
unsigned short c_oflag;
unsigned short c_cflag;
unsigned short c_lflag;
+#ifdef __alpha__
+ unsigned char c_cc[LINUX_NCCS];
+ unsigned char c_line;
+ unsigned int c_ispeed;
+ unsigned int c_ospeed;
+#else
unsigned char c_line;
unsigned char c_cc[LINUX_NCC];
+#endif
};
struct linux_termios {
@@ -966,7 +983,7 @@ linux_ioctl_cdrom(struct proc *p, struct linux_ioctl_args *args)
* Sound related ioctls
*/
-static unsigned dirbits[4] = { IOC_VOID, IOC_IN, IOC_OUT, IOC_INOUT };
+static u_int32_t dirbits[4] = { IOC_VOID, IOC_IN, IOC_OUT, IOC_INOUT };
#define SETDIR(c) (((c) & ~IOC_DIRMASK) | dirbits[args->cmd >> 30])
diff --git a/sys/compat/linux/linux_ipc.c b/sys/compat/linux/linux_ipc.c
index 48e13d5..b5e5381 100644
--- a/sys/compat/linux/linux_ipc.c
+++ b/sys/compat/linux/linux_ipc.c
@@ -36,7 +36,11 @@
#include <sys/shm.h>
#include <machine/../linux/linux.h>
+#ifdef __alpha__
+#include <linux_proto.h>
+#else
#include <machine/../linux/linux_proto.h>
+#endif
#include <compat/linux/linux_ipc.h>
#include <compat/linux/linux_util.h>
diff --git a/sys/compat/linux/linux_ipc.h b/sys/compat/linux/linux_ipc.h
index e51a35e..b5c1255 100644
--- a/sys/compat/linux/linux_ipc.h
+++ b/sys/compat/linux/linux_ipc.h
@@ -31,6 +31,7 @@
#ifndef _LINUX_IPC_H_
#define _LINUX_IPC_H_
+#ifndef __alpha__
int linux_msgctl __P((struct proc *, struct linux_ipc_args *));
int linux_msgget __P((struct proc *, struct linux_ipc_args *));
int linux_msgrcv __P((struct proc *, struct linux_ipc_args *));
@@ -44,5 +45,6 @@ int linux_shmat __P((struct proc *, struct linux_ipc_args *));
int linux_shmctl __P((struct proc *, struct linux_ipc_args *));
int linux_shmdt __P((struct proc *, struct linux_ipc_args *));
int linux_shmget __P((struct proc *, struct linux_ipc_args *));
+#endif /*!__alpha__*/
#endif /* _LINUX_IPC_H_ */
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 8b32658..1afffe0 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -59,29 +59,42 @@
#include <machine/limits.h>
#include <machine/psl.h>
#include <machine/sysarch.h>
+#ifdef __i386__
#include <machine/segments.h>
+#endif
#include <posix4/sched.h>
#include <machine/../linux/linux.h>
+#ifdef __alpha__
+#include <linux_proto.h>
+#else
#include <machine/../linux/linux_proto.h>
+#endif
#include <compat/linux/linux_mib.h>
#include <compat/linux/linux_util.h>
+#ifdef __alpha__
+#define BSD_TO_LINUX_SIGNAL(sig) (sig)
+#else
#define BSD_TO_LINUX_SIGNAL(sig) \
(((sig) <= LINUX_SIGTBLSZ) ? bsd_to_linux_signal[_SIG_IDX(sig)] : sig)
+#endif
struct linux_rlimit {
unsigned long rlim_cur;
unsigned long rlim_max;
};
+#ifndef __alpha__
static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] =
{ RLIMIT_CPU, RLIMIT_FSIZE, RLIMIT_DATA, RLIMIT_STACK,
RLIMIT_CORE, RLIMIT_RSS, RLIMIT_NPROC, RLIMIT_NOFILE,
RLIMIT_MEMLOCK, -1
};
+#endif /*!__alpha__*/
+#ifndef __alpha__
int
linux_alarm(struct proc *p, struct linux_alarm_args *args)
{
@@ -117,6 +130,7 @@ linux_alarm(struct proc *p, struct linux_alarm_args *args)
}
return 0;
}
+#endif /*!__alpha__*/
int
linux_brk(struct proc *p, struct linux_brk_args *args)
@@ -160,9 +174,9 @@ linux_brk(struct proc *p, struct linux_brk_args *args)
new = (vm_offset_t)args->dsend;
tmp.nsize = (char *) new;
if (((caddr_t)new > vm->vm_daddr) && !obreak(p, &tmp))
- p->p_retval[0] = (int)new;
+ p->p_retval[0] = (long)new;
else
- p->p_retval[0] = (int)old;
+ p->p_retval[0] = (long)old;
return 0;
#endif
@@ -391,7 +405,7 @@ printf("uselib: Page aligned binary %lu\n", file_offset);
goto cleanup;
}
#ifdef DEBUG
-printf("mem=%08x = %08x %08x\n", vmaddr, ((int*)vmaddr)[0], ((int*)vmaddr)[1]);
+printf("mem=%08lx = %08lx %08lx\n", vmaddr, ((long*)vmaddr)[0], ((long*)vmaddr)[1]);
#endif
if (bss_size != 0) {
/*
@@ -552,9 +566,11 @@ linux_mremap(struct proc *p, struct linux_mremap_args *args)
int error = 0;
#ifdef DEBUG
- printf("Linux-emul(%ld): mremap(%p, %08x, %08x, %08x)\n",
- (long)p->p_pid, (void *)args->addr, args->old_len, args->new_len,
- args->flags);
+ printf("Linux-emul(%ld): mremap(%p, %08lx, %08lx, %08lx)\n",
+ (long)p->p_pid, (void *)args->addr,
+ (unsigned long)args->old_len,
+ (unsigned long)args->new_len,
+ (unsigned long)args->flags);
#endif
args->new_len = round_page(args->new_len);
args->old_len = round_page(args->old_len);
@@ -570,7 +586,7 @@ linux_mremap(struct proc *p, struct linux_mremap_args *args)
error = munmap(p, &bsd_args);
}
- p->p_retval[0] = error ? 0 : (int)args->addr;
+ p->p_retval[0] = error ? 0 : (u_long)args->addr;
return error;
}
@@ -586,6 +602,7 @@ linux_msync(struct proc *p, struct linux_msync_args *args)
return msync(p, &bsd_args);
}
+#ifndef __alpha__
int
linux_time(struct proc *p, struct linux_time_args *args)
{
@@ -603,6 +620,7 @@ linux_time(struct proc *p, struct linux_time_args *args)
p->p_retval[0] = tm;
return 0;
}
+#endif /*!__alpha__*/
struct linux_times_argv {
long tms_utime;
@@ -713,6 +731,7 @@ linux_utime(struct proc *p, struct linux_utime_args *args)
#define __WCLONE 0x80000000
+#ifndef __alpha__
int
linux_waitpid(struct proc *p, struct linux_waitpid_args *args)
{
@@ -753,6 +772,7 @@ linux_waitpid(struct proc *p, struct linux_waitpid_args *args)
} else
return 0;
}
+#endif /*!__alpha__*/
int
linux_wait4(struct proc *p, struct linux_wait4_args *args)
@@ -836,8 +856,10 @@ linux_personality(struct proc *p, struct linux_personality_args *args)
printf("Linux-emul(%ld): personality(%d)\n",
(long)p->p_pid, args->per);
#endif
+#ifndef __alpha__
if (args->per != 0)
return EINVAL;
+#endif
/* Yes Jim, it's still a Linux... */
p->p_retval[0] = 0;
@@ -888,6 +910,7 @@ linux_getitimer(struct proc *p, struct linux_getitimer_args *args)
return getitimer(p, &bsa);
}
+#ifndef __alpha__
int
linux_nice(struct proc *p, struct linux_nice_args *args)
{
@@ -898,6 +921,7 @@ linux_nice(struct proc *p, struct linux_nice_args *args)
bsd_args.prio = args->inc;
return setpriority(p, &bsd_args);
}
+#endif /*!__alpha__*/
int
linux_setgroups(p, uap)
@@ -989,6 +1013,7 @@ linux_getgroups(p, uap)
return (0);
}
+#ifndef __alpha__
int
linux_setrlimit(p, uap)
struct proc *p;
@@ -1056,6 +1081,7 @@ linux_getrlimit(p, uap)
rlim.rlim_max = LONG_MAX;
return (copyout(&rlim, uap->rlim, sizeof(rlim)));
}
+#endif /*!__alpha__*/
int
linux_sched_setscheduler(p, uap)
diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c
index 82705b0..47c622d 100644
--- a/sys/compat/linux/linux_signal.c
+++ b/sys/compat/linux/linux_signal.c
@@ -35,7 +35,11 @@
#include <sys/signalvar.h>
#include <machine/../linux/linux.h>
+#ifdef __alpha__
+#include <linux_proto.h>
+#else
#include <machine/../linux/linux_proto.h>
+#endif
#include <compat/linux/linux_signal.h>
#include <compat/linux/linux_util.h>
@@ -49,7 +53,11 @@ linux_to_bsd_sigset(linux_sigset_t *lss, sigset_t *bss)
bss->__bits[1] = lss->__bits[1];
for (l = 1; l <= LINUX_SIGTBLSZ; l++) {
if (LINUX_SIGISMEMBER(*lss, l)) {
+#ifdef __alpha__
+ b = _SIG_IDX(l);
+#else
b = linux_to_bsd_signal[_SIG_IDX(l)];
+#endif
if (b)
SIGADDSET(*bss, b);
}
@@ -66,7 +74,11 @@ bsd_to_linux_sigset(sigset_t *bss, linux_sigset_t *lss)
lss->__bits[1] = bss->__bits[1];
for (b = 1; b <= LINUX_SIGTBLSZ; b++) {
if (SIGISMEMBER(*bss, b)) {
+#if __alpha__
+ l = _SIG_IDX(b);
+#else
l = bsd_to_linux_signal[_SIG_IDX(b)];
+#endif
if (l)
LINUX_SIGADDSET(*lss, l);
}
@@ -144,9 +156,11 @@ linux_do_sigaction(struct proc *p, int linux_sig, linux_sigaction_t *linux_nsa,
else
nsa = NULL;
+#ifndef __alpha__
if (linux_sig <= LINUX_SIGTBLSZ)
sa_args.sig = linux_to_bsd_signal[_SIG_IDX(linux_sig)];
else
+#endif
sa_args.sig = linux_sig;
sa_args.act = nsa;
@@ -161,6 +175,8 @@ linux_do_sigaction(struct proc *p, int linux_sig, linux_sigaction_t *linux_nsa,
return (0);
}
+
+#ifndef __alpha__
int
linux_signal(struct proc *p, struct linux_signal_args *args)
{
@@ -181,6 +197,7 @@ linux_signal(struct proc *p, struct linux_signal_args *args)
return (error);
}
+#endif /*!__alpha__*/
int
linux_rt_sigaction(struct proc *p, struct linux_rt_sigaction_args *args)
@@ -189,9 +206,9 @@ linux_rt_sigaction(struct proc *p, struct linux_rt_sigaction_args *args)
int error;
#ifdef DEBUG
- printf("Linux-emul(%ld): rt_sigaction(%d, %p, %p, %d)\n",
- (long)p->p_pid, args->sig, (void *)args->act,
- (void *)args->oact, args->sigsetsize);
+ printf("Linux-emul(%ld): rt_sigaction(%ld, %p, %p, %ld)\n",
+ (long)p->p_pid, (long)args->sig, (void *)args->act,
+ (void *)args->oact, (long)args->sigsetsize);
#endif
if (args->sigsetsize != sizeof(linux_sigset_t))
@@ -255,6 +272,7 @@ linux_do_sigprocmask(struct proc *p, int how, linux_sigset_t *new,
return (error);
}
+#ifndef __alpha__
int
linux_sigprocmask(struct proc *p, struct linux_sigprocmask_args *args)
{
@@ -285,6 +303,7 @@ linux_sigprocmask(struct proc *p, struct linux_sigprocmask_args *args)
return (error);
}
+#endif /*!__alpha__*/
int
linux_rt_sigprocmask(struct proc *p, struct linux_rt_sigprocmask_args *args)
@@ -293,9 +312,9 @@ linux_rt_sigprocmask(struct proc *p, struct linux_rt_sigprocmask_args *args)
int error;
#ifdef DEBUG
- printf("Linux-emul(%ld): rt_sigprocmask(%d, %p, %p, %d)\n",
+ printf("Linux-emul(%ld): rt_sigprocmask(%d, %p, %p, %ld)\n",
(long)p->p_pid, args->how, (void *)args->mask,
- (void *)args->omask, args->sigsetsize);
+ (void *)args->omask, (long)args->sigsetsize);
#endif
if (args->sigsetsize != sizeof(linux_sigset_t))
@@ -318,6 +337,7 @@ linux_rt_sigprocmask(struct proc *p, struct linux_rt_sigprocmask_args *args)
return (error);
}
+#ifndef __alpha__
int
linux_siggetmask(struct proc *p, struct linux_siggetmask_args *args)
{
@@ -373,6 +393,7 @@ linux_sigpending(struct proc *p, struct linux_sigpending_args *args)
mask = lset.__bits[0];
return (copyout(&mask, args->mask, sizeof(mask)));
}
+#endif /*!__alpha__*/
int
linux_kill(struct proc *p, struct linux_kill_args *args)
@@ -393,9 +414,11 @@ linux_kill(struct proc *p, struct linux_kill_args *args)
if (args->signum < 0 || args->signum > LINUX_NSIG)
return EINVAL;
+#ifndef __alpha__
if (args->signum > 0 && args->signum <= LINUX_SIGTBLSZ)
tmp.signum = linux_to_bsd_signal[_SIG_IDX(args->signum)];
else
+#endif
tmp.signum = args->signum;
tmp.pid = args->pid;
diff --git a/sys/compat/linux/linux_signal.h b/sys/compat/linux/linux_signal.h
index bdbe4d4..2330b28 100644
--- a/sys/compat/linux/linux_signal.h
+++ b/sys/compat/linux/linux_signal.h
@@ -32,7 +32,7 @@
#define _LINUX_SIGNAL_H_
void linux_to_bsd_sigset __P((linux_sigset_t *, sigset_t *));
-
+void bsd_to_linux_sigset __P((sigset_t *, linux_sigset_t *));
int linux_do_sigaction __P((struct proc *, int, linux_sigaction_t *,
linux_sigaction_t *));
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index b7c9b7d..2fdd3df 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -48,9 +48,14 @@
#include <netinet/ip.h>
#include <machine/../linux/linux.h>
+#ifdef __alpha__
+#include <linux_proto.h>
+#else
#include <machine/../linux/linux_proto.h>
+#endif
#include <compat/linux/linux_util.h>
+#ifndef __alpha__
static int
linux_to_bsd_domain(int domain)
{
@@ -902,3 +907,4 @@ linux_socketcall(struct proc *p, struct linux_socketcall_args *args)
uprintf("LINUX: 'socket' typ=%d not implemented\n", args->what);
return (ENOSYS);
}
+#endif /*!__alpha__*/
diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c
index 573cd74..5067740 100644
--- a/sys/compat/linux/linux_stats.c
+++ b/sys/compat/linux/linux_stats.c
@@ -41,10 +41,31 @@
#include <sys/vnode.h>
#include <machine/../linux/linux.h>
+#ifdef __alpha__
+#include <linux_proto.h>
+#else
#include <machine/../linux/linux_proto.h>
+#endif
#include <compat/linux/linux_util.h>
struct linux_newstat {
+#ifdef __alpha__
+ u_int stat_dev;
+ u_int stat_ino;
+ u_int stat_mode;
+ u_int stat_nlink;
+ u_int stat_uid;
+ u_int stat_gid;
+ u_int stat_rdev;
+ long stat_size;
+ u_long stat_atime;
+ u_long stat_mtime;
+ u_long stat_ctime;
+ u_int stat_blksize;
+ int stat_blocks;
+ u_int stat_flags;
+ u_int stat_gen;
+#else
u_short stat_dev;
u_short __pad1;
u_long stat_ino;
@@ -65,8 +86,10 @@ struct linux_newstat {
u_long __unused3;
u_long __unused4;
u_long __unused5;
+#endif
};
+
struct linux_ustat
{
int f_tfree;
@@ -192,16 +215,16 @@ linux_newfstat(struct proc *p, struct linux_newfstat_args *args)
}
struct linux_statfs_buf {
- long ftype;
- long fbsize;
- long fblocks;
- long fbfree;
- long fbavail;
- long ffiles;
- long fffree;
+ int ftype;
+ int fbsize;
+ int fblocks;
+ int fbfree;
+ int fbavail;
+ int ffiles;
+ int fffree;
linux_fsid_t ffsid;
- long fnamelen;
- long fspare[6];
+ int fnamelen;
+ int fspare[6];
};
#ifndef VT_NWFS
diff --git a/sys/compat/linux/linux_util.h b/sys/compat/linux/linux_util.h
index 444c9a5..81bacc2 100644
--- a/sys/compat/linux/linux_util.h
+++ b/sys/compat/linux/linux_util.h
@@ -92,4 +92,21 @@ int linux_emul_find __P((struct proc *, caddr_t *, const char *, char *,
#define CHECKALTEXIST(p, sgp, path) CHECKALT(p, sgp, path, 0)
#define CHECKALTCREAT(p, sgp, path) CHECKALT(p, sgp, path, 1)
+#define DUMMY(s) \
+int \
+linux_ ## s(struct proc *p, struct linux_ ## s ## _args *args) \
+{ \
+ return (unsupported_msg(p, #s)); \
+} \
+struct __hack
+
+static __inline int
+unsupported_msg(struct proc *p, const char *fname)
+{
+
+ printf("linux: syscall %s is obsoleted or not implemented (pid=%ld)\n",
+ fname, (long)p->p_pid);
+ return (ENOSYS);
+}
+
#endif /* !_LINUX_UTIL_H_ */
OpenPOWER on IntegriCloud