[rtems-libbsd commit] Updating FREEBSD for tty support

Sebastian Huber sebh at rtems.org
Thu May 11 09:23:18 UTC 2017


Module:    rtems-libbsd
Branch:    master
Commit:    4a8f953f62f38be118a9aa3cdce87743ec898015
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=4a8f953f62f38be118a9aa3cdce87743ec898015

Author:    Kevin Kirspel <kevin-kirspel at idexx.com>
Date:      Thu May  4 08:27:58 2017 -0400

Updating FREEBSD for tty support

---

 freebsd/sys/fs/devfs/devfs_int.h   |  2 +-
 freebsd/sys/fs/devfs/devfs_vnops.c | 10 ++++++
 freebsd/sys/kern/kern_conf.c       | 16 ++++------
 freebsd/sys/kern/subr_taskqueue.c  | 10 ------
 freebsd/sys/kern/tty.c             | 62 ++++++++++++++++++++++++++++++++++++++
 freebsd/sys/kern/tty_ttydisc.c     |  2 ++
 freebsd/sys/sys/conf.h             |  2 ++
 freebsd/sys/sys/file.h             |  4 +++
 freebsd/sys/sys/proc.h             |  2 ++
 9 files changed, 89 insertions(+), 21 deletions(-)

diff --git a/freebsd/sys/fs/devfs/devfs_int.h b/freebsd/sys/fs/devfs/devfs_int.h
index 670aba1..9e16b40 100644
--- a/freebsd/sys/fs/devfs/devfs_int.h
+++ b/freebsd/sys/fs/devfs/devfs_int.h
@@ -63,13 +63,13 @@ struct cdev_priv {
 	u_int			cdp_maxdirent;
 	struct devfs_dirent	**cdp_dirents;
 	struct devfs_dirent	*cdp_dirent0;
+#endif /* __rtems__ */
 
 	TAILQ_ENTRY(cdev_priv)	cdp_dtr_list;
 	void			(*cdp_dtr_cb)(void *);
 	void			*cdp_dtr_cb_arg;
 
 	LIST_HEAD(, cdev_privdata) cdp_fdpriv;
-#endif /* __rtems__ */
 };
 
 #define	cdev2priv(c)	__containerof(c, struct cdev_priv, cdp_c)
diff --git a/freebsd/sys/fs/devfs/devfs_vnops.c b/freebsd/sys/fs/devfs/devfs_vnops.c
index eb7df0f..b585178 100644
--- a/freebsd/sys/fs/devfs/devfs_vnops.c
+++ b/freebsd/sys/fs/devfs/devfs_vnops.c
@@ -64,6 +64,7 @@
 #include <sys/time.h>
 #include <sys/ttycom.h>
 #include <rtems/bsd/sys/unistd.h>
+#ifndef __rtems__
 #include <sys/vnode.h>
 
 static struct vop_vector devfs_vnodeops;
@@ -71,23 +72,29 @@ static struct vop_vector devfs_specops;
 static struct fileops devfs_ops_f;
 
 #include <fs/devfs/devfs.h>
+#endif /* __rtems__ */
 #include <fs/devfs/devfs_int.h>
 
+#ifndef __rtems__
 #include <security/mac/mac_framework.h>
 
 #include <vm/vm.h>
 #include <vm/vm_extern.h>
 #include <vm/vm_object.h>
+#endif /* __rtems__ */
 
 static MALLOC_DEFINE(M_CDEVPDATA, "DEVFSP", "Metainfo for cdev-fp data");
 
+#ifndef __rtems__
 struct mtx	devfs_de_interlock;
 MTX_SYSINIT(devfs_de_interlock, &devfs_de_interlock, "devfs interlock", MTX_DEF);
 struct sx	clone_drain_lock;
 SX_SYSINIT(clone_drain_lock, &clone_drain_lock, "clone events drain lock");
+#endif /* __rtems__ */
 struct mtx	cdevpriv_mtx;
 MTX_SYSINIT(cdevpriv_mtx, &cdevpriv_mtx, "cdevpriv lock", MTX_DEF);
 
+#ifndef __rtems__
 SYSCTL_DECL(_vfs_devfs);
 
 static int devfs_dotimes;
@@ -132,6 +139,7 @@ devfs_fp_check(struct file *fp, struct cdev **devp, struct cdevsw **dswp,
 	curthread->td_fpop = fp;
 	return (0);
 }
+#endif /* __rtems__ */
 
 int
 devfs_get_cdevpriv(void **datap)
@@ -220,6 +228,7 @@ devfs_clear_cdevpriv(void)
 	devfs_fpdrop(fp);
 }
 
+#ifndef __rtems__
 /*
  * On success devfs_populate_vp() returns with dmp->dm_lock held.
  */
@@ -1929,3 +1938,4 @@ static struct vop_vector devfs_specops = {
  */
 CTASSERT(O_NONBLOCK == IO_NDELAY);
 CTASSERT(O_FSYNC == IO_SYNC);
+#endif /* __rtems__ */
diff --git a/freebsd/sys/kern/kern_conf.c b/freebsd/sys/kern/kern_conf.c
index fb43c24..20f2e2c 100644
--- a/freebsd/sys/kern/kern_conf.c
+++ b/freebsd/sys/kern/kern_conf.c
@@ -59,11 +59,9 @@ static MALLOC_DEFINE(M_DEVT, "cdev", "cdev storage");
 
 struct mtx devmtx;
 static void destroy_devl(struct cdev *dev);
-#ifndef __rtems__
 static int destroy_dev_sched_cbl(struct cdev *dev,
     void (*cb)(void *), void *arg);
 static void destroy_dev_tq(void *ctx, int pending);
-#endif /* __rtems__ */
 static int make_dev_credv(int flags, struct cdev **dres, struct cdevsw *devsw,
     int unit, struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt,
     va_list ap);
@@ -164,7 +162,6 @@ dev_refl(struct cdev *dev)
 	dev->si_refcount++;
 }
 
-#ifndef __rtems__
 void
 dev_rel(struct cdev *dev)
 {
@@ -189,7 +186,6 @@ dev_rel(struct cdev *dev)
 	if (flag)
 		devfs_free(dev);
 }
-#endif /* __rtems__ */
 
 struct cdevsw *
 dev_refthread(struct cdev *dev, int *ref)
@@ -971,6 +967,7 @@ make_dev_p(int flags, struct cdev **cdev, struct cdevsw *devsw,
 	    ("make_dev_p: failed make_dev_credv (error=%d)", res));
 	return (res);
 }
+#endif /* __rtems__ */
 
 static void
 dev_dependsl(struct cdev *pdev, struct cdev *cdev)
@@ -1050,6 +1047,7 @@ make_dev_alias(struct cdev *pdev, const char *fmt, ...)
 	return (dev);
 }
 
+#ifndef __rtems__
 int
 make_dev_alias_p(int flags, struct cdev **cdev, struct cdev *pdev,
     const char *fmt, ...)
@@ -1156,7 +1154,6 @@ destroy_devl(struct cdev *dev)
 	/* Remove name marking */
 	dev->si_flags &= ~SI_NAMED;
 
-#ifndef __rtems__
 	/* If we are a child, remove us from the parents list */
 	if (dev->si_flags & SI_CHILD) {
 		LIST_REMOVE(dev, si_siblings);
@@ -1167,6 +1164,7 @@ destroy_devl(struct cdev *dev)
 	while (!LIST_EMPTY(&dev->si_children))
 		destroy_devl(LIST_FIRST(&dev->si_children));
 
+#ifndef __rtems__
 	/* Remove from clone list */
 	if (dev->si_flags & SI_CLONELIST) {
 		LIST_REMOVE(dev, si_clone);
@@ -1195,14 +1193,12 @@ destroy_devl(struct cdev *dev)
 		/* avoid out of order notify events */
 		notify_destroy(dev);
 	}
-#ifndef __rtems__
 	mtx_lock(&cdevpriv_mtx);
 	while ((p = LIST_FIRST(&cdp->cdp_fdpriv)) != NULL) {
 		devfs_destroy_cdevpriv(p);
 		mtx_lock(&cdevpriv_mtx);
 	}
 	mtx_unlock(&cdevpriv_mtx);
-#endif /* __rtems__ */
 	dev_lock();
 
 	dev->si_drv1 = 0;
@@ -1231,7 +1227,6 @@ destroy_devl(struct cdev *dev)
 		dev_free_devlocked(dev);
 }
 
