Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit52a4581

Browse files
committed
XOR process PID into a backend's initial random seed, to ensure that
different backends get a reasonably wide set of initial seeds even ifgettimeofday returns tv_usec values with only a few bits of precision.Per recent discussion.
1 parentf629583 commit52a4581

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.426 2004/10/06 09:35:21 momjian Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.427 2004/10/07 00:03:15 tgl Exp $
4141
*
4242
* NOTES
4343
*
@@ -2575,8 +2575,6 @@ static int
25752575
BackendRun(Port*port)
25762576
{
25772577
intstatus;
2578-
structtimevalnow;
2579-
structtimezonetz;
25802578
charremote_host[NI_MAXHOST];
25812579
charremote_port[NI_MAXSERV];
25822580
charremote_ps_data[NI_MAXHOST];
@@ -2754,9 +2752,7 @@ BackendRun(Port *port)
27542752
* start a new random sequence in the random() library function.
27552753
*/
27562754
random_seed=0;
2757-
gettimeofday(&now,&tz);
2758-
srandom((unsignedint)now.tv_usec);
2759-
2755+
srandom((unsignedint) (MyProcPid ^port->session_start.tv_usec));
27602756

27612757
/* ----------------
27622758
* Now, build the argv vector that will be given to PostgresMain.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp