This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.26-134-gc181840


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  c181840c93d3a8fcb50991b2326c40f34eb5e82b (commit)
       via  0bb2fabcb3bcac064a3d89917c0736353cdac2f4 (commit)
      from  65a086db91d4e06074b461b8e99efcebe1416a3f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c181840c93d3a8fcb50991b2326c40f34eb5e82b

commit c181840c93d3a8fcb50991b2326c40f34eb5e82b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Mon Jul 3 15:22:58 2017 -0300

    Consolidate non cancellable close call
    
    This patch consolidates all the non cancellable close calls to use
    the __close_nocancel{_nostatus} identifier.  For non cancellable targets
    it will be just a macro to call the default respective symbol while on Linux
    will be a internal one.
    
    Also, since it is used on libcrypto it is also exported in GLIBC_PRIVATE
    namespace.
    
    Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.
    
    	* sysdeps/generic/not-cancel.h (close_not_cancel): Remove macro.
    	(close_not_cancel_no_status): Likewise.
    	(__close_nocancel): New macro.
    	(__close_nocancel_no_status): 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_no_status): 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.

diff --git a/ChangeLog b/ChangeLog
index 4cdf2f7..b7493e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 d79a6b1..42f61fb 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 e7701b9..90c7895 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 f1dce29..d6a47de 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 514e38f..13e2f2a 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)
diff --git a/io/ftw.c b/io/ftw.c
index f33fed3..106b6bf 100644
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -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 f025178..b8b02ba 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 b78e7e5..0c20cbb 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 7825a1c..158cf14 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 781fa88..24ad671 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 26e3f4b..68e00f2 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 dd38f2b..21e7859 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 daaf6d6..03c0296 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_not_cancel_no_status (sock);
+    __close_nocancel_nostatus (sock);
  out:
   if (__nscd_drop_map_ref (mapped, &gc_cycle) != 0)
     {
diff --git a/nscd/nscd_getgr_r.c b/nscd/nscd_getgr_r.c
index 87b4552..1f60261 100644
--- a/nscd/nscd_getgr_r.c
+++ b/nscd/nscd_getgr_r.c
@@ -305,7 +305,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
 
  out_close:
   if (sock != -1)
-    close_not_cancel_no_status (sock);
+    __close_nocancel_nostatus (sock);
  out:
   if (__nscd_drop_map_ref (mapped, &gc_cycle) != 0)
     {
diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c
index daa708b..e234c7f 100644
--- a/nscd/nscd_gethst_r.c
+++ b/nscd/nscd_gethst_r.c
@@ -436,7 +436,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
 
  out_close:
   if (sock != -1)
-    close_not_cancel_no_status (sock);
+    __close_nocancel_nostatus (sock);
  out:
   if (__nscd_drop_map_ref (mapped, &gc_cycle) != 0)
     {
diff --git a/nscd/nscd_getpw_r.c b/nscd/nscd_getpw_r.c
index b291d2f..fbece1c 100644
--- a/nscd/nscd_getpw_r.c
+++ b/nscd/nscd_getpw_r.c
@@ -218,7 +218,7 @@ nscd_getpw_r (const char *key, size_t keylen, request_type type,
 
  out_close:
   if (sock != -1)
-    close_not_cancel_no_status (sock);
+    __close_nocancel_nostatus (sock);
  out:
   if (__nscd_drop_map_ref (mapped, &gc_cycle) != 0)
     {
diff --git a/nscd/nscd_getserv_r.c b/nscd/nscd_getserv_r.c
index 7dfb1c8..12c3104 100644
--- a/nscd/nscd_getserv_r.c
+++ b/nscd/nscd_getserv_r.c
@@ -356,7 +356,7 @@ nscd_getserv_r (const char *crit, size_t critlen, const char *proto,
 
  out_close:
   if (sock != -1)
-    close_not_cancel_no_status (sock);
+    __close_nocancel_nostatus (sock);
  out:
   if (__nscd_drop_map_ref (mapped, &gc_cycle) != 0)
     {
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index 22905d0..a225623 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -236,7 +236,7 @@ open_socket (request_type type, const char *key, size_t keylen)
     }
 
  out:
-  close_not_cancel_no_status (sock);
+  __close_nocancel_nostatus (sock);
 
   return -1;
 }
@@ -555,7 +555,7 @@ __nscd_open_socket (const char *key, size_t keylen, request_type type,
 	    return sock;
 	}
 
-      close_not_cancel_no_status (sock);
+      __close_nocancel_nostatus (sock);
     }
 
   __set_errno (saved_errno);
diff --git a/nscd/nscd_initgroups.c b/nscd/nscd_initgroups.c
index 00c6508..c06f2f8 100644
--- a/nscd/nscd_initgroups.c
+++ b/nscd/nscd_initgroups.c
@@ -157,7 +157,7 @@ __nscd_getgrouplist (const char *user, gid_t group, long int *size,
 
  out_close:
   if (sock != -1)
-    close_not_cancel_no_status (sock);
+    __close_nocancel_nostatus (sock);
  out:
   if (__nscd_drop_map_ref (mapped, &gc_cycle) != 0)
     {
diff --git a/nscd/nscd_netgroup.c b/nscd/nscd_netgroup.c
index 44f37ef..559bb34 100644
--- a/nscd/nscd_netgroup.c
+++ b/nscd/nscd_netgroup.c
@@ -139,7 +139,7 @@ __nscd_setnetgrent (const char *group, struct __netgrent *datap)
 
  out_close:
   if (sock != -1)
-    close_not_cancel_no_status (sock);
+    __close_nocancel_nostatus (sock);
  out:
   if (__nscd_drop_map_ref (mapped, &gc_cycle) != 0)
     {
@@ -263,7 +263,7 @@ __nscd_innetgr (const char *netgroup, const char *host, const char *user,
 
  out_close:
   if (sock != -1)
-    close_not_cancel_no_status (sock);
+    __close_nocancel_nostatus (sock);
  out:
   if (__nscd_drop_map_ref (mapped, &gc_cycle) != 0)
     {
diff --git a/nss/nss_db/db-open.c b/nss/nss_db/db-open.c
index 40a2540..bf08ac9 100644
--- a/nss/nss_db/db-open.c
+++ b/nss/nss_db/db-open.c
@@ -52,7 +52,7 @@ internal_setent (const char *file, struct nss_db_map *mapping)
 	    status = NSS_STATUS_TRYAGAIN;
 	}
 
-      close_not_cancel_no_status (fd);
+      __close_nocancel_nostatus (fd);
     }
 
   return status;
diff --git a/resolv/res-close.c b/resolv/res-close.c
index 21f038c..766bf42 100644
--- a/resolv/res-close.c
+++ b/resolv/res-close.c
@@ -94,7 +94,7 @@ __res_iclose (res_state statp, bool free_addr)
 {
   if (statp->_vcsock >= 0)
     {
-      close_not_cancel_no_status (statp->_vcsock);
+      __close_nocancel_nostatus (statp->_vcsock);
       statp->_vcsock = -1;
       statp->_flags &= ~(RES_F_VC | RES_F_CONN);
     }
@@ -103,7 +103,7 @@ __res_iclose (res_state statp, bool free_addr)
       {
         if (statp->_u._ext.nssocks[ns] != -1)
           {
-            close_not_cancel_no_status (statp->_u._ext.nssocks[ns]);
+            __close_nocancel_nostatus (statp->_u._ext.nssocks[ns]);
             statp->_u._ext.nssocks[ns] = -1;
           }
         if (free_addr)
diff --git a/sunrpc/pm_getmaps.c b/sunrpc/pm_getmaps.c
index 88c44f0..094492b 100644
--- a/sunrpc/pm_getmaps.c
+++ b/sunrpc/pm_getmaps.c
@@ -81,7 +81,7 @@ pmap_getmaps (struct sockaddr_in *address)
     }
   /* We only need to close the socket here if we opened  it.  */
   if (closeit)
-    close_not_cancel (socket);
+    __close_nocancel (socket);
   address->sin_port = 0;
   return head;
 }
diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h
index df9aea6..ee9988a 100644
--- a/sysdeps/generic/not-cancel.h
+++ b/sysdeps/generic/not-cancel.h
@@ -26,9 +26,9 @@
   __openat (__VA_ARGS__)
 #define __openat64_nocancel(...) \
   __openat64 (__VA_ARGS__)
-#define close_not_cancel(fd) \
+#define __close_nocancel(fd) \
   __close (fd)
-#define close_not_cancel_no_status(fd) \
+#define __close_nocancel_nostatus(fd) \
   (void) __close (fd)
 #define __read_nocancel(fd, buf, n) \
   __read (fd, buf, n)
diff --git a/sysdeps/posix/closedir.c b/sysdeps/posix/closedir.c
index e7b7d77..dbde65f 100644
--- a/sysdeps/posix/closedir.c
+++ b/sysdeps/posix/closedir.c
@@ -49,6 +49,6 @@ __closedir (DIR *dirp)
 
   free ((void *) dirp);
 
-  return close_not_cancel (fd);
+  return __close_nocancel (fd);
 }
 weak_alias (__closedir, closedir)
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 09f85fc..f02bbbe 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -2399,7 +2399,7 @@ getaddrinfo (const char *name, const char *service,
 		{
 		  if (fd != -1)
 		  close_retry:
-		    close_not_cancel_no_status (fd);
+		    __close_nocancel_nostatus (fd);
 		  af = q->ai_family;
 		  fd = __socket (af, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_IP);
 		}
@@ -2502,7 +2502,7 @@ getaddrinfo (const char *name, const char *service,
 	}
 
       if (fd != -1)
-	close_not_cancel_no_status (fd);
+	__close_nocancel_nostatus (fd);
 
       /* We got all the source addresses we can get, now sort using
 	 the information.  */
diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
index caa3527..702a052 100644
--- a/sysdeps/posix/getcwd.c
+++ b/sysdeps/posix/getcwd.c
@@ -176,7 +176,7 @@ extern char *alloca ();
 # include <kernel-features.h>
 #else
 # define __openat64_nocancel(dfd, name, mode) openat64 (dfd, name, mode)
-# define close_not_cancel_no_status(fd) close (fd)
+# define __close_nocancel_nostatus(fd) close (fd)
 #endif
 
 #ifndef PATH_MAX
@@ -521,7 +521,7 @@ __getcwd (char *buf, size_t size)
   if (dirstream != NULL)
     __closedir (dirstream);
   if (fd_needs_closing)
-    close_not_cancel_no_status (fd);
+    __close_nocancel_nostatus (fd);
 #ifndef NO_ALLOCATION
   if (buf == NULL)
     free (path);
diff --git a/sysdeps/posix/opendir.c b/sysdeps/posix/opendir.c
index 51a92e8..880ebc9 100644
--- a/sysdeps/posix/opendir.c
+++ b/sysdeps/posix/opendir.c
@@ -65,7 +65,7 @@ tryopen_o_directory (void)
 
   if (x >= 0)
     {
-      close_not_cancel_no_status (x);
+      __close_nocancel_nostatus (x);
       o_directory_works = -1;
     }
   else if (errno != ENOTDIR)
@@ -129,7 +129,7 @@ opendir_tail (int fd)
     {
       __set_errno (ENOTDIR);
     lose:
-      close_not_cancel_no_status (fd);
+      __close_nocancel_nostatus (fd);
       return NULL;
     }
 
@@ -227,7 +227,7 @@ __alloc_dir (int fd, bool close_fd, int flags, const struct stat64 *statp)
 	  if (close_fd)
 	    {
 	      int save_errno = errno;
-	      close_not_cancel_no_status (fd);
+	      __close_nocancel_nostatus (fd);
 	      __set_errno (save_errno);
 	    }
 	  return NULL;
diff --git a/sysdeps/posix/spawni.c b/sysdeps/posix/spawni.c
index b573271..0605562 100644
--- a/sysdeps/posix/spawni.c
+++ b/sysdeps/posix/spawni.c
@@ -157,7 +157,7 @@ __spawni_child (void *arguments)
 	  switch (action->tag)
 	    {
 	    case spawn_do_close:
-	      if (close_not_cancel (action->action.close_action.fd) != 0)
+	      if (__close_nocancel (action->action.close_action.fd) != 0)
 		{
 		  if (have_fdlimit == 0)
 		    {
@@ -180,7 +180,7 @@ __spawni_child (void *arguments)
 		   with the process already at maximum number of file descriptor
 		   opened and also for multiple actions on single-open special
 		   paths (like /dev/watchdog).  */
-		close_not_cancel (action->action.open_action.fd);
+		__close_nocancel (action->action.open_action.fd);
 
 		int new_fd = __open_nocancel (action->action.open_action.path,
 					      action->action.open_action.oflag
@@ -197,7 +197,7 @@ __spawni_child (void *arguments)
 			!= action->action.open_action.fd)
 		      goto fail;
 
-		    if (close_not_cancel (new_fd) != 0)
+		    if (__close_nocancel (new_fd) != 0)
 		      goto fail;
 		  }
 	      }
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index b553514..6c9e06f 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -171,6 +171,7 @@ libc {
     __syscall_rt_sigqueueinfo;
     __open_nocancel;
     __read_nocancel;
+    __close_nocancel;
     # functions used by nscd
     __netlink_assert_response;
   }
diff --git a/sysdeps/unix/sysv/linux/check_native.c b/sysdeps/unix/sysv/linux/check_native.c
index 7e5a7c9..dc2da83 100644
--- a/sysdeps/unix/sysv/linux/check_native.c
+++ b/sysdeps/unix/sysv/linux/check_native.c
@@ -167,7 +167,7 @@ __check_native (uint32_t a1_index, int *a1_native,
   while (! done);
 
  out:
-  close_not_cancel_no_status (fd);
+  __close_nocancel_nostatus (fd);
 
   return;
 
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index 3bf221a..4dd0275 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -328,7 +328,7 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
 				&addr_len) == 0)
 	    data = make_request (fd, nladdr.nl_pid);
 
-	  close_not_cancel_no_status (fd);
+	  __close_nocancel_nostatus (fd);
 	}
 
       if (data != NULL)
diff --git a/sysdeps/unix/sysv/linux/close.c b/sysdeps/unix/sysv/linux/close.c
index 1ac71ce..dd21d8d 100644
--- a/sysdeps/unix/sysv/linux/close.c
+++ b/sysdeps/unix/sysv/linux/close.c
@@ -18,6 +18,7 @@
 
 #include <unistd.h>
 #include <sysdep-cancel.h>
+#include <not-cancel.h>
 
 /* Close the file descriptor FD.  */
 int
@@ -28,3 +29,14 @@ __close (int fd)
 libc_hidden_def (__close)
 strong_alias (__close, __libc_close)
 weak_alias (__close, close)
+
+# if !IS_IN (rtld)
+int
+__close_nocancel (int fd)
+{
+  return INLINE_SYSCALL_CALL (close, fd);
+}
+#else
+strong_alias (__libc_close, __close_nocancel)
+#endif
+libc_hidden_def (__close_nocancel)
diff --git a/sysdeps/unix/sysv/linux/fips-private.h b/sysdeps/unix/sysv/linux/fips-private.h
index 775f2c2..23833f0 100644
--- a/sysdeps/unix/sysv/linux/fips-private.h
+++ b/sysdeps/unix/sysv/linux/fips-private.h
@@ -50,7 +50,7 @@ fips_enabled_p (void)
 	  char buf[32];
 	  ssize_t n;
 	  n = TEMP_FAILURE_RETRY (__read_nocancel (fd, buf, sizeof (buf) - 1));
-	  close_not_cancel_no_status (fd);
+	  __close_nocancel_nostatus (fd);
 
 	  if (n > 0)
 	    {
diff --git a/sysdeps/unix/sysv/linux/gethostid.c b/sysdeps/unix/sysv/linux/gethostid.c
index 11c7e73..ca03877 100644
--- a/sysdeps/unix/sysv/linux/gethostid.c
+++ b/sysdeps/unix/sysv/linux/gethostid.c
@@ -53,7 +53,7 @@ sethostid (long int id)
 
   written = __write_nocancel (fd, &id32, sizeof (id32));
 
-  close_not_cancel_no_status (fd);
+  __close_nocancel_nostatus (fd);
 
   return written != sizeof (id32) ? -1 : 0;
 }
@@ -82,7 +82,7 @@ gethostid (void)
     {
       ssize_t n = __read_nocancel (fd, &id, sizeof (id));
 
-      close_not_cancel_no_status (fd);
+      __close_nocancel_nostatus (fd);
 
       if (n == sizeof (id))
 	return id;
diff --git a/sysdeps/unix/sysv/linux/getloadavg.c b/sysdeps/unix/sysv/linux/getloadavg.c
index 64bad17..4b75741 100644
--- a/sysdeps/unix/sysv/linux/getloadavg.c
+++ b/sysdeps/unix/sysv/linux/getloadavg.c
@@ -43,7 +43,7 @@ getloadavg (double loadavg[], int nelem)
       int i;
 
       nread = __read_nocancel (fd, buf, sizeof buf - 1);
-      close_not_cancel_no_status (fd);
+      __close_nocancel_nostatus (fd);
       if (nread <= 0)
 	return -1;
       buf[nread - 1] = '\0';
diff --git a/sysdeps/unix/sysv/linux/getlogin_r.c b/sysdeps/unix/sysv/linux/getlogin_r.c
index 1de746b..45c468f 100644
--- a/sysdeps/unix/sysv/linux/getlogin_r.c
+++ b/sysdeps/unix/sysv/linux/getlogin_r.c
@@ -43,7 +43,7 @@ __getlogin_r_loginuid (char *name, size_t namesize)
   char uidbuf[12];
   ssize_t n = TEMP_FAILURE_RETRY (__read_nocancel (fd, uidbuf,
 						   sizeof (uidbuf)));
-  close_not_cancel_no_status (fd);
+  __close_nocancel_nostatus (fd);
 
   uid_t uid;
   char *endp;
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
index d1400d6..d02c86d 100644
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -180,7 +180,7 @@ __get_nprocs (void)
 	  }
 	while (l < re);
 
-      close_not_cancel_no_status (fd);
+      __close_nocancel_nostatus (fd);
 
       if (result > 0)
 	goto out;
@@ -207,7 +207,7 @@ __get_nprocs (void)
 	else if (isdigit (l[3]))
 	  ++result;
 
-      close_not_cancel_no_status (fd);
+      __close_nocancel_nostatus (fd);
     }
   else
     {
@@ -215,7 +215,7 @@ __get_nprocs (void)
       if (fd != -1)
 	{
 	  GET_NPROCS_PARSER (fd, buffer, cp, re, buffer_end, result);
-	  close_not_cancel_no_status (fd);
+	  __close_nocancel_nostatus (fd);
 	}
     }
 
diff --git a/sysdeps/unix/sysv/linux/grantpt.c b/sysdeps/unix/sysv/linux/grantpt.c
index 97c6ba7..2030e07 100644
--- a/sysdeps/unix/sysv/linux/grantpt.c
+++ b/sysdeps/unix/sysv/linux/grantpt.c
@@ -26,7 +26,7 @@ close_all_fds (void)
 	    char *endp;
 	    long int fd = strtol (d->d_name, &endp, 10);
 	    if (*endp == '\0' && fd != PTY_FILENO && fd != dirfd (dir))
-	      close_not_cancel_no_status (fd);
+	      __close_nocancel_nostatus (fd);
 	  }
 
       __closedir (dir);
diff --git a/sysdeps/unix/sysv/linux/i386/smp.h b/sysdeps/unix/sysv/linux/i386/smp.h
index eb1ac5d..320958a 100644
--- a/sysdeps/unix/sysv/linux/i386/smp.h
+++ b/sysdeps/unix/sysv/linux/i386/smp.h
@@ -47,7 +47,7 @@ is_smp_system (void)
 	/* This also didn't work.  We give up and say it's a UP machine.  */
 	u.buf[0] = '\0';
 
-      close_not_cancel_no_status (fd);
+      __close_nocancel_nostatus (fd);
       cp = u.buf;
     }
 
diff --git a/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c b/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
index 6aab1e8..79c95b4 100644
--- a/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
+++ b/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
@@ -41,7 +41,7 @@ has_cpuclock (void)
 	      || buf[0] != '0' || buf[1] != '\n')
 	    newval = -1;
 
-	  close_not_cancel_no_status (fd);
+	  __close_nocancel_nostatus (fd);
 	}
 
       itc_usable = newval;
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 8ba5eae..56f3f13 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -47,12 +47,12 @@ __if_nametoindex (const char *ifname)
   if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0)
     {
       int saved_errno = errno;
-      close_not_cancel_no_status (fd);
+      __close_nocancel_nostatus (fd);
       if (saved_errno == EINVAL)
 	__set_errno (ENOSYS);
       return 0;
     }
-  close_not_cancel_no_status (fd);
+  __close_nocancel_nostatus (fd);
   return ifr.ifr_ifindex;
 #endif
 }
@@ -224,7 +224,7 @@ __if_indextoname (unsigned int ifindex, char *ifname)
   ifr.ifr_ifindex = ifindex;
   status = __ioctl (fd, SIOCGIFNAME, &ifr);
 
-  close_not_cancel_no_status (fd);
+  __close_nocancel_nostatus (fd);
 
   if (status  < 0)
     {
diff --git a/sysdeps/unix/sysv/linux/libc_fatal.c b/sysdeps/unix/sysv/linux/libc_fatal.c
index c7c6a07..4bc1521 100644
--- a/sysdeps/unix/sysv/linux/libc_fatal.c
+++ b/sysdeps/unix/sysv/linux/libc_fatal.c
@@ -59,7 +59,7 @@ backtrace_and_maps (int do_abort, bool written, int fd)
           while ((n2 = __read_nocancel (fd2, buf, sizeof (buf))) > 0)
             if (__write_nocancel (fd, buf, n2) != n2)
               break;
-          close_not_cancel_no_status (fd2);
+          __close_nocancel_nostatus (fd2);
         }
     }
 }
diff --git a/sysdeps/unix/sysv/linux/malloc-sysdep.h b/sysdeps/unix/sysv/linux/malloc-sysdep.h
index 7a7acba..4bb7bc0 100644
--- a/sysdeps/unix/sysv/linux/malloc-sysdep.h
+++ b/sysdeps/unix/sysv/linux/malloc-sysdep.h
@@ -49,7 +49,7 @@ check_may_shrink_heap (void)
 	  char val;
 	  ssize_t n = __read_nocancel (fd, &val, 1);
 	  may_shrink_heap = n > 0 && val == '2';
-	  close_not_cancel_no_status (fd);
+	  __close_nocancel_nostatus (fd);
 	}
     }
 
diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
index 626430c..f12e6f5 100644
--- a/sysdeps/unix/sysv/linux/mq_notify.c
+++ b/sysdeps/unix/sysv/linux/mq_notify.c
@@ -209,7 +209,7 @@ init_mq_netlink (void)
 
   if (err != 0)
     {
-      close_not_cancel_no_status (netlink_socket);
+      __close_nocancel_nostatus (netlink_socket);
       netlink_socket = -1;
     }
 }
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index 08ad773..5182451 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -51,13 +51,16 @@ __typeof (__write) __write_nocancel;
 libc_hidden_proto (__write_nocancel)
 
 /* Uncancelable close.  */
-#define __close_nocancel(fd) \
-  INLINE_SYSCALL (close, 1, fd)
-#define close_not_cancel(fd) \
-  __close_nocancel (fd)
-#define close_not_cancel_no_status(fd) \
-  (void) ({ INTERNAL_SYSCALL_DECL (err);				      \
-	    INTERNAL_SYSCALL (close, err, 1, (fd)); })
+__typeof (__close) __close_nocancel;
+libc_hidden_proto (__close_nocancel)
+
+/* Non cancellable close syscall that does not also set errno in case of
+   failure.  */
+static inline void
+__close_nocancel_nostatus (int fd)
+{
+  __close_nocancel (fd);
+}
 
 /* Uncancelable writev.  */
 #define writev_not_cancel_no_status(fd, iov, n) \
