10 #include "XrdClient/XrdClientConn.hh"
34 open (name, flags, perms);
55 <<
"Destructor called on XROOTD file '" <<
m_name
56 <<
"' but the file is still open";
95 if ((name == 0) || (*name == 0)) {
97 ex <<
"Cannot open a file without a name";
103 ex <<
"Must open file '" << name <<
"' at least for read or write";
117 openflags |= kXR_open_updt;
119 openflags |= kXR_open_read;
123 ex <<
"Opening file '" << name <<
"' in append mode not supported";
131 openflags |= kXR_delete;
132 openflags |= kXR_new;
133 openflags |= kXR_mkpath;
137 openflags |= kXR_delete;
143 if (!
m_client->Open(perms, openflags)
144 ||
m_client->LastServerResp()->status != kXR_ok) {
146 ex <<
"XrdClient::Open(name='" << name
147 <<
"', flags=0x" << std::hex << openflags
148 <<
", permissions=0" << std::oct << perms <<
std::dec
149 <<
") => error '" <<
m_client->LastServerError()->errmsg
150 <<
"' (errno=" <<
m_client->LastServerError()->errnum <<
")";
157 ex <<
"XrdClient::Stat(name='" << name
158 <<
") => error '" <<
m_client->LastServerError()->errmsg
159 <<
"' (errno=" <<
m_client->LastServerError()->errnum <<
")";
172 m_client->SendMonitoringInfo(crabJobId, &dictId);
173 edm::LogInfo(
"XrdFileInfo") <<
"Set monitoring ID to " << crabJobId <<
" with resulting dictId " << dictId <<
".";
179 edm::LogInfo(
"XrdFileInfo") <<
"Connection URL " << conn->GetCurrentUrl().GetUrl().c_str();
183 if (statsService.isAvailable()) {
184 statsService->setCurrentServer(host);
194 <<
"XrdFile::close(name='" <<
m_name
195 <<
"') called but the file is not open";
202 <<
"XrdFile::close(name='" <<
m_name
203 <<
"') failed with error '" <<
m_client->LastServerError()->errmsg
204 <<
"' (errno=" <<
m_client->LastServerError()->errnum <<
")";
228 if (n > 0x7fffffff) {
230 ex <<
"XrdFile::read(name='" <<
m_name <<
"', n=" << n
231 <<
") too many bytes, limit is 0x7fffffff";
239 ex <<
"XrdClient::Read(name='" <<
m_name
240 <<
"', offset=" <<
m_offset <<
", n=" << n
241 <<
") failed with error '" <<
m_client->LastServerError()->errmsg
242 <<
"' (errno=" <<
m_client->LastServerError()->errnum <<
")";
254 if (n > 0x7fffffff) {
256 ex <<
"XrdFile::read(name='" <<
m_name <<
"', n=" << n
257 <<
") exceeds read size limit 0x7fffffff";
265 ex <<
"XrdClient::Read(name='" <<
m_name
266 <<
"', offset=" <<
m_offset <<
", n=" << n
267 <<
") failed with error '" <<
m_client->LastServerError()->errmsg
268 <<
"' (errno=" <<
m_client->LastServerError()->errnum <<
")";
279 if (n > 0x7fffffff) {
281 ex <<
"XrdFile::write(name='" <<
m_name <<
"', n=" << n
282 <<
") too many bytes, limit is 0x7fffffff";
290 ex <<
"XrdFile::write(name='" <<
m_name <<
"', n=" << n
291 <<
") failed with error '" <<
m_client->LastServerError()->errmsg
292 <<
"' (errno=" <<
m_client->LastServerError()->errnum <<
")";
307 if (n > 0x7fffffff) {
309 ex <<
"XrdFile::write(name='" <<
m_name <<
"', n=" << n
310 <<
") too many bytes, limit is 0x7fffffff";
315 ssize_t
s =
m_client->Write(from, pos, n);
318 ex <<
"XrdFile::write(name='" <<
m_name <<
"', n=" << n
319 <<
") failed with error '" <<
m_client->LastServerError()->errmsg
320 <<
"' (errno=" <<
m_client->LastServerError()->errnum <<
")";
325 if (pos + s >
m_stat.size)
340 std::vector<long long> offsets; offsets.resize(n);
341 std::vector<int> lens; lens.resize(n);
346 total += what[
i].
size();
349 kXR_int64
r =
m_client->ReadV(
NULL, &offsets[0], &lens[0], n);
361 ex <<
"XrdFile::position() called on a closed file";
382 ex <<
"XrdFile::position() called with incorrect 'whence' parameter";
400 ex <<
"XrdFile::resize(name='" <<
m_name <<
"') not implemented";
411 std::stringstream
ss;
412 ss <<
"Current server connection: " << conn->GetCurrentUrl().GetUrl().c_str();
414 if (conn->IsOpTimeLimitElapsed(
time(
NULL)))
416 ex.
addAdditionalInfo(
"Operation timeout expired. This is possibly a temporary issue which may go away on retry.");
419 struct ServerResponseBody_Error * lastError =
m_client->LastServerError();
420 if (lastError && lastError->errnum != kXR_noErrorYet)
422 std::stringstream
ss;
425 char errmsg[4097]; errmsg[4096] =
'\0';
426 strncpy(errmsg, lastError->errmsg, 4096);
427 ss <<
"Last server error (code=" << lastError->errnum <<
")";
428 if (strlen(errmsg)) {ss <<
": " << errmsg;}
virtual void resize(IOOffset size)
#define PREFETCH_PROBE_LENGTH
virtual void create(const char *name, bool exclusive=false, int perms=0666)
std::vector< Variable::Flags > flags
virtual bool prefetch(const IOPosBuffer *what, IOSize n)
virtual IOOffset position(void) const
void addAdditionalInfo(std::string const &info)
unsigned int offset(bool)
IOOffset offset(void) const
virtual IOOffset size(void) const
void addContext(std::string const &context)
pthread_mutex_t m_readv_mutex
static const char * getJobID()
volatile std::atomic< bool > shutdown_flag false
void addConnection(cms::Exception &)
virtual void open(const char *name, int flags=IOFlags::OpenRead, int perms=0666)
virtual IOSize write(const void *from, IOSize n)