30int socket_read_method(
int,
char *,
int);
31int socket_write_method(
int,
const char *,
int);
32int file_read_method(
int,
char *,
int);
33int file_write_method(
int,
const char *,
int);
89 assert(
F->read_handler ==
nullptr);
90 assert(
F->write_handler ==
nullptr);
93 debugs(51, 3,
"fd_close FD " << fd <<
" " <<
F->desc);
95 F->flags.open =
false;
104socket_read_method(
int fd,
char *buf,
int len)
106 return recv(fd, (
void *) buf, len, 0);
110file_read_method(
int fd,
char *buf,
int len)
112 return _read(fd, buf, len);
116socket_write_method(
int fd,
const char *buf,
int len)
118 return send(fd, (
const void *) buf, len, 0);
122file_write_method(
int fd,
const char *buf,
int len)
124 return _write(fd, buf, len);
131 return read(fd, buf, len);
137 return write(fd, buf, len);
143 return recvmsg(fd,
reinterpret_cast<msghdr*
>(buf), MSG_DONTWAIT);
150 return i > 0 ? len : i;
156fd_open(
int fd,
unsigned int type,
const char *desc)
168 debugs(51, 3,
"fd_open() FD " << fd <<
" " << desc);
170 F->flags.open =
true;
174 F->win32.handle = _get_osfhandle(fd);
181 F->setIo(&socket_read_method, &socket_write_method);
187 F->setIo(&file_read_method, &file_write_method);
191 fatalf(
"fd_open(): unknown FD type - FD#: %i, type: %u, desc %s\n", fd, type, desc);
236 F->bytes_read += len;
238 F->bytes_written += len;
257 (
F->bytes_read &&
F->bytes_written ?
"READ/WRITE" :
258 F->bytes_read ?
"READING" :
F->bytes_written ?
"WRITING" :
260 " "<< std::right << std::setw(4) << i <<
" " <<
F->desc);
290 static time_t
last = 0;
308 if (newReserve > x) {
310 debugs(51,
DBG_CRITICAL,
"WARNING: This machine has a serious shortage of filedescriptors.");
318 " due to failures (" << (
Squid_MaxFD - newReserve) <<
"/" <<
Squid_MaxFD <<
" file descriptors available)");
A const & min(A const &lhs, A const &rhs)
#define debugs(SECTION, LEVEL, CONTENT)
#define debug_log
change-avoidance macro; new code should call DebugStream() instead
void fatalf(const char *fmt,...)
int default_read_method(int, char *, int)
void fd_note(int fd, const char *s)
int msghdr_read_method(int, char *, int)
int default_write_method(int, const char *, int)
void fdAdjustReserved(void)
void fd_bytes(int fd, int len, unsigned int type)
void fd_open(int fd, unsigned int type, const char *desc)
static void fdUpdateBiggest(int fd, int)
int msghdr_write_method(int, const char *, int)
static uint32 F(uint32 X, uint32 Y, uint32 Z)
void ResetSelect(int fd)
reset/undo/unregister the watch for an FD which was set by Comm::SetSelect()
char * xstrncpy(char *dst, const char *src, size_t n)