pty.c (47625) | pty.c (47640) |
---|---|
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 --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95 | 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 --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95 |
34 * $Id: tty_pty.c,v 1.59 1999/05/18 14:53:52 luoqi Exp $ | 34 * $Id: tty_pty.c,v 1.60 1999/05/30 16:52:57 phk Exp $ |
35 */ 36 37/* 38 * Pseudo-teletype Driver 39 * (Actually two drivers, requiring two entries in 'cdevsw') 40 */ 41#include "pty.h" /* XXX */ 42#include "opt_compat.h" --- 795 unchanged lines hidden (view full) --- 838static void ptc_drvinit __P((void *unused)); 839static void 840ptc_drvinit(unused) 841 void *unused; 842{ 843#ifdef DEVFS 844 int i,j,k; 845#endif | 35 */ 36 37/* 38 * Pseudo-teletype Driver 39 * (Actually two drivers, requiring two entries in 'cdevsw') 40 */ 41#include "pty.h" /* XXX */ 42#include "opt_compat.h" --- 795 unchanged lines hidden (view full) --- 838static void ptc_drvinit __P((void *unused)); 839static void 840ptc_drvinit(unused) 841 void *unused; 842{ 843#ifdef DEVFS 844 int i,j,k; 845#endif |
846 dev_t dev; | |
847 848 if( ! ptc_devsw_installed ) { | 846 847 if( ! ptc_devsw_installed ) { |
849 dev = makedev(CDEV_MAJOR_S, 0); 850 cdevsw_add(&dev, &pts_cdevsw, NULL); 851 dev = makedev(CDEV_MAJOR_C, 0); 852 cdevsw_add(&dev, &ptc_cdevsw, NULL); | 848 cdevsw_add(&pts_cdevsw); 849 cdevsw_add(&ptc_cdevsw); |
853 ptc_devsw_installed = 1; 854#ifdef DEVFS 855 for ( i = 0 ; i<NPTY ; i++ ) { 856 j = i / 32; 857 k = i % 32; 858 devfs_token_pts[i] = 859 devfs_add_devswf(&pts_cdevsw,i, 860 DV_CHR,0,0,0666, 861 "tty%c%r",jnames[j],k); 862 devfs_token_ptc[i] = 863 devfs_add_devswf(&ptc_cdevsw,i, 864 DV_CHR,0,0,0666, 865 "pty%c%r",jnames[j],k); 866 } 867#endif 868 } 869} 870 871SYSINIT(ptcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR_C,ptc_drvinit,NULL) | 850 ptc_devsw_installed = 1; 851#ifdef DEVFS 852 for ( i = 0 ; i<NPTY ; i++ ) { 853 j = i / 32; 854 k = i % 32; 855 devfs_token_pts[i] = 856 devfs_add_devswf(&pts_cdevsw,i, 857 DV_CHR,0,0,0666, 858 "tty%c%r",jnames[j],k); 859 devfs_token_ptc[i] = 860 devfs_add_devswf(&ptc_cdevsw,i, 861 DV_CHR,0,0,0666, 862 "pty%c%r",jnames[j],k); 863 } 864#endif 865 } 866} 867 868SYSINIT(ptcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR_C,ptc_drvinit,NULL) |