17 <<
"Cannot change file but operation '" << why <<
"' was called";
22 : image_(base->
size()),
33 if (
char *
p = getenv(
"TMPDIR"))
37 pattern +=
"/cmssw-shadow-XXXXXX";
39 std::vector<char>
temp(pattern.c_str(), pattern.c_str()+pattern.size()+1);
40 int fd = mkstemp(&
temp[0]);
43 <<
"Cannot create temporary file '" << pattern <<
"': "
44 << strerror(errno) <<
" (error " << errno <<
")";
71 void *
window = mmap(0, len, PROT_READ | PROT_WRITE, MAP_SHARED,
file_->
fd(), start);
72 if (window == MAP_FAILED)
74 <<
"Unable to map a window of local cache file: "
75 << strerror(errno) <<
" (error " << errno <<
")";
85 <<
"Unable to cache " << len <<
" byte file segment at " << start
93 <<
"Unable to cache " << len <<
" byte file segment at " << start
94 <<
": got only " << nread <<
" bytes back";
114 cache(here, here + n);
132 end += into[
i].
size();
153 {
nowrite(
"write");
return 0; }
157 {
nowrite(
"write");
return 0; }
161 {
nowrite(
"writev");
return 0; }
165 {
nowrite(
"writev");
return 0; }
virtual char const * what() const
virtual IOSize readv(IOBuffer *into, IOSize length)
void cache(IOOffset start, IOOffset end)
virtual IOSize readv(IOPosBuffer *into, IOSize buffers)
virtual IOSize read(void *into, IOSize n, IOOffset pos)
virtual bool prefetch(const IOPosBuffer *what, IOSize n)
virtual IOSize read(void *into, IOSize n)
virtual IOOffset position(void) const
virtual IOSize writev(const IOBuffer *from, IOSize n)
LocalCacheFile(Storage *base, const std::string &tmpdir="")
static const IOOffset CHUNK_SIZE
unsigned int offset(bool)
std::vector< char > present_
IOOffset offset(void) const
static std::string from(" from ")
virtual IOOffset position(IOOffset offset, Relative whence=SET)
virtual IOSize write(const void *from, IOSize n)
virtual IOOffset size(void) const
virtual IOSize readv(IOBuffer *into, IOSize n)
virtual void resize(IOOffset size)
virtual bool prefetch(const IOPosBuffer *what, IOSize n)
virtual void resize(IOOffset size)
virtual IOFD fd(void) const
tuple size
Write out results.
static void nowrite(const char *why)