be-fsstubs.c
上传用户:blenddy
上传日期:2007-01-07
资源大小:6495k
文件大小:12k
- /*-------------------------------------------------------------------------
- *
- * be-fsstubs.c
- * support for filesystem operations on large objects
- *
- * Copyright (c) 1994, Regents of the University of California
- *
- *
- * IDENTIFICATION
- * $Header: /usr/local/cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.35 1999/06/04 21:13:38 tgl Exp $
- *
- * NOTES
- * This should be moved to a more appropriate place. It is here
- * for lack of a better place.
- *
- * Builtin functions for open/close/read/write operations on large objects.
- *
- * These functions operate in a private GlobalMemoryContext, which means
- * that large object descriptors hang around until we destroy the context.
- * That happens in lo_commit(). It'd be possible to prolong the lifetime
- * of the context so that LO FDs are good across transactions (for example,
- * we could release the context only if we see that no FDs remain open).
- * But we'd need additional state in order to do the right thing at the
- * end of an aborted transaction. FDs opened during an aborted xact would
- * still need to be closed, since they might not be pointing at valid
- * relations at all. For now, we'll stick with the existing documented
- * semantics of LO FDs: they're only good within a transaction.
- *
- *-------------------------------------------------------------------------
- */
- #include <fcntl.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <unistd.h>
- #include <string.h>
- #include <postgres.h>
- #include <lib/dllist.h>
- #include <libpq/libpq.h>
- #include <libpq/libpq-fs.h>
- #include <nodes/nodes.h>
- #include <utils/memutils.h>
- #include <lib/fstack.h>
- #include <utils/mcxt.h>
- #include <catalog/pg_shadow.h> /* for superuser() */
- #include <storage/fd.h> /* for O_ */
- #include <storage/large_object.h>
- #include <libpq/be-fsstubs.h>
- /* [PA] is Pascal Andr