From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id A0ED9385481F for ; Mon, 12 Apr 2021 17:55:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A0ED9385481F Received: by mail-ej1-x631.google.com with SMTP id r12so21736229ejr.5 for ; Mon, 12 Apr 2021 10:55:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=GUsoo5DDG8aXGkjgA0vKeC5x4Y/Pl8sQxuoX22EBSfw=; b=EL0Q5iojjmYbdaNtOKnSDa6mWD+HzmlzEy+fMjvvea+j4hNs/nGU79NQ6W1WAVmYC5 crFOLtDPrI/g4AYurVMHs9/Aibm76+6PHpLHEy+mrT88dOm3Z7uxvfpa3pxJqYfkeVGl sMdoPWQ1ax2ZriYXqw0QWj9BET/SkPr2KMpu1a35sprCytETqKzYnWLjxjzwHQaAgYqb jNDt4v9yyyJld+/4/Ii3dxkGa5h4nwHA2sdunyM5hu7DomR1oagfHiuKkXLRIb1JvBkP MhnfbEC9OQyKq0hUchMOhtMdI8LmogmURK94iu6NRb7uqJN1Gc+6fyYQQD/vmaKJQUsr Kuvg== X-Gm-Message-State: AOAM531e5cQVm1voTIamQZ0qTvL9sZxYDJqlUdjCunh/yG8IX/hyzOs8 exHTi8UJOQmWJjDwRZDOkkHwVKPAukE= X-Google-Smtp-Source: ABdhPJyWuvVNgIu1Y5JBciBInlmO7JAvwagvIcVgV2EDkf2mJs684jXbNPYp6sjbNHHSth1gLBYQHQ== X-Received: by 2002:a17:906:c010:: with SMTP id e16mr28557775ejz.214.1618250131780; Mon, 12 Apr 2021 10:55:31 -0700 (PDT) Received: from [192.168.0.154] ([151.69.16.169]) by smtp.googlemail.com with ESMTPSA id hc43sm6342561ejc.97.2021.04.12.10.55.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Apr 2021 10:55:31 -0700 (PDT) Subject: Re: What is the point of IPC_PRIVATE of shmget? To: libc-help@sourceware.org Cc: Florian Weimer References: <87wnt7iizx.fsf@oldenburg.str.redhat.com> <87sg3viio7.fsf@oldenburg.str.redhat.com> From: Manfred Message-ID: <9653dac2-7c03-cad0-34fa-94d0101165d8@gmail.com> Date: Mon, 12 Apr 2021 19:55:30 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <87sg3viio7.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Apr 2021 17:55:33 -0000 On 4/12/2021 6:14 PM, Florian Weimer via Libc-help wrote: > * Peng Yu: > >> On Mon, Apr 12, 2021 at 11:07 AM Florian Weimer wrote: >>> >>> * Peng Yu via Libc-help: >>> >>>> I don't get the point of IPC_PRIVATE of shmget(). Since it is just >>>> used by the current process, why not just use malloc? >>>> >>>> Can anybody give a real example in which IPC_PRIVATE must be used, but >>>> malloc or other variant of *alloc functions are not appropriate to >>>> use? Thanks. >>> >>> shmget(2) says this: >>> >>> | BUGS >>> | The name choice IPC_PRIVATE was perhaps unfortunate, IPC_NEW >>> | would more clearly show its function. >>> >>> Does this answer your question? >> >> No. That is just a naming issue. It is still privately used by the >> current process instead of other processes. > > Oh, it can be shared if the process forks. With malloc, you'd lose the > sharing. Out of curiosity, Does it need to fork? Can the identifier be shared in some other way? Thanks, Manfred > > Thanks, > Florian >