-void termioschars __P((struct termios *t));
-int tputchar __P((int c, struct tty *tp));
-#ifndef __APPLE__
-int ttioctl __P((struct tty *tp, int com, void *data, int flag));
-#else
-int ttioctl __P((struct tty *tp, u_long com, caddr_t data, int flag,
- struct proc *p));
-#endif
-int ttread __P((struct tty *tp, struct uio *uio, int flag));
-void ttrstrt __P((void *tp));
-int ttyselect __P((struct tty *tp, int rw, void * wql, struct proc *p));
-int ttselect __P((dev_t dev, int rw, void * wql, struct proc *p));
-void ttsetwater __P((struct tty *tp));
-int ttspeedtab __P((int speed, struct speedtab *table));
-int ttstart __P((struct tty *tp));
-void ttwakeup __P((struct tty *tp));
-int ttwrite __P((struct tty *tp, struct uio *uio, int flag));
-void ttwwakeup __P((struct tty *tp));
-void ttyblock __P((struct tty *tp));
-void ttychars __P((struct tty *tp));
-int ttycheckoutq __P((struct tty *tp, int wait));
-int ttyclose __P((struct tty *tp));
-void ttyflush __P((struct tty *tp, int rw));
-void ttyinfo __P((struct tty *tp));
-int ttyinput __P((int c, struct tty *tp));
-int ttylclose __P((struct tty *tp, int flag));
-int ttymodem __P((struct tty *tp, int flag));
-int ttyopen __P((dev_t device, struct tty *tp));
-int ttysleep __P((struct tty *tp,
- void *chan, int pri, char *wmesg, int timeout));
-int ttywait __P((struct tty *tp));
-struct tty *ttymalloc __P((void));
-void ttyfree __P((struct tty *));
+void tty_lock(struct tty *tp);
+void tty_unlock(struct tty *tp);
+
+void termioschars(struct termios *t);
+int tputchar(int c, struct tty *tp);
+int ttioctl(struct tty *tp, u_long com, caddr_t data, int flag,
+ struct proc *p);
+int ttread(struct tty *tp, struct uio *uio, int flag);
+int ttyselect(struct tty *tp, int rw, void * wql, struct proc *p);
+int ttselect(dev_t dev, int rw, void * wql, struct proc *p);
+void ttsetwater(struct tty *tp);
+int ttspeedtab(int speed, struct speedtab *table);
+int ttstart(struct tty *tp);
+void ttwakeup(struct tty *tp);
+int ttwrite(struct tty *tp, struct uio *uio, int flag);
+void ttwwakeup(struct tty *tp);
+void ttyblock(struct tty *tp);
+int ttycheckoutq(struct tty *tp, int wait);
+int ttyclose(struct tty *tp); /* LEGACY: avoid using */
+void ttyflush(struct tty *tp, int rw);
+void ttyinfo(struct tty *tp);
+void ttyinfo_locked(struct tty *tp);
+int ttyinput(int c, struct tty *tp);
+int ttylclose(struct tty *tp, int flag);
+int ttymodem(struct tty *tp, int flag);
+int ttyopen(dev_t device, struct tty *tp);
+int ttysleep(struct tty *tp,
+ void *chan, int pri, const char *wmesg, int timeout);
+int ttywait(struct tty *tp);
+struct tty *ttymalloc(void);
+void ttyfree(struct tty *);
+void ttysetpgrphup(struct tty *tp);
+void ttyclrpgrphup(struct tty *tp);
+
+#ifdef XNU_KERNEL_PRIVATE
+extern void ttyhold(struct tty *tp);
+
+#define TTY_LOCK_OWNED(tp) LCK_MTX_ASSERT(&tp->t_lock, LCK_MTX_ASSERT_OWNED)
+#define TTY_LOCK_NOTOWNED(tp) LCK_MTX_ASSERT(&tp->t_lock, LCK_MTX_ASSERT_NOTOWNED)
+
+#define PTS_MAJOR 4
+#define PTC_MAJOR 5
+#endif /* defined(XNU_KERNEL_PRIVATE) */