/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996, 1997, 1998
* Sleepycat Software. All rights reserved.
*/
#include "config.h"
#ifndef lint
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
#include <errno.h>
#endif
#include "db_int.h"
#include "shqueue.h"
#include "db_shash.h"
#include "mp.h"
#include "common_ext.h"
/*
* memp_fput --
* Mpool file put function.
*/
int
void *pgaddr;
{
/* Validate arguments. */
if (flags) {
return (ret);
return (ret);
"%s: dirty flag set for readonly file page",
return (EACCES);
}
}
/* Decrement the pinned reference count. */
"%s: put: more blocks returned than retrieved",
else
/*
* If we're mapping the file, there's nothing to do. Because we can
* stop mapping the file at any time, we have to check on each buffer
* to see if the address we gave the application was part of the map
* region.
*/
return (0);
}
/* Convert the page address to a buffer header. */
}
}
if (LF_ISSET(DB_MPOOL_DISCARD))
/*
* Check for a reference count going to zero. This can happen if the
* application returns a page twice.
*/
return (EINVAL);
}
/*
* If more than one reference to the page, we're done. Ignore the
* discard flags (for now) and leave it at its position in the LRU
* chain. The rest gets done at last reference close.
*/
return (0);
}
else
/*
* If this buffer is scheduled for writing because of a checkpoint, we
* need to write it (if we marked it dirty), or update the checkpoint
* counters (if we didn't mark it dirty). If we try to write it and
* can't, that's not necessarily an error, but set a flag so that the
* next time the memp_sync function runs we try writing it there, as
* the checkpoint application better be able to write all of the files.
*/
if (__memp_bhwrite(dbmp,
} else {
}
return (0);
}