diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 8e76ad6e7f..ed58954bd8 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,9 @@ +2005-10-25 Joel Sherrill + + * sapi/include/confdefs.h, telnetd/pty.c, telnetd/pty.h: Attempt + to fix MAX_PTYS and provide a real configuration entry. This should + make telnetd some suitable for inclusion in cpukit. + 2005-10-17 Ralf Corsepius * libfs/src/dosfs/msdos_misc.c: Revert to vers. 1.9. diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index 4d6fea1e89..d7dbc2ba1d 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -103,6 +103,20 @@ uint32_t rtems_libio_number_iops = CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS; ((CONFIGURE_NUMBER_OF_TERMIOS_PORTS * 4) + 1) #endif +/* + * PTYs + */ + +#ifndef CONFIGURE_MAXIMUM_PTYS +#define CONFIGURE_MAXIMUM_PTYS 0 +#endif + +#ifdef CONFIGURE_INIT +int rtems_telnetd_maximum_ptys = CONFIGURE_MAXIMUM_PTYS; +#else +extern int rtems_telnetd_maximum_ptys; +#endif + /* * Mount Table Configuration */ diff --git a/cpukit/telnetd/pty.c b/cpukit/telnetd/pty.c index c19d05db37..38aa0a1c97 100644 --- a/cpukit/telnetd/pty.c +++ b/cpukit/telnetd/pty.c @@ -45,10 +45,7 @@ #define IAC_SE 240 #define IAC_EOR 239 -struct pty_tt; -typedef struct pty_tt pty_t; - -struct pty_tt { +typedef struct { char *devname; struct rtems_termios_tty *ttyp; tcflag_t c_cflag; @@ -57,11 +54,12 @@ struct pty_tt { int last_cr; int iac_mode; -}; +} pty_t; int ptys_initted=FALSE; -pty_t ptys[MAX_PTYS]; +pty_t *ptys; +int rtems_telnetd_maximum_ptys; /* This procedure returns the devname for a pty slot free. * If not slot availiable (field socket>=0) @@ -71,7 +69,7 @@ pty_t ptys[MAX_PTYS]; char * get_pty(int socket) { int ndx; if (!ptys_initted) return NULL; - for (ndx=0;ndxc_cflag; } else { return -1; @@ -217,7 +215,7 @@ static int ptyPollInitialize(int major,int minor,void * arg) { rtems_libio_open_close_args_t * args = arg; struct termios t; - if (minoriop->data1; @@ -230,7 +228,7 @@ ptyPollInitialize(int major,int minor,void * arg) { /*-----------------------------------------------------------*/ static int ptyShutdown(int major,int minor,void * arg) { - if (minor=0) close(ptys[minor].socket); ptys[minor].socket=-1; @@ -246,7 +244,7 @@ ptyShutdown(int major,int minor,void * arg) { static int ptyPollWrite(int minor, const char * buf,int len) { int count; - if (minor -#ifndef MAX_PTYS -#define MAX_PTYS 16 -#endif - char * get_pty(int socket); rtems_device_driver pty_initialize(