diff --git a/sysdeps/unix/sysv/linux/pthread_getname.c b/sysdeps/unix/sysv/linux/pthread_getname.c
index 93c1dfd..d3dfee0 100644
--- a/sysdeps/unix/sysv/linux/pthread_getname.c
+++ b/sysdeps/unix/sysv/linux/pthread_getname.c
@@ -63,7 +63,7 @@ pthread_getname_np (pthread_t th, char *buf, size_t len)
 	buf[n] = '\0';
     }
 
-  close_not_cancel_no_status (fd);
+  __close_nocancel_nostatus (fd);
 
   return res;
 }
diff --git a/sysdeps/unix/sysv/linux/pthread_setname.c b/sysdeps/unix/sysv/linux/pthread_setname.c
index c5e9a33..2f68086 100644
--- a/sysdeps/unix/sysv/linux/pthread_setname.c
+++ b/sysdeps/unix/sysv/linux/pthread_setname.c
@@ -57,7 +57,7 @@ pthread_setname_np (pthread_t th, const char *name)
   else if (n != name_len)
     res = EIO;
 
-  close_not_cancel_no_status (fd);
+  __close_nocancel_nostatus (fd);
 
   return res;
 }
diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c
index 4994a07..dea1650 100644
--- a/sysdeps/unix/sysv/linux/spawni.c
+++ b/sysdeps/unix/sysv/linux/spawni.c
@@ -205,7 +205,7 @@ __spawni_child (void *arguments)
 	  switch (action->tag)
 	    {
 	    case spawn_do_close:
-	      if (close_not_cancel (action->action.close_action.fd) != 0)
+	      if (__close_nocancel (action->action.close_action.fd) != 0)
 		{
 		  if (!have_fdlimit)
 		    {
@@ -228,7 +228,7 @@ __spawni_child (void *arguments)
 		   with the process already at maximum number of file descriptor
 		   opened and also for multiple actions on single-open special
 		   paths (like /dev/watchdog).  */
-		close_not_cancel (action->action.open_action.fd);
+		__close_nocancel (action->action.open_action.fd);
 
 		int ret = __open_nocancel (action->action.open_action.path,
 					   action->action.
@@ -247,7 +247,7 @@ __spawni_child (void *arguments)
 			!= action->action.open_action.fd)
 		      goto fail;
 
-		    if (close_not_cancel (new_fd) != 0)
+		    if (__close_nocancel (new_fd) != 0)
 		      goto fail;
 		  }
 	      }
diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c
index f9becfb..773a6ac 100644
--- a/sysdeps/unix/sysv/linux/sysconf.c
+++ b/sysdeps/unix/sysv/linux/sysconf.c
@@ -122,7 +122,7 @@ __sysconf (int name)
 	  char buf[32];
 	  ssize_t n;
 	  n = TEMP_FAILURE_RETRY (__read_nocancel (fd, buf, sizeof (buf) - 1));
-	  close_not_cancel_no_status (fd);
+	  __close_nocancel_nostatus (fd);
 
 	  if (n > 0)
 	    {

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0bb2fabcb3bcac064a3d89917c0736353cdac2f4

commit 0bb2fabcb3bcac064a3d89917c0736353cdac2f4
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Mon Jul 3 15:00:26 2017 -0300

    Consolidate non cancellable openat call
    
    This patch consolidates all the non cancellable openat{64} calls to use
    the __openat{64}_nocancel identifier.  For non cancellable targets it will
    be just a macro to call the default respective symbol while on Linux
    will be a internal one.
    
    Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.
    
    	* sysdeps/generic/not-cancel.h (openat_not_cancel): Remove macro.
    	(openat_not_cancel_3): Likewise.
    	(openat64_not_cancel_3): Likewise).
    	(openat_not_cancel_3): Likewise).
    	* sysdeps/unix/sysv/linux/not-cancel.h (openat_not_cancel): Remove
    	macro.
    	(openat_not_cancel_3): Likewise.
    	(openat64_not_cancel): Likewise.
    	(openat64_not_cancel_3): Likewise.
    	* sysdeps/unix/sysv/linux/openat.c (__openat_nocancel): New function.
    	* sysdeps/unix/sysv/linux/openat64.c (__openat64_nocancel): Likewise.
    	* io/ftw.c (open_dir_stream): Replace openat{64}_not_cancel{_3} with
    	__open{64}_nocancel.
    	* sysdeps/mach/hurd/opendir.c (__opendirat): Likewise.
    	* sysdeps/posix/getcwd.c (__getcwd): Likewise.
    	* sysdeps/posix/opendir.c (__opendirat): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 1751cfb..4cdf2f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2017-08-18  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+	* sysdeps/generic/not-cancel.h (openat_not_cancel): Remove macro.
