Re: kernel on buildd (Re: [Glibc-bsd-commits] r5714 - trunk/glibc-ports/kfreebsd/bits)
Hey Steven! On Thu, 2015-05-28 at 22:22:06 +0100, Steven Chamberlain wrote: > Guillem Jover wrote: > > In any case here's the patches I've prepared to send upstream. Only > > build tested, though. > > Thanks for this. Thank you for the review and testing. > Patch 1 would have been a good workaround for Debian sid, if Andreas > had accepted it, but I don't think it should be permanent or go > upstream. I don't like to special-case kfreebsd in code except in > places we really have to, and it's actually wrong for FreeBSD <= 9 > (though they're not a user of util-linux). This allows using the value even if the build system does not know about it, either because we are building on an old system or because the libc is not up-to-date. For FreeBSD <= 9, it should be handled by the run-time checks, so it should fallback to the other codepath. I can reorder the patches so that this makse more sense. In any case I think I'll just send it upstream and let them decide if they want to carry it or not. Or did you mean something else with the comment that it is wrong (I would not expect the value to have been reused for example)? > Patches 2 and 3 look good to go upstream as they benefit other systems > not having fcntl.h or F_DUPFD_CLOEXEC (and older kfreebsd). Sure. > They make patch 1 unnecessary? Well, partially I guess, if the library is being used by threaded applications that fork, then they might end up leaking if the library got built on an old system, but is run on a newer one. > I tested your fallback code and it is working (duplicates the fd and > sets FD_CLOEXEC). Without F_DUPFD_CLOEXEC I get a compiler warning > about unused lowfd, but that doesn't really matter here. Cool, thanks. Sending them upstream now. Regards, Guillem -- To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20150605173357.ga30...@gaara.hadrons.org
Re: kernel on buildd (Re: [Glibc-bsd-commits] r5714 - trunk/glibc-ports/kfreebsd/bits)
Hi Guillem, Guillem Jover wrote: > In any case here's the patches I've prepared to send upstream. Only > build tested, though. Thanks for this. Patch 1 would have been a good workaround for Debian sid, if Andreas had accepted it, but I don't think it should be permanent or go upstream. I don't like to special-case kfreebsd in code except in places we really have to, and it's actually wrong for FreeBSD <= 9 (though they're not a user of util-linux). Patches 2 and 3 look good to go upstream as they benefit other systems not having fcntl.h or F_DUPFD_CLOEXEC (and older kfreebsd). They make patch 1 unnecessary? I tested your fallback code and it is working (duplicates the fd and sets FD_CLOEXEC). Without F_DUPFD_CLOEXEC I get a compiler warning about unused lowfd, but that doesn't really matter here. Regards, -- Steven Chamberlain ste...@pyro.eu.org -- To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20150528212206.gc27...@pyro.eu.org
Re: kernel on buildd (Re: [Glibc-bsd-commits] r5714 - trunk/glibc-ports/kfreebsd/bits)
Hi! On Thu, 2015-05-28 at 09:00:41 +0200, Petr Salinger wrote: > what is currently used kernel on buildd for kfreebsd-* ? > > According to last log of util-linux (22 May 2015/fayrfax.debian.org): > Kernel: GNU/kFreeBSD 9.0-2-amd64 kfreebsd-amd64 (x86_64) > > Please beware, that F_DUPFD_CLOEXEC is not supported on this kernel. > The addition of F_DUPFD_CLOEXEC bellow is long term way, but in mean time > (until buildd is upgraded to 10.x), we need to use fallback to previous code > path in util-linux. That might be needed only if that code path is executed on the buildds, something I'm not sure about. In any case here's the patches I've prepared to send upstream. Only build tested, though. Thanks, Guillem From e8cfe3d17d61e19203445cbf96a136fad30fc05a Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Thu, 28 May 2015 17:46:02 +0200 Subject: [PATCH 1/3] include/c: Define F_DUPFD_CLOEXEC on kFreeBSD systems if missing The kernel of FreeBSD version 10 and higher supports this fcntl command, but the system libc, in this case glibc, might not yet know about it. Signed-off-by: Guillem Jover --- include/c.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/include/c.h b/include/c.h index a72e264..1eda75f 100644 --- a/include/c.h +++ b/include/c.h @@ -231,6 +231,12 @@ static inline int dirfd(DIR *d) #define O_CLOEXEC 0 #endif +#ifdef __FreeBSD_kernel__ +#ifndef F_DUPFD_CLOEXEC +#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ +#endif +#endif + #ifndef AI_ADDRCONFIG #define AI_ADDRCONFIG 0x0020 -- 2.2.1.209.g41e5f3a From 0267c0f4e739b788a90500446173585502e6ddb3 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Thu, 28 May 2015 17:51:09 +0200 Subject: [PATCH 2/3] lib/fileutils: Add new dup_fd_cloexec function This function duplicates and marks a file descriptor as close-on-exec. Takes care of build and run-time support for the fcntl F_DUPFD_CLOEXEC command, and other errors. Signed-off-by: Guillem Jover --- include/fileutils.h | 1 + lib/fileutils.c | 30 ++ 2 files changed, 31 insertions(+) diff --git a/include/fileutils.h b/include/fileutils.h index 3353f69..e0e2ece 100644 --- a/include/fileutils.h +++ b/include/fileutils.h @@ -25,6 +25,7 @@ static inline FILE *xfmkstemp(char **tmpname, char *dir) return ret; } +extern int dup_fd_cloexec(int oldfd, int lowfd); extern int get_fd_tabsize(void); extern int mkdir_p(const char *path, mode_t mode); diff --git a/lib/fileutils.c b/lib/fileutils.c index bffa8ff..81b38ad 100644 --- a/lib/fileutils.c +++ b/lib/fileutils.c @@ -50,6 +50,36 @@ int xmkstemp(char **tmpname, char *dir) return fd; } +int dup_fd_cloexec(int oldfd, int lowfd) +{ + int fd, flags, errno_save; + +#ifdef F_DUPFD_CLOEXEC + fd = fcntl(oldfd, F_DUPFD_CLOEXEC, lowfd); + if (fd >= 0) + return fd; +#endif + + fd = dup(oldfd); + if (fd < 0) + return fd; + + flags = fcntl(fd, F_GETFD); + if (flags < 0) + goto unwind; + if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) + goto unwind; + + return fd; + +unwind: + errno_save = errno; + close(fd); + errno = errno_save; + + return -1; +} + /* * portable getdtablesize() */ -- 2.2.1.209.g41e5f3a From 53e0536299ae17540a465fe3f71a636676abb965 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Thu, 28 May 2015 17:52:33 +0200 Subject: [PATCH 3/3] lib/sysfs: Use dup_fd_cloexec instead of direct call to fcntl Signed-off-by: Guillem Jover --- lib/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index 1ea2e77..975e264 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -265,7 +265,7 @@ DIR *sysfs_opendir(struct sysfs_cxt *cxt, const char *attr) * -- we cannot use cxt->sysfs_fd directly, because closedir() * will close this our persistent file descriptor. */ - fd = fcntl(cxt->dir_fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1); + fd = dup_fd_cloexec(cxt->dir_fd, STDERR_FILENO + 1); if (fd < 0) return NULL; -- 2.2.1.209.g41e5f3a
Re: kernel on buildd (Re: [Glibc-bsd-commits] r5714 - trunk/glibc-ports/kfreebsd/bits)
Ahoi! Christoph Egger writes: >> Ahoi! >> >> Petr Salinger writes: >>> what is currently used kernel on buildd for kfreebsd-* ? >>> >>> According to last log of util-linux (22 May 2015/fayrfax.debian.org): >>> Kernel: GNU/kFreeBSD 9.0-2-amd64 kfreebsd-amd64 (x86_64) >> >> You are indeed right. All buildds are still running wheezy. Peter from >> DSA upgraded the porterbox, falla, and experienced huge stability >> problems I could not reproduce which stalled the upgrades. Anyone with >> more ideas is certainly welcomed by DSA in helping to figure out what is >> going on there. | sonewconn: pcb 0xf8000e37f930: Listen queue overflow: 8 already in queue awaiting acceptance (6 occurrences) Maybe related to that? Anyone already seen that before? Christoph -- To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/87fv6gfyga@mitoraj.siccegge.de
Re: kernel on buildd (Re: [Glibc-bsd-commits] r5714 - trunk/glibc-ports/kfreebsd/bits)
tags 785796 - patch thanks Hi, Petr Salinger wrote: > what is currently used kernel on buildd for kfreebsd-* ? > > According to last log of util-linux (22 May 2015/fayrfax.debian.org): > Kernel: GNU/kFreeBSD 9.0-2-amd64 kfreebsd-amd64 (x86_64) Damn, I thought all the builds were upgraded to 10.1. Thanks for pointing this out. Therefore please don't apply this patch to glibc yet... we'll need a plan B. Regards, -- Steven Chamberlain ste...@pyro.eu.org -- To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20150528161332.gc62...@pyro.eu.org
Re: kernel on buildd (Re: [Glibc-bsd-commits] r5714 - trunk/glibc-ports/kfreebsd/bits)
On Thu, 2015-05-28 at 10:07 +0200, Christoph Egger wrote: > > Petr Salinger writes: > >> what is currently used kernel on buildd for kfreebsd-* ? uname -a: GNU/kFreeBSD falla 10.1-0-amd64 #0 Tue, 07 Apr 2015 22:13:19 +0100 x86_64 amd64 QEMU Virtual CPU version 2.1.2 GNU/kFreeBSD GNU/kFreeBSD fils 9.0-2-686 #0 Sun May 17 22:06:56 UTC 2015 i386 i386 QEMU Virtual CPU version 2.1.2 GNU/kFreeBSD GNU/kFreeBSD finzi 9.0-2-686 #0 Sun May 17 22:06:56 UTC 2015 i386 i386 QEMU Virtual CPU version 2.1.2 GNU/kFreeBSD GNU/kFreeBSD asdfasdf 9.0-2-amd64 #0 Fri Nov 7 13:40:32 UTC 2014 x86_64 amd64 AMD Sempron(tm) Processor 3000+ GNU/kFreeBSD GNU/kFreeBSD fano 9.0-2-amd64 #0 Sun May 17 20:12:58 UTC 2015 x86_64 amd64 QEMU Virtual CPU version 2.1.2 GNU/kFreeBSD GNU/kFreeBSD fischer 9.0-2-686 #0 Sun May 17 22:06:56 UTC 2015 i386 i386 QEMU Virtual CPU version 2.1.2 GNU/kFreeBSD GNU/kFreeBSD fayrfax 9.0-2-amd64 #0 Sun May 17 20:12:58 UTC 2015 x86_64 amd64 QEMU Virtual CPU version 2.1.2 GNU/kFreeBSD io.debian.net appears to be down. -- bye, pabs https://wiki.debian.org/PaulWise signature.asc Description: This is a digitally signed message part
Re: kernel on buildd (Re: [Glibc-bsd-commits] r5714 - trunk/glibc-ports/kfreebsd/bits)
debian-adm...@lists.debian.org is the right mailadress for that side Christoph Egger writes: > Ahoi! > > Petr Salinger writes: >> what is currently used kernel on buildd for kfreebsd-* ? >> >> According to last log of util-linux (22 May 2015/fayrfax.debian.org): >> Kernel: GNU/kFreeBSD 9.0-2-amd64 kfreebsd-amd64 (x86_64) > > You are indeed right. All buildds are still running wheezy. Peter from > DSA upgraded the porterbox, falla, and experienced huge stability > problems I could not reproduce which stalled the upgrades. Anyone with > more ideas is certainly welcomed by DSA in helping to figure out what is > going on there. > > Christoph -- -- To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/87d21lrupk@mitoraj.siccegge.de
Re: kernel on buildd (Re: [Glibc-bsd-commits] r5714 - trunk/glibc-ports/kfreebsd/bits)
Ahoi! Petr Salinger writes: > what is currently used kernel on buildd for kfreebsd-* ? > > According to last log of util-linux (22 May 2015/fayrfax.debian.org): > Kernel: GNU/kFreeBSD 9.0-2-amd64 kfreebsd-amd64 (x86_64) You are indeed right. All buildds are still running wheezy. Peter from DSA upgraded the porterbox, falla, and experienced huge stability problems I could not reproduce which stalled the upgrades. Anyone with more ideas is certainly welcomed by DSA in helping to figure out what is going on there. Christoph signature.asc Description: PGP signature
kernel on buildd (Re: [Glibc-bsd-commits] r5714 - trunk/glibc-ports/kfreebsd/bits)
Hi, what is currently used kernel on buildd for kfreebsd-* ? According to last log of util-linux (22 May 2015/fayrfax.debian.org): Kernel: GNU/kFreeBSD 9.0-2-amd64 kfreebsd-amd64 (x86_64) Please beware, that F_DUPFD_CLOEXEC is not supported on this kernel. The addition of F_DUPFD_CLOEXEC bellow is long term way, but in mean time (until buildd is upgraded to 10.x), we need to use fallback to previous code path in util-linux. Petr On Tue, 26 May 2015, Christoph Egger wrote: Hi Steven, list! I understand the thing below is the intended fix for util-linux? Is there some planned timeline to get it into unstable? We're not building anything currently for as long as util-linux isn't updated so one might want to push a little Thanks Christoph stevenc-gu...@alioth.debian.org writes: Author: stevenc-guest Date: 2015-05-24 14:00:19 + (Sun, 24 May 2015) New Revision: 5714 Modified: trunk/glibc-ports/kfreebsd/bits/fcntl.h Log: provide F_DUPFD_CLOEXEC of POSIX.1-2008, implemented in kfreebsd-10 Modified: trunk/glibc-ports/kfreebsd/bits/fcntl.h === --- trunk/glibc-ports/kfreebsd/bits/fcntl.h 2015-05-23 14:52:10 UTC (rev 5713) +++ trunk/glibc-ports/kfreebsd/bits/fcntl.h 2015-05-24 14:00:19 UTC (rev 5714) @@ -148,6 +148,10 @@ #define F_SETLK64 12 /* Set record locking info (non-blocking). */ #define F_SETLKW64 13 /* Set record locking info (blocking). */ +#if __USE_BSD || __POSIX_VISIBLE >= 200809 +#defineF_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ +#endif + #if defined __USE_BSD || defined __USE_UNIX98 # define F_GETOWN 5 /* Get owner of socket (receiver of SIGIO). */ # define F_SETOWN 6 /* Set owner of socket (receiver of SIGIO). */ -- 9FED 5C6C E206 B70A 5857 70CA 9655 22B9 D49A E731 Debian Developer | Lisp Hacker | CaCert Assurer -- To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/alpine.lnx.2.00.1505280854350.27...@contest.felk.cvut.cz