From 2b254c814b139f93997f61525d77b934596c53a3 Mon Sep 17 00:00:00 2001 From: Björn Jacke Date: Thu, 16 Sep 2010 21:36:37 +0200 Subject: s3/s4: merge msleep and smb_msleep the merged variant is renamed to smb_msleep as some platforms already have a msleep function. --- source4/torture/basic/base.c | 4 +- source4/torture/basic/delaywrite.c | 132 ++++++++++++++++++------------------- source4/torture/basic/delete.c | 2 +- source4/torture/basic/disconnect.c | 2 +- 4 files changed, 70 insertions(+), 70 deletions(-) (limited to 'source4/torture/basic') diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index c9148d1915..7b96e1c093 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -680,13 +680,13 @@ static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli torture_comment(tctx, "pid %u open %d\n", (unsigned)getpid(), i); - msleep(10 * msec); + smb_msleep(10 * msec); i++; if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) { torture_comment(tctx,"Failed to close %s, error=%s\n", fname, smbcli_errstr(cli->tree)); return false; } - msleep(2 * msec); + smb_msleep(2 * msec); } if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) { diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index 0c43c29cad..f82b32fe8d 100644 --- a/source4/torture/basic/delaywrite.c +++ b/source4/torture/basic/delaywrite.c @@ -111,7 +111,7 @@ static bool test_delayed_write_update(struct torture_context *tctx, struct smbcl break; } fflush(stdout); - msleep(1 * msec); + smb_msleep(1 * msec); } if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) { @@ -162,7 +162,7 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc /* 3 second delay to ensure we get past any 2 second time granularity (older systems may have that) */ - msleep(3 * msec); + smb_msleep(3 * msec); finfo1.all_info.level = RAW_FILEINFO_ALL_INFO; finfo1.all_info.in.file.fnum = fnum1; @@ -180,7 +180,7 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc /* 3 second delay to ensure we get past any 2 second time granularity (older systems may have that) */ - msleep(3 * msec); + smb_msleep(3 * msec); /* Do a zero length SMBwrite call to truncate. */ written = smbcli_smbwrite(cli->tree, fnum1, "x", 1024, 0); @@ -231,7 +231,7 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc break; } fflush(stdout); - msleep(1 * msec); + smb_msleep(1 * msec); } if (finfo1.all_info.out.write_time == finfo2.all_info.out.write_time) { @@ -241,7 +241,7 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc } fflush(stdout); - msleep(2 * msec); + smb_msleep(2 * msec); /* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */ written = smbcli_smbwrite(cli->tree, fnum1, "x", 0, 1); @@ -282,7 +282,7 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc break; } fflush(stdout); - msleep(1 * msec); + smb_msleep(1 * msec); } if (finfo2.all_info.out.write_time != finfo3.all_info.out.write_time) { @@ -292,7 +292,7 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc } fflush(stdout); - msleep(2 * msec); + smb_msleep(2 * msec); /* the close should trigger an write time update */ smbcli_close(cli->tree, fnum1); @@ -353,7 +353,7 @@ static bool test_delayed_write_update1a(struct torture_context *tctx, struct smb /* 3 second delay to ensure we get past any 2 second time granularity (older systems may have that) */ - msleep(3 * msec); + smb_msleep(3 * msec); finfo1.all_info.level = RAW_FILEINFO_ALL_INFO; finfo1.all_info.in.file.fnum = fnum1; @@ -418,7 +418,7 @@ static bool test_delayed_write_update1a(struct torture_context *tctx, struct smb break; } fflush(stdout); - msleep(1 * msec); + smb_msleep(1 * msec); } if (finfo1.all_info.out.write_time == finfo2.all_info.out.write_time) { @@ -428,7 +428,7 @@ static bool test_delayed_write_update1a(struct torture_context *tctx, struct smb } fflush(stdout); - msleep(2 * msec); + smb_msleep(2 * msec); /* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */ written = smbcli_smbwrite(cli->tree, fnum1, "x", 0, 1); @@ -467,7 +467,7 @@ static bool test_delayed_write_update1a(struct torture_context *tctx, struct smb break; } fflush(stdout); - msleep(1 * msec); + smb_msleep(1 * msec); } if (finfo2.all_info.out.write_time != finfo3.all_info.out.write_time) { @@ -535,7 +535,7 @@ static bool test_delayed_write_update1b(struct torture_context *tctx, struct smb /* 3 second delay to ensure we get past any 2 second time granularity (older systems may have that) */ - msleep(3 * msec); + smb_msleep(3 * msec); finfo1.all_info.level = RAW_FILEINFO_ALL_INFO; finfo1.all_info.in.file.fnum = fnum1; @@ -596,7 +596,7 @@ static bool test_delayed_write_update1b(struct torture_context *tctx, struct smb break; } fflush(stdout); - msleep(1 * msec); + smb_msleep(1 * msec); } if (finfo1.all_info.out.write_time == finfo2.all_info.out.write_time) { @@ -606,7 +606,7 @@ static bool test_delayed_write_update1b(struct torture_context *tctx, struct smb } fflush(stdout); - msleep(2 * msec); + smb_msleep(2 * msec); /* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */ written = smbcli_smbwrite(cli->tree, fnum1, "x", 0, 1); @@ -644,7 +644,7 @@ static bool test_delayed_write_update1b(struct torture_context *tctx, struct smb break; } fflush(stdout); - msleep(1 * msec); + smb_msleep(1 * msec); } if (finfo2.all_info.out.write_time != finfo3.all_info.out.write_time) { @@ -710,7 +710,7 @@ static bool test_delayed_write_update1c(struct torture_context *tctx, struct smb /* 3 second delay to ensure we get past any 2 second time granularity (older systems may have that) */ - msleep(3 * msec); + smb_msleep(3 * msec); finfo1.all_info.level = RAW_FILEINFO_ALL_INFO; finfo1.all_info.in.file.fnum = fnum1; @@ -776,7 +776,7 @@ static bool test_delayed_write_update1c(struct torture_context *tctx, struct smb break; } fflush(stdout); - msleep(1 * msec); + smb_msleep(1 * msec); } if (finfo1.all_info.out.write_time == finfo2.all_info.out.write_time) { @@ -786,7 +786,7 @@ static bool test_delayed_write_update1c(struct torture_context *tctx, struct smb } fflush(stdout); - msleep(2 * msec); + smb_msleep(2 * msec); /* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */ written = smbcli_smbwrite(cli->tree, fnum1, "x", 0, 1); @@ -822,7 +822,7 @@ static bool test_delayed_write_update1c(struct torture_context *tctx, struct smb break; } fflush(stdout); - msleep(1 * msec); + smb_msleep(1 * msec); } if (finfo2.all_info.out.write_time != finfo3.all_info.out.write_time) { @@ -900,7 +900,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc /* 3 second delay to ensure we get past any 2 second time granularity (older systems may have that) */ - msleep(3 * msec); + smb_msleep(3 * msec); { /* Try using setfileinfo instead of write to update write time. */ @@ -1007,7 +1007,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc break; } fflush(stdout); - msleep(1 * msec); + smb_msleep(1 * msec); } if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) { @@ -1015,7 +1015,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc } fflush(stdout); - msleep(2 * msec); + smb_msleep(2 * msec); fnum2 = smbcli_open(cli->tree, fname, O_RDWR, DENY_NONE); if (fnum2 == -1) { @@ -1099,7 +1099,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc break; } fflush(stdout); - msleep(1 * msec); + smb_msleep(1 * msec); } if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) { @@ -1131,7 +1131,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc torture_comment(tctx, "Second open initial write time %s\n", nt_time_string(tctx, finfo1.basic_info.out.write_time)); - msleep(10 * msec); + smb_msleep(10 * msec); torture_comment(tctx, "Doing a 10 byte write to extend the file to see if this changes the last write time.\n"); written = smbcli_write(cli->tree, fnum1, 0, "0123456789", 31, 10); @@ -1187,7 +1187,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc break; } fflush(stdout); - msleep(1*msec); + smb_msleep(1*msec); } if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) { @@ -1258,7 +1258,7 @@ static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_s goto done; } - msleep(1 * msec); + smb_msleep(1 * msec); written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1); @@ -1573,7 +1573,7 @@ static bool test_delayed_write_update3(struct torture_context *tctx, diff, sec); break; } - msleep(0.5 * msec); + smb_msleep(0.5 * msec); } GET_INFO_BOTH(finfo1,pinfo1); @@ -1602,7 +1602,7 @@ static bool test_delayed_write_update3(struct torture_context *tctx, ret = false; break; } - msleep(1 * msec); + smb_msleep(1 * msec); } GET_INFO_BOTH(finfo2,pinfo2); @@ -1612,7 +1612,7 @@ static bool test_delayed_write_update3(struct torture_context *tctx, } /* sleep */ - msleep(5 * msec); + smb_msleep(5 * msec); GET_INFO_BOTH(finfo3,pinfo3); COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2); @@ -1699,7 +1699,7 @@ static bool test_delayed_write_update3a(struct torture_context *tctx, * sleep some time, to demonstrate the handling of write times * doesn't depend on the time since the open */ - msleep(5 * msec); + smb_msleep(5 * msec); /* get the initial times */ GET_INFO_BOTH(finfo1,pinfo1); @@ -1739,20 +1739,20 @@ static bool test_delayed_write_update3a(struct torture_context *tctx, diff, sec); break; } - msleep(0.5 * msec); + smb_msleep(0.5 * msec); } GET_INFO_BOTH(finfo1,pinfo1); COMPARE_WRITE_TIME_GREATER(pinfo1, pinfo0); - msleep(3 * msec); + smb_msleep(3 * msec); /* * demonstrate that a truncate write always * updates the write time immediately */ for (i=0; i < 3; i++) { - msleep(2 * msec); + smb_msleep(2 * msec); /* do a write */ torture_comment(tctx, "Do a truncate SMBwrite [%d] on the file handle\n", i); written = smbcli_smbwrite(cli->tree, fnum1, "x", 10240, 0); @@ -1767,7 +1767,7 @@ static bool test_delayed_write_update3a(struct torture_context *tctx, finfo1 = finfo2; } - msleep(3 * msec); + smb_msleep(3 * msec); /* sure any further write doesn't update the write time */ start = timeval_current(); @@ -1792,7 +1792,7 @@ static bool test_delayed_write_update3a(struct torture_context *tctx, ret = false; break; } - msleep(1 * msec); + smb_msleep(1 * msec); } GET_INFO_BOTH(finfo2,pinfo2); @@ -1802,7 +1802,7 @@ static bool test_delayed_write_update3a(struct torture_context *tctx, } /* sleep */ - msleep(3 * msec); + smb_msleep(3 * msec); /* get the initial times */ GET_INFO_BOTH(finfo1,pinfo1); @@ -1813,7 +1813,7 @@ static bool test_delayed_write_update3a(struct torture_context *tctx, * updates the write time immediately */ for (i=0; i < 3; i++) { - msleep(2 * msec); + smb_msleep(2 * msec); /* do a write */ torture_comment(tctx, "Do a truncate SMBwrite [%d] on the file handle\n", i); written = smbcli_smbwrite(cli->tree, fnum1, "x", 512, 0); @@ -1829,7 +1829,7 @@ static bool test_delayed_write_update3a(struct torture_context *tctx, } /* sleep */ - msleep(3 * msec); + smb_msleep(3 * msec); GET_INFO_BOTH(finfo3,pinfo3); COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2); @@ -1914,7 +1914,7 @@ static bool test_delayed_write_update3b(struct torture_context *tctx, * sleep some time, to demonstrate the handling of write times * doesn't depend on the time since the open */ - msleep(5 * msec); + smb_msleep(5 * msec); /* get the initial times */ GET_INFO_BOTH(finfo1,pinfo1); @@ -1954,7 +1954,7 @@ static bool test_delayed_write_update3b(struct torture_context *tctx, diff, sec); break; } - msleep(0.5 * msec); + smb_msleep(0.5 * msec); } GET_INFO_BOTH(finfo1,pinfo1); @@ -1983,7 +1983,7 @@ static bool test_delayed_write_update3b(struct torture_context *tctx, ret = false; break; } - msleep(1 * msec); + smb_msleep(1 * msec); } GET_INFO_BOTH(finfo2,pinfo2); @@ -1993,7 +1993,7 @@ static bool test_delayed_write_update3b(struct torture_context *tctx, } /* sleep */ - msleep(5 * msec); + smb_msleep(5 * msec); GET_INFO_BOTH(finfo3,pinfo3); COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2); @@ -2082,7 +2082,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx, * sleep some time, to demonstrate the handling of write times * doesn't depend on the time since the open */ - msleep(5 * msec); + smb_msleep(5 * msec); /* get the initial times */ GET_INFO_BOTH(finfo1,pinfo1); @@ -2093,7 +2093,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx, * updates the write time immediately */ for (i=0; i < 3; i++) { - msleep(2 * msec); + smb_msleep(2 * msec); /* do a write */ torture_comment(tctx, "Do a truncate SMBwrite [%d] on the file handle\n", i); written = smbcli_smbwrite(cli->tree, fnum1, "x", 512, 0); @@ -2130,7 +2130,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx, ret = false; break; } - msleep(1 * msec); + smb_msleep(1 * msec); } GET_INFO_BOTH(finfo2,pinfo2); @@ -2140,7 +2140,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx, } /* sleep */ - msleep(5 * msec); + smb_msleep(5 * msec); /* get the initial times */ GET_INFO_BOTH(finfo1,pinfo1); @@ -2151,7 +2151,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx, * updates the write time immediately */ for (i=0; i < 3; i++) { - msleep(2 * msec); + smb_msleep(2 * msec); /* do a write */ torture_comment(tctx, "Do a truncate write [%d] on the file handle\n", i); written = smbcli_smbwrite(cli->tree, fnum1, "x", 512, 0); @@ -2167,7 +2167,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx, } /* sleep */ - msleep(5 * msec); + smb_msleep(5 * msec); GET_INFO_BOTH(finfo2,pinfo2); COMPARE_WRITE_TIME_EQUAL(finfo2, finfo1); @@ -2195,7 +2195,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx, ret = false; break; } - msleep(1 * msec); + smb_msleep(1 * msec); } GET_INFO_BOTH(finfo2,pinfo2); @@ -2205,7 +2205,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx, } /* sleep */ - msleep(5 * msec); + smb_msleep(5 * msec); GET_INFO_BOTH(finfo3,pinfo3); COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2); @@ -2289,7 +2289,7 @@ static bool test_delayed_write_update4(struct torture_context *tctx, GET_INFO_BOTH(finfo0,pinfo0); /* sleep a bit */ - msleep(5 * msec); + smb_msleep(5 * msec); /* do a write */ torture_comment(tctx, "Do a write on the file handle\n"); @@ -2329,7 +2329,7 @@ static bool test_delayed_write_update4(struct torture_context *tctx, diff, sec); break; } - msleep(0.5 * msec); + smb_msleep(0.5 * msec); } GET_INFO_BOTH(finfo1,pinfo1); @@ -2358,7 +2358,7 @@ static bool test_delayed_write_update4(struct torture_context *tctx, ret = false; break; } - msleep(1 * msec); + smb_msleep(1 * msec); } GET_INFO_BOTH(finfo2,pinfo2); @@ -2368,7 +2368,7 @@ static bool test_delayed_write_update4(struct torture_context *tctx, } /* sleep */ - msleep(5 * msec); + smb_msleep(5 * msec); GET_INFO_BOTH(finfo3,pinfo3); COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2); @@ -2489,7 +2489,7 @@ static bool test_delayed_write_update5(struct torture_context *tctx, ret = false; break; } - msleep(1 * msec); + smb_msleep(1 * msec); } GET_INFO_BOTH(finfo3,pinfo3); @@ -2521,7 +2521,7 @@ static bool test_delayed_write_update5(struct torture_context *tctx, ret = false; break; } - msleep(1 * msec); + smb_msleep(1 * msec); } GET_INFO_BOTH(finfo4,pinfo4); @@ -2531,7 +2531,7 @@ static bool test_delayed_write_update5(struct torture_context *tctx, } /* sleep */ - msleep(5 * msec); + smb_msleep(5 * msec); GET_INFO_BOTH(finfo5,pinfo5); COMPARE_WRITE_TIME_EQUAL(finfo5, finfo4); @@ -2651,7 +2651,7 @@ static bool test_delayed_write_update5b(struct torture_context *tctx, ret = false; break; } - msleep(1 * msec); + smb_msleep(1 * msec); } GET_INFO_BOTH(finfo3,pinfo3); @@ -2683,7 +2683,7 @@ static bool test_delayed_write_update5b(struct torture_context *tctx, ret = false; break; } - msleep(1 * msec); + smb_msleep(1 * msec); } GET_INFO_BOTH(finfo4,pinfo4); @@ -2693,7 +2693,7 @@ static bool test_delayed_write_update5b(struct torture_context *tctx, } /* sleep */ - msleep(5 * msec); + smb_msleep(5 * msec); GET_INFO_BOTH(finfo5,pinfo5); COMPARE_WRITE_TIME_EQUAL(finfo5, finfo4); @@ -2830,7 +2830,7 @@ again: ret = false; break; } - msleep(1 * msec); + smb_msleep(1 * msec); } GET_INFO_BOTH(finfo3,pinfo3); @@ -2862,7 +2862,7 @@ again: ret = false; break; } - msleep(1 * msec); + smb_msleep(1 * msec); } GET_INFO_BOTH(finfo4,pinfo4); @@ -2872,7 +2872,7 @@ again: } /* sleep */ - msleep(5 * msec); + smb_msleep(5 * msec); GET_INFO_BOTH(finfo5,pinfo5); COMPARE_WRITE_TIME_EQUAL(finfo5, finfo4); @@ -2898,7 +2898,7 @@ again: COMPARE_WRITE_TIME_EQUAL(finfo5, pinfo6); /* See if we have lost the sticky write time on handle2 */ - msleep(3 * msec); + smb_msleep(3 * msec); torture_comment(tctx, "Have we lost the sticky write time ?\n"); /* Make sure any further normal write doesn't update the write time */ @@ -2925,7 +2925,7 @@ again: ret = false; break; } - msleep(1 * msec); + smb_msleep(1 * msec); } /* What about a truncate write ? */ @@ -2952,7 +2952,7 @@ again: ret = false; break; } - msleep(1 * msec); + smb_msleep(1 * msec); } diff --git a/source4/torture/basic/delete.c b/source4/torture/basic/delete.c index 22d92193b9..2b26b1e64a 100644 --- a/source4/torture/basic/delete.c +++ b/source4/torture/basic/delete.c @@ -1422,7 +1422,7 @@ static bool deltest21(struct torture_context *tctx) /* On slow build farm machines it might happen that they are not fast * enogh to delete the file for this test */ - msleep(200); + smb_msleep(200); /* File should not be there. */ fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, diff --git a/source4/torture/basic/disconnect.c b/source4/torture/basic/disconnect.c index 7f071178f4..2cfa72048e 100644 --- a/source4/torture/basic/disconnect.c +++ b/source4/torture/basic/disconnect.c @@ -162,7 +162,7 @@ bool torture_disconnect(struct torture_context *torture) * new process comes in. Try to get rid of the random * failures in the build farm. */ - msleep(200); + smb_msleep(200); } } -- cgit