2222#include <signal.h>
2323#include <unistd.h>
2424#include <sys/stat.h>
25- #if defined(__hpux )
26- #include <sys/param.h>
27- #include <sys/pstat.h>
28- #endif
2925
3026#include "miscadmin.h"
3127#ifdef PROFILE_PID_DIR
3531#include "storage/ipc.h"
3632#include "tcop/tcopprot.h"
3733
38- extern long max_measured_stack_depth ;
39- extern long max_measured_register_stack_depth ;
40-
4134
4235/*
4336 * This flag is set during proc_exit() to change ereport()'s behavior,
@@ -87,69 +80,6 @@ static int on_proc_exit_index,
8780 before_shmem_exit_index ;
8881
8982
90- /* Report process's stack consumption to stderr */
91- static void
92- report_stack_size (void )
93- {
94- #if defined(__hpux )
95- /* HPUX: examine process's memory map with pstat_getprocvm() */
96- int targetpid = getpid ();
97- int ndx ;
98-
99- for (ndx = 0 ;; ndx ++ )
100- {
101- struct pst_vm_status buf ;
102- const char * pagetype ;
103- int res ;
104-
105- res = pstat_getprocvm (& buf , sizeof (buf ), targetpid , ndx );
106- if (res < 0 )
107- {
108- perror ("getprocvm" );
109- break ;
110- }
111- if (res != 1 )
112- break ;
113- switch (buf .pst_type )
114- {
115- case PS_STACK :
116- pagetype = "STACK" ;
117- break ;
118- #ifdef PS_RSESTACK
119- case PS_RSESTACK :
120- pagetype = "REGSTACK" ;
121- break ;
122- #endif
123- default :
124- continue ;
125- }
126- fprintf (stderr , "%d: stack addr 0x%lx, length %ld, physical pages %ld, type %s\n" ,
127- targetpid ,
128- buf .pst_vaddr ,
129- buf .pst_length ,
130- buf .pst_phys_pages ,
131- pagetype );
132- }
133- #else /* non HPUX */
134- /* Otherwise: try to use pmap. No error if that doesn't work. */
135- char sysbuf [128 ];
136-
137- snprintf (sysbuf , sizeof (sysbuf ), "pmap -x %d | grep -i stack 1>&2" ,
138- (int ) getpid ());
139- (void ) system (sysbuf );
140- #endif
141-
142- #if defined(__ia64__ ) || defined(__ia64 )
143- fprintf (stderr , "max measured stack depths %ldkB, %ldkB\n" ,
144- (max_measured_stack_depth + 1023 ) / 1024 ,
145- (max_measured_register_stack_depth + 1023 ) / 1024 );
146- #else
147- fprintf (stderr , "max measured stack depth %ldkB\n" ,
148- (max_measured_stack_depth + 1023 ) / 1024 );
149- #endif
150- }
151-
152-
15383/* ----------------------------------------------------------------
15484 * proc_exit
15585 *
@@ -171,9 +101,6 @@ proc_exit(int code)
171101 /* Clean up everything that must be cleaned up */
172102 proc_exit_prepare (code );
173103
174- /* report stack size to stderr */
175- report_stack_size ();
176-
177104#ifdef PROFILE_PID_DIR
178105 {
179106 /*
0 commit comments