1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +03:00

Pgindent run for 8.0.

This commit is contained in:
Bruce Momjian
2004-08-29 05:07:03 +00:00
parent 90cb9c3051
commit b6b71b85bc
527 changed files with 20550 additions and 18283 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.37 2004/08/29 04:12:51 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.38 2004/08/29 05:06:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -72,29 +72,30 @@ current_database(PG_FUNCTION_ARGS)
* Functions to send signals to other backends.
*/
static int pg_signal_backend(int pid, int sig)
static int
pg_signal_backend(int pid, int sig)
{
if (!superuser())
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("must be superuser to signal other server processes"))));
(errmsg("must be superuser to signal other server processes"))));
if (!IsBackendPid(pid))
{
/*
* This is just a warning so a loop-through-resultset will not abort
* if one backend terminated on it's own during the run
* This is just a warning so a loop-through-resultset will not
* abort if one backend terminated on it's own during the run
*/
ereport(WARNING,
(errmsg("PID %d is not a PostgreSQL server process", pid)));
(errmsg("PID %d is not a PostgreSQL server process", pid)));
return 0;
}
if (kill(pid, sig))
if (kill(pid, sig))
{
/* Again, just a warning to allow loops */
ereport(WARNING,
(errmsg("could not send signal to process %d: %m",pid)));
(errmsg("could not send signal to process %d: %m", pid)));
return 0;
}
return 1;
@ -103,7 +104,7 @@ static int pg_signal_backend(int pid, int sig)
Datum
pg_cancel_backend(PG_FUNCTION_ARGS)
{
PG_RETURN_INT32(pg_signal_backend(PG_GETARG_INT32(0),SIGINT));
PG_RETURN_INT32(pg_signal_backend(PG_GETARG_INT32(0), SIGINT));
}
#ifdef NOT_USED
@ -113,21 +114,21 @@ pg_cancel_backend(PG_FUNCTION_ARGS)
Datum
pg_terminate_backend(PG_FUNCTION_ARGS)
{
PG_RETURN_INT32(pg_signal_backend(PG_GETARG_INT32(0),SIGTERM));
PG_RETURN_INT32(pg_signal_backend(PG_GETARG_INT32(0), SIGTERM));
}
#endif
/* Function to find out which databases make use of a tablespace */
typedef struct
typedef struct
{
char *location;
DIR *dirdesc;
char *location;
DIR *dirdesc;
} ts_db_fctx;
Datum pg_tablespace_databases(PG_FUNCTION_ARGS)
Datum
pg_tablespace_databases(PG_FUNCTION_ARGS)
{
FuncCallContext *funcctx;
struct dirent *de;
@ -136,18 +137,18 @@ Datum pg_tablespace_databases(PG_FUNCTION_ARGS)
if (SRF_IS_FIRSTCALL())
{
MemoryContext oldcontext;
Oid tablespaceOid=PG_GETARG_OID(0);
Oid tablespaceOid = PG_GETARG_OID(0);
funcctx=SRF_FIRSTCALL_INIT();
funcctx = SRF_FIRSTCALL_INIT();
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
fctx = palloc(sizeof(ts_db_fctx));
/*
* size = path length + tablespace dirname length
* + 2 dir sep chars + oid + terminator
* size = path length + tablespace dirname length + 2 dir sep
* chars + oid + terminator
*/
fctx->location = (char*) palloc(strlen(DataDir) + 11 + 10 + 1);
fctx->location = (char *) palloc(strlen(DataDir) + 11 + 10 + 1);
if (tablespaceOid == GLOBALTABLESPACE_OID)
{
fctx->dirdesc = NULL;
@ -160,8 +161,8 @@ Datum pg_tablespace_databases(PG_FUNCTION_ARGS)
sprintf(fctx->location, "%s/base", DataDir);
else
sprintf(fctx->location, "%s/pg_tblspc/%u", DataDir,
tablespaceOid);
tablespaceOid);
fctx->dirdesc = AllocateDir(fctx->location);
if (!fctx->dirdesc)
@ -173,25 +174,26 @@ Datum pg_tablespace_databases(PG_FUNCTION_ARGS)
errmsg("could not open directory \"%s\": %m",
fctx->location)));
ereport(WARNING,
(errmsg("%u is not a tablespace oid", tablespaceOid)));
(errmsg("%u is not a tablespace oid", tablespaceOid)));
}
}
funcctx->user_fctx = fctx;
MemoryContextSwitchTo(oldcontext);
}
funcctx=SRF_PERCALL_SETUP();
fctx = (ts_db_fctx*) funcctx->user_fctx;
funcctx = SRF_PERCALL_SETUP();
fctx = (ts_db_fctx *) funcctx->user_fctx;
if (!fctx->dirdesc) /* not a tablespace */
if (!fctx->dirdesc) /* not a tablespace */
SRF_RETURN_DONE(funcctx);
while ((de = readdir(fctx->dirdesc)) != NULL)
{
char *subdir;
DIR *dirdesc;
char *subdir;
DIR *dirdesc;
Oid datOid = atooid(de->d_name);
Oid datOid = atooid(de->d_name);
/* this test skips . and .., but is awfully weak */
if (!datOid)
continue;