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
85c0c732
Commit
85c0c732
authored
Mar 20, 2001
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 'ps' WAIT status display bug on setproctitle() platforms, cleared by
Tom Lane.
parent
2bea1e0a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
24 deletions
+28
-24
src/backend/utils/misc/ps_status.c
src/backend/utils/misc/ps_status.c
+28
-24
No files found.
src/backend/utils/misc/ps_status.c
View file @
85c0c732
...
...
@@ -5,7 +5,7 @@
* to contain some useful information. Differs wildly across
* platforms.
*
* $Header: /cvsroot/pgsql/src/backend/utils/misc/ps_status.c,v 1.
2 2000/07/09 13:14:11 petere
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/ps_status.c,v 1.
3 2001/03/20 22:31:54 momjian
Exp $
*
* Copyright 2000 by PostgreSQL Global Development Group
* various details abducted from various places
...
...
@@ -44,7 +44,7 @@ extern char **environ;
* PS_USE_PS_STRINGS
* assign PS_STRINGS->ps_argvstr = "string"
* (some BSD systems)
* PS_USE_CHAN
C
E_ARGV
* PS_USE_CHAN
G
E_ARGV
* assign argv[0] = "string"
* (some other BSD systems)
* PS_USE_CLOBBER_ARGV
...
...
@@ -189,27 +189,26 @@ init_ps_display(int argc, char *argv[],
void
set_ps_display
(
const
char
*
value
)
{
#ifndef PS_USE_NONE
/* no ps display for stand-alone backend */
if
(
!
IsUnderPostmaster
)
return
;
#ifndef PS_USE_NONE
# ifdef PS_USE_CLOBBER_ARGV
/* If ps_buffer is a pointer, it might still be null */
if
(
!
ps_buffer
)
return
;
# ifdef PS_USE_SETPROCTITLE
setproctitle
(
"%s%s"
,
ps_buffer
,
value
);
# else
/* not PS_USE_SETPROCTITLE */
{
size_t
vallen
=
strlen
(
value
);
# endif
strncpy
(
ps_buffer
+
ps_buffer_fixed_size
,
value
,
/* Update ps_buffer to contain both fixed part and value */
StrNCpy
(
ps_buffer
+
ps_buffer_fixed_size
,
value
,
ps_buffer_size
-
ps_buffer_fixed_size
);
if
(
ps_buffer_fixed_size
+
vallen
>=
ps_buffer_size
)
ps_buffer
[
ps_buffer_size
-
1
]
=
0
;
else
ps_buffer
[
ps_buffer_fixed_size
+
vallen
]
=
0
;
/* Transmit new setting to kernel, if necessary */
# ifdef PS_USE_SETPROCTITLE
setproctitle
(
"%s"
,
ps_buffer
);
# endif
# ifdef PS_USE_PSTAT
{
...
...
@@ -229,24 +228,29 @@ set_ps_display(const char * value)
{
char
*
cp
;
/* pad unused memory */
for
(
cp
=
ps_buffer
+
ps_buffer_fixed_size
+
vallen
;
for
(
cp
=
ps_buffer
+
strlen
(
ps_buffer
)
;
cp
<
ps_buffer
+
ps_buffer_size
;
cp
++
)
*
cp
=
PS_PADDING
;
}
# endif
/* PS_USE_CLOBBER_ARGV */
}
# endif
/* not USE_SETPROCTITLE */
#endif
/* not PS_USE_NONE */
}
/*
* Returns what's currently in the ps display, in case someone needs
* it.
* it.
Note that only the variable part is returned.
*/
const
char
*
get_ps_display
(
void
)
{
#ifdef PS_USE_CLOBBER_ARGV
/* If ps_buffer is a pointer, it might still be null */
if
(
!
ps_buffer
)
return
""
;
#endif
return
ps_buffer
+
ps_buffer_fixed_size
;
}
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