PostgreSQL Source Code  git master
proclist_types.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * proclist_types.h
4  * doubly-linked lists of pgprocnos
5  *
6  * See proclist.h for functions that operate on these types.
7  *
8  * Portions Copyright (c) 2016-2023, PostgreSQL Global Development Group
9  *
10  * IDENTIFICATION
11  * src/include/storage/proclist_types.h
12  *-------------------------------------------------------------------------
13  */
14 
15 #ifndef PROCLIST_TYPES_H
16 #define PROCLIST_TYPES_H
17 
18 /*
19  * A node in a doubly-linked list of processes. The link fields contain
20  * the 0-based PGPROC indexes of the next and previous process, or
21  * INVALID_PGPROCNO in the next-link of the last node and the prev-link
22  * of the first node. A node that is currently not in any list
23  * should have next == prev == 0; this is not a possible state for a node
24  * that is in a list, because we disallow circularity.
25  */
26 typedef struct proclist_node
27 {
28  int next; /* pgprocno of the next PGPROC */
29  int prev; /* pgprocno of the prev PGPROC */
31 
32 /*
33  * Header of a doubly-linked list of PGPROCs, identified by pgprocno.
34  * An empty list is represented by head == tail == INVALID_PGPROCNO.
35  */
36 typedef struct proclist_head
37 {
38  int head; /* pgprocno of the head PGPROC */
39  int tail; /* pgprocno of the tail PGPROC */
41 
42 /*
43  * List iterator allowing some modifications while iterating.
44  */
45 typedef struct proclist_mutable_iter
46 {
47  int cur; /* pgprocno of the current PGPROC */
48  int next; /* pgprocno of the next PGPROC */
50 
51 #endif /* PROCLIST_TYPES_H */
struct proclist_head proclist_head
struct proclist_node proclist_node
struct proclist_mutable_iter proclist_mutable_iter