Re: Reopen logfile on SIGHUP

Alexander Kuzmenkov <a.kuzmenkov@postgrespro.ru>

From: Alexander Kuzmenkov <a.kuzmenkov@postgrespro.ru>
To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: sk@zsrv.org, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, andres@anarazel.de, stark@mit.edu, a.lubennikova@postgrespro.ru, pgsql-hackers@postgresql.org, g.smolkin@postgrespro.ru
Date: 2018-08-10T12:33:26Z
Lists: pgsql-hackers
On 08/09/2018 10:33 AM, Kyotaro HORIGUCHI wrote:
>
> - Since I'm not sure unlink is signal-handler safe on all
>    supported platforms, I moved unlink() call out of
>    checkLogrotateSignal() to SysLoggerMain, just before rotating
>    log file.

Which platforms specifically do you have in mind? unlink() is required 
to be async-signal-safe by POSIX.1-2001, which is required by UNIX 03, 
and these are rather old.
For UNIX 03-certified distributions, see this list: 
http://www.opengroup.org/csq/search/t=XY1.html
For FreeBSD, unlink() was signal-safe at least in 4.0, which was 
released in 2000 
https://www.freebsd.org/cgi/man.cgi?query=sigaction&apropos=0&sektion=0&manpath=FreeBSD+4.0-RELEASE&arch=default&format=html
Debian 4.0, which was released in 2007 and had a 2.6 kernel, also claims 
to have a signal-safe unlink(): 
https://www.freebsd.org/cgi/man.cgi?query=signal&apropos=0&sektion=0&manpath=Debian+4.0.9&arch=default&format=html

-- 
Alexander Kuzmenkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



Commits

  1. Implement "pg_ctl logrotate" command