~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to src/DiskIO/AIO/AIODiskFile.cc

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2009-09-24 14:51:06 UTC
  • mfrom: (1.1.12 upstream)
  • mto: (20.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20090924145106-38jgrzmj0d73pha5
Tags: 3.1.0.13-1
* Upload to experimental

* New upstream release
  - Fixes Follow-X-Forwarded-For support (Closes: #523943)
  - Adds IPv6 support (Closes: #432351)

* debian/rules
  - Removed obsolete configuration options
  - Enable db and radius basic authentication modules

* debian/patches/01-cf.data.debian
  - Adapted to new upstream version

* debian/patches/02-makefile-defaults
  - Adapted to new upstream version

* debian/{squid.postinst,squid.rc,README.Debian,watch}
  - Updated references to squid 3.1

* debian/squid3.install
  - Install CSS file for error pages
  - Install manual pages for new authentication modules

* debian/squid3-common.install
  - Install documented version of configuration file in /usr/share/doc/squid3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
1
/*
3
 
 * $Id: AIODiskFile.cc,v 1.6 2007/05/29 13:31:43 amosjeffries Exp $
 
2
 * $Id$
4
3
 *
5
4
 * SQUID Web Proxy Cache          http://www.squid-cache.org/
6
5
 * ----------------------------------------------------------
18
17
 *  it under the terms of the GNU General Public License as published by
19
18
 *  the Free Software Foundation; either version 2 of the License, or
20
19
 *  (at your option) any later version.
21
 
 *  
 
20
 *
22
21
 *  This program is distributed in the hope that it will be useful,
23
22
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
24
23
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
24
 *  GNU General Public License for more details.
26
 
 *  
 
25
 *
27
26
 *  You should have received a copy of the GNU General Public License
28
27
 *  along with this program; if not, write to the Free Software
29
28
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
30
29
 *
31
30
 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
32
31
 */
33
 
/*
 
32
 
 
33
/**
34
34
 * Author: Adrian Chadd <adrian@squid-cache.org>
35
35
 *
 
36
 \par
36
37
 * These routines are simple plugin replacements for the file_* routines
37
38
 * in disk.c . They back-end into the POSIX AIO routines to provide
38
39
 * a nice and simple async IO framework for COSS.
39
40
 *
 
41
 \par
40
42
 * AIO is suitable for COSS - the only sync operations that the standard
41
43
 * supports are read/write, and since COSS works on a single file
42
44
 * per storedir it should work just fine.
51
53
 
52
54
CBDATA_CLASS_INIT(AIODiskFile);
53
55
void *
54
 
AIODiskFile::operator new (size_t)
 
56
AIODiskFile::operator new(size_t unused)
55
57
{
56
58
    CBDATA_INIT_TYPE(AIODiskFile);
57
59
    return cbdataAlloc(AIODiskFile);
58
60
}
59
61
 
60
62
void
61
 
AIODiskFile::operator delete (void *address)
 
63
AIODiskFile::operator delete(void *address)
62
64
{
63
65
    cbdataFree(address);
64
66
}
65
67
 
66
 
AIODiskFile::AIODiskFile (char const *aPath, AIODiskIOStrategy *aStrategy) : fd(-1), closed(true), error_(false)
 
68
AIODiskFile::AIODiskFile(char const *aPath, AIODiskIOStrategy *aStrategy) : fd(-1), closed(true), error_(false)
67
69
{
68
70
    assert (aPath);
69
71
    path = aPath;
81
83
}
82
84
 
83
85
void
84
 
AIODiskFile::open (int flags, mode_t mode, IORequestor::Pointer callback)
 
86
AIODiskFile::open(int flags, mode_t mode, RefCount<IORequestor> callback)
85
87
{
86
88
    /* Simulate async calls */
87
89
#ifdef _SQUID_WIN32_
88
 
    fd = aio_open(path.buf(), flags);
 
90
    fd = aio_open(path.termedBuf(), flags);
89
91
#else
90
 
 
91
 
    fd = file_open(path.buf() , flags);
 
92
    fd = file_open(path.termedBuf() , flags);
92
93
#endif
93
94
 
94
95
    ioRequestor = callback;
95
96
 
96
97
    if (fd < 0) {
97
 
        debugs(79, 3, "BlockingFile::open: got failure (" << errno << ")");
 
98
        debugs(79, 3, HERE << ": got failure (" << errno << ")");
98
99
        error(true);
99
100
    } else {
100
101
        closed = false;
101
102
        store_open_disk_fd++;
102
 
        debugs(79, 3, "BlockingFile::open: opened FD " << fd);
 
103
        debugs(79, 3, HERE << ": opened FD " << fd);
103
104
    }
104
105
 
105
106
    callback->ioCompletedNotification();
106
107
}
107
108
 
108
109
void
109
 
AIODiskFile::create (int flags, mode_t mode, RefCount<IORequestor> callback)
 
110
AIODiskFile::create(int flags, mode_t mode, RefCount<IORequestor> callback)
110
111
{
111
112
    /* We use the same logic path for open */
112
113
    open(flags, mode, callback);