-#ifndef __rtems__
 static void
 delist_dev_locked(struct cdev *dev)
 {
@@ -1270,7 +1265,6 @@ delist_dev(struct cdev *dev)
 	delist_dev_locked(dev);
 	dev_unlock();
 }
-#endif /* __rtems__ */
 
 void
 destroy_dev(struct cdev *dev)
@@ -1282,7 +1276,6 @@ destroy_dev(struct cdev *dev)
 	dev_unlock_and_free();
 }
 
-#ifndef __rtems__
 const char *
 devtoname(struct cdev *dev)
 {
@@ -1290,6 +1283,7 @@ devtoname(struct cdev *dev)
 	return (dev->si_name);
 }
 
+#ifndef __rtems__
 int
 dev_stdclone(char *name, char **namep, const char *stem, int *unit)
 {
@@ -1464,6 +1458,7 @@ clone_cleanup(struct clonedevs **cdp)
 	free(cd, M_DEVBUF);
 	*cdp = NULL;
 }
+#endif /* __rtems__ */
 
 static TAILQ_HEAD(, cdev_priv) dev_ddtr =
 	TAILQ_HEAD_INITIALIZER(dev_ddtr);
@@ -1536,6 +1531,7 @@ destroy_dev_sched(struct cdev *dev)
 	return (destroy_dev_sched_cb(dev, NULL, NULL));
 }
 
+#ifndef __rtems__
 void
 destroy_dev_drain(struct cdevsw *csw)
 {
diff --git a/freebsd/sys/kern/subr_taskqueue.c b/freebsd/sys/kern/subr_taskqueue.c
index c739ccf..c394869 100644
--- a/freebsd/sys/kern/subr_taskqueue.c
+++ b/freebsd/sys/kern/subr_taskqueue.c
@@ -49,15 +49,11 @@ __FBSDID("$FreeBSD$");
 #include <machine/stdarg.h>
 
 static MALLOC_DEFINE(M_TASKQUEUE, "taskqueue", "Task Queues");
-#ifndef __rtems__
 static void	*taskqueue_giant_ih;
-#endif /* __rtems__ */
 static void	*taskqueue_ih;
 static void	 taskqueue_fast_enqueue(void *);
 static void	 taskqueue_swi_enqueue(void *);
-#ifndef __rtems__
 static void	 taskqueue_swi_giant_enqueue(void *);
-#endif /* __rtems__ */
 
 struct taskqueue_busy {
 	struct task	*tb_running;
@@ -182,9 +178,7 @@ _taskqueue_create(const char *name, int mflags,
 	queue->tq_flags |= TQ_FLAGS_ACTIVE;
 	if (enqueue == taskqueue_fast_enqueue ||
 	    enqueue == taskqueue_swi_enqueue ||
-#ifndef __rtems__
 	    enqueue == taskqueue_swi_giant_enqueue ||
-#endif /* __rtems__ */
 	    enqueue == taskqueue_thread_enqueue)
 		queue->tq_flags |= TQ_FLAGS_UNLOCKED_ENQUEUE;
 	mtx_init(&queue->tq_mutex, tq_name, NULL, mtxflags);
@@ -652,7 +646,6 @@ taskqueue_swi_run(void *dummy)
 	taskqueue_run(taskqueue_swi);
 }
 
-#ifndef __rtems__
 static void
 taskqueue_swi_giant_enqueue(void *context)
 {
@@ -664,7 +657,6 @@ taskqueue_swi_giant_run(void *dummy)
 {
 	taskqueue_run(taskqueue_swi_giant);
 }
-#endif /* __rtems__ */
 
 static int
 _taskqueue_start_threads(struct taskqueue **tqp, int count, int pri,
@@ -829,11 +821,9 @@ TASKQUEUE_DEFINE(swi, taskqueue_swi_enqueue, NULL,
 		 swi_add(NULL, "task queue", taskqueue_swi_run, NULL, SWI_TQ,
 		     INTR_MPSAFE, &taskqueue_ih));
 
-#ifndef __rtems__
 TASKQUEUE_DEFINE(swi_giant, taskqueue_swi_giant_enqueue, NULL,
 		 swi_add(NULL, "Giant taskq", taskqueue_swi_giant_run,
 		     NULL, SWI_TQ_GIANT, 0, &taskqueue_giant_ih));
-#endif /* __rtems__ */
 
 TASKQUEUE_DEFINE_THREAD(thread);
 
diff --git a/freebsd/sys/kern/tty.c b/freebsd/sys/kern/tty.c
index 95afaeb..5972e32 100644
--- a/freebsd/sys/kern/tty.c
+++ b/freebsd/sys/kern/tty.c
@@ -235,9 +235,11 @@ ttydev_leave(struct tty *tp)
 	/* Stop asynchronous I/O. */
 	funsetown(&tp->t_sigio);
 
+#ifndef __rtems__
 	/* Remove console TTY. */
 	if (constty == tp)
 		constty_clear();
+#endif /* __rtems__ */
 
 	/* Drain any output. */
 	if (!tty_gone(tp))
@@ -388,9 +390,11 @@ ttydev_close(struct cdev *dev, int fflag, int devtype __unused,
 		return (0);
 	}
 
+#ifndef __rtems__
 	/* If revoking, flush output now to avoid draining it later. */
 	if (fflag & FREVOKE)
 		tty_flush(tp, FWRITE);
+#endif /* __rtems__ */
 
 	tp->t_flags &= ~TF_EXCLUDE;
 
@@ -405,6 +409,7 @@ ttydev_close(struct cdev *dev, int fflag, int devtype __unused,
 	return (0);
 }
 
+#ifndef __rtems__
 static __inline int
 tty_is_ctty(struct tty *tp, struct proc *p)
 {
@@ -413,10 +418,12 @@ tty_is_ctty(struct tty *tp, struct proc *p)
 
 	return (p->p_session == tp->t_session && p->p_flag & P_CONTROLT);
 }
+#endif /* __rtems__ */
 
 int
 tty_wait_background(struct tty *tp, struct thread *td, int sig)
 {
+#ifndef __rtems__
 	struct proc *p = td->td_proc;
 	struct pgrp *pg;
 	ksiginfo_t ksi;
@@ -475,6 +482,9 @@ tty_wait_background(struct tty *tp, struct thread *td, int sig)
 		if (error)
 			return (error);
 	}
+#else /* __rtems__ */
+	return (0);
+#endif /* __rtems__ */
 }
 
 static int
@@ -779,7 +789,9 @@ static struct cdevsw ttydev_cdevsw = {
 	.d_ioctl	= ttydev_ioctl,
 	.d_kqfilter	= ttydev_kqfilter,
 	.d_poll		= ttydev_poll,
+#ifndef __rtems__
 	.d_mmap		= ttydev_mmap,
+#endif /* __rtems__ */
 	.d_name		= "ttydev",
 	.d_flags	= D_TTY,
 };
@@ -1189,6 +1201,7 @@ tty_rel_gone(struct tty *tp)
  * Exposing information about current TTY's through sysctl
  */
 
+#ifndef __rtems__
 static void
 tty_to_xtty(struct tty *tp, struct xtty *xt)
 {
@@ -1242,6 +1255,7 @@ sysctl_kern_ttys(SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC(_kern, OID_AUTO, ttys, CTLTYPE_OPAQUE|CTLFLAG_RD|CTLFLAG_MPSAFE,
 	0, 0, sysctl_kern_ttys, "S,xtty", "List of TTYs");
+#endif /* __rtems__ */
 
 /*
  * Device node creation. Device has been set up, now we can expose it to
@@ -1270,6 +1284,7 @@ tty_makedevf(struct tty *tp, struct ucred *cred, int flags,
 	vsnrprintf(name, sizeof name, 32, fmt, ap);
 	va_end(ap);
 
+#ifndef __rtems__
 	if (cred == NULL) {
 		/* System device. */
 		uid = UID_ROOT;
@@ -1281,6 +1296,11 @@ tty_makedevf(struct tty *tp, struct ucred *cred, int flags,
 		gid = GID_TTY;
 		mode = S_IRUSR|S_IWUSR|S_IWGRP;
 	}
+#else /* __rtems__ */
+	uid = BSD_DEFAULT_UID;
+	gid = BSD_DEFAULT_GID;
+	mode = S_IRUSR|S_IWUSR|S_IWGRP;
+#endif /* __rtems__ */
 
 	flags = flags & TTYMK_CLONING ? MAKEDEV_REF : 0;
 	flags |= MAKEDEV_CHECKNAME;
@@ -1391,12 +1411,14 @@ tty_signal_sessleader(struct tty *tp, int sig)
 	/* Make signals start output again. */
 	tp->t_flags &= ~TF_STOPPED;
 
+#ifndef __rtems__
 	if (tp->t_session != NULL && tp->t_session->s_leader != NULL) {
 		p = tp->t_session->s_leader;
 		PROC_LOCK(p);
 		kern_psignal(p, sig);
 		PROC_UNLOCK(p);
 	}
+#endif /* __rtems__ */
 }
 
 void
@@ -1410,6 +1432,7 @@ tty_signal_pgrp(struct tty *tp, int sig)
 	/* Make signals start output again. */
 	tp->t_flags &= ~TF_STOPPED;
 
+#ifndef __rtems__
 	if (sig == SIGINFO && !(tp->t_termios.c_lflag & NOKERNINFO))
 		tty_info(tp);
 	if (tp->t_pgrp != NULL) {
@@ -1420,6 +1443,7 @@ tty_signal_pgrp(struct tty *tp, int sig)
 		pgsignal(tp->t_pgrp, sig, 1, &ksi);
 		PGRP_UNLOCK(tp->t_pgrp);
 	}
+#endif /* __rtems__ */
 }
 
 void
@@ -1516,7 +1540,9 @@ tty_set_winsize(struct tty *tp, const struct winsize *wsz)
 	if (memcmp(&tp->t_winsize, wsz, sizeof(*wsz)) == 0)
 		return;
 	tp->t_winsize = *wsz;
+#ifndef __rtems__
 	tty_signal_pgrp(tp, SIGWINCH);
+#endif /* __rtems__ */
 }
 
 static int
@@ -1575,9 +1601,11 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag,
 		*(int *)data = ttyoutq_bytesused(&tp->t_outq);
 		return (0);
 	case FIOSETOWN:
+#ifndef __rtems__
 		if (tp->t_session != NULL && !tty_is_ctty(tp, td->td_proc))
 			/* Not allowed to set ownership. */
 			return (ENOTTY);
+#endif /* __rtems__ */
 
 		/* Temporarily unlock the TTY to set ownership. */
 		tty_unlock(tp);
@@ -1585,9 +1613,11 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag,
 		tty_lock(tp);
 		return (error);
 	case FIOGETOWN:
+#ifndef __rtems__
 		if (tp->t_session != NULL && !tty_is_ctty(tp, td->td_proc))
 			/* Not allowed to set ownership. */
 			return (ENOTTY);
+#endif /* __rtems__ */
 
 		/* Get ownership. */
 		*(int *)data = fgetown(&tp->t_sigio);
@@ -1684,6 +1714,7 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag,
 		*(int *)data = TTYDISC;
 		return (0);
 	case TIOCGPGRP:
+#ifndef __rtems__
 		if (!tty_is_ctty(tp, td->td_proc))
 			return (ENOTTY);
 
@@ -1691,15 +1722,23 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag,
 			*(int *)data = tp->t_pgrp->pg_id;
 		else
 			*(int *)data = NO_PID;
+#else /* __rtems__ */
+		*(int *)data = NO_PID;
+#endif /* __rtems__ */
 		return (0);
 	case TIOCGSID:
+#ifndef __rtems__
 		if (!tty_is_ctty(tp, td->td_proc))
 			return (ENOTTY);
 
 		MPASS(tp->t_session);
 		*(int *)data = tp->t_session->s_sid;
+#else /* __rtems__ */
+		*(int *)data = NO_PID;
+#endif /* __rtems__ */
 		return (0);
 	case TIOCSCTTY: {
+#ifndef __rtems__
 		struct proc *p = td->td_proc;
 
 		/* XXX: This looks awful. */
@@ -1748,10 +1787,12 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag,
 		PROC_LOCK(p);
 		p->p_flag |= P_CONTROLT;
 		PROC_UNLOCK(p);
+#endif /* __rtems__ */
 
 		return (0);
 	}
 	case TIOCSPGRP: {
+#ifndef __rtems__
 		struct pgrp *pg;
 
 		/*
@@ -1784,6 +1825,7 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag,
 
 		/* Wake up the background process groups. */
 		cv_broadcast(&tp->t_bgwait);
+#endif /* __rtems__ */
 		return (0);
 	}
 	case TIOCFLUSH: {
@@ -1808,6 +1850,7 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag,
 			tp->t_drainwait = *(int *)data;
 		return (error);
 	case TIOCCONS:
+#ifndef __rtems__
 		/* Set terminal as console TTY. */
 		if (*(int *)data) {
 			error = priv_check(td, PRIV_TTY_CONSOLE);
@@ -1830,6 +1873,7 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag,
 		} else if (constty == tp) {
 			constty_clear();
 		}
+#endif /* __rtems__ */
 		return (0);
 	case TIOCGWINSZ:
 		/* Obtain window size. */
@@ -1855,14 +1899,18 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag,
 		ttydevsw_pktnotify(tp, TIOCPKT_START);
 		return (0);
 	case TIOCSTAT:
+#ifndef __rtems__
 		tty_info(tp);
+#endif /* __rtems__ */
 		return (0);
 	case TIOCSTI:
+#ifndef __rtems__
 		if ((fflag & FREAD) == 0 && priv_check(td, PRIV_TTY_STI))
 			return (EPERM);
 		if (!tty_is_ctty(tp, td->td_proc) &&
 		    priv_check(td, PRIV_TTY_STI))
 			return (EACCES);
+#endif /* __rtems__ */
 		ttydisc_rint(tp, *(char *)data, 0);
 		ttydisc_rint_done(tp);
 		return (0);
@@ -1941,9 +1989,17 @@ tty_hiwat_in_unblock(struct tty *tp)
 		 * Input flow control. Only leave the high watermark when we
 		 * can successfully store the VSTART character.
 		 */
+#ifndef __rtems__
 		if (ttyoutq_write_nofrag(&tp->t_outq,
 		    &tp->t_termios.c_cc[VSTART], 1) == 0)
 			tp->t_flags &= ~TF_HIWAT_IN;
+#else /* __rtems__ */
+		if (ttyoutq_write_nofrag(&tp->t_outq,
+		    &tp->t_termios.c_cc[VSTART], 1) == 0) {
+			tp->t_flags &= ~TF_HIWAT_IN;
+			ttydevsw_outwakeup(tp);
+		}
+#endif /* __rtems__ */
 	} else {
 		/* No input flow control. */
 		tp->t_flags &= ~TF_HIWAT_IN;
@@ -1967,6 +2023,7 @@ ttyhook_defrint(struct tty *tp, char c, int flags)
 	return (0);
 }
 
+#ifndef __rtems__
 int
 ttyhook_register(struct tty **rtp, struct proc *p, int fd, struct ttyhook *th,
     void *softc)
@@ -2060,6 +2117,7 @@ ttyhook_unregister(struct tty *tp)
 	/* Maybe deallocate the TTY as well. */
 	tty_rel_free(tp);
 }
+#endif /* __rtems__ */
 
 /*
  * /dev/console handling.
@@ -2114,11 +2172,14 @@ static struct cdevsw ttyconsdev_cdevsw = {
 	.d_ioctl	= ttydev_ioctl,
 	.d_kqfilter	= ttydev_kqfilter,
 	.d_poll		= ttydev_poll,
+#ifndef __rtems__
 	.d_mmap		= ttydev_mmap,
+#endif /* __rtems__ */
 	.d_name		= "ttyconsdev",
 	.d_flags	= D_TTY,
 };
 
