Loading...
Searching...
No Matches
XrdOssAio.cc File Reference
`#include <signal.h>`
`#include <cstdio>`
`#include <unistd.h>`
`#include <fcntl.h>`
`#include "XrdOss/XrdOssApi.hh"`
`#include "XrdOss/XrdOssTrace.hh"`
`#include "XrdSys/XrdSysError.hh"`
`#include "XrdSys/XrdSysPlatform.hh"`
`#include "XrdSys/XrdSysPthread.hh"`
`#include "XrdSfs/XrdSfsAio.hh"`
Include dependency graph for XrdOssAio.cc:

Go to the source code of this file.

## Functions

void * | XrdOssAioWait (void *mySigarg)

## Variables

XrdSysError | OssEroute
XrdSysTrace | OssTrace

## Function Documentation

## XrdOssAioWait()

void * XrdOssAioWait | ( | void * | mySigarg | ) |

Definition at line 356 of file XrdOssAio.cc.

{
#ifdef _POSIX_ASYNCHRONOUS_IO
EPNAME("AioWait");
int mySignum = *((int *)mySigarg);
const char *sigType = (mySignum == OSS_AIO_READ_DONE ? "read" : "write");
const int isRead = (mySignum == OSS_AIO_READ_DONE);
sigset_t mySigset;
siginfo_t myInfo;
XrdSfsAio *aiop;
int rc, numsig;
ssize_t retval;
#ifndef HAVE_SIGWTI
extern int sigwaitinfo(const sigset_t *set, siginfo_t *info);
extern siginfo_t *XrdOssAioInfoR;
extern siginfo_t *XrdOssAioInfoW;
// We will catch one signal at a time. So, the address of siginfo_t can be
// placed in a global area where the signal handler will find it. We have one
// two places where this can go.
//
if (isRead) XrdOssAioInfoR = &myInfo;
else XrdOssAioInfoW = &myInfo;
// Initialize the signal we will be suspended for
//
sigfillset(&mySigset);
sigdelset(&mySigset, mySignum);
#else
// Initialize the signal we will be waiting for
//
sigemptyset(&mySigset);
sigaddset(&mySigset, mySignum);
#endif
// Simply wait for events and requeue the completed AIO operation
//
do {do {numsig = sigwaitinfo((const sigset_t *)&mySigset, &myInfo);}
while (numsig < 0 && errno == EINTR);
if (numsig < 0)
{OssEroute.Emsg("AioWait",errno,sigType,"wait for AIO signal");
XrdOssSys::AioAllOk = 0;
break;
}
if (numsig != mySignum || myInfo.si_code != SI_ASYNCIO)
{char buff[80];
sprintf(buff, "%d %d", myInfo.si_code, numsig);
OssEroute.Emsg("AioWait", "received unexpected signal", buff);
continue;
}
#ifdef __APPLE__
aiop = (XrdSfsAio *)myInfo.si_value.sigval_ptr;
#else
aiop = (XrdSfsAio *)myInfo.si_value.sival_ptr;
#endif
while ((rc = aio_error(&aiop->sfsAio)) == EINPROGRESS) {}
retval = (ssize_t)aio_return(&aiop->sfsAio);
DEBUG(sigType <<" completed for " <<aiop->TIdent <<"; rc=" <<rc
<<" result=" <<retval <<" aiocb=" <<Xrd::hex1 <<aiop);
if (retval < 0) aiop->Result = -rc;
else aiop->Result = retval;
if (isRead) aiop->doneRead();
else aiop->doneWrite();
} while(1);
#endif
return (void *)0;
}
DEBUG
#define DEBUG(x)
Definition XrdBwmTrace.hh:54
EPNAME
#define EPNAME(x)
Definition XrdBwmTrace.hh:56
OssEroute
XrdSysError OssEroute
XrdOssSys::AioAllOk
static int AioAllOk
Definition XrdOssApi.hh:201
XrdSfsAio
Definition XrdSfsAio.hh:59
XrdSfsAio::Result
ssize_t Result
Definition XrdSfsAio.hh:65
XrdSfsAio::TIdent
const char * TIdent
Definition XrdSfsAio.hh:67
XrdSfsAio::doneRead
virtual void doneRead()=0
XrdSfsAio::sfsAio
struct aiocb sfsAio
Definition XrdSfsAio.hh:62
XrdSfsAio::doneWrite
virtual void doneWrite()=0
Xrd::hex1
@ hex1
Definition XrdSysTrace.hh:42

References XrdOssSys::AioAllOk, DEBUG, XrdSfsAio::doneRead(), XrdSfsAio::doneWrite(), EPNAME, Xrd::hex1, OssEroute, XrdSfsAio::Result, XrdSfsAio::sfsAio, and XrdSfsAio::TIdent.

Referenced by XrdOssSys::AioInit().

Here is the call graph for this function:
Here is the caller graph for this function:

## Variable Documentation

## OssEroute

XrdSysError OssEroute

extern

Referenced by XrdOssSpace::Adjust(), XrdOssSys::AioInit(), XrdOssSys::Alloc_Cache(), XrdOssSys::BreakLink(), XrdOssCopy::Copy(), XrdOssSys::Create(), XrdOssFile::Fsync(), XrdOssSys::GetFile(), XrdOssSpace::Init(), XrdOssSys::Init(), XrdOssMio::Map(), XrdOssSys::MSS_Closedir(), XrdOssSys::MSS_Create(), XrdOssSys::MSS_Opendir(), XrdOssSys::MSS_Readdir(), XrdOssSys::MSS_Rename(), XrdOssSys::MSS_Stat(), XrdOssSys::MSS_Unlink(), XrdOssSys::MSS_Xeq(), XrdOssFile::Open(), XrdOssSpace::Quotas(), XrdOssFile::Read(), XrdOssMio::Recycle(), XrdOssSys::Reloc(), XrdOssSys::Rename(), XrdOssSys::RenameLink(), XrdOssSys::RenameLink3(), XrdOssCache::Scan(), XrdOssSys::Stage_RT(), XrdOssSpace::Unassign(), XrdOssAt::Unlink(), XrdOssSpace::Usage(), XrdOssFile::Write(), XrdOssAioWait(), and XrdOssGetSS().

## OssTrace

XrdSysTrace OssTrace

extern

Referenced by XrdOssSys::Config_Display(), XrdOssSys::ConfigStage(), XrdOssSys::Configure(), XrdOssGetSS(), and XrdOssSys::xtrace().