Mail Archives: cygwin/2010/04/13/13:43:47
--------------060207020908070703050902
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
While configuring apr-1.4.2 with Cygwin 1.7.5, the test for accept4
hung. I don't know much about this API, so I've just disabled it in
libapr1 for now, but I wanted to report the hang in case it was a
Cygwin bug.
The associated conftest is attached.
--
David Rothenberger ---- daveroth AT acm DOT org
QOTD:
"I'd never marry a woman who didn't like pizza... I might play
golf with her, but I wouldn't marry her!"
--------------060207020908070703050902
Content-Type: text/plain;
name="accept4.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="accept4.c"
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <signal.h>
#include <errno.h>
#define A4_SOCK "./apr_accept4_test_socket"
int main()
{
pid_t pid;
int fd;
struct sockaddr_un loc, rem;
socklen_t rem_sz;
if ((pid = fork())) {
int status;
unlink(A4_SOCK);
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
goto cleanup_failure2;
loc.sun_family = AF_UNIX;
strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1);
if (bind(fd, (struct sockaddr *) &loc,
sizeof(struct sockaddr_un)) == -1)
goto cleanup_failure;
if (listen(fd, 5) == -1)
goto cleanup_failure;
rem_sz = sizeof(struct sockaddr_un);
if (accept4(fd, (struct sockaddr *) &rem, &rem_sz, 0) == -1) {
goto cleanup_failure;
}
else {
close(fd);
waitpid(pid, &status, 0);
unlink(A4_SOCK);
return 0;
}
cleanup_failure:
close(fd);
cleanup_failure2:
kill(pid, SIGKILL);
waitpid(pid, &status, 0);
unlink(A4_SOCK);
return 1;
}
else {
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
return 1; /* this will be bad: we'll hang */
loc.sun_family = AF_UNIX;
strncpy(loc.sun_path, A4_SOCK, sizeof(loc.sun_path) - 1);
while(connect(fd, (struct sockaddr *) &loc,
sizeof(struct sockaddr_un)) == -1 &&
(errno==ENOENT || errno==ECONNREFUSED))
;
close(fd);
return 0;
}
}
--------------060207020908070703050902
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
--------------060207020908070703050902--
- Raw text -