pty.c (12967) | pty.c (13630) |
---|---|
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.33 1995/12/14 08:31:59 phk Exp $ | 34 * $Id: tty_pty.c,v 1.34 1995/12/22 15:53:53 bde Exp $ |
35 */ 36 37/* 38 * Pseudo-teletype Driver 39 * (Actually two drivers, requiring two entries in 'cdevsw') 40 */ 41#include "pty.h" /* XXX */ 42 --- 723 unchanged lines hidden (view full) --- 766} 767 768static ptc_devsw_installed = 0; 769#ifdef DEVFS 770#define MAXUNITS (8 * 32) 771static void *devfs_token_pts[MAXUNITS]; 772static void *devfs_token_ptc[MAXUNITS]; 773static const char jnames[] = "pqrsPQRS"; | 35 */ 36 37/* 38 * Pseudo-teletype Driver 39 * (Actually two drivers, requiring two entries in 'cdevsw') 40 */ 41#include "pty.h" /* XXX */ 42 --- 723 unchanged lines hidden (view full) --- 766} 767 768static ptc_devsw_installed = 0; 769#ifdef DEVFS 770#define MAXUNITS (8 * 32) 771static void *devfs_token_pts[MAXUNITS]; 772static void *devfs_token_ptc[MAXUNITS]; 773static const char jnames[] = "pqrsPQRS"; |
774static const char knames[] = "0123456789abcdefghijklmnopqrstuv"; | |
775#endif 776 777static void 778ptc_drvinit(void *unused) 779{ 780#ifdef DEVFS 781 int i,j,k; 782 char name[16]; --- 12 unchanged lines hidden (view full) --- 795#undef NPTY 796#define NPTY MAXUNITS 797#endif 798 for ( i = 0 ; i<NPTY ; i++ ) { 799 void *x; 800 801 j = i / 32; 802 k = i % 32; | 774#endif 775 776static void 777ptc_drvinit(void *unused) 778{ 779#ifdef DEVFS 780 int i,j,k; 781 char name[16]; --- 12 unchanged lines hidden (view full) --- 794#undef NPTY 795#define NPTY MAXUNITS 796#endif 797 for ( i = 0 ; i<NPTY ; i++ ) { 798 void *x; 799 800 j = i / 32; 801 k = i % 32; |
803 sprintf(name,"tty%c%c",jnames[j],knames[k]); | |
804 devfs_token_pts[i] = | 802 devfs_token_pts[i] = |
805 devfs_add_devsw("/",name,&pts_cdevsw,i, 806 DV_CHR,0,0,0666); 807 sprintf(name,"pty%c%c",jnames[j],knames[k]); | 803 devfs_add_devswf(&pts_cdevsw,i, 804 DV_CHR,0,0,0666, 805 "tty%c%n",j,k); |
808 devfs_token_ptc[i] = | 806 devfs_token_ptc[i] = |
809 devfs_add_devsw("/",name,&ptc_cdevsw,i, 810 DV_CHR,0,0,0666); | 807 devfs_add_devswf(&ptc_cdevsw,i, 808 DV_CHR,0,0,0666, 809 "pty%c%n",j,k); |
811 } 812#endif 813 } 814} 815 816SYSINIT(ptcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR_C,ptc_drvinit,NULL) 817 818 | 810 } 811#endif 812 } 813} 814 815SYSINIT(ptcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR_C,ptc_drvinit,NULL) 816 817 |