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

Commit68b34b2

Browse files
committed
Try to fix portability bugs in recent pgbench commits.
1. pg_time_usec_t needs to be printed with INT64_FORMAT, not %ld, or 32bit systems complain, per lapwing.2. Some Windows compilers didn't like a thread function not marked with__stdcall, per whelk; let's see if this fixes the problem.
1 parent1657b37 commit68b34b2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎src/bin/pgbench/pgbench.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ typedef struct socket_set
121121
#defineTHREAD_T HANDLE
122122
#defineTHREAD_FUNC_RETURN_TYPE unsigned
123123
#defineTHREAD_FUNC_RETURN return 0
124+
#defineTHREAD_FUNC_CC __stdcall
124125
#defineTHREAD_CREATE(handle,function,arg) \
125126
((*(handle) = (HANDLE) _beginthreadex(NULL, 0, (function), (arg), 0, NULL)) == 0 ? errno : 0)
126127
#defineTHREAD_JOIN(handle) \
@@ -139,6 +140,7 @@ typedef struct socket_set
139140
#defineTHREAD_T pthread_t
140141
#defineTHREAD_FUNC_RETURN_TYPE void *
141142
#defineTHREAD_FUNC_RETURN return NULL
143+
#defineTHREAD_FUNC_CC
142144
#defineTHREAD_CREATE(handle,function,arg) \
143145
pthread_create((handle), NULL, (function), (arg))
144146
#defineTHREAD_JOIN(handle) \
@@ -153,6 +155,7 @@ typedef struct socket_set
153155
#defineTHREAD_T void *
154156
#defineTHREAD_FUNC_RETURN_TYPE void *
155157
#defineTHREAD_FUNC_RETURN return NULL
158+
#defineTHREAD_FUNC_CC
156159
#defineTHREAD_BARRIER_T int
157160
#defineTHREAD_BARRIER_INIT(barrier,n) (*(barrier) = 0)
158161
#defineTHREAD_BARRIER_WAIT(barrier)
@@ -639,7 +642,7 @@ static void doLog(TState *thread, CState *st,
639642
staticvoidprocessXactStats(TState*thread,CState*st,pg_time_usec_t*now,
640643
boolskipped,StatsData*agg);
641644
staticvoidaddScript(ParsedScriptscript);
642-
staticTHREAD_FUNC_RETURN_TYPEthreadRun(void*arg);
645+
staticTHREAD_FUNC_RETURN_TYPETHREAD_FUNC_CCthreadRun(void*arg);
643646
staticvoidfinishCon(CState*st);
644647
staticvoidsetalarm(intseconds);
645648
staticsocket_set*alloc_socket_set(intcount);
@@ -3565,10 +3568,12 @@ doLog(TState *thread, CState *st,
35653568
{
35663569
/* no, print raw transactions */
35673570
if (skipped)
3568-
fprintf(logfile,"%d "INT64_FORMAT" skipped %d %ld %ld",
3571+
fprintf(logfile,"%d "INT64_FORMAT" skipped %d "INT64_FORMAT" "
3572+
INT64_FORMAT,
35693573
st->id,st->cnt,st->use_file,now /1000000,now %1000000);
35703574
else
3571-
fprintf(logfile,"%d "INT64_FORMAT" %.0f %d %ld %ld",
3575+
fprintf(logfile,"%d "INT64_FORMAT" %.0f %d "INT64_FORMAT" "
3576+
INT64_FORMAT,
35723577
st->id,st->cnt,latency,st->use_file,
35733578
now /1000000,now %1000000);
35743579
if (throttle_delay)
@@ -6222,7 +6227,7 @@ main(int argc, char **argv)
62226227
returnexit_code;
62236228
}
62246229

6225-
staticTHREAD_FUNC_RETURN_TYPE
6230+
staticTHREAD_FUNC_RETURN_TYPETHREAD_FUNC_CC
62266231
threadRun(void*arg)
62276232
{
62286233
TState*thread= (TState*)arg;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp