delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/03/12/06:36:58

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3ED3B3858413
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1678617379;
bh=AkbxAOZ9ATYbRLOlUpFliqZaABAB+FPG8XDeT9CW/oc=;
h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=M5pVyoIlKOqaECObcuP81uhPbHZjfkMsSA3dTTA7YgmxH18x63enM5tzCeDc/sms8
FRZ5TQN1yy9b4UeGAeXJ3Faeo6Y0q8v5XVhlRSxSuxahU6G1sSJrVw1iqWmBp3pfsV
X6aoHX6sIKwhnJOluh9+ZujDi7sZlrysIVDc6A7Y=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2546C3858D1E
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112; t=1678617341;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=FyVXLv2tCGFAEXFClnoUCcUobOcEG2FIa7bTnO2Bk6A=;
b=uWBhZj5ri7JCnX6C0e8nv7sNVKMQn0XnL28DecQG4YbZ0HmRh8DaGkJx/odxwKk1Bw
UrYbv5iFOUYJ+iwsYEqLLFqiZBOC1oaJqorxGjsNDePFlsx4t2LZCM/GWyU8xcflCPGR
ev78vhoeL9AXWf0HOsGf9rZgF/ecuh2Ij0O19liv6pfUt8Uh3Ty6uPbrroPDU8UQSBJY
jZoKYD990S/k+2dXrSkBHfyi2/fqgGiJIHulUrUeTSyqbeNThhvVXa2HlE9kpDMH/n6N
UgQWMbO/60dx6iJbu5BGXmv57E9YhRwA3ieDNEDBBcaM4JaVlERfUomRwGb6ZGq8RBcQ
Gk7Q==
X-Gm-Message-State: AO0yUKUViNLyNQ3CB16u75CzF0gnYnRac3LSdTgkAPF9BL3+IWkXtoun
ou/fCQVrubH0xJjD/HEYNGpQHKi96E7pvpbQuWc=
X-Google-Smtp-Source: AK7set9/WPqkVdNSrgaW9DFG6N113yvgL0c/hNOQdg+giIHUxEGHiYycnN4HMqspNhOPykbM9gt9FAV14++hjIA6ens=
X-Received: by 2002:a1f:4507:0:b0:42d:5ea6:bd58 with SMTP id
s7-20020a1f4507000000b0042d5ea6bd58mr9531478vka.3.1678617341425; Sun, 12 Mar
2023 03:35:41 -0700 (PDT)
MIME-Version: 1.0
References: <da1d3c87-b83d-c5f2-95e9-d38952da0703 AT gmail DOT com>
In-Reply-To: <da1d3c87-b83d-c5f2-95e9-d38952da0703@gmail.com>
Date: Sun, 12 Mar 2023 11:35:26 +0100
Message-ID: <CAEhDDbBcB61X_FxJynpwva8Mm5=UatDDfbEowup7ydO67WwGWg@mail.gmail.com>
Subject: Re: 3.4.6-1 shm_open always returns -1, errno EINVAL
To: Matthew Rickard <rickard DOT matt AT gmail DOT com>, cygwin list <cygwin AT cygwin DOT com>
X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT,
RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS,
TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Csaba Raduly via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Csaba Raduly <rcsaba AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

Hi Matthew,

On Sun, 12 Mar 2023 at 07:44, Matthew Rickard  wrote:
>
> Hi all,
>
> Cygwin 3.4.6-1 shm_open seems to reject all calls, returning  the value
> -1 and setting errno to 22 EINVAL.
>
> For example, this program:
>
> #include <sys/mman.h>
> #include <fcntl.h>
> #include <errno.h>
> #include <stdio.h>
>
> int main() {
>    int res = shm_open("123", O_CREAT | O_RDWR, 0666);
>    int error = errno;
>    printf("res=%d errno=%d\n", res, errno);
>    if (error == EINVAL)
>      printf("That's EINVAL\n");
>    return 0;
> }
>
> Says:
>
> $ gcc -Og -o tiny tiny.c; ./tiny
> res=-1 errno=22
> That's EINVAL
>

https://man7.org/linux/man-pages/man3/shm_open.3.html  says:

For portable use, a shared memory object should be identified by
       a name of the form /somename; that is, a null-terminated string
       of up to NAME_MAX (i.e., 255) characters consisting of an initial
       slash, followed by one or more characters, none of which are
       slashes.

Changing the shm_open call to

shm_open("/123", O_CREAT | O_RDWR, 0666);

returns 3 and sets errno to zero.

Csaba
-- 
You can get very substantial performance improvements
by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformant way
to get the wrong information: this is what you want. - Scott Meyers (C++TDaWYK)

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019