Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
82555376
Commit
82555376
authored
Aug 25, 1998
by
Marc G. Fournier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
8e9d69d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
0 deletions
+87
-0
src/include/utils/ps_status.h
src/include/utils/ps_status.h
+87
-0
No files found.
src/include/utils/ps_status.h
0 → 100644
View file @
82555376
/*-------------------------------------------------------------------------
*
* ps_status.h--
*
* Defines macros to show backend status on the ps status line.
* Unfortunately this is system dpendent.
*
*-------------------------------------------------------------------------
*/
#ifndef PS_STATUS_H
#define PS_STATUS_H
#ifdef linux
#include <stdio.h>
#include <string.h>
#include "utils/trace.h"
extern
char
*
ps_status_buffer
;
#define PS_DEFINE_BUFFER \
char *ps_status_buffer = NULL;
#define PS_INIT_STATUS(argc, argv, execname, username, hostname, dbname) \
{ \
int i; \
for (i = 0; i < (argc); i++) { \
memset((argv)[i], 0, strlen((argv)[i])); \
} \
ps_status_buffer = (argv)[0]; \
sprintf(ps_status_buffer, "%s %s %s %s ", execname, username, hostname, dbname); \
ps_status_buffer += strlen(ps_status_buffer); \
}
#define PS_CLEAR_STATUS() \
{ if (ps_status_buffer) memset(ps_status_buffer, 0, strlen(ps_status_buffer)); }
#define PS_SET_STATUS(status) \
{ \
if (ps_status_buffer) \
{ \
PS_CLEAR_STATUS(); \
strcat(ps_status_buffer, status); \
} \
}
#define PS_STATUS (ps_status_buffer ? ps_status_buffer : "")
#else
/* !linux */
extern
const
char
**
ps_status
;
#define PS_DEFINE_BUFFER \
const char **ps_status = NULL;
#define PS_INIT_STATUS(argc, argv, execname, username, hostname, dbname) \
{ \
int i; \
Assert(argc >= 5); \
argv[0] = execname; \
argv[1] = hostname; \
argv[2] = username; \
argv[3] = dbname; \
ps_status = (const char **)&argv[4]; \
for (i = 4; i < argc; i++) \
argv[i] = "";
/* blank them */
\
}
#define PS_CLEAR_STATUS() \
{ if (ps_status) *ps_status = ""; }
#define PS_SET_STATUS(status) \
{ if (ps_status) *ps_status = (status); }
#define PS_STATUS (ps_status ? *ps_status : "")
#endif
#ifdef DONT_HAVE_PS_STATUS
#define PS_DEFINE_BUFFER
#define PS_INIT_STATUS(argc, argv, execname, username, hostname, dbname)
#define PS_CLEAR_STATUS()
#define PS_SET_STATUS(status) { if ((status)); }
#define PS_STATUS ""
#endif
/* !linux */
#endif
/* PS_STATUS_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment