-#ifndef NeXT
-int
-ttsetcompat(tp, com, data, term)
- register struct tty *tp;
- int *com;
- caddr_t data;
- struct termios *term;
-#else
-__private_extern__ int
-ttsetcompat(tp, com, data, term)
- register struct tty *tp;
- u_long *com;
- caddr_t data;
- struct termios *term;
-#endif /* !NeXT */
+
+/*
+ * ttsetcompat
+ *
+ * Description: Convert backward compatability set command arguments as
+ * follows:
+ *
+ * TIOCSETP -> TIOSETAF
+ * TIOCSETN -> TIOCSETA
+ * TIOCSETC -> TIOCSETA
+ * TIOCSLTC -> TIOCSETA
+ * TIOCLBIS -> TIOCSETA
+ * TIOCLBIC -> TIOCSETA
+ * TIOCLSET -> TIOCSETA
+ *
+ * The converted command argument and potentially modified 'term'
+ * argument are returned to ttcompat(), which will then call
+ * ttioctl_locked(), if this function returns successfully.
+ *
+ * Parameters struct tty *tp The tty on which the operation is
+ * being performed.
+ * u_long *com A pointer to the terminal input/output
+ * command being requested; its contents
+ * will be modified per the table above,
+ * on a non-error return.
+ * caddr_t data Command specific parameter data; this
+ * data is read but not modified.
+ * struct termios *term A local stack termios structure from
+ * ttcompat(), whose contents are to be
+ * modified based on *com and *data.
+ *
+ * Returns: EINVAL An input speed or output speed is
+ * outside the allowable range for a
+ * TIOCSETP or TIOCSETN command.
+ * 0 All other cases return 0.
+ *
+ * Notes: This function may modify the contents of the tp->t_flags
+ * field in a successful call to TIOCSETP, TIOCSETN, TIOCLBIS,
+ * TIOCLBIC, or TIOCLSET.
+ *
+ * All other tp fields will remain unmodifed, since the struct
+ * termios is a local stack copy from ttcompat(), and not the
+ * real thing. A subsequent call to ttioctl_locked() in
+ * ttcompat(), however, may result in subsequent changes.
+ *
+ * WARNING: This compatibility code is not 6/432 clean; it will only
+ * work for 32 bit processes on 32 bit kernels or 64 bit
+ * processes on 64 bit kernels. We are not addressing this
+ * due to <rdar://6904053>.
+ */
+static int
+ttsetcompat(struct tty *tp, u_long *com, caddr_t data, struct termios *term)