+	(openat_not_cancel_3): Likewise.
+	(openat64_not_cancel_3): Likewise).
+	(openat_not_cancel_3): Likewise).
+	* sysdeps/unix/sysv/linux/not-cancel.h (openat_not_cancel): Remove
+	macro.
+	(openat_not_cancel_3): Likewise.
+	(openat64_not_cancel): Likewise.
+	(openat64_not_cancel_3): Likewise.
+	* sysdeps/unix/sysv/linux/openat.c (__openat_nocancel): New function.
+	* sysdeps/unix/sysv/linux/openat64.c (__openat64_nocancel): Likewise.
+	* io/ftw.c (open_dir_stream): Replace openat{64}_not_cancel{_3} with
+	__open{64}_nocancel.
+	* sysdeps/mach/hurd/opendir.c (__opendirat): Likewise.
+	* sysdeps/posix/getcwd.c (__getcwd): Likewise.
+	* sysdeps/posix/opendir.c (__opendirat): Likewise.
+
 2017-08-18  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
diff --git a/io/ftw.c b/io/ftw.c
index 140a237..f33fed3 100644
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -337,8 +337,8 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp)
 
       if (dfdp != NULL && *dfdp != -1)
 	{
-	  int fd = openat64_not_cancel_3 (*dfdp, data->dirbuf + data->ftw.base,
-					  O_RDONLY | O_DIRECTORY | O_NDELAY);
+	  int fd = __openat64_nocancel (*dfdp, data->dirbuf + data->ftw.base,
+					O_RDONLY | O_DIRECTORY | O_NDELAY);
 	  dirp->stream = NULL;
 	  if (fd != -1 && (dirp->stream = __fdopendir (fd)) == NULL)
 	    close_not_cancel_no_status (fd);
diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h
index e91cb6c..df9aea6 100644
--- a/sysdeps/generic/not-cancel.h
+++ b/sysdeps/generic/not-cancel.h
@@ -22,14 +22,10 @@
   __open (__VA_ARGS__)
 #define __open64_nocancel(...) \
   __open64 (__VA_ARGS__)
-#define openat_not_cancel(fd, name, flags, mode) \
-  __openat (fd, name, flags, mode)
-#define openat_not_cancel_3(fd, name, flags) \
-  __openat (fd, name, flags, 0)
-#define openat64_not_cancel(fd, name, flags, mode) \
-  __openat64 (fd, name, flags, mode)
-#define openat64_not_cancel_3(fd, name, flags) \
-  __openat64 (fd, name, flags, 0)
+#define __openat_nocancel(...) \
+  __openat (__VA_ARGS__)
+#define __openat64_nocancel(...) \
+  __openat64 (__VA_ARGS__)
 #define close_not_cancel(fd) \
   __close (fd)
 #define close_not_cancel_no_status(fd) \
diff --git a/sysdeps/mach/hurd/opendir.c b/sysdeps/mach/hurd/opendir.c
index 8db70b2..d3757f0 100644
--- a/sysdeps/mach/hurd/opendir.c
+++ b/sysdeps/mach/hurd/opendir.c
@@ -86,7 +86,7 @@ __opendirat (int dfd, const char *name)
   assert (dfd == AT_FDCWD);
   fd = __open_nocancel (name, flags);
 #else
-  fd = openat_not_cancel_3 (dfd, name, flags);
+  fd = __openat_nocancel (dfd, name, flags);
 #endif
   if (fd < 0)
     return NULL;
diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
index 75bcfd2..caa3527 100644
--- a/sysdeps/posix/getcwd.c
+++ b/sysdeps/posix/getcwd.c
@@ -175,7 +175,7 @@ extern char *alloca ();
 # include <not-cancel.h>
 # include <kernel-features.h>
 #else
-# define openat64_not_cancel_3(dfd, name, mode) openat64 (dfd, name, mode)
+# define __openat64_nocancel(dfd, name, mode) openat64 (dfd, name, mode)
 # define close_not_cancel_no_status(fd) close (fd)
 #endif
 
@@ -281,7 +281,7 @@ __getcwd (char *buf, size_t size)
   while (!(thisdev == rootdev && thisino == rootino))
     {
       if (__have_atfcts >= 0)
-	  fd = openat64_not_cancel_3 (fd, "..", O_RDONLY | O_CLOEXEC);
+	  fd = __openat64_nocancel (fd, "..", O_RDONLY | O_CLOEXEC);
       else
 	fd = -1;
       if (fd >= 0)
diff --git a/sysdeps/posix/opendir.c b/sysdeps/posix/opendir.c
index 3ee27b2..51a92e8 100644
--- a/sysdeps/posix/opendir.c
+++ b/sysdeps/posix/opendir.c
@@ -161,7 +161,7 @@ __opendirat (int dfd, const char *name)
 	}
     }
 
-  return opendir_tail (openat_not_cancel_3 (dfd, name, opendir_oflags));
+  return opendir_tail (__openat_nocancel (dfd, name, opendir_oflags));
 }
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index 84dc72a..08ad773 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -34,6 +34,14 @@ libc_hidden_proto (__open_nocancel)
 __typeof (open64) __open64_nocancel;
 libc_hidden_proto (__open64_nocancel)
 
+/* Non cancellable openat syscall.  */
+__typeof (openat) __openat_nocancel;
+libc_hidden_proto (__openat_nocancel)
+
+/* Non cacellable openat syscall (LFS version).  */
+__typeof (openat64) __openat64_nocancel;
+libc_hidden_proto (__openat64_nocancel)
+
 /* Non cancellable read syscall.  */
 __typeof (__read) __read_nocancel;
 libc_hidden_proto (__read_nocancel)
@@ -42,16 +50,6 @@ libc_hidden_proto (__read_nocancel)
 __typeof (__write) __write_nocancel;
 libc_hidden_proto (__write_nocancel)
 
-/* Uncancelable openat.  */
-#define openat_not_cancel(fd, fname, oflag, mode) \
-  INLINE_SYSCALL (openat, 4, fd, fname, oflag, mode)
-#define openat_not_cancel_3(fd, fname, oflag) \
-  INLINE_SYSCALL (openat, 3, fd, fname, oflag)
-#define openat64_not_cancel(fd, fname, oflag, mode) \
-  INLINE_SYSCALL (openat, 4, fd, fname, oflag | O_LARGEFILE, mode)
-#define openat64_not_cancel_3(fd, fname, oflag) \
-  INLINE_SYSCALL (openat, 3, fd, fname, oflag | O_LARGEFILE)
-
 /* Uncancelable close.  */
 #define __close_nocancel(fd) \
   INLINE_SYSCALL (close, 1, fd)
diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
index 1587305..05c1b39 100644
--- a/sysdeps/unix/sysv/linux/openat.c
+++ b/sysdeps/unix/sysv/linux/openat.c
@@ -19,6 +19,7 @@
 #include <stdarg.h>
 
 #include <sysdep-cancel.h>
+#include <not-cancel.h>
 
 #ifndef __OFF_T_MATCHES_OFF64_T
 
@@ -43,4 +44,23 @@ weak_alias (__libc_openat, __openat)
 libc_hidden_weak (__openat)
 weak_alias (__libc_openat, openat)
 
+# if !IS_IN (rtld)
+int
+__openat_nocancel (int fd, const char *file, int oflag, ...)
+{
+  mode_t mode = 0;
+  if (__OPEN_NEEDS_MODE (oflag))
+    {
+      va_list arg;
+      va_start (arg, oflag);
+      mode = va_arg (arg, mode_t);
+      va_end (arg);
+    }
+
+  return INLINE_SYSCALL_CALL (openat, fd, file, oflag, mode);
+}
+# else
+strong_alias (__libc_openat, __openat_nocancel)
+# endif
+libc_hidden_weak (__openat_nocancel)
 #endif
diff --git a/sysdeps/unix/sysv/linux/openat64.c b/sysdeps/unix/sysv/linux/openat64.c
index 4942061..816e8f1 100644
--- a/sysdeps/unix/sysv/linux/openat64.c
+++ b/sysdeps/unix/sysv/linux/openat64.c
@@ -19,6 +19,13 @@
 #include <stdarg.h>
 
 #include <sysdep-cancel.h>
