delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:date:from:to:subject:message-id:mime-version | |
:content-type; q=dns; s=default; b=bhYZOhbk3R6ZB8SIebo14iJmzSoan | |
/VrtXu5uOZgCWLN3V+QuqAMPstK6i1mANsO+NRSIMuHOHftCQ+u3xSx0MYpEd9sC | |
B5al0A15is7fc6vvokRejrkTWv8Rds6tkH92pHGn7fwMHQrnHLCyFSpXhtjHqYN0 | |
H/H73Ome9uNn1g= | |
DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:date:from:to:subject:message-id:mime-version | |
:content-type; s=default; bh=LxYD2OB35XiFPUVciGqHnP0+j7o=; b=cSC | |
XKx6yIggLLng0wVG9s9dAc6AmYNK6ZZo5qOItTNzETZSCpDj5QpHOLCpgqkWhsJY | |
tLJ3dUGRWQMQcc2acBFa/k6QA5k92HE1ztgTZax7Fj9sJbrYhIICH3GuD5NIbcG0 | |
Cfn0Iu5eNgJ1JVAi7jPLGXlNhntzHHTWxFrkMxhY= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Authentication-Results: | sourceware.org; auth=none |
X-Spam-SWARE-Status: | No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=listen, 100000, D*vinschen.de, Feb |
X-HELO: | conssluserg-03.nifty.com |
DKIM-Filter: | OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com w63AiHxI000718 |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1530614658; bh=KePJ39uXmOS5ERdtJUS0+Su9X/xGv4a4dzzrQqP6lg4=; h=Date:From:To:Subject:From; b=oYTEgNcyvcAw7O1LbnHflkFq/rUzsfQ20DXdBQO+smmu5llZ4Vi6pThjJxEiNlYqR QrWkzfzhkeg1TOhmcskjA/4pBfymsVl/IeZfVL9Xl4ivZiym7lSlaWkorWC4RLVhIF mjpfn9BKqm4rLvj7YTNAWwc6gvBJsGXXRmZXHnMX6qGIqImFmUuurGlAkXXpCSkcHG 23YJ7zlUjNFCwF//Nx+2HHiS8j7X4b1I2M0Oy5773RlHDA4C0CBLpdLvw83AVsLVOE 73E2ACIFj+cLi5RYmBJoxhp1mkyWmLBNk5c/N9tTh5FL/XnDFjGvqtBGgvHkaeNZ8i TxdT1hXCXjC2A== |
Date: | Tue, 3 Jul 2018 19:44:29 +0900 |
From: | Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp> |
To: | cygwin AT cygwin DOT com |
Subject: | Named AF_UNIX socket not working in cygwin1.dll of git HEAD. |
Message-Id: | <20180703194429.6aeab3cb1041fe475ecde834@nifty.ne.jp> |
Mime-Version: | 1.0 |
X-IsSubscribed: | yes |
--Multipart=_Tue__3_Jul_2018_19_44_29_+0900_jgRJiulXZIG1mw6/ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Named AF_UNIX socket does not work in cygwin1.dll of git HEAD. A simple test case is attched. Expected result: 10: 1234567890 Result in cygwin1.dll of git HEAD: bind: Bad address unlink: Device or resource busy It seems that this occures regarding the following commit. commit 859d215b7e006e5fc60f686ec976e997e35d169b Author: Corinna Vinschen <corinna AT vinschen DOT de> Date: Wed Feb 21 21:40:01 2018 +0100 Cygwin: split out fhandler_socket into inet and local classes First cut, still incomplete * fhandler_socket is now base class for other socket classes * fhandler_socket_inet handles AF_INET and AF_INET6 sockets * fhandler_socket_local handles AF_LOCAL/AF_UNIX sockets * finally get rid of fdsock by using set_socket_handle in accept4 * align file-related calls (fstat, fstatvfs, fchown, fchmod, facl) to Linux. Signed-off-by: Corinna Vinschen <corinna AT vinschen DOT de> -- Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp> --Multipart=_Tue__3_Jul_2018_19_44_29_+0900_jgRJiulXZIG1mw6/ Content-Type: text/x-csrc; name="sockunix.c" Content-Disposition: attachment; filename="sockunix.c" Content-Transfer-Encoding: 7bit #include <stdio.h> #include <sys/socket.h> #include <sys/un.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/wait.h> #include <signal.h> #define SOCKNAME "sock_unix" int main() { int fd; struct sockaddr_un sunx; pid_t pid; ssize_t len; char buf[BUFSIZ]; memset(&sunx, 0, sizeof(sunx)); sunx.sun_family = AF_UNIX; strncpy (sunx.sun_path, SOCKNAME, sizeof(sunx.sun_path) -1 ); pid = fork(); if (pid) { int fd1; fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd < 0) { perror("socket"); goto end_server; } if (bind(fd, (struct sockaddr *)&sunx, sizeof(sunx)) < 0) { perror("bind"); goto end_server; } if (listen(fd, 1) < 0) { perror("listen"); goto end_server; } fd1 = accept(fd, 0, 0); if (fd1 < 0) { perror("accept"); goto end_server; } while ((len = read(fd1, buf, sizeof(buf))) > 0) { buf[len] = '\0'; printf("%d: %s\n", len, buf); } close(fd1); end_server: close(fd); kill(pid, SIGTERM); wait(NULL); if (unlink(SOCKNAME) < 0) { perror("unlink"); } } else { usleep(100000); fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd < 0) { perror("socket"); goto end_client; } if (connect(fd, (struct sockaddr *)&sunx, sizeof(sunx)) < 0) { perror("connect"); goto end_client; } write(fd, "1234567890", 10); end_client: close(fd); } return 0; } --Multipart=_Tue__3_Jul_2018_19_44_29_+0900_jgRJiulXZIG1mw6/ Content-Type: text/plain; charset=us-ascii -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple --Multipart=_Tue__3_Jul_2018_19_44_29_+0900_jgRJiulXZIG1mw6/--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |