33#include <sys/eventhandler.h>
35#include <sys/kernel.h>
40#include <fs/devfs/devfs.h>
41#include <fs/devfs/devfs_int.h>
46 .d_version = D_VERSION,
68 if (strcmp(
name,
"tty"))
71 sx_sunlock(&clone_drain_lock);
73 sx_slock(&clone_drain_lock);
75 if (!(p->p_flag & P_CONTROLT))
77 else if (p->p_session->s_ttyvp == NULL)
79 else if (p->p_session->s_ttyvp->v_type == VBAD ||
80 p->p_session->s_ttyvp->v_rdev == NULL) {
84 *dev = p->p_session->s_ttyvp->v_rdev;
94 EVENTHANDLER_REGISTER(dev_clone,
ctty_clone, 0, 1000);
96 GID_WHEEL, 0666,
"ctty");
struct cdev * make_dev_credf(int flags, struct cdevsw *devsw, int unit, struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt,...)
void dev_refl(struct cdev *dev)
struct sx __exclusive_cache_line proctree_lock
static void ctty_drvinit(void *unused)
SYSINIT(cttydev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, ctty_drvinit, NULL)
static struct cdevsw ctty_cdevsw
static struct cdev * ctty
static void ctty_clone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev)