Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dup2.c #4483

Merged
merged 1 commit into from
May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion LEGAL
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,6 @@ mentioned below.
[include/ruby/st.h]
[missing/acosh.c]
[missing/alloca.c]
[missing/dup2.c]
[missing/erf.c]
[missing/finite.c]
[missing/hypot.c]
Expand Down
9 changes: 7 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1858,10 +1858,16 @@ AS_CASE(["$target_os"],[freebsd*],[
AC_REPLACE_FUNCS(close)
])

AC_DEFUN([RUBY_REQUIRE_FUNC], [
AC_CHECK_FUNCS([$1])
AS_IF([test "$ac_cv_func_[]AS_TR_SH($1)" = yes], [],
[AC_MSG_ERROR($1[() must be supported])])
])
m4_map_args_w([dup dup2], [RUBY_REQUIRE_FUNC(], [)])

AC_REPLACE_FUNCS(acosh)
AC_REPLACE_FUNCS(cbrt)
AC_REPLACE_FUNCS(crypt)
AC_REPLACE_FUNCS(dup2)
AC_REPLACE_FUNCS(erf)
AC_REPLACE_FUNCS(explicit_bzero)
AC_REPLACE_FUNCS(ffs)
Expand Down Expand Up @@ -1922,7 +1928,6 @@ AC_CHECK_FUNCS(dirfd)
AC_CHECK_FUNCS(dl_iterate_phdr)
AC_CHECK_FUNCS(dlopen)
AC_CHECK_FUNCS(dladdr)
AC_CHECK_FUNCS(dup)
AC_CHECK_FUNCS(dup3)
AC_CHECK_FUNCS(eaccess)
AC_CHECK_FUNCS(endgrent)
Expand Down
4 changes: 0 additions & 4 deletions include/ruby/missing.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ RUBY_EXTERN double atanh(double);
RUBY_EXTERN char *crypt(const char *, const char *);
#endif

#ifndef HAVE_DUP2
RUBY_EXTERN int dup2(int, int);
#endif

#ifndef HAVE_EACCESS
RUBY_EXTERN int eaccess(const char*, int);
#endif
Expand Down
4 changes: 1 addition & 3 deletions io.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,16 +462,14 @@ rb_cloexec_fcntl_dupfd(int fd, int minfd)
}
#elif defined(HAVE_FCNTL) && defined(F_DUPFD)
ret = fcntl(fd, F_DUPFD, minfd);
#elif defined(HAVE_DUP)
#else
ret = dup(fd);
if (ret >= 0 && ret < minfd) {
const int prev_fd = ret;
ret = rb_cloexec_fcntl_dupfd(fd, minfd);
close(prev_fd);
}
return ret;
#else
# error "dup() or fcntl(F_DUPFD) must be supported."
#endif
if (ret < 0) return ret;
rb_maygvl_fd_fix_cloexec(ret);
Expand Down
60 changes: 0 additions & 60 deletions missing/dup2.c

This file was deleted.