Exemplo n.º 1
0
    /* Check if the entry is open and on the lru list---
       if not re-open it
       @throws SystemException if the lru limit is reached and the whole
               lru list is pinned.
     */
    void
    FileManager::checkActive(File& file)
    {
        ScopedMutexLock scm(_fileLock);
        assert(*(file._listPos) == &file);

        /* Check if the entry is already open, if so, update the lru
           and mark it pinned
         */
        if (file._fd >= 0)
        {
            _lru.erase(file._listPos);
            _lru.push_front(&file);
            file._listPos = _lru.begin();
            file._pin++;
            return;
        }

        /* Make sure there is room in the lru
         */
        checkLimit();

        /* Try to open the file using the saved flags
         */
        file._fd = File::openFile(file._path, file._flags);
        
        /* Remove from the closed list and add to the lru
         */
        file._pin++;
        _closed.erase(file._listPos);
        _lru.push_front(&file);
        file._listPos = _lru.begin();
    }
Exemplo n.º 2
0
    /* Add a new open entry to the lru
     */
    void
    FileManager::addFd(File& file)
    {
        ScopedMutexLock scm(_fileLock);

        checkInit();
        checkLimit();

        /* Add to the LRU
         */
        _lru.push_front(&file);
        file._listPos = _lru.begin();
    }
Exemplo n.º 3
0
 /* Remove an open entry from the lru or closed list
  */
 void
 FileManager::forgetFd(File& file)
 {
     ScopedMutexLock scm(_fileLock);
     
     if (file._fd >= 0)
     {
         _lru.erase(file._listPos);
     }
     else
     {
         _closed.erase(file._listPos);
     }
 }
Exemplo n.º 4
0
OD(pow,"pow",scm(l),scd(l),MFD,DFD)
MF(pow_o){if(fr){A t;A v=r;
  do{A u;ll(u,v,e);rr(t,u,v,e);if(t.r)err(5);v=u;}
  while(!t.v.as(s32).scalar<I>());z=v;R;}
 if(ww.r)err(4);I c=ww.v.as(s32).scalar<I>();z=r;DO(c,ll(z,z,e))}
DF(pow_o){if(fr){A t;A v=r;
  do{A u;ll(u,l,v,e);rr(t,u,v,e);if(t.r)err(5);v=u;}
  while(!t.v.as(s32).scalar<I>());z=v;R;}
 if(ww.r)err(4);I c=ww.v.as(s32).scalar<I>();
 A t=r;DO(c,ll(t,l,t,e))z=t;}