mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/dbm/extconf.rb: check dbm_pagfno() and dbm_dirfno().
* ext/dbm/dbm.c: use above to set close-on-exec flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
66595f3894
commit
e4e5b7df4c
3 changed files with 35 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
Mon Nov 7 20:15:44 2011 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/dbm/extconf.rb: check dbm_pagfno() and dbm_dirfno().
|
||||
|
||||
* ext/dbm/dbm.c: use above to set close-on-exec flag.
|
||||
|
||||
Mon Nov 7 20:05:16 2011 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* io.c (io_fflush): remove fsync().
|
||||
|
|
|
@ -162,6 +162,30 @@ fdbm_initialize(int argc, VALUE *argv, VALUE obj)
|
|||
}
|
||||
}
|
||||
|
||||
if (dbm) {
|
||||
/*
|
||||
* History of dbm_pagfno() and dbm_dirfno() in ndbm and its compatibles.
|
||||
*
|
||||
* 1986: 4.3BSD provides ndbm.
|
||||
* It provides dbm_pagfno() and dbm_dirfno() as macros.
|
||||
* 1991: gdbm-1.5 provides them as functions.
|
||||
* They returns a same descriptor.
|
||||
* (Earlier releases may have the functions too.)
|
||||
* 1991: Net/2 provides Berkeley DB.
|
||||
* It doesn't provide dbm_pagfno() and dbm_dirfno().
|
||||
* 1992: 4.4BSD Alpha provides Berkeley DB with dbm_dirfno() as a function.
|
||||
* dbm_pagfno() is a macro as DBM_PAGFNO_NOT_AVAILABLE.
|
||||
* 2011: gdbm-1.9 creates a separate dir file.
|
||||
* dbm_pagfno() and dbm_dirfno() returns different descriptors.
|
||||
*/
|
||||
#if defined(HAVE_DBM_PAGFNO)
|
||||
rb_fd_fix_cloexec(dbm_pagfno(dbm));
|
||||
#endif
|
||||
#if defined(HAVE_DBM_DIRFNO)
|
||||
rb_fd_fix_cloexec(dbm_dirfno(dbm));
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!dbm) {
|
||||
if (mode == -1) return Qnil;
|
||||
rb_sys_fail(RSTRING_PTR(file));
|
||||
|
|
|
@ -21,6 +21,8 @@ headers = {
|
|||
"qdbm" => ["relic.h", "qdbm/relic.h"],
|
||||
}
|
||||
|
||||
$dbm_headers = []
|
||||
|
||||
def headers.db_check(db)
|
||||
db_prefix = nil
|
||||
have_gdbm = false
|
||||
|
@ -44,6 +46,7 @@ def headers.db_check(db)
|
|||
have_func(db_prefix+"dbm_clearerr") unless have_gdbm
|
||||
$defs << hsearch if hsearch
|
||||
$defs << '-DDBM_HDR="<'+hdr+'>"'
|
||||
$dbm_headers << hdr
|
||||
true
|
||||
else
|
||||
false
|
||||
|
@ -53,5 +56,7 @@ end
|
|||
if dblib.any? {|db| headers.db_check(db)}
|
||||
have_header("cdefs.h")
|
||||
have_header("sys/cdefs.h")
|
||||
have_func("dbm_pagfno", $dbm_headers)
|
||||
have_func("dbm_dirfno", $dbm_headers)
|
||||
create_makefile("dbm")
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue