From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Luis R. Rodriguez" Subject: Re: [PATCH v7 2/8] cxenstored: add support for systemd active sockets Date: Mon, 28 Jul 2014 17:06:43 +0200 Message-ID: <20140728150643.GC21930@wotan.suse.de> References: <1405639699-13494-1-git-send-email-mcgrof@do-not-panic.com> <1405639699-13494-3-git-send-email-mcgrof@do-not-panic.com> <1406214613.25535.0.camel@kazak.uk.xensource.com> <20140725224519.GC4191@wotan.suse.de> <1406540892.24842.101.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XBmVh-0001Ii-7M for xen-devel@lists.xenproject.org; Mon, 28 Jul 2014 15:06:45 +0000 Content-Disposition: inline In-Reply-To: <1406540892.24842.101.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: xen-devel@lists.xenproject.org, "Luis R. Rodriguez" List-Id: xen-devel@lists.xenproject.org On Mon, Jul 28, 2014 at 10:48:12AM +0100, Ian Campbell wrote: > On Sat, 2014-07-26 at 00:45 +0200, Luis R. Rodriguez wrote: > > > > + n = sd_listen_fds(0); > > > > + if (n <= 0) { > > > > + sd_notifyf(0, "STATUS=Failed to get any active sockets: %s\n" > > > > + "ERRNO=%i", > > > > + strerror(errno), > > > > + errno); > > > > + barf_perror("sd_listen_fds() failed\n"); > > > > + } else if (n > 2) { > > > > + fprintf(stderr, SD_ERR "Expected 2 fds but given %d\n", n); > > > > + sd_notifyf(0, "STATUS=Mismatch on number (2): %s\n" > > > > + "ERRNO=%d", > > > > > > You've used %u everywhere else... > > > > Sorry this was not clear, I don't see usage of %u in my patches. > > Sorry, looks like I meant %i not %u. %i and %d are equivalent, so I > suppose it's just a code consistency nit. OK. > > > Perhaps you wanted to send n in the STATUS? > > > > There's an fprintf(stderr) right above above that provides the n variables, > > when you use fprintf(stderr) that goes the systemd journal as well. > > Hrm, so either the sd_notify or the fprintf is a bit redundant then? fprintf() is just easier for separate calls you can call one sd_notify() with the status though so I printed earlier segments with fpritnf(). Luis