*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.267 2002/02/23 01:31:35 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.268 2002/03/02 20:46:12 tgl Exp $
*
* NOTES
*
{
int i;
pid_t pid;
+#ifdef LINUX_PROFILE
+ struct itimerval prof_itimer;
+#endif
+
+#ifdef LINUX_PROFILE
+ /* see comments in BackendStartup */
+ getitimer(ITIMER_PROF, &prof_itimer);
+#endif
pid = fork();
if (pid == (pid_t) -1)
_exit(0);
}
+#ifdef LINUX_PROFILE
+ setitimer(ITIMER_PROF, &prof_itimer, NULL);
+#endif
+
MyProcPid = getpid(); /* reset MyProcPid to child */
/* GH: If there's no setsid(), we hopefully don't need silent mode.
/*
* BackendStartup -- start backend process
*
- * returns: STATUS_ERROR if the fork/exec failed, STATUS_OK otherwise.
+ * returns: STATUS_ERROR if the fork failed, STATUS_OK otherwise.
*/
static int
BackendStartup(Port *port)
{
Backend *bn; /* for backend cleanup */
pid_t pid;
+#ifdef LINUX_PROFILE
+ struct itimerval prof_itimer;
+#endif
/*
* Compute the cancel key that will be assigned to this backend. The
fflush(stdout);
fflush(stderr);
+#ifdef LINUX_PROFILE
+ /*
+ * Linux's fork() resets the profiling timer in the child process.
+ * If we want to profile child processes then we need to save and restore
+ * the timer setting. This is a waste of time if not profiling, however,
+ * so only do it if commanded by specific -DLINUX_PROFILE switch.
+ */
+ getitimer(ITIMER_PROF, &prof_itimer);
+#endif
+
#ifdef __BEOS__
/* Specific beos actions before backend startup */
beos_before_backend_startup();
{
int status;
+#ifdef LINUX_PROFILE
+ setitimer(ITIMER_PROF, &prof_itimer, NULL);
+#endif
+
#ifdef __BEOS__
/* Specific beos backend startup actions */
beos_backend_startup();
{
pid_t pid;
Backend *bn;
+#ifdef LINUX_PROFILE
+ struct itimerval prof_itimer;
+#endif
fflush(stdout);
fflush(stderr);
+#ifdef LINUX_PROFILE
+ /* see comments in BackendStartup */
+ getitimer(ITIMER_PROF, &prof_itimer);
+#endif
+
#ifdef __BEOS__
/* Specific beos actions before backend startup */
beos_before_backend_startup();
char dbbuf[ARGV_SIZE];
char xlbuf[ARGV_SIZE];
+#ifdef LINUX_PROFILE
+ setitimer(ITIMER_PROF, &prof_itimer, NULL);
+#endif
+
#ifdef __BEOS__
/* Specific beos actions after backend startup */
beos_backend_startup();
*/
if (xlop == BS_XLOG_CHECKPOINT)
{
- if (!(bn = (Backend *) calloc(1, sizeof(Backend))))
+ if (!(bn = (Backend *) malloc(sizeof(Backend))))
{
elog(DEBUG, "CheckPointDataBase: malloc failed");
ExitPostmaster(1);