1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/kern/tty_pty.c 130640 2004-06-17 17:16:53Z phk $"); |
34 35/* 36 * Pseudo-teletype Driver 37 * (Actually two drivers, requiring two entries in 'cdevsw') 38 */ 39#include "opt_compat.h" 40#include "opt_tty.h" 41#include <sys/param.h> --- 96 unchanged lines hidden (view full) --- 138{ 139 struct cdev *devs; 140 struct ptsc *pt; 141 int n; 142 143 n = minor(devc); 144 /* For now we only map the lower 8 bits of the minor */ 145 if (n & ~0xff) |
146 return (NULL); |
147 148 devc->si_flags &= ~SI_CHEAPCLONE; 149 150 pt = malloc(sizeof(*pt), M_PTY, M_WAITOK | M_ZERO); 151 pt->devs = devs = make_dev(&pts_cdevsw, n, 152 UID_ROOT, GID_WHEEL, 0666, "tty%c%r", names[n / 32], n % 32); 153 pt->devc = devc; 154 --- 617 unchanged lines hidden (view full) --- 772 return (error); 773} 774 775static void 776pty_clone(void *arg, char *name, int namelen, struct cdev **dev) 777{ 778 int u; 779 |
780 if (*dev != NULL) |
781 return; 782 if (bcmp(name, "pty", 3) != 0) 783 return; 784 if (name[5] != '\0') 785 return; 786 switch (name[3]) { 787 case 'p': u = 0; break; 788 case 'q': u = 32; break; --- 28 unchanged lines hidden --- |