recvbuff.h (330106) | recvbuff.h (362716) |
---|---|
1#ifndef RECVBUFF_H 2#define RECVBUFF_H 3 4#include "ntp.h" 5#include "ntp_net.h" 6#include "ntp_lists.h" 7 8#include <isc/result.h> 9 10/* 11 * recvbuf memory management 12 */ | 1#ifndef RECVBUFF_H 2#define RECVBUFF_H 3 4#include "ntp.h" 5#include "ntp_net.h" 6#include "ntp_lists.h" 7 8#include <isc/result.h> 9 10/* 11 * recvbuf memory management 12 */ |
13#define RECV_INIT 10 /* 10 buffers initially */ | 13#define RECV_INIT 64 /* 64 buffers initially */ |
14#define RECV_LOWAT 3 /* when we're down to three buffers get more */ | 14#define RECV_LOWAT 3 /* when we're down to three buffers get more */ |
15#define RECV_INC 5 /* get 5 more at a time */ 16#define RECV_TOOMANY 40 /* this is way too many buffers */ | 15#define RECV_INC 32 /* [power of 2] get 32 more at a time */ 16#define RECV_BATCH 128 /* [power of 2] max increment in one sweep */ 17#define RECV_TOOMANY 4096 /* this should suffice, really. TODO: tos option? */ |
17 | 18 |
19/* If we have clocks, keep an iron reserve of receive buffers for 20 * clocks only. 21 */ 22#if defined(REFCLOCK) 23# if !defined(RECV_CLOCK) || RECV_CLOCK == 0 24# undef RECV_CLOCK 25# define RECV_CLOCK 16 26# endif 27#else 28# if defined(RECV_CLOCK) 29# undef RECV_CLOCK 30# endif 31# define RECV_CLOCK 0 32#endif 33 |
|
18#if defined HAVE_IO_COMPLETION_PORT 19# include "ntp_iocompletionport.h" 20# include "ntp_timer.h" 21 22# define RECV_BLOCK_IO() EnterCriticalSection(&RecvCritSection) 23# define RECV_UNBLOCK_IO() LeaveCriticalSection(&RecvCritSection) 24 25/* Return the event which is set when items are added to the full list --- 59 unchanged lines hidden (view full) --- 85 86/* Get a free buffer (typically used so an async 87 * read can directly place data into the buffer 88 * 89 * The buffer is removed from the free list. Make sure 90 * you put it back with freerecvbuf() or 91 */ 92 | 34#if defined HAVE_IO_COMPLETION_PORT 35# include "ntp_iocompletionport.h" 36# include "ntp_timer.h" 37 38# define RECV_BLOCK_IO() EnterCriticalSection(&RecvCritSection) 39# define RECV_UNBLOCK_IO() LeaveCriticalSection(&RecvCritSection) 40 41/* Return the event which is set when items are added to the full list --- 59 unchanged lines hidden (view full) --- 101 102/* Get a free buffer (typically used so an async 103 * read can directly place data into the buffer 104 * 105 * The buffer is removed from the free list. Make sure 106 * you put it back with freerecvbuf() or 107 */ 108 |
93/* signal safe - no malloc */ 94extern struct recvbuf *get_free_recv_buffer(void); 95/* signal unsafe - may malloc, never returs NULL */ 96extern struct recvbuf *get_free_recv_buffer_alloc(void); | 109/* signal safe - no malloc, returns NULL when no bufs */ 110extern struct recvbuf *get_free_recv_buffer(int /*BOOL*/ urgent); 111/* signal unsafe - may malloc, returns NULL when no bufs */ 112extern struct recvbuf *get_free_recv_buffer_alloc(int /*BOOL*/ urgent); |
97 98/* Add a buffer to the full list 99 */ 100extern void add_full_recv_buffer(struct recvbuf *); 101 102/* number of recvbufs on freelist */ 103extern u_long free_recvbuffs(void); 104extern u_long full_recvbuffs(void); --- 20 unchanged lines hidden --- | 113 114/* Add a buffer to the full list 115 */ 116extern void add_full_recv_buffer(struct recvbuf *); 117 118/* number of recvbufs on freelist */ 119extern u_long free_recvbuffs(void); 120extern u_long full_recvbuffs(void); --- 20 unchanged lines hidden --- |