mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-23 07:19:15 +00:00
067428c171
This simplifies Emacs a bit, since it no longer needs to worry about closing file descriptors by hand in some cases. It also fixes some unlikely races. Not all such races, as libraries often open files internally without setting close-on-exec, but it's an improvement. * admin/merge-gnulib (GNULIB_MODULES): Add fcntl, pipe2. (GNULIB_TOOL_FLAGS): Avoid binary-io, close. Do not avoid fcntl. * configure.ac (mkostemp): New function to check for. (PTY_OPEN): Pass O_CLOEXEC to posix_openpt. * lib/fcntl.c, lib/getdtablesize.c, lib/pipe2.c, m4/fcntl.m4: * m4/getdtablesize.m4, m4/pipe2.m4: New files, taken from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * nt/gnulib.mk: Remove empty gl_GNULIB_ENABLED_verify section; otherwise, gnulib-tool complains given close-on-exec changes. * nt/inc/ms-w32.h (pipe): Remove. * nt/mingw-cfg.site (ac_cv_func_fcntl, gl_cv_func_fcntl_f_dupfd_cloexec) (gl_cv_func_fcntl_f_dupfd_works, ac_cv_func_pipe2): New vars. * src/alloc.c (valid_pointer_p) [!WINDOWSNT]: * src/callproc.c (Fcall_process) [!MSDOS]: * src/emacs.c (main) [!DOS_NT]: * src/nsterm.m (ns_term_init): * src/process.c (create_process): Use 'pipe2' with O_CLOEXEC instead of 'pipe'. * src/emacs.c (Fcall_process_region) [HAVE_MKOSTEMP]: * src/filelock.c (create_lock_file) [HAVE_MKOSTEMP]: Prefer mkostemp with O_CLOEXEC to mkstemp. * src/callproc.c (relocate_fd) [!WINDOWSNT]: * src/emacs.c (main): Use F_DUPFD_CLOEXEC, not plain F_DUPFD. No need to use fcntl (..., F_SETFD, FD_CLOEXEC), since we're now using pipe2. * src/filelock.c (create_lock_file) [! HAVE_MKOSTEMP]: Make the resulting file descriptor close-on-exec. * src/lisp.h, src/lread.c, src/process.c (close_load_descs, close_process_descs): * src/lread.c (load_descriptor_list, load_descriptor_unwind): Remove; no longer needed. All uses removed. * src/process.c (SOCK_CLOEXEC): Define to 0 if not supplied by system. (close_on_exec, accept4, process_socket) [!SOCK_CLOEXEC]: New functions. (socket) [!SOCK_CLOEXEC]: Supply a substitute. (Fmake_network_process, Fnetwork_interface_list): (Fnetwork_interface_info, server_accept_connection): Make newly-created socket close-on-exec. * src/sysdep.c (emacs_open, emacs_fopen): Make new-created descriptor close-on-exec. * src/w32.c (fcntl): Support F_DUPFD_CLOEXEC well enough for Emacs. * src/w32.c, src/w32.h (pipe2): Rename from 'pipe', with new flags arg. Fixes: debbugs:14803 |
||
---|---|---|
.. | ||
00gnulib.m4 | ||
acl.m4 | ||
alloca.m4 | ||
c-strtod.m4 | ||
clock_time.m4 | ||
close-stream.m4 | ||
dirent_h.m4 | ||
dup2.m4 | ||
environ.m4 | ||
errno_h.m4 | ||
euidaccess.m4 | ||
execinfo.m4 | ||
extensions.m4 | ||
extern-inline.m4 | ||
faccessat.m4 | ||
fcntl_h.m4 | ||
fcntl.m4 | ||
fdatasync.m4 | ||
fdopendir.m4 | ||
filemode.m4 | ||
fpending.m4 | ||
fstatat.m4 | ||
fsync.m4 | ||
getdtablesize.m4 | ||
getgroups.m4 | ||
getloadavg.m4 | ||
getopt.m4 | ||
gettime.m4 | ||
gettimeofday.m4 | ||
gnulib-common.m4 | ||
gnulib-comp.m4 | ||
gnulib-tool.m4 | ||
group-member.m4 | ||
include_next.m4 | ||
inttypes.m4 | ||
largefile.m4 | ||
longlong.m4 | ||
lstat.m4 | ||
manywarnings.m4 | ||
md5.m4 | ||
memrchr.m4 | ||
mktime.m4 | ||
multiarch.m4 | ||
nocrash.m4 | ||
off_t.m4 | ||
pathmax.m4 | ||
pipe2.m4 | ||
pselect.m4 | ||
pthread_sigmask.m4 | ||
putenv.m4 | ||
readlink.m4 | ||
readlinkat.m4 | ||
setenv.m4 | ||
sha1.m4 | ||
sha256.m4 | ||
sha512.m4 | ||
sig2str.m4 | ||
signal_h.m4 | ||
socklen.m4 | ||
ssize_t.m4 | ||
st_dm_mode.m4 | ||
stat-time.m4 | ||
stat.m4 | ||
stdalign.m4 | ||
stdarg.m4 | ||
stdbool.m4 | ||
stddef_h.m4 | ||
stdint.m4 | ||
stdio_h.m4 | ||
stdlib_h.m4 | ||
strftime.m4 | ||
string_h.m4 | ||
strtoimax.m4 | ||
strtoll.m4 | ||
strtoull.m4 | ||
strtoumax.m4 | ||
symlink.m4 | ||
sys_select_h.m4 | ||
sys_socket_h.m4 | ||
sys_stat_h.m4 | ||
sys_time_h.m4 | ||
sys_types_h.m4 | ||
time_h.m4 | ||
time_r.m4 | ||
timer_time.m4 | ||
timespec.m4 | ||
tm_gmtoff.m4 | ||
unistd_h.m4 | ||
utimbuf.m4 | ||
utimens.m4 | ||
utimes.m4 | ||
warnings.m4 | ||
wchar_t.m4 |