From owner-freebsd-current@FreeBSD.ORG Tue Oct 18 00:24:43 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDC0E106566B for ; Tue, 18 Oct 2011 00:24:43 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8C7D08FC0C for ; Tue, 18 Oct 2011 00:24:43 +0000 (UTC) Received: by yxn16 with SMTP id 16so26235yxn.13 for ; Mon, 17 Oct 2011 17:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=wYSRivWON7Xn/KFUrnpS1/kKqOeoyDT81/nMndRZMck=; b=wsmWnerEQR8mk1Iwaf8n12P4V5JGy+8v6g0wGhbnedYB133/dckP/92Q+PJV9AbMxx AiM83dG7ToYX4VeTjF+Q/LEm37SVya3p090aP6gehjY0IQv5geiwvLYD/Trkgjn5XTRZ ZqBAkuCVIGEK1smQZpxeGC3CX/I3O2kvcF5p4= MIME-Version: 1.0 Received: by 10.182.7.10 with SMTP id f10mr5861oba.56.1318897482775; Mon, 17 Oct 2011 17:24:42 -0700 (PDT) Received: by 10.182.122.33 with HTTP; Mon, 17 Oct 2011 17:24:42 -0700 (PDT) In-Reply-To: References: <1318884099-6005-1-git-send-email-lacombar@gmail.com> <20111017221933.GZ91943@hoeg.nl> <20111017222259.GA91943@hoeg.nl> Date: Mon, 17 Oct 2011 17:24:42 -0700 Message-ID: From: Garrett Cooper To: Arnaud Lacombe Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Ed Schouten , FreeBSD Current Subject: Re: [PATCH] Prepend timestamp in msgbuf 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, 18 Oct 2011 00:24:43 -0000 On Mon, Oct 17, 2011 at 5:18 PM, Arnaud Lacombe wrote: > Hi, > > On Mon, Oct 17, 2011 at 6:22 PM, Ed Schouten wrote: >> Ah, missed something. >> >>> + =A0 =A0 =A0 =A0 =A0 =A0 getnanouptime(&ts); >>> + =A0 =A0 =A0 =A0 =A0 =A0 err =3D snprintf(buf, sizeof buf, "[%zd.%.6ld= ] ", >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ts.tv_sec, ts.tv_nsec / 1000); >> >> It seems we also have a getmicrouptime(), which returns a struct >> timeval. > fixed. > >> Also a more general question: is it actually safe to call >> getnanouptime() here? This code gets executed from an arbitrary context, >> right? >> > right, but getmicrouptime() is not doing much magic. Just reading a > cached value, do an arithmetic conversion. I do not really see any > unsafe part. Based on glancing around other areas of the kernel, I'd assume that using this KPI as-is is fine because I don't see any locking employed elsewhere... -Garrett