From ap@bnc.net Sun Jun 13 11:09:01 1999
Return-Path: <ap@bnc.net>
Received: from mail.ivm.net (mail.ivm.de [195.78.161.2])
	by hub.freebsd.org (Postfix) with ESMTP id EA46914DF3
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 13 Jun 1999 11:08:58 -0700 (PDT)
	(envelope-from ap@bnc.net)
Received: from gemini.bnc.net (gemini.bnc.net [195.247.233.33])
	by mail.ivm.net (8.8.8/8.8.8) with ESMTP id UAA15996
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 13 Jun 1999 20:08:49 +0200
Received: (from ap@localhost)
          by gemini.bnc.net (8.9.3/8.9.1) id UAA12979;
          Sun, 13 Jun 1999 20:09:03 +0200 (CEST)
          (envelope-from ap)
Message-Id: <199906131809.UAA12979@gemini.bnc.net>
Date: Sun, 13 Jun 1999 20:09:03 +0200 (CEST)
From: Achim Patzner <ap@bnc.net>
Reply-To: ap@bnc.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: wcol is not getting its SHM segments
X-Send-Pr-Version: 3.2

>Number:         12191
>Category:       bin
>Synopsis:       wcol is trying to allocate a shared memory segment and failing
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 13 11:10:01 PDT 1999
>Closed-Date:    Fri Jul 20 15:41:01 PDT 2001
>Last-Modified:  Fri Jul 20 15:41:35 PDT 2001
>Originator:     Achim Patzner
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
>Environment:

	

FreeBSD gemini.bnc.net 4.0-CURRENT FreeBSD 4.0-CURRENT #1: Sat May 22
18:48:55 CEST 1999 root@gemini.bnc.net:/usr/src/sys/compile/GEMINI i386

>Description:

	

WARNING: This problem should probably appear in category kern too...

wcol is starting a number of child processes. Its using a shared memory segment for
communication with these children so its trying to allocate a shared memory
segment in shm.c:

int assign_pool(key_t shmkey)
{
    int chk;
    int flg;

    flg = 0666;
    /*
    flg = flg | IPC_CREAT;
    */

    chk = shmget(shmkey, (int)0, flg);
    if(chk==-1) {
        fprintf(stderr, "assign_pool: fail shmget() (%d)\n", errno);
        return chk;
    }
    return chk;
}

Allocation of a segment of size 0 is always returning ENOENT in 4.0-CURRENT
while in 3.2 it is working. I might have understood an EINVAL though...


>How-To-Repeat:

	

Install wcol and run it (under a debugger) or just run the above piece of
code.

>Fix:
	
	
Right now Im requesting a segment of the size which will later on be
requested anyway (after using this piece of code to make sure the key is
not already allocated).
A better fix was using ftok but I wouldnt know which path to use for it.


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->freebsd-bugs 
Responsible-Changed-By: hoek 
Responsible-Changed-When: Fri Jun 25 16:27:24 PDT 1999 
Responsible-Changed-Why:  
Daily maintainance. 

From: "Danny J. Zerkel" <dzerkel@columbus.rr.com>
To: freebsd-gnats-submit@FreeBSD.org, ap@bnc.net
Cc:  
Subject: Re: bin/12191: wcol is trying to allocate a shared memory segment and 
 failing
Date: Mon, 07 Feb 2000 23:26:47 -0500

 The code for shmget hasn't really changed between 3.2 and 4.0.  So,
 I don't know what you mean by "it is working".  It should be returning
 ENOENT if the segment doesn't exist.  If it does exist, a size of 0
 is ignored and the segment should be returned.
 
 PS- why not use the path of the program itself for ftok()?
 
 Executive Summary:
 
 Not a problem as far as I can see.
 
 -- Danny J. Zerkel
 dzerkel@columbus.rr.com
 
 
 
State-Changed-From-To: open->closed 
State-Changed-By: mike 
State-Changed-When: Fri Jul 20 15:41:01 PDT 2001 
State-Changed-Why:  

Timeout; no response from originator. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=12191 
>Unformatted:
