From owner-freebsd-current@FreeBSD.ORG Tue Dec 19 17:43:04 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B9B9016A415 for ; Tue, 19 Dec 2006 17:43:04 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.238]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C6B843C9F for ; Tue, 19 Dec 2006 17:42:59 +0000 (GMT) (envelope-from swhetzel@gmail.com) Received: by nz-out-0506.google.com with SMTP id i11so755255nzh for ; Tue, 19 Dec 2006 09:42:59 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=cITzYFfs+H32TXW35PLcvKR05bMNVJbDD/IJTXZqdS2MwrynOxqjsLwaBUUGLDnr+fnOWxTlfbW0WIx0Itpsev8cSSNpRXZIgo1SymtxCoTjyllhpZgXlOyAPiCOUdRLBXCcJpWQEJgRid0obQ8PYtfGNqWYWVxNf3TtwdLO/vQ= Received: by 10.65.122.20 with SMTP id z20mr7333404qbm.1166548505727; Tue, 19 Dec 2006 09:15:05 -0800 (PST) Received: by 10.65.61.1 with HTTP; Tue, 19 Dec 2006 09:15:05 -0800 (PST) Message-ID: <790a9fff0612190915va75678at895efa0bc93ac3a1@mail.gmail.com> Date: Tue, 19 Dec 2006 11:15:05 -0600 From: "Scot Hetzel" To: "FreeBSD Current" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: settimeofday function taking 24 - 30 minutes to complete X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Dec 2006 17:43:04 -0000 While working on implementing the settimeofday function in the linuxolator, I was using the LTP testcase settimeofday01 to test it. Running this test caused the system to hang for 24-30 minutes. I then decided to rewrite the testcase so that it would run on FreeBSD, and it also hung the system for 24-30 minutes. What the settimeofday01 test was doing is to set the time to a known value (100 sec, 100 usec) and then use gettimeofday to retrieve the current time. It then compared the returned value to check if it was within +/- 500 msec. I have since reduced the testcode down to the following testcase that is causing the hang. Any ideals as to what could be causing this hang? Scot #include #include #include #define VAL_SEC 100 #define VAL_MSEC 100 int main(int argc, char **argv) { struct timeval tp, tp1, save_tv; long return_test, errno_test; suseconds_t delta; #define TEST(SCALL) \ do { \ errno = 0; \ return_test = SCALL; \ errno_test = errno; \ } while (0) /* Save the current time values */ if ((gettimeofday(&save_tv, (struct timezone *)&tp1)) == -1) { printf("BROK: gettimeofday failed. errno=%d\n", errno); exit(1); } else { printf("INFO: Saved current time\n"); } tp.tv_sec = VAL_SEC; tp.tv_usec = VAL_MSEC; /* Hang occurs here */ TEST(settimeofday(&tp, NULL)); if (return_test == -1) { printf("FAIL: Error Setting Time, errno=%d\n", errno_test); } else { printf("INFO: settimeofday completed sucessfully\n"); } /* restore the original time values. */ if ((settimeofday(&save_tv, NULL)) == -1) { printf("WARN: FATAL COULD NOT RESET THE CLOCK\n"); printf("FAIL: Error Setting Time, errno=%d (%d, %d)\n", errno, tp.tv_sec, tp.tv_usec); } else { printf("INFO: Reset time to original value\n"); } return(0); } -- DISCLAIMER: No electrons were mamed while sending this message. Only slightly bruised.