+#include <not-cancel.h>
+
+#ifdef __OFF_T_MATCHES_OFF64_T
+# define EXTRA_OPEN_FLAGS 0
+#else
+# define EXTRA_OPEN_FLAGS O_LARGEFILE
+#endif
 
 /* Open FILE with access OFLAG.  Interpret relative paths relative to
    the directory associated with FD.  If OFLAG includes O_CREAT or
@@ -35,12 +42,6 @@ __libc_openat64 (int fd, const char *file, int oflag, ...)
       va_end (arg);
     }
 
-#ifdef __OFF_T_MATCHES_OFF64_T
-# define EXTRA_OPEN_FLAGS 0
-#else
-# define EXTRA_OPEN_FLAGS O_LARGEFILE
-#endif
-
   return SYSCALL_CANCEL (openat, fd, file, oflag | EXTRA_OPEN_FLAGS, mode);
 }
 
@@ -48,8 +49,31 @@ strong_alias (__libc_openat64, __openat64)
 libc_hidden_weak (__openat64)
 weak_alias (__libc_openat64, openat64)
 
+#if !IS_IN (rtld)
+int
+__openat64_nocancel (int fd, const char *file, int oflag, ...)
+{
+  mode_t mode = 0;
+  if (__OPEN_NEEDS_MODE (oflag))
+    {
+      va_list arg;
+      va_start (arg, oflag);
+      mode = va_arg (arg, mode_t);
+      va_end (arg);
+    }
+
+  return INLINE_SYSCALL_CALL (openat, fd, file, oflag | EXTRA_OPEN_FLAGS,
+			      mode);
+}
+#else
+strong_alias (__libc_openat64, __openat64_nocancel)
+#endif
+libc_hidden_def (__openat64_nocancel)
+
 #ifdef __OFF_T_MATCHES_OFF64_T
 strong_alias (__libc_openat64, __openat)
 libc_hidden_weak (__openat)
 weak_alias (__libc_openat64, openat)
+
+strong_alias (__openat64_nocancel, __openat_nocancel)
 #endif

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                   |   92 +++++++++++++++++++++++++++
 catgets/open_catalog.c                      |    2 +-
 gmon/gmon.c                                 |    2 +-
 iconv/gconv_cache.c                         |    4 +-
 intl/loadmsgcat.c                           |    2 +-
 io/ftw.c                                    |    8 +-
 libio/fileops.c                             |    6 +-
 libio/iopopen.c                             |    2 +-
 locale/loadarchive.c                        |    6 +-
 locale/loadlocale.c                         |    6 +-
 login/utmp_file.c                           |    8 +-
 misc/daemon.c                               |    4 +-
 nscd/nscd_getai.c                           |    2 +-
 nscd/nscd_getgr_r.c                         |    2 +-
 nscd/nscd_gethst_r.c                        |    2 +-
 nscd/nscd_getpw_r.c                         |    2 +-
 nscd/nscd_getserv_r.c                       |    2 +-
 nscd/nscd_helper.c                          |    4 +-
 nscd/nscd_initgroups.c                      |    2 +-
 nscd/nscd_netgroup.c                        |    4 +-
 nss/nss_db/db-open.c                        |    2 +-
 resolv/res-close.c                          |    4 +-
 sunrpc/pm_getmaps.c                         |    2 +-
 sysdeps/generic/not-cancel.h                |   16 ++---
 sysdeps/mach/hurd/opendir.c                 |    2 +-
 sysdeps/posix/closedir.c                    |    2 +-
 sysdeps/posix/getaddrinfo.c                 |    4 +-
 sysdeps/posix/getcwd.c                      |    8 +-
 sysdeps/posix/opendir.c                     |    8 +-
 sysdeps/posix/spawni.c                      |    6 +-
 sysdeps/unix/sysv/linux/Versions            |    1 +
 sysdeps/unix/sysv/linux/check_native.c      |    2 +-
 sysdeps/unix/sysv/linux/check_pf.c          |    2 +-
 sysdeps/unix/sysv/linux/close.c             |   12 ++++
 sysdeps/unix/sysv/linux/fips-private.h      |    2 +-
 sysdeps/unix/sysv/linux/gethostid.c         |    4 +-
 sysdeps/unix/sysv/linux/getloadavg.c        |    2 +-
 sysdeps/unix/sysv/linux/getlogin_r.c        |    2 +-
 sysdeps/unix/sysv/linux/getsysstats.c       |    6 +-
 sysdeps/unix/sysv/linux/grantpt.c           |    2 +-
 sysdeps/unix/sysv/linux/i386/smp.h          |    2 +-
 sysdeps/unix/sysv/linux/ia64/has_cpuclock.c |    2 +-
 sysdeps/unix/sysv/linux/if_index.c          |    6 +-
 sysdeps/unix/sysv/linux/libc_fatal.c        |    2 +-
 sysdeps/unix/sysv/linux/malloc-sysdep.h     |    2 +-
 sysdeps/unix/sysv/linux/mq_notify.c         |    2 +-
 sysdeps/unix/sysv/linux/not-cancel.h        |   35 +++++-----
 sysdeps/unix/sysv/linux/openat.c            |   20 ++++++
 sysdeps/unix/sysv/linux/openat64.c          |   36 +++++++++--
 sysdeps/unix/sysv/linux/pthread_getname.c   |    2 +-
 sysdeps/unix/sysv/linux/pthread_setname.c   |    2 +-
 sysdeps/unix/sysv/linux/spawni.c            |    6 +-
 sysdeps/unix/sysv/linux/sysconf.c           |    2 +-
 53 files changed, 258 insertions(+), 112 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]