Changeset 4ca43d72 in rtems
- Timestamp:
- 01/20/05 17:00:38 (19 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 1147a65
- Parents:
- 982c61cc
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/ChangeLog
r982c61cc r4ca43d72 1 2005-01-20 Joel Sherrill <joel@OARcorp.com> 2 3 PR 736/pppd 4 * libnetworking/pppd/chat.c, libnetworking/pppd/demand.c, 5 libnetworking/pppd/pppd.h, libnetworking/pppd/rtemsmain.c, 6 libnetworking/pppd/sys-rtems.c, libnetworking/pppd/utils.c: ttyfd 7 should not be static and should have a name more specific to pppd. 8 1 9 2005-01-07 Ralf Corsepius <ralf.corsepius@rtems.org> 2 10 -
c/src/libnetworking/pppd/chat.c
r982c61cc r4ca43d72 164 164 static char *phone_num = (char *) 0; 165 165 static char *phone_num2 = (char *) 0; 166 static intttyfd;166 /* static */ int pppd_ttyfd; 167 167 static int timeout = DEFAULT_CHAT_TIMEOUT; 168 168 … … 247 247 /* initialize exit code */ 248 248 exit_code = 0; 249 ttyfd = fd;249 pppd_ttyfd = fd; 250 250 251 251 script=pScript; … … 272 272 } 273 273 } 274 ttyfd = (int)-1;274 pppd_ttyfd = (int)-1; 275 275 276 276 return ( exit_code ); … … 279 279 void break_sequence() 280 280 { 281 tcsendbreak( ttyfd, 0);281 tcsendbreak(pppd_ttyfd, 0); 282 282 } 283 283 … … 700 700 while(tries) 701 701 { 702 status = read( ttyfd, &c, 1);702 status = read(pppd_ttyfd, &c, 1); 703 703 switch (status) { 704 704 case 1: … … 716 716 char ch = c; 717 717 718 return(write( ttyfd, &ch, 1));718 return(write(pppd_ttyfd, &ch, 1)); 719 719 } 720 720 … … 792 792 memset(temp2, 0, sizeof(temp2)); 793 793 794 tcgetattr( ttyfd, &tios);794 tcgetattr(pppd_ttyfd, &tios); 795 795 tios.c_cc[VMIN] = 0; 796 796 tios.c_cc[VTIME] = timeout*10/MAX_TIMEOUTS; 797 tcsetattr( ttyfd, TCSANOW, &tios);797 tcsetattr(pppd_ttyfd, TCSANOW, &tios); 798 798 799 799 string = clean(in_string, 0); -
c/src/libnetworking/pppd/demand.c
r982c61cc r4ca43d72 46 46 static const char rcsid[] = RCSID; 47 47 48 static char *frame;48 static unsigned char *frame; 49 49 static int framelen; 50 50 static int framemax; -
c/src/libnetworking/pppd/pppd.h
r982c61cc r4ca43d72 142 142 extern int pppifunit; /* Interface unit number */ 143 143 extern char ifname[]; /* Interface name */ 144 extern int ttyfd;/* Serial device file descriptor */144 extern int pppd_ttyfd; /* Serial device file descriptor */ 145 145 extern char hostname[]; /* Our hostname */ 146 146 extern u_char outpacket_buf[]; /* Buffer for outgoing packets */ … … 302 302 void log_packet __P((u_char *, int, char *, int)); 303 303 /* Format a packet and log it with syslog */ 304 void print_string __P(( char*, int, void (*) (void *, char *, ...),304 void print_string __P((void *, int, void (*) (void *, char *, ...), 305 305 void *)); /* Format a string for output */ 306 306 int slprintf __P((char *, int, char *, ...)); /* sprintf++ */ -
c/src/libnetworking/pppd/rtemsmain.c
r982c61cc r4ca43d72 78 78 static char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */ 79 79 80 int ttyfd; /* Serial port file descriptor */80 /* int pppd_ttyfd; * Serial port file descriptor */ 81 81 int baud_rate; /* Actual bits/second for serial device */ 82 82 int hungup; /* terminal has been hung up */ … … 233 233 234 234 need_holdoff = 1; 235 ttyfd = -1;235 pppd_ttyfd = -1; 236 236 real_ttyfd = -1; 237 237 pppd_status = EXIT_OK; … … 265 265 user before opening it. */ 266 266 int err; 267 ttyfd = open(devnam, O_NONBLOCK | O_RDWR, 0);267 pppd_ttyfd = open(devnam, O_NONBLOCK | O_RDWR, 0); 268 268 err = errno; 269 if ( ttyfd >= 0) {269 if (pppd_ttyfd >= 0) { 270 270 break; 271 271 } … … 278 278 goto fail; 279 279 } 280 if ((fdflags = fcntl( ttyfd, F_GETFL)) == -1281 || fcntl( ttyfd, F_SETFL, fdflags & ~O_NONBLOCK) < 0)280 if ((fdflags = fcntl(pppd_ttyfd, F_GETFL)) == -1 281 || fcntl(pppd_ttyfd, F_SETFL, fdflags & ~O_NONBLOCK) < 0) 282 282 warn("Couldn't reset non-blocking mode on device: %m"); 283 283 … … 292 292 * we could clear CLOCAL at this point. 293 293 */ 294 set_up_tty( ttyfd, ((connector != NULL && connector[0] != 0)294 set_up_tty(pppd_ttyfd, ((connector != NULL && connector[0] != 0) 295 295 || initializer != NULL)); 296 real_ttyfd = ttyfd;296 real_ttyfd = pppd_ttyfd; 297 297 } 298 298 … … 309 309 310 310 if (initializer && initializer[0]) { 311 if (device_script( ttyfd, DIALER_INIT, initializer) < 0) {311 if (device_script(pppd_ttyfd, DIALER_INIT, initializer) < 0) { 312 312 error("Initializer script failed"); 313 313 pppd_status = EXIT_INIT_FAILED; … … 321 321 322 322 if (connector && connector[0]) { 323 if (device_script( ttyfd, DIALER_CONNECT, connector) < 0) {323 if (device_script(pppd_ttyfd, DIALER_CONNECT, connector) < 0) { 324 324 error("Connect script failed"); 325 325 pppd_status = EXIT_CONNECT_FAILED; … … 361 361 /* run welcome script, if any */ 362 362 if (welcomer && welcomer[0]) { 363 if (device_script( ttyfd, DIALER_WELCOME, welcomer) < 0)363 if (device_script(pppd_ttyfd, DIALER_WELCOME, welcomer) < 0) 364 364 warn("Welcome script failed"); 365 365 } 366 366 367 367 /* set up the serial device as a ppp interface */ 368 fd_ppp = establish_ppp( ttyfd);368 fd_ppp = establish_ppp(pppd_ttyfd); 369 369 if (fd_ppp < 0) { 370 370 pppd_status = EXIT_FATAL_ERROR; … … 416 416 if (demand) 417 417 restore_loop(); 418 disestablish_ppp( ttyfd);418 disestablish_ppp(pppd_ttyfd); 419 419 fd_ppp = -1; 420 420 if (!hungup) … … 430 430 if (real_ttyfd >= 0) 431 431 set_up_tty(real_ttyfd, 1); 432 if (device_script( ttyfd, DIALER_DISCONNECT, disconnect_script) < 0) {432 if (device_script(pppd_ttyfd, DIALER_DISCONNECT, disconnect_script) < 0) { 433 433 warn("disconnect script failed"); 434 434 } else { … … 686 686 687 687 if (fd_ppp >= 0) 688 disestablish_ppp( ttyfd);688 disestablish_ppp(pppd_ttyfd); 689 689 if (real_ttyfd >= 0) 690 690 close_tty(); -
c/src/libnetworking/pppd/sys-rtems.c
r982c61cc r4ca43d72 489 489 /* printf("sent packet [%d]\n", len); */ 490 490 491 if (write( ttyfd, p, len) < 0) {491 if (write(pppd_ttyfd, p, len) < 0) { 492 492 if (errno != EIO) 493 493 error("write: %m"); … … 532 532 int len; 533 533 534 if ((len = read( ttyfd, buf, PPP_MTU + PPP_HDRLEN)) < 0) {534 if ((len = read(pppd_ttyfd, buf, PPP_MTU + PPP_HDRLEN)) < 0) { 535 535 if (errno == EWOULDBLOCK || errno == EINTR) len = -1; 536 536 /*fatal("read: %m"); */ … … 650 650 data.length = opt_len; 651 651 data.transmit = for_transmit; 652 if (ioctl( ttyfd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0)652 if (ioctl(pppd_ttyfd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0) 653 653 return 1; 654 654 return (errno == ENOBUFS)? 0: -1; -
c/src/libnetworking/pppd/utils.c
r982c61cc r4ca43d72 469 469 */ 470 470 void 471 print_string(p , len, printer, arg)472 char *p;471 print_string(p_arg, len, printer, arg) 472 void *p_arg; 473 473 int len; 474 474 void (*printer) __P((void *, char *, ...)); … … 476 476 { 477 477 int c; 478 unsigned char *p = (unsigned char *)p_arg; 478 479 479 480 printer(arg, "\""); -
cpukit/pppd/chat.c
r982c61cc r4ca43d72 164 164 static char *phone_num = (char *) 0; 165 165 static char *phone_num2 = (char *) 0; 166 static intttyfd;166 /* static */ int pppd_ttyfd; 167 167 static int timeout = DEFAULT_CHAT_TIMEOUT; 168 168 … … 247 247 /* initialize exit code */ 248 248 exit_code = 0; 249 ttyfd = fd;249 pppd_ttyfd = fd; 250 250 251 251 script=pScript; … … 272 272 } 273 273 } 274 ttyfd = (int)-1;274 pppd_ttyfd = (int)-1; 275 275 276 276 return ( exit_code ); … … 279 279 void break_sequence() 280 280 { 281 tcsendbreak( ttyfd, 0);281 tcsendbreak(pppd_ttyfd, 0); 282 282 } 283 283 … … 700 700 while(tries) 701 701 { 702 status = read( ttyfd, &c, 1);702 status = read(pppd_ttyfd, &c, 1); 703 703 switch (status) { 704 704 case 1: … … 716 716 char ch = c; 717 717 718 return(write( ttyfd, &ch, 1));718 return(write(pppd_ttyfd, &ch, 1)); 719 719 } 720 720 … … 792 792 memset(temp2, 0, sizeof(temp2)); 793 793 794 tcgetattr( ttyfd, &tios);794 tcgetattr(pppd_ttyfd, &tios); 795 795 tios.c_cc[VMIN] = 0; 796 796 tios.c_cc[VTIME] = timeout*10/MAX_TIMEOUTS; 797 tcsetattr( ttyfd, TCSANOW, &tios);797 tcsetattr(pppd_ttyfd, TCSANOW, &tios); 798 798 799 799 string = clean(in_string, 0); -
cpukit/pppd/demand.c
r982c61cc r4ca43d72 46 46 static const char rcsid[] = RCSID; 47 47 48 static char *frame;48 static unsigned char *frame; 49 49 static int framelen; 50 50 static int framemax; -
cpukit/pppd/pppd.h
r982c61cc r4ca43d72 142 142 extern int pppifunit; /* Interface unit number */ 143 143 extern char ifname[]; /* Interface name */ 144 extern int ttyfd;/* Serial device file descriptor */144 extern int pppd_ttyfd; /* Serial device file descriptor */ 145 145 extern char hostname[]; /* Our hostname */ 146 146 extern u_char outpacket_buf[]; /* Buffer for outgoing packets */ … … 302 302 void log_packet __P((u_char *, int, char *, int)); 303 303 /* Format a packet and log it with syslog */ 304 void print_string __P(( char*, int, void (*) (void *, char *, ...),304 void print_string __P((void *, int, void (*) (void *, char *, ...), 305 305 void *)); /* Format a string for output */ 306 306 int slprintf __P((char *, int, char *, ...)); /* sprintf++ */ -
cpukit/pppd/rtemsmain.c
r982c61cc r4ca43d72 78 78 static char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */ 79 79 80 int ttyfd; /* Serial port file descriptor */80 /* int pppd_ttyfd; * Serial port file descriptor */ 81 81 int baud_rate; /* Actual bits/second for serial device */ 82 82 int hungup; /* terminal has been hung up */ … … 233 233 234 234 need_holdoff = 1; 235 ttyfd = -1;235 pppd_ttyfd = -1; 236 236 real_ttyfd = -1; 237 237 pppd_status = EXIT_OK; … … 265 265 user before opening it. */ 266 266 int err; 267 ttyfd = open(devnam, O_NONBLOCK | O_RDWR, 0);267 pppd_ttyfd = open(devnam, O_NONBLOCK | O_RDWR, 0); 268 268 err = errno; 269 if ( ttyfd >= 0) {269 if (pppd_ttyfd >= 0) { 270 270 break; 271 271 } … … 278 278 goto fail; 279 279 } 280 if ((fdflags = fcntl( ttyfd, F_GETFL)) == -1281 || fcntl( ttyfd, F_SETFL, fdflags & ~O_NONBLOCK) < 0)280 if ((fdflags = fcntl(pppd_ttyfd, F_GETFL)) == -1 281 || fcntl(pppd_ttyfd, F_SETFL, fdflags & ~O_NONBLOCK) < 0) 282 282 warn("Couldn't reset non-blocking mode on device: %m"); 283 283 … … 292 292 * we could clear CLOCAL at this point. 293 293 */ 294 set_up_tty( ttyfd, ((connector != NULL && connector[0] != 0)294 set_up_tty(pppd_ttyfd, ((connector != NULL && connector[0] != 0) 295 295 || initializer != NULL)); 296 real_ttyfd = ttyfd;296 real_ttyfd = pppd_ttyfd; 297 297 } 298 298 … … 309 309 310 310 if (initializer && initializer[0]) { 311 if (device_script( ttyfd, DIALER_INIT, initializer) < 0) {311 if (device_script(pppd_ttyfd, DIALER_INIT, initializer) < 0) { 312 312 error("Initializer script failed"); 313 313 pppd_status = EXIT_INIT_FAILED; … … 321 321 322 322 if (connector && connector[0]) { 323 if (device_script( ttyfd, DIALER_CONNECT, connector) < 0) {323 if (device_script(pppd_ttyfd, DIALER_CONNECT, connector) < 0) { 324 324 error("Connect script failed"); 325 325 pppd_status = EXIT_CONNECT_FAILED; … … 361 361 /* run welcome script, if any */ 362 362 if (welcomer && welcomer[0]) { 363 if (device_script( ttyfd, DIALER_WELCOME, welcomer) < 0)363 if (device_script(pppd_ttyfd, DIALER_WELCOME, welcomer) < 0) 364 364 warn("Welcome script failed"); 365 365 } 366 366 367 367 /* set up the serial device as a ppp interface */ 368 fd_ppp = establish_ppp( ttyfd);368 fd_ppp = establish_ppp(pppd_ttyfd); 369 369 if (fd_ppp < 0) { 370 370 pppd_status = EXIT_FATAL_ERROR; … … 416 416 if (demand) 417 417 restore_loop(); 418 disestablish_ppp( ttyfd);418 disestablish_ppp(pppd_ttyfd); 419 419 fd_ppp = -1; 420 420 if (!hungup) … … 430 430 if (real_ttyfd >= 0) 431 431 set_up_tty(real_ttyfd, 1); 432 if (device_script( ttyfd, DIALER_DISCONNECT, disconnect_script) < 0) {432 if (device_script(pppd_ttyfd, DIALER_DISCONNECT, disconnect_script) < 0) { 433 433 warn("disconnect script failed"); 434 434 } else { … … 686 686 687 687 if (fd_ppp >= 0) 688 disestablish_ppp( ttyfd);688 disestablish_ppp(pppd_ttyfd); 689 689 if (real_ttyfd >= 0) 690 690 close_tty(); -
cpukit/pppd/sys-rtems.c
r982c61cc r4ca43d72 489 489 /* printf("sent packet [%d]\n", len); */ 490 490 491 if (write( ttyfd, p, len) < 0) {491 if (write(pppd_ttyfd, p, len) < 0) { 492 492 if (errno != EIO) 493 493 error("write: %m"); … … 532 532 int len; 533 533 534 if ((len = read( ttyfd, buf, PPP_MTU + PPP_HDRLEN)) < 0) {534 if ((len = read(pppd_ttyfd, buf, PPP_MTU + PPP_HDRLEN)) < 0) { 535 535 if (errno == EWOULDBLOCK || errno == EINTR) len = -1; 536 536 /*fatal("read: %m"); */ … … 650 650 data.length = opt_len; 651 651 data.transmit = for_transmit; 652 if (ioctl( ttyfd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0)652 if (ioctl(pppd_ttyfd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0) 653 653 return 1; 654 654 return (errno == ENOBUFS)? 0: -1; -
cpukit/pppd/utils.c
r982c61cc r4ca43d72 469 469 */ 470 470 void 471 print_string(p , len, printer, arg)472 char *p;471 print_string(p_arg, len, printer, arg) 472 void *p_arg; 473 473 int len; 474 474 void (*printer) __P((void *, char *, ...)); … … 476 476 { 477 477 int c; 478 unsigned char *p = (unsigned char *)p_arg; 478 479 479 480 printer(arg, "\"");
Note: See TracChangeset
for help on using the changeset viewer.