physical.c (53830) | physical.c (54912) |
---|---|
1/* 2 * Written by Eivind Eklund <eivind@yes.no> 3 * for Yes Interactive 4 * 5 * Copyright (C) 1998, Yes Interactive. All rights reserved. 6 * 7 * Redistribution and use in any form is permitted. Redistribution in 8 * source form should include the above copyright and this set of 9 * conditions, because large sections american law seems to have been 10 * created by a bunch of jerks on drugs that are now illegal, forcing 11 * me to include this copyright-stuff instead of placing this in the 12 * public domain. The name of of 'Yes Interactive' or 'Eivind Eklund' 13 * may not be used to endorse or promote products derived from this 14 * software without specific prior written permission. 15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18 * | 1/* 2 * Written by Eivind Eklund <eivind@yes.no> 3 * for Yes Interactive 4 * 5 * Copyright (C) 1998, Yes Interactive. All rights reserved. 6 * 7 * Redistribution and use in any form is permitted. Redistribution in 8 * source form should include the above copyright and this set of 9 * conditions, because large sections american law seems to have been 10 * created by a bunch of jerks on drugs that are now illegal, forcing 11 * me to include this copyright-stuff instead of placing this in the 12 * public domain. The name of of 'Yes Interactive' or 'Eivind Eklund' 13 * may not be used to endorse or promote products derived from this 14 * software without specific prior written permission. 15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18 * |
19 * $FreeBSD: head/usr.sbin/ppp/physical.c 53830 1999-11-28 15:50:08Z brian $ | 19 * $FreeBSD: head/usr.sbin/ppp/physical.c 54912 1999-12-20 20:29:47Z brian $ |
20 * 21 */ 22 23#include <sys/param.h> 24#include <netinet/in.h> 25#include <netinet/in_systm.h> 26#include <netinet/ip.h> 27#include <sys/un.h> --- 351 unchanged lines hidden (view full) --- 379{ 380 struct physical *p = descriptor2physical(d); 381 int nw, result = 0; 382 383 if (p->out == NULL) 384 p->out = link_Dequeue(&p->link); 385 386 if (p->out) { | 20 * 21 */ 22 23#include <sys/param.h> 24#include <netinet/in.h> 25#include <netinet/in_systm.h> 26#include <netinet/ip.h> 27#include <sys/un.h> --- 351 unchanged lines hidden (view full) --- 379{ 380 struct physical *p = descriptor2physical(d); 381 int nw, result = 0; 382 383 if (p->out == NULL) 384 p->out = link_Dequeue(&p->link); 385 386 if (p->out) { |
387 nw = physical_Write(p, MBUF_CTOP(p->out), p->out->cnt); | 387 nw = physical_Write(p, MBUF_CTOP(p->out), p->out->m_len); |
388 log_Printf(LogDEBUG, "%s: DescriptorWrite: wrote %d(%d) to %d\n", | 388 log_Printf(LogDEBUG, "%s: DescriptorWrite: wrote %d(%d) to %d\n", |
389 p->link.name, nw, p->out->cnt, p->fd); | 389 p->link.name, nw, p->out->m_len, p->fd); |
390 if (nw > 0) { | 390 if (nw > 0) { |
391 p->out->cnt -= nw; 392 p->out->offset += nw; 393 if (p->out->cnt == 0) 394 p->out = mbuf_FreeSeg(p->out); | 391 p->out->m_len -= nw; 392 p->out->m_offset += nw; 393 if (p->out->m_len == 0) 394 p->out = m_free(p->out); |
395 result = 1; 396 } else if (nw < 0) { 397 if (errno != EAGAIN) { 398 log_Printf(LogPHASE, "%s: write (%d): %s\n", p->link.name, 399 p->fd, strerror(errno)); 400 datalink_Down(p->dl, CLOSE_NORMAL); 401 } 402 result = 1; --- 29 unchanged lines hidden (view full) --- 432 433 prompt_Printf(arg->prompt, "\n Link Type: %s\n", mode2Nam(p->type)); 434 prompt_Printf(arg->prompt, " Connect Count: %d\n", p->connect_count); 435#ifdef TIOCOUTQ 436 if (p->fd >= 0 && ioctl(p->fd, TIOCOUTQ, &n) >= 0) 437 prompt_Printf(arg->prompt, " Physical outq: %d\n", n); 438#endif 439 | 395 result = 1; 396 } else if (nw < 0) { 397 if (errno != EAGAIN) { 398 log_Printf(LogPHASE, "%s: write (%d): %s\n", p->link.name, 399 p->fd, strerror(errno)); 400 datalink_Down(p->dl, CLOSE_NORMAL); 401 } 402 result = 1; --- 29 unchanged lines hidden (view full) --- 432 433 prompt_Printf(arg->prompt, "\n Link Type: %s\n", mode2Nam(p->type)); 434 prompt_Printf(arg->prompt, " Connect Count: %d\n", p->connect_count); 435#ifdef TIOCOUTQ 436 if (p->fd >= 0 && ioctl(p->fd, TIOCOUTQ, &n) >= 0) 437 prompt_Printf(arg->prompt, " Physical outq: %d\n", n); 438#endif 439 |
440 prompt_Printf(arg->prompt, " Queued Packets: %d\n", 441 link_QueueLen(&p->link)); | 440 prompt_Printf(arg->prompt, " Queued Packets: %lu\n", 441 (u_long)link_QueueLen(&p->link)); |
442 prompt_Printf(arg->prompt, " Phone Number: %s\n", arg->cx->phone.chosen); 443 444 prompt_Printf(arg->prompt, "\nDefaults:\n"); 445 446 prompt_Printf(arg->prompt, " Device List: "); 447 dev = p->cfg.devlist; 448 for (n = 0; n < p->cfg.ndev; n++) { 449 if (n) --- 448 unchanged lines hidden (view full) --- 898 p->type = mode; 899 return 1; 900} 901 902void 903physical_DeleteQueue(struct physical *p) 904{ 905 if (p->out) { | 442 prompt_Printf(arg->prompt, " Phone Number: %s\n", arg->cx->phone.chosen); 443 444 prompt_Printf(arg->prompt, "\nDefaults:\n"); 445 446 prompt_Printf(arg->prompt, " Device List: "); 447 dev = p->cfg.devlist; 448 for (n = 0; n < p->cfg.ndev; n++) { 449 if (n) --- 448 unchanged lines hidden (view full) --- 898 p->type = mode; 899 return 1; 900} 901 902void 903physical_DeleteQueue(struct physical *p) 904{ 905 if (p->out) { |
906 mbuf_Free(p->out); | 906 m_freem(p->out); |
907 p->out = NULL; 908 } 909 link_DeleteQueue(&p->link); 910} 911 912void 913physical_SetDevice(struct physical *p, const char *name) 914{ --- 146 unchanged lines hidden --- | 907 p->out = NULL; 908 } 909 link_DeleteQueue(&p->link); 910} 911 912void 913physical_SetDevice(struct physical *p, const char *name) 914{ --- 146 unchanged lines hidden --- |