Re: [HACKERS] postmaster.pid

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] postmaster.pid
Date: 1999-12-03 08:06:56
Message-ID: 199912030806.DAA07950@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > > I have committed changes to postmaster.c. Now it creates a file called
> > > "postmaster.pid" under $PGDATA, which holds postmaster's process
> > > id. If the file has already existed, postmaster won't start. So we
> > > cannot start more than on postmaster with same $PGDATA any more. I
> > > believe it's a good thing. The file will be deleted upon postmaster
> > > shutting down.
> >
> > I assume you do a kill(0) on the pid if the file exists on startup to
> > check to see if the pid is still valid?
>
> A little bit different.
>
> 1) if the port is already in use, postmaster exits (same as before)

OK

> 2) if it fails to create pid file, call
> ExitPostmaster(1). ExitPostmaster calls proc_exit() and proc_exit
> calls exit().

So you don't start if the pid file is there, or do you delete it if the
port is free?

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 1999-12-03 08:17:01 Re: [HACKERS] postmaster.pid
Previous Message Bruce Momjian 1999-12-03 07:56:27 Re: [SQL] the book and sql92