ModDevPoll.cc File Reference
#include "squid.h"
#include "comm/Loops.h"
#include "fd.h"
#include "fde.h"
#include "mgr/Registration.h"
#include "StatCounters.h"
#include "StatHist.h"
#include "Store.h"
#include <cerrno>
#include <climits>
Include dependency graph for ModDevPoll.cc:

Go to the source code of this file.

Classes

struct  _devpoll_state
 Current state. More...
 

Macros

#define DEBUG_DEVPOLL   0
 
#define DEVPOLL_UPDATESIZE   OPEN_MAX
 
#define DEVPOLL_QUERYSIZE   OPEN_MAX
 

Typedefs

typedef short pollfd_events_t
 

Functions

static void commDevPollRegisterWithCacheManager (void)
 
static void comm_flush_updates (void)
 Write batched file descriptor event changes to poll device. More...
 
static void comm_update_fd (int fd, int events)
 Register change in desired polling state for file descriptor. More...
 
static void commIncomingStats (StoreEntry *sentry)
 

Variables

struct {
   struct pollfd *   pfds
 
   int   cur
 
   int   size
 
devpoll_update
 Update list. More...
 
static int devpoll_fd
 
static int max_poll_time = 1000
 
static struct _devpoll_statedevpoll_state
 
static struct dvpoll do_poll
 
static int dpoll_nfds
 

Macro Definition Documentation

◆ DEBUG_DEVPOLL

#define DEBUG_DEVPOLL   0

Definition at line 49 of file ModDevPoll.cc.

◆ DEVPOLL_QUERYSIZE

#define DEVPOLL_QUERYSIZE   OPEN_MAX

Definition at line 53 of file ModDevPoll.cc.

◆ DEVPOLL_UPDATESIZE

#define DEVPOLL_UPDATESIZE   OPEN_MAX

Definition at line 52 of file ModDevPoll.cc.

Typedef Documentation

◆ pollfd_events_t

typedef short pollfd_events_t

Definition at line 56 of file ModDevPoll.cc.

Function Documentation

◆ comm_flush_updates()

static void comm_flush_updates ( void  )
static

Writes out the static array of file descriptor event changes to the poll device. This is done only when necessary (i.e. just before the poll device is queried during the select call, and whenever the number of changes to store in the array exceeds the size of the array).

Definition at line 99 of file ModDevPoll.cc.

References assert, DEBUG_DEVPOLL, debugs, devpoll_fd, and devpoll_update.

Referenced by comm_update_fd(), and Comm::DoSelect().

◆ comm_update_fd()

static void comm_update_fd ( int  fd,
int  events 
)
static

Prevents unnecessary calls to the /dev/poll API by queueing changes in the devpoll_update array. If the array fills up the comm_flush_updates function is called.

Parameters
fdfile descriptor to register change with
eventsevents to register (usually POLLIN, POLLOUT, or POLLREMOVE)

Definition at line 131 of file ModDevPoll.cc.

References comm_flush_updates(), DEBUG_DEVPOLL, debugs, and devpoll_update.

Referenced by Comm::SetSelect().

◆ commDevPollRegisterWithCacheManager()

static void commDevPollRegisterWithCacheManager ( void  )
static

Definition at line 158 of file ModDevPoll.cc.

References commIncomingStats(), and Mgr::RegisterAction().

Referenced by Comm::SelectLoopInit().

◆ commIncomingStats()

static void commIncomingStats ( StoreEntry sentry)
static

Variable Documentation

◆ cur

◆ devpoll_fd

int devpoll_fd
static

handle to /dev/poll device

Definition at line 79 of file ModDevPoll.cc.

Referenced by comm_flush_updates(), Comm::DoSelect(), and Comm::SelectLoopInit().

◆ devpoll_state

struct _devpoll_state* devpoll_state
static

array of socket states

Definition at line 82 of file ModDevPoll.cc.

Referenced by Comm::DoSelect(), Comm::SelectLoopInit(), and Comm::SetSelect().

◆ 

struct { ... } devpoll_update

This structure contains an array of settings to send to the /dev/poll interface. Rather than send changes to /dev/poll one at a time they are pushed onto this array (updating cur to indicate how many of the pfds structure elements have been set) until it is full before it is written out the API.

Referenced by comm_flush_updates(), comm_update_fd(), and Comm::SelectLoopInit().

◆ do_poll

struct dvpoll do_poll
static

data struct for storing poll results

Definition at line 83 of file ModDevPoll.cc.

Referenced by Comm::DoSelect(), and Comm::SelectLoopInit().

◆ dpoll_nfds

int dpoll_nfds
static

maximum number of poll results

Definition at line 84 of file ModDevPoll.cc.

Referenced by Comm::DoSelect(), and Comm::SelectLoopInit().

◆ max_poll_time

int max_poll_time = 1000
static

maximum milliseconds to spend in poll

Definition at line 80 of file ModDevPoll.cc.

Referenced by Comm::DoSelect(), and Comm::QuickPollRequired().

◆ pfds

struct pollfd* pfds

ptr to array of struct pollfd config elements

Definition at line 73 of file ModDevPoll.cc.

Referenced by comm_check_incoming_poll_handlers().

◆ size

int size

maximum number of elements in array

Definition at line 75 of file ModDevPoll.cc.

Referenced by Store::SwapMetaUnpacker::SwapMetaUnpacker(), Ftp::CtrlChannel::~CtrlChannel(), action(), Ssl::CertificateDb::addCertAndPrivateKey(), addr2oid(), ConnStateData::afterClientWrite(), Parser::BinaryTokenizer::area(), Ssl::AskPasswordCb(), Ipc::OneToOneUniQueue::Bytes2Items(), cbdataInternalAddType(), Icmp::CheckSum(), Adaptation::Config::clear(), client_Inst(), clientdbUpdate(), comm_read_base(), commHalfClosedReader(), commSetTcpRcvbuf(), concat(), BodyPipe::consume(), Ssl::CertificateDb::Create(), CtoCpp1(), dump_CpuAffinityMap(), Adaptation::Icap::ModXact::echoMore(), errorSendComplete(), Adaptation::Icap::ModXact::estimateVirginBody(), BodyPipe::expectProductionEndAfter(), ConnStateData::expectRequestBody(), VectorMap< Key, Value >::findKeyIndex(), Auth::Scheme::FreeAll(), ftpListParseParts(), Mem::AllocatorProxy::getAllocator(), BodyPipe::getMoreData(), Ssl::ServerBio::giveBuffered(), Parser::BinaryTokenizer::got(), Adaptation::Icap::OptXact::handleCommWrote(), hash4(), hash_string(), HeapKeyGen_StoreEntry_GDSF(), hex_dump(), Ftp::Gateway::htmlifyListEntry(), idnsSentQueryVC(), VectorMap< Key, Value >::indexUsed(), Parser::BinaryTokenizer::inetAny(), Ipc::OneToOneUniQueue::Items2Bytes(), ldap_escape_value(), log_extended(), log_output(), HttpHdrRange::lowestOffset(), match(), memDataInit(), memFindBufSizeType(), memFreeBuf(), memFreeBufFunc(), memFreeString(), netdbExchangeHandleReply(), ntlm_unpack_auth(), oid2addr(), Store::Disk::optionObjectSizeParse(), HttpBody::packInto(), Ssl::ErrorDetailFile::parse(), Http::One::TeChunkedParser::parseChunkSize(), HtcpReplyData::parseHeader(), HttpRequest::parseHeader(), ClientDelayConfig::parsePoolCount(), ClientDelayConfig::parsePoolId(), Fs::Ufs::UFSSwapDir::parseSizeL1L2(), peerDigestFetchedEnough(), peerDigestFetchReply(), peerDigestSwapInCBlock(), peerDigestSwapInMask(), BodyPipe::postAppend(), BodyPipe::postConsume(), Adaptation::Icap::VirginBodyAct::progress(), BodyPipe::putMoreData(), Ssl::Bio::read(), Ssl::ClientBio::read(), Ssl::ServerBio::read(), Rock::IoState::read_(), Fs::Ufs::UFSStoreState::read_(), Ssl::ServerBio::readAndGive(), Ssl::ServerBio::readAndParse(), Fs::Ufs::RebuildState::rebuildFromDirectory(), Dns::CachedIps::reportCurrent(), Dns::CachedIps::restoreGoodness(), DiskdIOStrategy::SEND(), DiskdIOStrategy::send(), Snmp::Var::setObject(), setSocketBuffers(), Snmp::Var::setString(), Store::Disk::sizeInBlocks(), Parser::BinaryTokenizer::skip(), Parser::BinaryTokenizer::skipped(), SMB_Create(), SMB_Logon_TCon_Open(), SMB_Lseek(), SMB_Open(), Store::ParsingBuffer::space(), squid_bio_read(), squid_bio_write(), squidaio_get_pool(), squidaio_xfree(), squidaio_xmalloc(), Client::startAdaptation(), statHistBinDumper(), statHistSBufDumper(), storeGetMemSpace(), storeIOWrite(), storeRead(), IcmpStub::testChecksum(), Rock::IoState::tryWrite(), Store::UnpackPrefix(), urldecode(), Adaptation::Ecap::XactionRep::vbContent(), Adaptation::Ecap::XactionRep::vbContentShift(), Adaptation::Icap::ModXact::virginConsume(), Parser::BinaryTokenizer::want(), Rock::IoState::write(), Fs::Ufs::UFSStoreState::write(), TunnelStateData::Connection::write(), Ssl::Bio::write(), Ssl::ClientBio::write(), Ssl::ServerBio::write(), Comm::Write(), Http::Stream::writeComplete(), Adaptation::Icap::ModXact::writePreviewBody(), Adaptation::Icap::ModXact::writePrimeBody(), Adaptation::Icap::ModXact::writeSomeBody(), Rock::IoState::writeToBuffer(), and Adaptation::Icap::Preview::wrote().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors