From: wangpeiwen19920808@... Date: 2018-06-22T06:03:35+00:00 Subject: [ruby-core:87591] [Ruby trunk Bug#14864] some old linux has no O_CLOEXEC Issue #14864 has been reported by wangpeiwen (������ ���). ---------------------------------------- Bug #14864: some old linux has no O_CLOEXEC https://bugs.ruby-lang.org/issues/14864 * Author: wangpeiwen (������ ���) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 2.5.1 * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- I get some error when building ruby on suse 10, ~~~ compiling dir.c dir.c: In function ���nogvl_opendir_at���: dir.c:1439: error: ���O_CLOEXEC��� undeclared (first use in this function) dir.c:1439: error: (Each undeclared identifier is reported only once dir.c:1439: error: for each function it appears in.) make: *** [Makefile:398: dir.o] Error 1 ~~~ and I see some "ifdef O_CLOEXEC" in io.c and etc. ~~~ ext/dbm/dbm.c:169:29: * gdbm 1.10 works with O_CLOEXEC. gdbm 1.9.1 silently ignore it. ext/dbm/dbm.c:171:9:#ifndef O_CLOEXEC ext/dbm/dbm.c:172:12:# define O_CLOEXEC 0 ext/dbm/dbm.c:177:49: dbm = dbm_open(RSTRING_PTR(file), flags|O_CLOEXEC, mode); ext/dbm/dbm.c:182:62: dbm = dbm_open(RSTRING_PTR(file), O_RDWR|O_CREAT|O_CLOEXEC, mode); ext/dbm/dbm.c:185:54: dbm = dbm_open(RSTRING_PTR(file), O_RDWR|O_CLOEXEC, 0); ext/dbm/dbm.c:188:56: dbm = dbm_open(RSTRING_PTR(file), O_RDONLY|O_CLOEXEC, 0); ext/sdbm/_sdbm.c:228:8:#ifdef O_CLOEXEC ext/sdbm/_sdbm.c:229:18: flags |= O_CLOEXEC; ext/pty/pty.c:257:38: /* FreeBSD 9.2 or later supports O_CLOEXEC ext/pty/pty.c:266:14:# if defined(O_CLOEXEC) ext/pty/pty.c:268:51: * So version dependency on GNU/Linux is same as O_CLOEXEC with open(). ext/pty/pty.c:269:5: * O_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */ ext/pty/pty.c:270:11: flags |= O_CLOEXEC; dir.c:1439:41: const int opendir_flags = (O_RDONLY|O_CLOEXEC| io.c:238:13:#if defined(O_CLOEXEC) && defined(F_GETFD) io.c:246:27:#endif /* fall through if O_CLOEXEC does not work: */ io.c:257:8:#ifdef O_CLOEXEC io.c:258:8: /* O_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */ io.c:259:14: flags |= O_CLOEXEC; io.c:295:35:#if defined(HAVE_DUP3) && defined(O_CLOEXEC) io.c:298:38: ret = dup3(oldfd, newfd, O_CLOEXEC); io.c:327:29: ret = pipe2(fildes, O_CLOEXEC); ~~~ should we add ifdef in dir.c for building on some platform without O_CLOEXEC -- https://bugs.ruby-lang.org/ Unsubscribe: