mbuf.c (26516) | mbuf.c (26940) |
---|---|
1/* 2 * PPP Memory handling module 3 * 4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 5 * 6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that the above copyright notice and this paragraph are 10 * duplicated in all such forms and that any documentation, 11 * advertising materials, and other materials related to such 12 * distribution and use acknowledge that the software was developed 13 * by the Internet Initiative Japan, Inc. The name of the 14 * IIJ may not be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * | 1/* 2 * PPP Memory handling module 3 * 4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 5 * 6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that the above copyright notice and this paragraph are 10 * duplicated in all such forms and that any documentation, 11 * advertising materials, and other materials related to such 12 * distribution and use acknowledge that the software was developed 13 * by the Internet Initiative Japan, Inc. The name of the 14 * IIJ may not be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * |
20 * $Id: mbuf.c,v 1.6 1997/05/10 01:22:15 brian Exp $ | 20 * $Id: mbuf.c,v 1.7 1997/06/09 03:27:29 brian Exp $ |
21 * 22 */ 23#include <sys/types.h> 24#include <sys/socket.h> 25#include <sys/param.h> 26#include <netinet/in.h> 27#include "defs.h" 28#include "loadalias.h" 29#include "vars.h" | 21 * 22 */ 23#include <sys/types.h> 24#include <sys/socket.h> 25#include <sys/param.h> 26#include <netinet/in.h> 27#include "defs.h" 28#include "loadalias.h" 29#include "vars.h" |
30#include "server.h" |
|
30 31struct memmap { 32 struct mbuf *queue; 33 int count; 34} MemMap[MB_MAX+2]; 35 36static int totalalloced; 37 --- 16 unchanged lines hidden (view full) --- 54 u_char *p; 55 struct mbuf *bp; 56 57 if (type > MB_MAX) 58 LogPrintf(LogERROR, "Bad mbuf type %d\n", type); 59 bp = (struct mbuf *)malloc(sizeof(struct mbuf)); 60 if (bp == NULL) { 61 LogPrintf(LogALERT, "failed to allocate memory: %u\n", sizeof(struct mbuf)); | 31 32struct memmap { 33 struct mbuf *queue; 34 int count; 35} MemMap[MB_MAX+2]; 36 37static int totalalloced; 38 --- 16 unchanged lines hidden (view full) --- 55 u_char *p; 56 struct mbuf *bp; 57 58 if (type > MB_MAX) 59 LogPrintf(LogERROR, "Bad mbuf type %d\n", type); 60 bp = (struct mbuf *)malloc(sizeof(struct mbuf)); 61 if (bp == NULL) { 62 LogPrintf(LogALERT, "failed to allocate memory: %u\n", sizeof(struct mbuf)); |
63 ServerClose(); |
|
62 exit(1); 63 } 64 bzero(bp, sizeof(struct mbuf)); 65 p = (u_char *)malloc(cnt); 66 if (p == NULL) { 67 LogPrintf(LogALERT, "failed to allocate memory: %d\n", cnt); | 64 exit(1); 65 } 66 bzero(bp, sizeof(struct mbuf)); 67 p = (u_char *)malloc(cnt); 68 if (p == NULL) { 69 LogPrintf(LogALERT, "failed to allocate memory: %d\n", cnt); |
70 ServerClose(); |
|
68 exit(1); 69 } 70 MemMap[type].count += cnt; 71 totalalloced += cnt; 72 bp->base = p; 73 bp->size = bp->cnt = cnt; 74 bp->type = type; 75 return(bp); --- 99 unchanged lines hidden --- | 71 exit(1); 72 } 73 MemMap[type].count += cnt; 74 totalalloced += cnt; 75 bp->base = p; 76 bp->size = bp->cnt = cnt; 77 bp->type = type; 78 return(bp); --- 99 unchanged lines hidden --- |