PostgreSQL Source Code git master
Loading...
Searching...
No Matches
fsmfuncs.c File Reference
#include "postgres.h"
#include "fmgr.h"
#include "lib/stringinfo.h"
#include "miscadmin.h"
#include "pageinspect.h"
#include "storage/fsm_internals.h"
#include "utils/builtins.h"
Include dependency graph for fsmfuncs.c:

Go to the source code of this file.

Functions

 PG_FUNCTION_INFO_V1 (fsm_page_contents)
 
Datum fsm_page_contents (PG_FUNCTION_ARGS)
 

Function Documentation

◆ fsm_page_contents()

Datum fsm_page_contents ( PG_FUNCTION_ARGS  )

Definition at line 35 of file fsmfuncs.c.

36{
38 StringInfoData sinfo;
39 Page page;
41 int i;
42
43 if (!superuser())
46 errmsg("must be superuser to use raw page functions")));
47
49
50 if (PageIsNew(page))
52
54
55 initStringInfo(&sinfo);
56
57 for (i = 0; i < NodesPerPage; i++)
58 {
59 if (fsmpage->fp_nodes[i] != 0)
60 appendStringInfo(&sinfo, "%d: %d\n", i, fsmpage->fp_nodes[i]);
61 }
62 appendStringInfo(&sinfo, "fp_next_slot: %d\n", fsmpage->fp_next_slot);
63
65}
static bool PageIsNew(const PageData *page)
Definition bufpage.h:233
static char * PageGetContents(Page page)
Definition bufpage.h:257
PageData * Page
Definition bufpage.h:81
int errcode(int sqlerrcode)
Definition elog.c:863
int errmsg(const char *fmt,...)
Definition elog.c:1080
#define ERROR
Definition elog.h:39
#define ereport(elevel,...)
Definition elog.h:150
#define PG_RETURN_NULL()
Definition fmgr.h:346
#define PG_RETURN_TEXT_P(x)
Definition fmgr.h:374
#define PG_GETARG_BYTEA_P(n)
Definition fmgr.h:336
#define NodesPerPage
FSMPageData * FSMPage
int i
Definition isn.c:77
Page get_page_from_raw(bytea *raw_page)
Definition rawpage.c:218
static int fb(int x)
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition stringinfo.c:145
void initStringInfo(StringInfo str)
Definition stringinfo.c:97
Definition c.h:706
bool superuser(void)
Definition superuser.c:46
text * cstring_to_text_with_len(const char *s, int len)
Definition varlena.c:193

References appendStringInfo(), cstring_to_text_with_len(), StringInfoData::data, ereport, errcode(), errmsg(), ERROR, fb(), get_page_from_raw(), i, initStringInfo(), StringInfoData::len, NodesPerPage, PageGetContents(), PageIsNew(), PG_GETARG_BYTEA_P, PG_RETURN_NULL, PG_RETURN_TEXT_P, and superuser().

◆ PG_FUNCTION_INFO_V1()

PG_FUNCTION_INFO_V1 ( fsm_page_contents  )