Skip to content

Commit

Permalink
[Utils] Avoid emitting polling fstsl error message unless aborting.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 authored and simonmichal committed May 2, 2022
1 parent ffce22d commit 03b35da
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
8 changes: 3 additions & 5 deletions src/XrdSys/XrdSysIOEventsPollE.icc
Expand Up @@ -216,16 +216,14 @@ void XrdSys::IOEvents::PollE::Begin(XrdSysSemaphore *syncsem,
if (numpolled == 0) CbkTMO();
else if (numpolled < 0)
{int rc = errno;
cerr <<"EPoll: " <<XrdSysE2T(rc) <<" polling for events" <<endl;
//--------------------------------------------------------------
// If we are in a child process and the epoll file descriptor
// has been closed, there is an immense chance the fork will be
// followed by an exec, in which case we don't want to abort
//--------------------------------------------------------------
if( rc == EBADF && parentPID != getpid() )
return;
else
abort();
if( rc == EBADF && parentPID != getpid() ) return;
cerr <<"EPoll: "<<XrdSysE2T(rc)<<" polling for events "<<endl;
abort();
}
else for (int i = 0; i < numpolled; i++)
{if ((cP = (Channel *)pollTab[i].data.ptr))
Expand Down
8 changes: 3 additions & 5 deletions src/XrdSys/XrdSysIOEventsPollKQ.icc
Expand Up @@ -223,16 +223,14 @@ void XrdSys::IOEvents::PollKQ::Begin(XrdSysSemaphore *syncsem,
if (numpolled == 0) CbkTMO();
else if (numpolled < 0)
{int rc = errno;
cerr <<"KQ: " <<XrdSysE2T(rc) <<" polling for events" <<endl;
//--------------------------------------------------------------
// If we are in a child process and the poll file descriptor
// has been closed, there is an immense chance the fork will be
// followed by an exec, in which case we don't want to abort
//--------------------------------------------------------------
if( rc == EBADF && parentPID != getpid() )
return;
else
abort();
if( rc == EBADF && parentPID != getpid() ) return;
cerr <<"KQ: " <<XrdSysE2T(rc) <<" polling for events" <<endl;
abort();
}
else for (int i = 0; i < numpolled; i++)
{if ((cP = (Channel *)pollTab[i].udata)) Dispatch(cP, i);
Expand Down
8 changes: 3 additions & 5 deletions src/XrdSys/XrdSysIOEventsPollPoll.icc
Expand Up @@ -198,16 +198,14 @@ void XrdSys::IOEvents::PollPoll::Begin(XrdSysSemaphore *syncsem,
if (numpolled == 0) CbkTMO();
else if (numpolled < 0)
{int rc = errno;
cerr <<"EPoll: " <<XrdSysE2T(rc) <<" polling for events" <<endl;
//--------------------------------------------------------------
// If we are in a child process and the poll file descriptor
// has been closed, there is an immense chance the fork will be
// followed by an exec, in which case we don't want to abort
//--------------------------------------------------------------
if( rc == EBADF && parentPID != getpid() )
return;
else
abort();
if( rc == EBADF && parentPID != getpid() ) return;
cerr <<"PPoll: "<<XrdSysE2T(rc)<<" polling for events"<<endl;
abort();
}
else{if (pollTab[0].revents) numpolled--;
for (i = 1; i < num2poll && numpolled; i++)
Expand Down
8 changes: 3 additions & 5 deletions src/XrdSys/XrdSysIOEventsPollPort.icc
Expand Up @@ -196,16 +196,14 @@ void XrdSys::IOEvents::PollPort::Begin(XrdSysSemaphore *syncsem,
if (rc)
{if (errno == ETIME || !errno) CbkTMO();
else {int rc = errno;
cerr <<"PollP: " <<XrdSysE2T(rc) <<" polling for events" <<endl;
//--------------------------------------------------------------
// If we are in a child process and the poll file descriptor
// has been closed, there is an immense chance the fork will be
// followed by an exec, in which case we don't want to abort
//--------------------------------------------------------------
if( rc == EBADF && parentPID != getpid() )
return;
else
abort();
if( rc == EBADF && parentPID != getpid() ) return;
cerr <<"PollP: " <<XrdSysE2T(rc) <<" polling for events" <<endl;
abort();
}
}
for (int i = 0; i < (int)numpolled; i++)
Expand Down

0 comments on commit 03b35da

Please sign in to comment.