src/backend/utils/init/miscinit.c
/*
 * TouchSocketLockFiles -- mark socket lock files as recently accessed
 *
 * This routine should be called every so often to ensure that the socket
 * lock files have a recent mod or access date.  That saves them
 * from being removed by overenthusiastic /tmp-directory-cleaner daemons.
 * (Another reason we should never have put the socket file in /tmp...)
 */
- mark socket lock files as recently accessed
This routine should be called every so often to ensure that the socket
lock files have a recent mod or access date.  That saves them
from being removed by overenthusiastic /tmp-directory-cleaner daemons.
(Another reason we should never have put the socket file in /tmp...)
- mark socket lock files as recently accessed This routine should be called every so often to ensure that the socket lock files have a recent mod or access date . That saves them from being removed by overenthusiastic / tmp - directory - cleaner daemons . ( Another reason we should never have put the socket file in / tmp ... )
void
TouchSocketLockFiles(void)
{
	ListCell   *l;
	foreach(l, lock_files)
	{
		char	   *socketLockFile = (char *) lfirst(l);
		if (strcmp(socketLockFile, DIRECTORY_LOCK_FILE) == 0)
			continue;
#ifdef HAVE_UTIME
		utime(socketLockFile, NULL);
#else							
#ifdef HAVE_UTIMES
		utimes(socketLockFile, NULL);
#else							
		int			fd;
		char		buffer[1];
		fd = open(socketLockFile, O_RDONLY | PG_BINARY, 0);
		if (fd >= 0)
		{
			read(fd, buffer, sizeof(buffer));
			close(fd);
		}
#endif   
#endif   
	}
}
void TouchSocketLockFiles ( void ) { ListCell * l ; foreach ( l , lock_files ) { char * socketLockFile = ( char * ) lfirst ( l ) ; if ( strcmp ( socketLockFile , DIRECTORY_LOCK_FILE ) == 0 ) continue ; #ifdef HAVE_UTIME utime ( socketLockFile , NULL ) ; #else #ifdef HAVE_UTIMES utimes ( socketLockFile , NULL ) ; #else int fd ; char buffer [ 1 ] ; fd = open ( socketLockFile , O_RDONLY | PG_BINARY , 0 ) ; if ( fd >= 0 ) { read ( fd , buffer , sizeof ( buffer ) ) ; close ( fd ) ; } #endif #endif } }
TouchSocketLockFiles -- mark socket lock files as recently accessed
 This routine should be called every so often to ensure that the socket
 lock files have a recent mod or access date.
TouchSocketLockFiles -- mark socket lock files as recently accessed This routine should be called every so often to ensure that the socket lock files have a recent mod or access date .
/* No need to touch the data directory lock file, we trust */ /*
		 * utime() is POSIX standard, utimes() is a common alternative; if we
		 * have neither, fall back to actually reading the file (which only
		 * sets the access time not mod time, but that should be enough in
		 * most cases).  In all paths, we ignore errors.
		 */ /* !HAVE_UTIME */ /* !HAVE_UTIMES */ /* HAVE_UTIMES */ /* HAVE_UTIME */