+#ifndef __rtems__
 static void
 ttyconsdev_init(void *unused __unused)
 {
@@ -2135,6 +2196,7 @@ ttyconsdev_select(const char *name)
 
 	dev_console_filename = name;
 }
+#endif /* __rtems__ */
 
 /*
  * Debugging routines.
diff --git a/freebsd/sys/kern/tty_ttydisc.c b/freebsd/sys/kern/tty_ttydisc.c
index edb1d15..2cdc332 100644
--- a/freebsd/sys/kern/tty_ttydisc.c
+++ b/freebsd/sys/kern/tty_ttydisc.c
@@ -914,7 +914,9 @@ ttydisc_rint(struct tty *tp, char c, int flags)
 	if (CMP_FLAG(l, ISIG)) {
 		if (CMP_FLAG(l, ICANON|IEXTEN) == (ICANON|IEXTEN)) {
 			if (CMP_CC(VSTATUS, c)) {
+#ifndef __rtems__
 				tty_signal_pgrp(tp, SIGINFO);
+#endif /* __rtems__ */
 				return (0);
 			}
 		}
diff --git a/freebsd/sys/sys/conf.h b/freebsd/sys/sys/conf.h
index 8d39c62..d5ced5c 100644
--- a/freebsd/sys/sys/conf.h
+++ b/freebsd/sys/sys/conf.h
@@ -84,9 +84,11 @@ struct cdev {
 	LIST_ENTRY(cdev)	si_list;
 #ifndef __rtems__
 	LIST_ENTRY(cdev)	si_clone;
+#endif /* __rtems__ */
 	LIST_HEAD(, cdev)	si_children;
 	LIST_ENTRY(cdev)	si_siblings;
 	struct cdev *si_parent;
+#ifndef __rtems__
 	struct mount	*si_mountpt;
 #endif /* __rtems__ */
 	void		*si_drv1, *si_drv2;
diff --git a/freebsd/sys/sys/file.h b/freebsd/sys/sys/file.h
index 092362b..8f91f52 100644
--- a/freebsd/sys/sys/file.h
+++ b/freebsd/sys/sys/file.h
@@ -199,6 +199,10 @@ struct file {
 	void		*f_label;	/* Place-holder for MAC label. */
 #else /* __rtems__ */
 	rtems_libio_t	f_io;
+	union {
+		struct cdev_privdata *fvn_cdevpriv;
+					/* (d) Private data for the cdev. */
+	} f_vnun;
 #endif /* __rtems__ */
 };
 #ifdef __rtems__
diff --git a/freebsd/sys/sys/proc.h b/freebsd/sys/sys/proc.h
index 7af3dc2..2b58ffe 100644
--- a/freebsd/sys/sys/proc.h
+++ b/freebsd/sys/sys/proc.h
@@ -301,7 +301,9 @@ struct thread {
 	u_long		td_profil_addr;	/* (k) Temporary addr until AST. */
 	u_int		td_profil_ticks; /* (k) Temporary ticks until AST. */
 	char		td_name[MAXCOMLEN + 1];	/* (*) Thread name. */
+#endif /* __rtems__ */
 	struct file	*td_fpop;	/* (k) file referencing cdev under op */
+#ifndef __rtems__
 	int		td_dbgflags;	/* (c) Userland debugger flags */
 	siginfo_t	td_si;		/* (c) For debugger or core file */
 	int		td_ng_outbound;	/* (k) Thread entered ng from above. */




More information about the vc mailing list