From owner-freebsd-current@FreeBSD.ORG Tue Oct 18 00:16:09 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 2EEAF106566B for ; Tue, 18 Oct 2011 00:16:09 +0000 (UTC) (envelope-from lacombar@gmail.com) Received: from mail-ww0-f42.google.com (mail-ww0-f42.google.com [74.125.82.42]) by mx1.freebsd.org (Postfix) with ESMTP id BE24A8FC08 for ; Tue, 18 Oct 2011 00:16:08 +0000 (UTC) Received: by wwn22 with SMTP id 22so4227561wwn.1 for ; Mon, 17 Oct 2011 17:16:07 -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=z+EGE9z1T9ySmDV2JR6g+/TzchFUXyM92a5z5d0RLfU=; b=DQPkUaccIZwVFImM3wlXrfSY7otl2AXdDATlewhZrii+t74d+qPZuNrXEBN7u7C9oA MWYCdCGYsthaa9QDjDITlnBkGBR1C8k/ZLpyTVkoYVhWgf/8SCaLgG4gadbzpNsWC/PV GC0eNOMPZ6KJJAH1vzJULi7eYTxW5Wur4xBzg= MIME-Version: 1.0 Received: by 10.227.134.18 with SMTP id h18mr21423wbt.49.1318896967590; Mon, 17 Oct 2011 17:16:07 -0700 (PDT) Received: by 10.180.103.198 with HTTP; Mon, 17 Oct 2011 17:16:07 -0700 (PDT) In-Reply-To: <20111017221933.GZ91943@hoeg.nl> References: <1318884099-6005-1-git-send-email-lacombar@gmail.com> <20111017221933.GZ91943@hoeg.nl> Date: Mon, 17 Oct 2011 20:16:07 -0400 Message-ID: From: Arnaud Lacombe To: Ed Schouten Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: 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:16:09 -0000 Hi, On Mon, Oct 17, 2011 at 6:19 PM, Ed Schouten wrote: > Hi Arnaud! > > * Arnaud Lacombe , 20111017 22:41: >> + =A0 =A0 =A0 =A0 =A0 =A0 buf[0] =3D '\0'; >> + =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); > > What's the use of buf[0] =3D '\0'? snprintf() will overwrite it anyway, > right? leftover from previous debug I guess; fixed. > Also. please use %jd and cast ts.tv_sec to intmax_t. The size of > time_t and size_t are independent. fixed. > As far as I know, you should be able > to use a 64-bit time_t on i386 by simply changing the typedef and > recompiling everything. > As long as you do not care about breaking the ABI, yes. But yet, the kernel and the userland may not need to each have the same representation of what `time_t' is, as long as they agree on the interface. >> + =A0 =A0 =A0 =A0 =A0 =A0 bufp =3D buf; >> + =A0 =A0 =A0 =A0 =A0 =A0 while (*bufp !=3D '\0') { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 __msgbuf_do_addchar(mbp, seq, = *bufp); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bufp++; >> + =A0 =A0 =A0 =A0 =A0 =A0 } > > It would be nicer to write this as follows: > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for (bufp =3D buf; *bufp !=3D '\0'; bufp++= ) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0__msgbuf_do_addchar(mbp, s= eq, *bufp); > fixed. >> - =A0 =A0 int =A0 =A0 =A0 =A0msg_needsnl; =A0 =A0 =A0 =A0 /* set when ne= wline needed */ >> + =A0 =A0 uint32_t =A0 msg_flags; > > Why change this to uint32_t instead of leaving it the way it is (or > changing it to unsigned int)? Even though they are likely to be equal in > size, there is no reason why msg_flags must be 32 bits. :-) > made it `unsigned int'; I don't like playing with signed bit-field. - Arnaud > -- > =A0Ed Schouten > =A0WWW: http://80386.nl/ >