NetBSD Problem Report #509

From gnats  Sun Oct  9 07:28:43 1994
Received: from wipux2.wifo.uni-mannheim.de (wipux2.wifo.uni-mannheim.de [134.155.59.2]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id HAA14163 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Sun, 9 Oct 1994 07:28:41 -0700
Message-Id: <199410091430.PAA00511@wipux2.wifo.uni-mannheim.de>
Date: Sun, 9 Oct 1994 15:30:06 +0100
From: andrew@wipux2.wifo.uni-mannheim.de (Andrew Wheadon)
Reply-To: andrew@wipux2.wifo.uni-mannheim.de
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: lpc always says: no daemon present
X-Send-Pr-Version: 3.2

>Number:         509
>Category:       bin
>Synopsis:       flock-checking of lpd-lock file wrong ?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 09 07:35:04 +0000 1994
>Closed-Date:    Sun Jan 14 17:26:23 +0000 1996
>Last-Modified:  Sun Jan 14 17:28:49 +0000 1996
>Originator:     Andrew Wheadon
>Release:        
>Organization:
The cost of living hasn't affected it's popularity. (unknown)
current	release=doc host=wipux2.wifo.uni-mannheim.de \ "NetBSD-current mirror"
hostbase=/mit/ftp/pub/NetBSD base=/usr prefix=/usr backup delete use-rel-suffix
>Environment:

System: NetBSD wipux2 1.0_BETA NetBSD 1.0_BETA (WIPUX) #0: Sat Oct 8 14:56:21 MET 1994 toor@wipux2:/src/src/sys/arch/i386/compile/WIPUX i386


>Description:
	Whenever I used 'lpc' to check the status, it always says
	I have no daemon present. If I ps ax | grep lpd, it shows
	me that the daemon is running. The printing also functions
	fine. (I print over a remote printer).
	If you can't repeat this please tell me as it'll mean I'm
	doing something wrong.

>How-To-Repeat:
	setup printing. start "lpd", run "lpc status".

>Fix:
	I looked through src/usr.sbin/lpr/lpc/cmds.c and patched it
	like show lower down, then it works. It seems to open the
	lock file (which produces a positive value, and it seems
	to be able to flock(fd, LOCK_SH|LOCK_NB) the lock-file which
	produces a value of zero, the later being undesired by lpc
	for some login I fail to understand. Does it expect the 
	lock-file to locked-exclusivly by the daemon or something ? 

*** ../cmds.c	Wed May 18 15:11:12 1994
--- cmds.c	Sun Oct  9 15:14:35 1994
***************
*** 813,817 ****
  		printf("\t%d entries in spool area\n", i);
  	fd = open(line, O_RDONLY);
! 	if (fd < 0 || flock(fd, LOCK_SH|LOCK_NB) == 0) {
  		(void) close(fd);	/* unlocks as well */
  		printf("\tno daemon present\n");
--- 813,817 ----
  		printf("\t%d entries in spool area\n", i);
  	fd = open(line, O_RDONLY);
! 	if (fd < 0) {
  		(void) close(fd);	/* unlocks as well */
  		printf("\tno daemon present\n");

>Release-Note:
>Audit-Trail:

From: Adam Glass <glass>
To: andrew@wipux2.wifo.uni-mannheim.de
Subject: Re: bin/509: flock-checking of lpd-lock file wrong ?
Date: Fri, 6 Jan 1995 20:17:44 -0800



    From gnats  Sun Oct  9 07:28:43 1994
    Date: Sun, 9 Oct 1994 15:30:06 +0100
    From: andrew@wipux2.wifo.uni-mannheim.de (Andrew Wheadon)
    Reply-To: andrew@wipux2.wifo.uni-mannheim.de
    X-Send-Pr-Version: 3.2

    >Number:         509
    >Category:       bin
    >Synopsis:       flock-checking of lpd-lock file wrong ?
    >Confidential:   no

    >Description:
 	   Whenever I used 'lpc' to check the status, it always says
 	   I have no daemon present. If I ps ax | grep lpd, it shows
 	   me that the daemon is running. The printing also functions
 	   fine. (I print over a remote printer).
 	   If you can't repeat this please tell me as it'll mean I'm
 	   doing something wrong.

    >How-To-Repeat:
 	   setup printing. start "lpd", run "lpc status".

 Actually i believe this behavior is correct.

 First some background...when lpd is started, it goes into daemon mode.
 Then it sits there waiting for requests to print jobs, receive jobs,
 remove jobs and display queues.  In all cases it forks off a copy of
 lpd to process these commands.  Some of these operations will require
 that the daemon lock down that printer's queue (most notably
 printjob).  The 'lpc status' command notes not whether the accepting
 daemon is present but whether there is a daemon currently locking that
 particular printer queue.

 Generally there won't be one unless there is something in the queue
 for that particular printer.  So i think your reported bug is not a bug.

 later,
 Adam Glass

From: "Charles M. Hannum" <mycroft@gnu.ai.mit.edu>
To: glass@NetBSD.ORG
Subject: Re: bin/509: flock-checking of lpd-lock file wrong ?
Date: Fri, 6 Jan 1995 23:23:55 -0500



 Perhaps the message needs to be changed to something a bit less
 obscure, like `printer not busy' or something.


State-Changed-From-To: open->closed 
State-Changed-By: hpeyerl 
State-Changed-When: Sun Jan 14 12:26:23 EST 1996 
State-Changed-Why:  
The behavior of 'lpc' is correct, but the message "no daemon present" 
was a bit confusing. Changed the message to "printer idle". 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.