diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-06-22 22:56:29 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-06-22 22:56:29 +0000 |
commit | d20763dbee7cdf8a700bf6bdd120b3913a3b99f4 (patch) | |
tree | 5cb9ed9ba10cdbac226fd6b96ac02a2cc5a543a8 /contrib/miscutil/misc_utils.c | |
parent | 4cc7a93d220644ae068ce2639b961db6764a68f6 (diff) | |
download | postgresql-d20763dbee7cdf8a700bf6bdd120b3913a3b99f4.tar.gz postgresql-d20763dbee7cdf8a700bf6bdd120b3913a3b99f4.zip |
Remove contrib modules that have been agreed to be obsolete.
(There are more that will be removed once they've been copied to
pgfoundry.org.)
Diffstat (limited to 'contrib/miscutil/misc_utils.c')
-rw-r--r-- | contrib/miscutil/misc_utils.c | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/contrib/miscutil/misc_utils.c b/contrib/miscutil/misc_utils.c deleted file mode 100644 index d595474862b..00000000000 --- a/contrib/miscutil/misc_utils.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * misc_utils.c -- - * - * This file defines miscellaneous PostgreSQL utility functions. - * - * Copyright (C) 1999, Massimo Dal Zotto <dz@cs.unitn.it> - * - * This file is distributed under the GNU General Public License - * either version 2, or (at your option) any later version. - */ - -#include "postgres.h" - -#include <unistd.h> -#include <signal.h> - -#include "access/heapam.h" -#include "access/htup.h" -#include "access/relscan.h" -#include "access/skey.h" -#include "access/tupdesc.h" -#include "catalog/pg_listener.h" -#include "commands/async.h" -#include "fmgr.h" -#include "storage/lmgr.h" -#include "utils/fmgroids.h" -#include "utils/rel.h" -#include "utils/tqual.h" - -#include "misc_utils.h" - - -int -backend_pid(void) -{ - return getpid(); -} - -int -unlisten(char *relname) -{ - Async_Unlisten(relname, getpid()); - return 0; -} - -int -int4max(int x, int y) -{ - return Max(x, y); -} - -int -int4min(int x, int y) -{ - return Min(x, y); -} - -/* - * Return the number of active listeners on a relation name. - */ -int -active_listeners(text *relname) -{ - HeapTuple lTuple; - Relation lRel; - HeapScanDesc sRel; - TupleDesc tdesc; - ScanKeyData key; - Datum d; - bool isnull; - int len, - pid; - int count = 0; - int ourpid = getpid(); - char listen_name[NAMEDATALEN]; - - lRel = heap_open(ListenerRelationId, AccessShareLock); - tdesc = RelationGetDescr(lRel); - - if (relname && (VARSIZE(relname) > VARHDRSZ)) - { - MemSet(listen_name, 0, NAMEDATALEN); - len = Min(VARSIZE(relname) - VARHDRSZ, NAMEDATALEN - 1); - memcpy(listen_name, VARDATA(relname), len); - ScanKeyInit(&key, - Anum_pg_listener_relname, - BTEqualStrategyNumber, F_NAMEEQ, - PointerGetDatum(listen_name)); - sRel = heap_beginscan(lRel, SnapshotNow, 1, &key); - } - else - sRel = heap_beginscan(lRel, SnapshotNow, 0, (ScanKey) NULL); - - while ((lTuple = heap_getnext(sRel, ForwardScanDirection)) != NULL) - { - d = heap_getattr(lTuple, Anum_pg_listener_pid, tdesc, &isnull); - pid = DatumGetInt32(d); - if ((pid == ourpid) || (kill(pid, 0) == 0)) - count++; - } - heap_endscan(sRel); - - heap_close(lRel, AccessShareLock); - - return count; -} |