aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_socket.c2
-rw-r--r--sys/compat/svr4/svr4_fcntl.c6
-rw-r--r--sys/compat/svr4/svr4_ioctl.c2
-rw-r--r--sys/compat/svr4/svr4_ipc.c2
-rw-r--r--sys/compat/svr4/svr4_misc.c2
-rw-r--r--sys/compat/svr4/svr4_signal.c5
-rw-r--r--sys/compat/svr4/svr4_stat.c2
-rw-r--r--sys/compat/svr4/svr4_stream.c28
-rw-r--r--sys/compat/svr4/svr4_termios.c9
-rw-r--r--sys/compat/svr4/svr4_ttold.c24
-rw-r--r--sys/compat/svr4/svr4_util.h5
11 files changed, 81 insertions, 6 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index f1f26bcf9686..b5d7f2bcc7a2 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -1187,7 +1187,9 @@ linux_socketcall(struct thread *td, struct linux_socketcall_args *args)
return (linux_recvmsg(td, arg));
}
+ mtx_lock(&Giant);
uprintf("LINUX: 'socket' typ=%d not implemented\n", args->what);
+ mtx_unlock(&Giant);
return (ENOSYS);
}
#endif /*!__alpha__*/
diff --git a/sys/compat/svr4/svr4_fcntl.c b/sys/compat/svr4/svr4_fcntl.c
index ad748383c0e2..2107813623be 100644
--- a/sys/compat/svr4/svr4_fcntl.c
+++ b/sys/compat/svr4/svr4_fcntl.c
@@ -377,8 +377,10 @@ svr4_sys_open(td, uap)
free(newpath, M_TEMP);
if (error) {
- /* uprintf("svr4_open(%s, 0x%0x, 0%o): %d\n", uap->path,
- uap->flags, uap->mode, error);*/
+ /* mtx_lock(&Giant);
+ uprintf("svr4_open(%s, 0x%0x, 0%o): %d\n", uap->path,
+ uap->flags, uap->mode, error);
+ mtx_unlock(&Giant);*/
return error;
}
diff --git a/sys/compat/svr4/svr4_ioctl.c b/sys/compat/svr4/svr4_ioctl.c
index b192a2c77ec8..ba8218faae88 100644
--- a/sys/compat/svr4/svr4_ioctl.c
+++ b/sys/compat/svr4/svr4_ioctl.c
@@ -30,6 +30,8 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/filedesc.h>
diff --git a/sys/compat/svr4/svr4_ipc.c b/sys/compat/svr4/svr4_ipc.c
index 0b6acbf5a073..976668c637c9 100644
--- a/sys/compat/svr4/svr4_ipc.c
+++ b/sys/compat/svr4/svr4_ipc.c
@@ -77,7 +77,9 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/ipc.h>
+#include <sys/lock.h>
#include <sys/msg.h>
+#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/sem.h>
#include <sys/shm.h>
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c
index d7a9069125ec..2b3176591963 100644
--- a/sys/compat/svr4/svr4_misc.c
+++ b/sys/compat/svr4/svr4_misc.c
@@ -485,7 +485,9 @@ again:
panic("svr4_sys_getdents64: bad reclen");
off = *cookie++; /* each entry points to the next */
if ((off >> 32) != 0) {
+ mtx_lock(&Giant);
uprintf("svr4_sys_getdents64: dir offset too large for emulated program");
+ mtx_unlock(&Giant);
error = EINVAL;
goto out;
}
diff --git a/sys/compat/svr4/svr4_signal.c b/sys/compat/svr4/svr4_signal.c
index c0a3a21f0c02..57023e950c80 100644
--- a/sys/compat/svr4/svr4_signal.c
+++ b/sys/compat/svr4/svr4_signal.c
@@ -238,8 +238,11 @@ svr4_to_bsd_sigaltstack(sss, bss)
bss->ss_flags |= SS_DISABLE;
if ((sss->ss_flags & SVR4_SS_ONSTACK) != 0)
bss->ss_flags |= SS_ONSTACK;
- if ((sss->ss_flags & ~SVR4_SS_ALLBITS) != 0)
+ if ((sss->ss_flags & ~SVR4_SS_ALLBITS) != 0) {
+ mtx_lock(&Giant);
/*XXX*/ uprintf("svr4_to_bsd_sigaltstack: extra bits ignored\n");
+ mtx_unlock(&Giant);
+ }
}
void
diff --git a/sys/compat/svr4/svr4_stat.c b/sys/compat/svr4/svr4_stat.c
index d0f4d93aa8c4..62bc22305fa0 100644
--- a/sys/compat/svr4/svr4_stat.c
+++ b/sys/compat/svr4/svr4_stat.c
@@ -30,6 +30,8 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/stat.h>
diff --git a/sys/compat/svr4/svr4_stream.c b/sys/compat/svr4/svr4_stream.c
index bd6fa5af0e13..a8153e9395b4 100644
--- a/sys/compat/svr4/svr4_stream.c
+++ b/sys/compat/svr4/svr4_stream.c
@@ -378,6 +378,8 @@ bufprint(buf, len)
{
size_t i;
+ GIANT_REQUIRED;
+
uprintf("\n\t");
for (i = 0; i < len; i++) {
uprintf("%x ", buf[i]);
@@ -395,6 +397,8 @@ show_ioc(str, ioc)
int len;
int error;
+ GIANT_REQUIRED;
+
len = ioc->len;
if (len > 1024)
len = 1024;
@@ -430,6 +434,8 @@ show_strbuf(str)
int maxlen = str->maxlen;
int len = str->len;
+ GIANT_REQUIRED;
+
if (maxlen > 8192)
maxlen = 8192;
@@ -473,6 +479,8 @@ show_msg(str, fd, ctl, dat, flags)
struct svr4_strbuf buf;
int error;
+ GIANT_REQUIRED;
+
uprintf("%s(%d", str, fd);
if (ctl != NULL) {
if ((error = copyin(ctl, &buf, sizeof(buf))) != 0)
@@ -1407,8 +1415,12 @@ i_str(fp, td, retval, fd, cmd, dat)
return error;
#ifdef DEBUG_SVR4
- if ((error = show_ioc(">", &ioc)) != 0)
+ mtx_lock(&Giant);
+ if ((error = show_ioc(">", &ioc)) != 0) {
+ mtx_unlock(&Giant);
return error;
+ }
+ mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
switch (ioc.cmd & 0xff00) {
@@ -1429,8 +1441,12 @@ i_str(fp, td, retval, fd, cmd, dat)
}
#ifdef DEBUG_SVR4
- if ((error = show_ioc("<", &ioc)) != 0)
+ mtx_lock(&Giant);
+ if ((error = show_ioc("<", &ioc)) != 0) {
+ mtx_lock(&Giant);
return error;
+ }
+ mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
return copyout(&ioc, dat, sizeof(ioc));
}
@@ -1550,7 +1566,9 @@ svr4_stream_ioctl(fp, td, retval, fd, cmd, dat)
case SVR4_I_PUSH:
DPRINTF(("I_PUSH %p\n", dat));
#if defined(DEBUG_SVR4)
+ mtx_lock(&Giant);
show_strbuf((struct svr4_strbuf *)dat);
+ mtx_unlock(&Giant);
#endif
return 0;
@@ -1743,8 +1761,10 @@ svr4_do_putmsg(td, uap, fp)
retval = td->td_retval;
#ifdef DEBUG_SVR4
+ mtx_lock(&Giant);
show_msg(">putmsg", uap->fd, uap->ctl,
uap->dat, uap->flags);
+ mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
FILE_LOCK_ASSERT(fp, MA_NOTOWNED);
@@ -1940,8 +1960,10 @@ svr4_do_getmsg(td, uap, fp)
memset(&sc, 0, sizeof(sc));
#ifdef DEBUG_SVR4
+ mtx_lock(&Giant);
show_msg(">getmsg", uap->fd, uap->ctl,
uap->dat, 0);
+ mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
if (uap->ctl != NULL) {
@@ -2249,8 +2271,10 @@ svr4_do_getmsg(td, uap, fp)
*retval = 0;
#ifdef DEBUG_SVR4
+ mtx_lock(&Giant);
show_msg("<getmsg", uap->fd, uap->ctl,
uap->dat, fl);
+ mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
return error;
}
diff --git a/sys/compat/svr4/svr4_termios.c b/sys/compat/svr4/svr4_termios.c
index 37a6783aff11..b204929258f3 100644
--- a/sys/compat/svr4/svr4_termios.c
+++ b/sys/compat/svr4/svr4_termios.c
@@ -30,6 +30,8 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/file.h>
@@ -156,6 +158,9 @@ print_bsd_termios(bt)
const struct termios *bt;
{
int i;
+
+ GIANT_REQUIRED;
+
uprintf("BSD\niflag=%o oflag=%o cflag=%o lflag=%o\n",
bt->c_iflag, bt->c_oflag, bt->c_cflag, bt->c_lflag);
uprintf("cc: ");
@@ -508,7 +513,9 @@ svr4_term_ioctl(fp, td, retval, fd, cmd, data)
bsd_to_svr4_termios(&bt, &st);
#ifdef DEBUG_SVR4
+ mtx_lock(&Giant);
print_bsd_termios(&bt);
+ mtx_unlock(&Giant);
print_svr4_termios(&st);
#endif /* DEBUG_SVR4 */
@@ -576,7 +583,9 @@ svr4_term_ioctl(fp, td, retval, fd, cmd, data)
}
#ifdef DEBUG_SVR4
+ mtx_lock(&Giant);
print_bsd_termios(&bt);
+ mtx_unlock(&Giant);
print_svr4_termios(&st);
#endif /* DEBUG_SVR4 */
diff --git a/sys/compat/svr4/svr4_ttold.c b/sys/compat/svr4/svr4_ttold.c
index 3575607faa95..537f88a73bcf 100644
--- a/sys/compat/svr4/svr4_ttold.c
+++ b/sys/compat/svr4/svr4_ttold.c
@@ -32,6 +32,8 @@ __FBSDID("$FreeBSD$");
#ifndef BURN_BRIDGES
#include <sys/param.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/file.h>
@@ -69,6 +71,8 @@ print_svr4_sgttyb(str, ss)
struct svr4_sgttyb *ss;
{
+ GIANT_REQUIRED;
+
uprintf("%s\nispeed=%o ospeed=%o ", str, ss->sg_ispeed, ss->sg_ospeed);
uprintf("erase=%o kill=%o flags=%o\n", ss->sg_erase, ss->sg_kill,
ss->sg_flags);
@@ -79,6 +83,9 @@ print_svr4_tchars(str, st)
const char *str;
struct svr4_tchars *st;
{
+
+ GIANT_REQUIRED;
+
uprintf("%s\nintrc=%o quitc=%o ", str, st->t_intrc, st->t_quitc);
uprintf("startc=%o stopc=%o eofc=%o brkc=%o\n", st->t_startc,
st->t_stopc, st->t_eofc, st->t_brkc);
@@ -89,6 +96,9 @@ print_svr4_ltchars(str, sl)
const char *str;
struct svr4_ltchars *sl;
{
+
+ GIANT_REQUIRED;
+
uprintf("%s\nsuspc=%o dsuspc=%o ", str, sl->t_suspc, sl->t_dsuspc);
uprintf("rprntc=%o flushc=%o werasc=%o lnextc=%o\n", sl->t_rprntc,
sl->t_flushc, sl->t_werasc, sl->t_lnextc);
@@ -231,7 +241,9 @@ svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
return copyout(&pid, data, sizeof(pid));
#else
+ mtx_lock(&Giant);
uprintf("ioctl(TIOCGSID) for pid %d unsupported\n", td->td_proc->p_pid);
+ mtx_unlock(&Giant);
return EINVAL;
#endif
}
@@ -248,7 +260,9 @@ svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
bsd_sgttyb_to_svr4_sgttyb(&bs, &ss);
#ifdef DEBUG_SVR4
+ mtx_lock(&Giant);
print_svr4_sgttyb("SVR4_TIOCGETP", &ss);
+ mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
return copyout(&ss, data, sizeof(ss));
}
@@ -264,7 +278,9 @@ svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
svr4_sgttyb_to_bsd_sgttyb(&ss, &bs);
#ifdef DEBUG_SVR4
+ mtx_lock(&Giant);
print_svr4_sgttyb("SVR4_TIOCSET{P,N}", &ss);
+ mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
cmd = (cmd == SVR4_TIOCSETP) ? TIOCSETP : TIOCSETN;
return fo_ioctl(fp, cmd, (caddr_t) &bs,
@@ -283,7 +299,9 @@ svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
bsd_tchars_to_svr4_tchars(&bt, &st);
#ifdef DEBUG_SVR4
+ mtx_lock(&Giant);
print_svr4_tchars("SVR4_TIOCGETC", &st);
+ mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
return copyout(&st, data, sizeof(st));
}
@@ -298,7 +316,9 @@ svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
svr4_tchars_to_bsd_tchars(&st, &bt);
#ifdef DEBUG_SVR4
+ mtx_lock(&Giant);
print_svr4_tchars("SVR4_TIOCSETC", &st);
+ mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
return fo_ioctl(fp, TIOCSETC, (caddr_t) &bt,
td->td_ucred, td);
@@ -316,7 +336,9 @@ svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
bsd_ltchars_to_svr4_ltchars(&bl, &sl);
#ifdef DEBUG_SVR4
+ mtx_lock(&Giant);
print_svr4_ltchars("SVR4_TIOCGLTC", &sl);
+ mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
return copyout(&sl, data, sizeof(sl));
}
@@ -331,7 +353,9 @@ svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
svr4_ltchars_to_bsd_ltchars(&sl, &bl);
#ifdef DEBUG_SVR4
+ mtx_lock(&Giant);
print_svr4_ltchars("SVR4_TIOCSLTC", &sl);
+ mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
return fo_ioctl(fp, TIOCSLTC, (caddr_t) &bl,
td->td_ucred, td);
diff --git a/sys/compat/svr4/svr4_util.h b/sys/compat/svr4/svr4_util.h
index 66902dd96b0d..54ed43037227 100644
--- a/sys/compat/svr4/svr4_util.h
+++ b/sys/compat/svr4/svr4_util.h
@@ -42,7 +42,10 @@
#include <sys/uio.h>
#ifdef DEBUG_SVR4
-#define DPRINTF(a) uprintf a;
+#define DPRINTF(a) do { \
+ mtx_lock(&Giant); \
+ uprintf a; \
+} while (0)
#else
#define DPRINTF(a)
#endif