delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/06/06/07:06:15

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AD6003857B8E
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1686049534;
bh=+j0fuTl7nRoREV3/46wRvHxYdHjm3QsgNomLoZvRC4M=;
h=Date:To:Subject:References:List-Id:List-Unsubscribe:List-Archive:
List-Post:List-Help:List-Subscribe:From:Reply-To:From;
b=vtCzjjEfteF/RmsSJITXFIzJEakx1WSYOeKsZf/DDI9DSP1HmzaBwwIBBpn5U4YEw
MhYwkyLWrdafNFbfqx2ZV61qlQl+iDLI+vqvgtWlT7OOLHfRF13lu+miJ/U322kUNb
EhNyE3JH9Ah9OIwLQlR+Zr6JO3igg0B219Cay2H4=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D6BAC3858D33
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
t=1686049517; bh=MMHOhAiIuwmYy5FKdSfSnqd1+LJBza1Np+a1bGG3lsr=;
h=X-Sonic-MF:Date:From:To:Subject:From:Subject;
b=naNxl9Xu++zcw1iuLJKaSS1Shzc/HKcAeRuIlNxN/Ky+X7qy21BiwDKSMg540pYxsKPnMg5qktZNr72mNEIjU7+12p2GxjeumNQgzN0d/6KTk9wL5ZiJw72+smzaHoT3gJOnT5k8NM2klV8RSWUZ/7WTenQKtzZvAVNerET78mTJP5QYEhwXwOdofxpp5P1phbOsDVj9pxfAAKwY2VKYq5QzyIqoUHTDAU/zUY2oQ7rDsAXuvVK2CaiMx7O7yVSPguhUdXcPglwpHZED32izxYEos8Qhk488IVraUdY8JthUjRqaOOs/SYrbqIUlIDhRQbLM8HW1jXNMUKMH29fnzQ==
X-YMail-OSG: cJ9zin0VM1mwb9H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08f1BW.V8qxU03nzIHy0fWE486ObYWH9jCt.XLlKtGeQZqBwVbpWpGE
y_oPesGaosYms85EtyCMjqs6VAH6rbvLXIJlvGbE8M6jP0lwGXfcIg3.H256kCngkHgqe1_TBYCb
VFRD_n4gkm4NmU_Hs4NeeJZ_OXdA-
X-Sonic-MF: <spk121 AT yahoo DOT com>
X-Sonic-ID: b1a063f3-da52-410a-a1ea-94a30e106b1b
Date: Tue, 6 Jun 2023 11:01:20 +0000 (UTC)
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Message-ID: <1010129621.187968.1686049280947@mail.yahoo.com>
Subject: On abstract sockets
MIME-Version: 1.0
References: <1010129621 DOT 187968 DOT 1686049280947 DOT ref AT mail DOT yahoo DOT com>
X-Mailer: WebService/1.1.21516 YMailNorrin
X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT,
FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS,
TXREP, T_SCC_BODY_TEXT_LINE 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: Mike Gran via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Mike Gran <spk121 AT yahoo DOT com>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 356B60wx032761

Hello Cygwin-

I just wanted to double-check my understanding that binding
an abstract socket (a NULL-prefixed filename) is not currently
supported on Cygwin. I think there used to be some sort
of emulation of abstract sockets, but, that's not true anymore,
right?

With the sample program below, bind for AF_UNIX traces into
fhandler_socket_local::bind, since AF_UNIX == AF_LOCAL.

fhandler_socket_local::bind copies the NULL-prefixed abstract
name using 

  strncpy (sun_path, un_addr->sun_path, len);

which truncates sun_path to be an empty string. Searching
for the existence of the empty path causes errno ENOENT.

Also, it seems unclear if winsock2 sockets supports abstract sockets
anyway.

Thanks,
Mike Gran

// tmp.c
#include <sys/socket.h>
#include <sys/un.h>
#include <stdlib.h>
#include <stdio.h>

int main()
{
    int s;
    struct sockaddr_un name;
    int ret;

    s = socket(AF_UNIX, SOCK_STREAM, 0);
    if (s == -1) {
        perror("socket");
        exit(1);
    }

    const char path[5] = { 0, 'f', 'o', 'o', 0};
    memset(&name, 0, sizeof(name));    
    name.sun_family = AF_UNIX;
    memcpy(name.sun_path, path, sizeof(path));
    
    ret = bind(s, (const struct sockaddr *) &name, 2 + sizeof(path));
    if (ret == -1) {
        perror("bind");
        exit(1);
    }
    return 0;
}

-- 
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