~ubuntu-branches/ubuntu/oneiric/squid3/oneiric-security

« back to all changes in this revision

Viewing changes to src/fd.cc

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2007-05-13 16:03:16 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070513160316-2h6kn6h1z0q1fvyo
Tags: 3.0.PRE6-1
* New upstream release
  - Removed patches integrated upsteam:
    + 04-m68k-ftbfs

* debian/rules
  - Enable delay pools (Closes: #410785)
  - Enable cache digests (Closes: #416631)
  - Enable ICAP client
  - Raised Max Filedescriptor limit to 65536

* debian/control
  - Added real package dependency for httpd in squid3-cgi

* debian/patches/02-makefile-defaults
  - Fix default configuration file for cachemgr.cgi (Closes: #416630)

* debian/squid3.postinst
  - Fixed bashish in postinst (Closes: #411797)

* debian/patches/05-helpers-typo
  - Added upstream patch fixing compilation error in src/helpers.cc

* debian/patches/06-mem-obj-reference
  - Added upstream patch fixing a mem_obj reference in src/store.cc

* debian/patches/07-close-icap-connections
  - Added upstream patch fixing icap connection starvation

* debian/squid3.rc
  - Added LSB-compliant description to rc script

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
/*
3
 
 * $Id: fd.cc,v 1.54 2006/05/08 23:38:33 robertc Exp $
 
3
 * $Id: fd.cc,v 1.57 2007/04/28 22:26:37 hno Exp $
4
4
 *
5
5
 * DEBUG: section 51    Filedescriptor Functions
6
6
 * AUTHOR: Duane Wessels
97
97
        assert(F->write_handler == NULL);
98
98
    }
99
99
 
100
 
    debug(51, 3) ("fd_close FD %d %s\n", fd, F->desc);
 
100
    debugs(51, 3, "fd_close FD " << fd << " " << F->desc);
101
101
    commSetSelect(fd, COMM_SELECT_READ, NULL, NULL, 0);
102
102
    commSetSelect(fd, COMM_SELECT_WRITE, NULL, NULL, 0);
103
103
    F->flags.open = 0;
112
112
int
113
113
socket_read_method(int fd, char *buf, int len)
114
114
{
115
 
    return (recv(fd, (void *) buf, len, 0));
 
115
    int i;
 
116
    PROF_start(send);
 
117
    i = recv(fd, (void *) buf, len, 0);
 
118
    PROF_stop(send);
 
119
    return i;
116
120
}
117
121
 
118
122
int
119
123
file_read_method(int fd, char *buf, int len)
120
124
{
121
 
    return (_read(fd, buf, len));
 
125
    int i;
 
126
    PROF_start(read);
 
127
    i = _read(fd, buf, len);
 
128
    PROF_stop(read);
 
129
    return i;
122
130
}
123
131
 
124
132
int
125
133
socket_write_method(int fd, const char *buf, int len)
126
134
{
127
 
    return (send(fd, (const void *) buf, len, 0));
 
135
    int i;
 
136
    PROF_start(send);
 
137
    i = send(fd, (const void *) buf, len, 0);
 
138
    PROF_stop(send);
 
139
    return i;
128
140
}
129
141
 
130
142
int
137
149
int
138
150
default_read_method(int fd, char *buf, int len)
139
151
{
140
 
    return (read(fd, buf, len));
 
152
    int i;
 
153
    PROF_start(read);
 
154
    i = read(fd, buf, len);
 
155
    PROF_stop(read);
 
156
    return i;
141
157
}
142
158
 
143
159
int
144
160
default_write_method(int fd, const char *buf, int len)
145
161
{
146
 
    return (write(fd, buf, len));
 
162
    int i;
 
163
    PROF_start(write);
 
164
    i = write(fd, buf, len);
 
165
    PROF_stop(write);
 
166
    return i;
147
167
}
148
168
 
149
169
#endif
156
176
    F = &fd_table[fd];
157
177
 
158
178
    if (F->flags.open) {
159
 
        debug(51, 1) ("WARNING: Closing open FD %4d\n", fd);
 
179
        debugs(51, 1, "WARNING: Closing open FD " << std::setw(4) << fd);
160
180
        fd_close(fd);
161
181
    }
162
182
 
163
183
    assert(!F->flags.open);
164
 
    debug(51, 3) ("fd_open FD %d %s\n", fd, desc);
 
184
    debugs(51, 3, "fd_open FD " << fd << " " << desc);
165
185
    F->type = type;
166
186
    F->flags.open = 1;
167
187
    F->epoll_state = 0;
248
268
        if (i == fileno(debug_log))
249
269
            continue;
250
270
 
251
 
        debug(51, 1) ("Open FD %-10s %4d %s\n",
252
 
                      F->bytes_read && F->bytes_written ? "READ/WRITE" :
253
 
                      F->bytes_read ? "READING" :
254
 
                      F->bytes_written ? "WRITING" : null_string,
255
 
                      i, F->desc);
 
271
        debugs(51, 1, "Open FD "<< std::left<< std::setw(10) << 
 
272
               (F->bytes_read && F->bytes_written ? "READ/WRITE" :
 
273
                F->bytes_read ? "READING" : F->bytes_written ? "WRITING" : 
 
274
                null_string)  <<
 
275
               " "<< std::right << std::setw(4) << i  << " " << F->desc);
256
276
    }
257
277
}
258
278
 
302
322
 
303
323
    if (newReserve > x) {
304
324
        /* perhaps this should be fatal()? -DW */
305
 
        debug(51, 0) ("WARNING: This machine has a serious shortage of filedescriptors.\n");
 
325
        debugs(51, 0, "WARNING: This machine has a serious shortage of filedescriptors.");
306
326
        newReserve = x;
307
327
    }
308
328
 
309
 
    debug(51, 0) ("Reserved FD adjusted from %d to %d due to failures\n",
310
 
                  RESERVED_FD, newReserve);
 
329
    debugs(51, 0, "Reserved FD adjusted from " << RESERVED_FD << " to " << newReserve << " due to failures");
311
330
    RESERVED_FD = newReserve;
312
331
}