pty.c (12564) | pty.c (12567) |
---|---|
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.2 (Berkeley) 9/23/93 | 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.2 (Berkeley) 9/23/93 |
34 * $Id: tty_pty.c,v 1.26 1995/11/29 14:40:36 julian Exp $ | 34 * $Id: tty_pty.c,v 1.27 1995/12/02 07:30:19 julian Exp $ |
35 */ 36 37/* 38 * Pseudo-teletype Driver 39 * (Actually two drivers, requiring two entries in 'cdevsw') 40 */ 41#include "pty.h" /* XXX */ 42 --- 708 unchanged lines hidden (view full) --- 751 ptyioctl, nullstop, nullreset, ptydevtotty,/* ptyp */ 752 ptcselect, nommap, NULL }; 753 754static ptc_devsw_installed = 0; 755 756static void ptc_drvinit(void *unused) 757{ 758#ifdef DEVFS | 35 */ 36 37/* 38 * Pseudo-teletype Driver 39 * (Actually two drivers, requiring two entries in 'cdevsw') 40 */ 41#include "pty.h" /* XXX */ 42 --- 708 unchanged lines hidden (view full) --- 751 ptyioctl, nullstop, nullreset, ptydevtotty,/* ptyp */ 752 ptcselect, nommap, NULL }; 753 754static ptc_devsw_installed = 0; 755 756static void ptc_drvinit(void *unused) 757{ 758#ifdef DEVFS |
759 int i 760 char jnames[] = "pqrsPQRS" 761 char knames[] = "0123456789abcdefghijklmnopqrstuv" | 759 int i,j,k; 760 char jnames[] = "pqrsPQRS"; 761 char knames[] = "0123456789abcdefghijklmnopqrstuv"; |
762 char devname[16]; 763#define MAXUNITS (8 * 32) 764#endif 765 dev_t dev; 766 dev_t dev_c; 767 768 if( ! ptc_devsw_installed ) { 769 dev = makedev(CDEV_MAJOR_S,0); 770 cdevsw_add(&dev,&pts_cdevsw,NULL); 771 dev_c = makedev(CDEV_MAJOR_C,0); 772 cdevsw_add(&dev_c,&ptc_cdevsw,NULL); 773 ptc_devsw_installed = 1; 774#ifdef DEVFS 775/*XXX*/ 776#if NPTY > MAXUNITS 777#undef NPTY 778#define NPTY MAXUNITS 779#endif 780 for ( i = 0 ; i<NPTY ; i++ ) { | 762 char devname[16]; 763#define MAXUNITS (8 * 32) 764#endif 765 dev_t dev; 766 dev_t dev_c; 767 768 if( ! ptc_devsw_installed ) { 769 dev = makedev(CDEV_MAJOR_S,0); 770 cdevsw_add(&dev,&pts_cdevsw,NULL); 771 dev_c = makedev(CDEV_MAJOR_C,0); 772 cdevsw_add(&dev_c,&ptc_cdevsw,NULL); 773 ptc_devsw_installed = 1; 774#ifdef DEVFS 775/*XXX*/ 776#if NPTY > MAXUNITS 777#undef NPTY 778#define NPTY MAXUNITS 779#endif 780 for ( i = 0 ; i<NPTY ; i++ ) { |
781 int x; | 781 void * x; |
782 783 j = i / 32; 784 k = i % 32; 785 sprintf(devname,"pty%c%c",jnames[j],knames[k]); 786 x=devfs_add_devsw("/",devname,major(dev_c),0,DV_CHR,0,0,0600); 787 sprintf(devname,"tty%c%c",jnames[j],knames[k]); 788 x=devfs_add_devsw("/",devname,major(dev),0,DV_CHR,0,0,0600); 789 } 790#endif 791 } 792} 793 794SYSINIT(ptcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR_C,ptc_drvinit,NULL) 795 796#endif /* JREMOD */ 797 | 782 783 j = i / 32; 784 k = i % 32; 785 sprintf(devname,"pty%c%c",jnames[j],knames[k]); 786 x=devfs_add_devsw("/",devname,major(dev_c),0,DV_CHR,0,0,0600); 787 sprintf(devname,"tty%c%c",jnames[j],knames[k]); 788 x=devfs_add_devsw("/",devname,major(dev),0,DV_CHR,0,0,0600); 789 } 790#endif 791 } 792} 793 794SYSINIT(ptcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR_C,ptc_drvinit,NULL) 795 796#endif /* JREMOD */ 797 |