diff options
50 files changed, 171 insertions, 82 deletions
@@ -1,5 +1,78 @@ 2017-08-18 Adhemerval Zanella <adhemerval.zanella@linaro.org> + * sysdeps/generic/not-cancel.h (close_not_cancel): Remove macro. + (close_not_cancel_no_status): Likewise. + (__close_nocancel): New macro. + (__close_nocancel_nostatus): Likewise. + * sysdeps/unix/sysv/linux/not-cancel.h (__close_nocancel): Remove + macro. + (close_not_cancel): Likewise. + (close_not_cancel_no_status): Likewise. + (__close_nocancel): New prototype. + (__close_nocancel_nostatus): New function. + * sysdeps/unix/sysv/linux/close.c (__close_nocancel): New function. + * catgets/open_catalog.c (__open_catalog): Replace + close_not_cancel{_no_status) with __close_nocancel{_nostatus}. + * gmon/gmon.c (write_gmon): Likewise. + * iconv/gconv_cache.c (__gconv_load_cache): Likewise. + * intl/loadmsgcat.c (close): Likewise. + * io/ftw.c (open_dir_stream): Likewise. + (ftw_startup): Likewise. + * libio/fileops.c (_IO_file_open): Likewise. + (_IO_file_close_mmap): Likewise. + (_IO_file_close): Likewise. + * libio/iopopen.c (_IO_dup2): Likewise. + * locale/loadarchive.c (_nl_load_locale_from_archive): Likewise. + * locale/loadlocale.c (_nl_load_locale): Likewise. + * login/utmp_file.c (pututline_file): Likewise. + (endutent_file): Likewise. + * misc/daemon.c (daemon): Likewise. + * nscd/nscd_getai.c (__nscd_getai): Likewise. + * nscd/nscd_getgr_r.c (nscd_getgr_r): Likewise. + * nscd/nscd_gethst_r.c (nscd_gethst_r): Likewise. + * nscd/nscd_getpw_r.c (nscd_getpw_r): Likewise. + * nscd/nscd_getserv_r.c (nscd_getserv_r): Likewise. + * nscd/nscd_helper.c (open_socket): Likewise. + (__nscd_open_socket): Likewise. + * nscd/nscd_initgroups.c (__nscd_getgrouplist): Likewise. + * nscd/nscd_netgroup.c (__nscd_setnetgrent): Likewise. + (__nscd_innetgr): Likewise. + * nss/nss_db/db-open.c (internal_setent): Likewise. + * resolv/res-close.c (__res_iclose): Likewise. + * sunrpc/pm_getmaps.c (pmap_getmaps): Likewise. + * sysdeps/posix/closedir.c (__closedir): Likewise. + * sysdeps/posix/getaddrinfo.c (getaddrinfo): Likewise. + * sysdeps/posix/getcwd.c (__getcwd): Likewise. + * sysdeps/posix/opendir.c (tryopen_o_directory): Likewise. + (opendir_tail): Likewise. + * sysdeps/posix/spawni.c (__spawni_child): Likewise. + * sysdeps/unix/sysv/linux/check_native.c (__check_native): Likewise. + * sysdeps/unix/sysv/linux/check_pf.c (__check_pf): Likewise. + * sysdeps/unix/sysv/linux/fips-private.h (fips_enabled_p): Likewise. + * sysdeps/unix/sysv/linux/gethostid.c (sethostid): Likewise. + (gethostid): Likewise. + * sysdeps/unix/sysv/linux/getloadavg.c (getloadavg): Likewise. + * sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid): + Likewise. + * sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Likewise. + * sysdeps/unix/sysv/linux/grantpt.c (close_all_fds): Likewise. + * sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise. + * sysdeps/unix/sysv/linux/ia64/has_cpuclock.c (has_cpuclock): + Likewise. + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): Likewise. + * sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps): Likewise. + * sysdeps/unix/sysv/linux/malloc-sysdep.h (check_may_shrink_heap): + Likewise. + * sysdeps/unix/sysv/linux/mq_notify.c (init_mq_netlink): Likewise. + * sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np): + Likewise. + * sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np): + Likewise. + * sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Likewise. + * sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Likewise. + * sysdeps/unix/sysv/linux/Versions (libc) [GLIBC_PRIVATE]: Add + __close_nocancel. + * sysdeps/generic/not-cancel.h (openat_not_cancel): Remove macro. (openat_not_cancel_3): Likewise. (openat64_not_cancel_3): Likewise). diff --git a/catgets/open_catalog.c b/catgets/open_catalog.c index d79a6b1f34..42f61fb3f1 100644 --- a/catgets/open_catalog.c +++ b/catgets/open_catalog.c @@ -328,7 +328,7 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var, /* Release the lock again. */ close_unlock_return: - close_not_cancel_no_status (fd); + __close_nocancel_nostatus (fd); free (buf); return result; diff --git a/gmon/gmon.c b/gmon/gmon.c index e7701b9757..90c7895980 100644 --- a/gmon/gmon.c +++ b/gmon/gmon.c @@ -386,7 +386,7 @@ write_gmon (void) /* write basic-block execution counts: */ write_bb_counts (fd); - close_not_cancel_no_status (fd); + __close_nocancel_nostatus (fd); } diff --git a/iconv/gconv_cache.c b/iconv/gconv_cache.c index f1dce291f5..d6a47de838 100644 --- a/iconv/gconv_cache.c +++ b/iconv/gconv_cache.c @@ -71,7 +71,7 @@ __gconv_load_cache (void) || (size_t) st.st_size < sizeof (struct gconvcache_header)) { close_and_exit: - close_not_cancel_no_status (fd); + __close_nocancel_nostatus (fd); return -1; } @@ -108,7 +108,7 @@ __gconv_load_cache (void) } /* We don't need the file descriptor anymore. */ - close_not_cancel_no_status (fd); + __close_nocancel_nostatus (fd); /* Check the consistency. */ header = (struct gconvcache_header *) gconv_cache; diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c index 514e38fed6..13e2f2a573 100644 --- a/intl/loadmsgcat.c +++ b/intl/loadmsgcat.c @@ -446,7 +446,7 @@ because some ISO C functions will require linking with this object file and the name space must not be polluted. */ # define open(name, flags) __open_nocancel (name, flags) -# define close(fd) close_not_cancel_no_status (fd) +# define close(fd) __close_nocancel_nostatus (fd) # define read(fd, buf, n) __read_nocancel (fd, buf, n) # define mmap(addr, len, prot, flags, fd, offset) \ __mmap (addr, len, prot, flags, fd, offset) @@ -341,7 +341,7 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp) O_RDONLY | O_DIRECTORY | O_NDELAY); dirp->stream = NULL; if (fd != -1 && (dirp->stream = __fdopendir (fd)) == NULL) - close_not_cancel_no_status (fd); + __close_nocancel_nostatus (fd); } else { @@ -791,7 +791,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, { int save_err = errno; __fchdir (cwdfd); - close_not_cancel_no_status (cwdfd); + __close_nocancel_nostatus (cwdfd); __set_errno (save_err); } else if (cwd != NULL) diff --git a/libio/fileops.c b/libio/fileops.c index f02517877a..b8b02ba261 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -242,7 +242,7 @@ _IO_file_open (_IO_FILE *fp, const char *filename, int posix_mode, int prot, _IO_off64_t new_pos = _IO_SYSSEEK (fp, 0, _IO_seek_end); if (new_pos == _IO_pos_BAD && errno != ESPIPE) { - close_not_cancel (fdesc); + __close_nocancel (fdesc); return NULL; } } @@ -1231,7 +1231,7 @@ _IO_file_close_mmap (_IO_FILE *fp) fp->_IO_buf_base = fp->_IO_buf_end = NULL; /* Cancelling close should be avoided if possible since it leaves an unrecoverable state behind. */ - return close_not_cancel (fp->_fileno); + return __close_nocancel (fp->_fileno); } int @@ -1239,7 +1239,7 @@ _IO_file_close (_IO_FILE *fp) { /* Cancelling close should be avoided if possible since it leaves an unrecoverable state behind. */ - return close_not_cancel (fp->_fileno); + return __close_nocancel (fp->_fileno); } libc_hidden_def (_IO_file_close) diff --git a/libio/iopopen.c b/libio/iopopen.c index b78e7e5ef2..0c20cbbfe2 100644 --- a/libio/iopopen.c +++ b/libio/iopopen.c @@ -76,7 +76,7 @@ extern int _IO_dup2 (int fd, int fd2) __THROW; #ifndef _IO_close #ifdef _LIBC -#define _IO_close close_not_cancel +#define _IO_close __close_nocancel #else #define _IO_close close #endif diff --git a/locale/loadarchive.c b/locale/loadarchive.c index 7825a1c655..158cf14af8 100644 --- a/locale/loadarchive.c +++ b/locale/loadarchive.c @@ -213,7 +213,7 @@ _nl_load_locale_from_archive (int category, const char **namep) /* stat failed, very strange. */ close_and_out: if (fd >= 0) - close_not_cancel_no_status (fd); + __close_nocancel_nostatus (fd); return NULL; } @@ -253,7 +253,7 @@ _nl_load_locale_from_archive (int category, const char **namep) { /* We've mapped the whole file already, so we can be sure we won't need this file descriptor later. */ - close_not_cancel_no_status (fd); + __close_nocancel_nostatus (fd); fd = -1; } @@ -452,7 +452,7 @@ _nl_load_locale_from_archive (int category, const char **namep) /* We don't need the file descriptor any longer. */ if (fd >= 0) - close_not_cancel_no_status (fd); + __close_nocancel_nostatus (fd); fd = -1; /* We succeeded in mapping all the necessary regions of the archive. diff --git a/locale/loadlocale.c b/locale/loadlocale.c index 781fa8808c..24ad671ead 100644 --- a/locale/loadlocale.c +++ b/locale/loadlocale.c @@ -181,7 +181,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category) if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0) { puntfd: - close_not_cancel_no_status (fd); + __close_nocancel_nostatus (fd); return; } if (__glibc_unlikely (S_ISDIR (st.st_mode))) @@ -191,7 +191,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category) char *newp; size_t filenamelen; - close_not_cancel_no_status (fd); + __close_nocancel_nostatus (fd); filenamelen = strlen (file->filename); newp = (char *) alloca (filenamelen @@ -257,7 +257,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category) #endif /* _POSIX_MAPPED_FILES */ /* We have mapped the data, so we no longer need the descriptor. */ - close_not_cancel_no_status (fd); + __close_nocancel_nostatus (fd); if (__glibc_unlikely (filedata == NULL)) /* We failed to map or read the data. */ diff --git a/login/utmp_file.c b/login/utmp_file.c index 26e3f4bf89..68e00f2a02 100644 --- a/login/utmp_file.c +++ b/login/utmp_file.c @@ -382,10 +382,10 @@ pututline_file (const struct utmp *data) if (__lseek64 (new_fd, __lseek64 (file_fd, 0, SEEK_CUR), SEEK_SET) == -1 || __dup2 (new_fd, file_fd) < 0) { - close_not_cancel_no_status (new_fd); + __close_nocancel_nostatus (new_fd); return NULL; } - close_not_cancel_no_status (new_fd); + __close_nocancel_nostatus (new_fd); file_writable = true; } @@ -471,7 +471,7 @@ endutent_file (void) { assert (file_fd >= 0); - close_not_cancel_no_status (file_fd); + __close_nocancel_nostatus (file_fd); file_fd = -1; } @@ -518,7 +518,7 @@ unlock_return: UNLOCK_FILE (fd); /* Close WTMP file. */ - close_not_cancel_no_status (fd); + __close_nocancel_nostatus (fd); return result; } diff --git a/misc/daemon.c b/misc/daemon.c index dd38f2b87f..21e785966a 100644 --- a/misc/daemon.c +++ b/misc/daemon.c @@ -80,12 +80,12 @@ daemon (int nochdir, int noclose) } else { /* We must set an errno value since no function call actually failed. */ - close_not_cancel_no_status (fd); + __close_nocancel_nostatus (fd); __set_errno (ENODEV); return -1; } } else { - close_not_cancel_no_status (fd); + __close_nocancel_nostatus (fd); return -1; } } diff --git a/nscd/nscd_getai.c b/nscd/nscd_getai.c index daaf6d68b2..03c02961d1 100644 --- a/nscd/nscd_getai.c +++ b/nscd/nscd_getai.c @@ -189,7 +189,7 @@ __nscd_getai (const char *key, struct nscd_ai_result **result, int *h_errnop) out_close: if (sock != -1) - close_ |
