about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/clock_gettime.c4
-rw-r--r--sysdeps/unix/clock_settime.c4
-rw-r--r--sysdeps/unix/grantpt.c4
-rw-r--r--sysdeps/unix/sysv/linux/accept4.c2
-rw-r--r--sysdeps/unix/sysv/linux/adjtime.c2
-rw-r--r--sysdeps/unix/sysv/linux/check_pf.c2
-rw-r--r--sysdeps/unix/sysv/linux/dl-osinfo.h4
-rw-r--r--sysdeps/unix/sysv/linux/faccessat.c4
-rw-r--r--sysdeps/unix/sysv/linux/fchmodat.c4
-rw-r--r--sysdeps/unix/sysv/linux/fchownat.c4
-rw-r--r--sysdeps/unix/sysv/linux/futimesat.c6
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat.c6
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat64.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/fallocate.c2
-rw-r--r--sysdeps/unix/sysv/linux/i386/fallocate64.c2
-rw-r--r--sysdeps/unix/sysv/linux/i386/fchownat.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/fxstatat.c8
-rw-r--r--sysdeps/unix/sysv/linux/i386/get_clockfreq.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/posix_fallocate.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/posix_fallocate64.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/scandir64.c2
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/linux/ifaddrs.c8
-rw-r--r--sysdeps/unix/sysv/linux/linkat.c4
-rw-r--r--sysdeps/unix/sysv/linux/mkdirat.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_unlink.c2
-rw-r--r--sysdeps/unix/sysv/linux/openat.c4
-rw-r--r--sysdeps/unix/sysv/linux/posix_fallocate.c4
-rw-r--r--sysdeps/unix/sysv/linux/posix_fallocate64.c4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/fchownat.c4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c4
-rw-r--r--sysdeps/unix/sysv/linux/readlinkat.c4
-rw-r--r--sysdeps/unix/sysv/linux/recvmmsg.c2
-rw-r--r--sysdeps/unix/sysv/linux/renameat.c6
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/linux/sched_setaffinity.c2
-rw-r--r--sysdeps/unix/sysv/linux/sendmmsg.c2
-rw-r--r--sysdeps/unix/sysv/linux/shm_open.c6
-rw-r--r--sysdeps/unix/sysv/linux/sleep.c2
-rw-r--r--sysdeps/unix/sysv/linux/symlinkat.c4
-rw-r--r--sysdeps/unix/sysv/linux/tcgetattr.c2
-rw-r--r--sysdeps/unix/sysv/linux/ttyname.c4
-rw-r--r--sysdeps/unix/sysv/linux/ttyname_r.c6
-rw-r--r--sysdeps/unix/sysv/linux/unlinkat.c4
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c4
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c4
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h4
-rw-r--r--sysdeps/unix/sysv/linux/xmknodat.c2
49 files changed, 92 insertions, 92 deletions
diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c
index 4a1e5b61c6..d4ca697444 100644
--- a/sysdeps/unix/clock_gettime.c
+++ b/sysdeps/unix/clock_gettime.c
@@ -41,14 +41,14 @@ hp_timing_gettime (clockid_t clock_id, struct timespec *tp)
 {
   hp_timing_t tsc;
 
-  if (__builtin_expect (freq == 0, 0))
+  if (__glibc_unlikely (freq == 0))
     {
       /* This can only happen if we haven't initialized the `freq'
 	 variable yet.  Do this now. We don't have to protect this
 	 code against multiple execution since all of them should
 	 lead to the same result.  */
       freq = __get_clockfreq ();
-      if (__builtin_expect (freq == 0, 0))
+      if (__glibc_unlikely (freq == 0))
 	/* Something went wrong.  */
 	return -1;
     }
diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c
index f3c67ef8c9..7ce6dfc1f2 100644
--- a/sysdeps/unix/clock_settime.c
+++ b/sysdeps/unix/clock_settime.c
@@ -43,14 +43,14 @@ hp_timing_settime (clockid_t clock_id, const struct timespec *tp)
   /* First thing is to get the current time.  */
   HP_TIMING_NOW (tsc);
 
-  if (__builtin_expect (freq == 0, 0))
+  if (__glibc_unlikely (freq == 0))
     {
       /* This can only happen if we haven't initialized the `freq'
 	 variable yet.  Do this now. We don't have to protect this
 	 code against multiple execution since all of them should lead
 	 to the same result.  */
       freq = __get_clockfreq ();
-      if (__builtin_expect (freq == 0, 0))
+      if (__glibc_unlikely (freq == 0))
 	/* Something went wrong.  */
 	return -1;
     }
diff --git a/sysdeps/unix/grantpt.c b/sysdeps/unix/grantpt.c
index 602dfb623a..c4f067f036 100644
--- a/sysdeps/unix/grantpt.c
+++ b/sysdeps/unix/grantpt.c
@@ -108,7 +108,7 @@ grantpt (int fd)
   char *buf = _buf;
   struct stat64 st;
 
-  if (__builtin_expect (pts_name (fd, &buf, sizeof (_buf), &st), 0))
+  if (__glibc_unlikely (pts_name (fd, &buf, sizeof (_buf), &st)))
     {
       int save_errno = errno;
 
@@ -136,7 +136,7 @@ grantpt (int fd)
     }
 
   static int tty_gid = -1;
-  if (__builtin_expect (tty_gid == -1, 0))
+  if (__glibc_unlikely (tty_gid == -1))
     {
       char *grtmpbuf;
       struct group grbuf;
diff --git a/sysdeps/unix/sysv/linux/accept4.c b/sysdeps/unix/sysv/linux/accept4.c
index 0e2113434a..019e96b677 100644
--- a/sysdeps/unix/sysv/linux/accept4.c
+++ b/sysdeps/unix/sysv/linux/accept4.c
@@ -52,7 +52,7 @@ static int have_accept4;
 int
 accept4 (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len, int flags)
 {
-  if (__builtin_expect (have_accept4 >= 0, 1))
+  if (__glibc_likely (have_accept4 >= 0))
     {
       int ret = __internal_accept4 (fd, addr, addr_len, flags);
       /* The kernel returns -EINVAL for unknown socket operations.
diff --git a/sysdeps/unix/sysv/linux/adjtime.c b/sysdeps/unix/sysv/linux/adjtime.c
index 45d4680645..be49911eeb 100644
--- a/sysdeps/unix/sysv/linux/adjtime.c
+++ b/sysdeps/unix/sysv/linux/adjtime.c
@@ -83,7 +83,7 @@ ADJTIME (const struct TIMEVAL *itv, struct TIMEVAL *otv)
 #if defined ADJ_OFFSET_SS_READ && !defined __ASSUME_ADJ_OFFSET_SS_READ
  again:
 #endif
-  if (__builtin_expect (ADJTIMEX (&tntx) < 0, 0))
+  if (__glibc_unlikely (ADJTIMEX (&tntx) < 0))
     {
 #if defined ADJ_OFFSET_SS_READ && !defined __ASSUME_ADJ_OFFSET_SS_READ
       if (itv && errno == EINVAL && tntx.modes == ADJ_OFFSET_SS_READ)
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index dd333b4a94..5c8e75affc 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -331,7 +331,7 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
     {
       int fd = __socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
 
-      if (__builtin_expect (fd >= 0, 1))
+      if (__glibc_likely (fd >= 0))
 	{
 	  struct sockaddr_nl nladdr;
 	  memset (&nladdr, '\0', sizeof (nladdr));
diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index 6608e6adb3..af1343822f 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -33,7 +33,7 @@
        if the library is not compiled to run on all kernels.  */	      \
 									      \
     int version = _dl_discover_osversion ();				      \
-    if (__builtin_expect (version >= 0, 1))				      \
+    if (__glibc_likely (version >= 0))					      \
       {									      \
 	if (__builtin_expect (GLRO(dl_osversion) == 0, 1)		      \
 	    || GLRO(dl_osversion) > version)				      \
@@ -58,7 +58,7 @@ _dl_setup_stack_chk_guard (void *dl_random)
   } ret;
 
 #ifndef __ASSUME_AT_RANDOM
-  if (__builtin_expect (dl_random == NULL, 0))
+  if (__glibc_unlikely (dl_random == NULL))
     {
       const size_t filllen = sizeof (ret.bytes) - 1;
       ret.num = 0;
diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c
index 06abac278d..c00f431a45 100644
--- a/sysdeps/unix/sysv/linux/faccessat.c
+++ b/sysdeps/unix/sysv/linux/faccessat.c
@@ -71,7 +71,7 @@ faccessat (fd, file, mode, flag)
       if (fd != AT_FDCWD && file[0] != '/')
 	{
 	  size_t filelen = strlen (file);
-	  if (__builtin_expect (filelen == 0, 0))
+	  if (__glibc_unlikely (filelen == 0))
 	    {
 	      __set_errno (ENOENT);
 	      return -1;
@@ -102,7 +102,7 @@ faccessat (fd, file, mode, flag)
 # endif
 	result = INTERNAL_SYSCALL (access, err, 2, file, mode);
 
-      if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+      if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
 	{
 	  __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
 	  result = -1;
diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c
index 803988d88c..4d3e43e371 100644
--- a/sysdeps/unix/sysv/linux/fchmodat.c
+++ b/sysdeps/unix/sysv/linux/fchmodat.c
@@ -70,7 +70,7 @@ fchmodat (fd, file, mode, flag)
   if (fd != AT_FDCWD && file[0] != '/')
     {
       size_t filelen = strlen (file);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -100,7 +100,7 @@ fchmodat (fd, file, mode, flag)
 # endif
     result = INTERNAL_SYSCALL (chmod, err, 2, file, mode);
 
-  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
     {
       __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
       result = -1;
diff --git a/sysdeps/unix/sysv/linux/fchownat.c b/sysdeps/unix/sysv/linux/fchownat.c
index b0329cd2c2..196b8005c3 100644
--- a/sysdeps/unix/sysv/linux/fchownat.c
+++ b/sysdeps/unix/sysv/linux/fchownat.c
@@ -65,7 +65,7 @@ fchownat (fd, file, owner, group, flag)
   if (fd != AT_FDCWD && file[0] != '/')
     {
       size_t filelen = strlen (file);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -93,7 +93,7 @@ fchownat (fd, file, owner, group, flag)
   else
     result = INTERNAL_SYSCALL (chown, err, 3, file, owner, group);
 
-  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
     {
       __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
       result = -1;
diff --git a/sysdeps/unix/sysv/linux/futimesat.c b/sysdeps/unix/sysv/linux/futimesat.c
index ce7290e0f3..89ea20b121 100644
--- a/sysdeps/unix/sysv/linux/futimesat.c
+++ b/sysdeps/unix/sysv/linux/futimesat.c
@@ -75,7 +75,7 @@ futimesat (fd, file, tvp)
   else if (fd != AT_FDCWD && file[0] != '/')
     {
       size_t filelen = strlen (file);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -100,7 +100,7 @@ futimesat (fd, file, tvp)
 
 # ifdef __NR_utimes
   result = INTERNAL_SYSCALL (utimes, err, 2, file, tvp);
-  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+  if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result, err)))
     return result;
 
 #  ifndef __ASSUME_UTIMES
@@ -126,7 +126,7 @@ futimesat (fd, file, tvp)
     times = NULL;
 
   result = INTERNAL_SYSCALL (utime, err, 2, file, times);
-  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+  if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result, err)))
     return result;
 
  fail:
diff --git a/sysdeps/unix/sysv/linux/fxstatat.c b/sysdeps/unix/sysv/linux/fxstatat.c
index 9acbf36a9b..1ec0922350 100644
--- a/sysdeps/unix/sysv/linux/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/fxstatat.c
@@ -84,7 +84,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
   if (fd != AT_FDCWD && file[0] != '/')
     {
       size_t filelen = strlen (file);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -114,7 +114,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
 	result = INTERNAL_SYSCALL (stat, err, 2, file,
 				   (struct kernel_stat *) st);
 
-      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+      if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result, err)))
 	return result;
     }
 #ifdef STAT_IS_KERNEL_STAT
@@ -129,7 +129,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
   else
     result = INTERNAL_SYSCALL (stat, err, 2, file, &kst);
 
-  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+  if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result, err)))
     return __xstat_conv (vers, &kst, st);
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c b/sysdeps/unix/sysv/linux/fxstatat64.c
index b6195c877a..24bd51bf46 100644
--- a/sysdeps/unix/sysv/linux/fxstatat64.c
+++ b/sysdeps/unix/sysv/linux/fxstatat64.c
@@ -33,7 +33,7 @@
 int
 __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
 {
-  if (__builtin_expect (vers != _STAT_VER_LINUX, 0))
+  if (__glibc_unlikely (vers != _STAT_VER_LINUX))
     {
       __set_errno (EINVAL);
       return -1;
@@ -76,7 +76,7 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
   if (fd != AT_FDCWD && file[0] != '/')
     {
       size_t filelen = strlen (file);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -101,7 +101,7 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
     result = INTERNAL_SYSCALL (lstat64, err, 2, file, st);
   else
     result = INTERNAL_SYSCALL (stat64, err, 2, file, st);
-  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+  if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result, err)))
     {
 # if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
       if (st->__st_ino != (__ino_t) st->st_ino)
diff --git a/sysdeps/unix/sysv/linux/i386/fallocate.c b/sysdeps/unix/sysv/linux/i386/fallocate.c
index 00fc6f3b76..3a4299ee29 100644
--- a/sysdeps/unix/sysv/linux/i386/fallocate.c
+++ b/sysdeps/unix/sysv/linux/i386/fallocate.c
@@ -40,7 +40,7 @@ fallocate (int fd, int mode, __off_t offset, __off_t len)
 
       LIBC_CANCEL_RESET (oldtype);
     }
-  if (__builtin_expect (err, 0))
+  if (__glibc_unlikely (err))
     {
       __set_errno (err);
       err = -1;
diff --git a/sysdeps/unix/sysv/linux/i386/fallocate64.c b/sysdeps/unix/sysv/linux/i386/fallocate64.c
index 14c304877d..d69021b633 100644
--- a/sysdeps/unix/sysv/linux/i386/fallocate64.c
+++ b/sysdeps/unix/sysv/linux/i386/fallocate64.c
@@ -40,7 +40,7 @@ fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
 
       LIBC_CANCEL_RESET (oldtype);
     }
-  if (__builtin_expect (err, 0))
+  if (__glibc_unlikely (err))
     {
       __set_errno (err);
       err = -1;
diff --git a/sysdeps/unix/sysv/linux/i386/fchownat.c b/sysdeps/unix/sysv/linux/i386/fchownat.c
index 7726bb6f72..5c2359c8b5 100644
--- a/sysdeps/unix/sysv/linux/i386/fchownat.c
+++ b/sysdeps/unix/sysv/linux/i386/fchownat.c
@@ -61,7 +61,7 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
   if (fd != AT_FDCWD && file[0] != '/')
     {
       size_t filelen = strlen (file);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -89,7 +89,7 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
   else
     result = INTERNAL_SYSCALL (chown32, err, 3, file, owner, group);
 
-  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
     {
       __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
       return -1;
diff --git a/sysdeps/unix/sysv/linux/i386/fxstatat.c b/sysdeps/unix/sysv/linux/i386/fxstatat.c
index 4180947dca..8fdbbb81f5 100644
--- a/sysdeps/unix/sysv/linux/i386/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/i386/fxstatat.c
@@ -66,7 +66,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
 #endif
 
 #ifndef __ASSUME_ATFCTS
-  if (__builtin_expect (flag & ~AT_SYMLINK_NOFOLLOW, 0))
+  if (__glibc_unlikely (flag & ~AT_SYMLINK_NOFOLLOW))
     {
       __set_errno (EINVAL);
       return -1;
@@ -77,7 +77,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
   if (fd != AT_FDCWD && file[0] != '/')
     {
       size_t filelen = strlen (file);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -113,11 +113,11 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
     result = INTERNAL_SYSCALL (lstat64, err, 2, file, &st64);
   else
     result = INTERNAL_SYSCALL (stat64, err, 2, file, &st64);
-  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+  if (__glibc_likely (!INTERNAL_SYSCALL_ERROR_P (result, err)))
     return __xstat32_conv (vers, &st64, st);
 
  out:
-  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
     {
       __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
       result = -1;
diff --git a/sysdeps/unix/sysv/linux/i386/get_clockfreq.c b/sysdeps/unix/sysv/linux/i386/get_clockfreq.c
index 9555c26580..024d4d0108 100644
--- a/sysdeps/unix/sysv/linux/i386/get_clockfreq.c
+++ b/sysdeps/unix/sysv/linux/i386/get_clockfreq.c
@@ -40,7 +40,7 @@ __get_clockfreq (void)
     return result;
 
   fd = __open ("/proc/cpuinfo", O_RDONLY);
-  if (__builtin_expect (fd != -1, 1))
+  if (__glibc_likely (fd != -1))
     {
       /* XXX AFAIK the /proc filesystem can generate "files" only up
          to a size of 4096 bytes.  */
@@ -52,7 +52,7 @@ __get_clockfreq (void)
 	{
 	  char *mhz = memmem (buf, n, "cpu MHz", 7);
 
-	  if (__builtin_expect (mhz != NULL, 1))
+	  if (__glibc_likely (mhz != NULL))
 	    {
 	      char *endp = buf + n;
 	      int seen_decpoint = 0;
diff --git a/sysdeps/unix/sysv/linux/i386/posix_fallocate.c b/sysdeps/unix/sysv/linux/i386/posix_fallocate.c
index bcadf8ddfb..f532898e5b 100644
--- a/sysdeps/unix/sysv/linux/i386/posix_fallocate.c
+++ b/sysdeps/unix/sysv/linux/i386/posix_fallocate.c
@@ -36,7 +36,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
 {
 #ifdef __NR_fallocate
 # ifndef __ASSUME_FALLOCATE
-  if (__builtin_expect (__have_fallocate >= 0, 1))
+  if (__glibc_likely (__have_fallocate >= 0))
 # endif
     {
       int res = __call_fallocate (fd, 0, offset, len);
@@ -44,7 +44,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
 	return 0;
 
 # ifndef __ASSUME_FALLOCATE
-      if (__builtin_expect (res == ENOSYS, 0))
+      if (__glibc_unlikely (res == ENOSYS))
 	__have_fallocate = -1;
       else
 # endif
diff --git a/sysdeps/unix/sysv/linux/i386/posix_fallocate64.c b/sysdeps/unix/sysv/linux/i386/posix_fallocate64.c
index 4fa61e8110..1aa1fcf316 100644
--- a/sysdeps/unix/sysv/linux/i386/posix_fallocate64.c
+++ b/sysdeps/unix/sysv/linux/i386/posix_fallocate64.c
@@ -38,7 +38,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
 {
 #ifdef __NR_fallocate
 # ifndef __ASSUME_FALLOCATE
-  if (__builtin_expect (__have_fallocate >= 0, 1))
+  if (__glibc_likely (__have_fallocate >= 0))
 # endif
     {
       int res = __call_fallocate (fd, 0, offset, len);
@@ -47,7 +47,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
 	return 0;
 
 # ifndef __ASSUME_FALLOCATE
-      if (__builtin_expect (res == ENOSYS, 0))
+      if (__glibc_unlikely (res == ENOSYS))
 	__have_fallocate = -1;
       else
 # endif
diff --git a/sysdeps/unix/sysv/linux/i386/scandir64.c b/sysdeps/unix/sysv/linux/i386/scandir64.c
index 90abe32a2b..2782eeb04e 100644
--- a/sysdeps/unix/sysv/linux/i386/scandir64.c
+++ b/sysdeps/unix/sysv/linux/i386/scandir64.c
@@ -85,7 +85,7 @@ __old_scandir64 (dir, namelist, select, cmp)
 	  /* Ignore errors from select or readdir */
 	  __set_errno (0);
 
-	  if (__builtin_expect (c.cnt == vsize, 0))
+	  if (__glibc_unlikely (c.cnt == vsize))
 	    {
 	      struct __old_dirent64 **new;
 	      if (vsize == 0)
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index 01888e9ce4..54f87c9f71 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -310,7 +310,7 @@ asm (".L__X'%ebx = 1\n\t"
 #define INLINE_SYSCALL(name, nr, args...) \
   ({									      \
     unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args);	      \
-    if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0))	      \
+    if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, )))	      \
       {									      \
 	__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));		      \
 	resultvar = 0xffffffff;						      \
diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c
index 7b8867100f..d83e8f8e84 100644
--- a/sysdeps/unix/sysv/linux/ifaddrs.c
+++ b/sysdeps/unix/sysv/linux/ifaddrs.c
@@ -175,7 +175,7 @@ __netlink_request (struct netlink_handle *h, int type)
       if (nladdr.nl_pid != 0)
 	continue;
 
-      if (__builtin_expect (msg.msg_flags & MSG_TRUNC, 0))
+      if (__glibc_unlikely (msg.msg_flags & MSG_TRUNC))
 	goto out_fail;
 
       size_t count = 0;
@@ -459,7 +459,7 @@ getifaddrs_internal (struct ifaddrs **ifap)
 		 kernel.  */
 	      ifa_index = map_newlink (ifim->ifi_index - 1, ifas,
 				       map_newlink_data, newlink);
-	      if (__builtin_expect (ifa_index == -1, 0))
+	      if (__glibc_unlikely (ifa_index == -1))
 		{
 		try_again:
 		  result = -EAGAIN;
@@ -552,7 +552,7 @@ getifaddrs_internal (struct ifaddrs **ifap)
 	      ifa_index = newlink + newaddr_idx;
 	      int idx = map_newlink (ifam->ifa_index - 1, ifas,
 				     map_newlink_data, newlink);
-	      if (__builtin_expect (idx == -1, 0))
+	      if (__glibc_unlikely (idx == -1))
 		goto try_again;
 	      ifas[ifa_index].ifa.ifa_flags = ifas[idx].ifa.ifa_flags;
 	      if (ifa_index > 0)
@@ -737,7 +737,7 @@ getifaddrs_internal (struct ifaddrs **ifap)
 		{
 		  int idx = map_newlink (ifam->ifa_index - 1, ifas,
 					 map_newlink_data, newlink);
-		  if (__builtin_expect (idx == -1, 0))
+		  if (__glibc_unlikely (idx == -1))
 		    goto try_again;
 		  ifas[ifa_index].ifa.ifa_name = ifas[idx].ifa.ifa_name;
 		}
diff --git a/sysdeps/unix/sysv/linux/linkat.c b/sysdeps/unix/sysv/linux/linkat.c
index ad09be64b3..29cefb8192 100644
--- a/sysdeps/unix/sysv/linux/linkat.c
+++ b/sysdeps/unix/sysv/linux/linkat.c
@@ -65,7 +65,7 @@ linkat (fromfd, from, tofd, to, flags)
   if (fromfd != AT_FDCWD && from[0] != '/')
     {
       size_t filelen = strlen (from);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -108,7 +108,7 @@ linkat (fromfd, from, tofd, to, flags)
 
   result = INTERNAL_SYSCALL (link, err, 2, from,  to);
 
-  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
     {
       __atfct_seterrno_2 (INTERNAL_SYSCALL_ERRNO (result, err), tofd, bufto,
 			  fromfd, buffrom);
diff --git a/sysdeps/unix/sysv/linux/mkdirat.c b/sysdeps/unix/sysv/linux/mkdirat.c
index 72d69c58f3..77099f3533 100644
--- a/sysdeps/unix/sysv/linux/mkdirat.c
+++ b/sysdeps/unix/sysv/linux/mkdirat.c
@@ -56,7 +56,7 @@ mkdirat (fd, file, mode)
   if (fd != AT_FDCWD && file[0] != '/')
     {
       size_t filelen = strlen (file);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -80,7 +80,7 @@ mkdirat (fd, file, mode)
   INTERNAL_SYSCALL_DECL (err);
   res = INTERNAL_SYSCALL (mkdir, err, 2, file, mode);
 
-  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
     {
       __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf);
       res = -1;
diff --git a/sysdeps/unix/sysv/linux/mq_unlink.c b/sysdeps/unix/sysv/linux/mq_unlink.c
index e16e4184fd..c5f12d8a7b 100644
--- a/sysdeps/unix/sysv/linux/mq_unlink.c
+++ b/sysdeps/unix/sysv/linux/mq_unlink.c
@@ -36,7 +36,7 @@ mq_unlink (const char *name)
 
   /* While unlink can return either EPERM or EACCES, mq_unlink should
      return just EACCES.  */
-  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (ret, err), 0))
+  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (ret, err)))
     {
       ret = INTERNAL_SYSCALL_ERRNO (ret, err);
       if (ret == EPERM)
diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
index 9bb8acec1f..2cf233b8de 100644
--- a/sysdeps/unix/sysv/linux/openat.c
+++ b/sysdeps/unix/sysv/linux/openat.c
@@ -108,7 +108,7 @@ OPENAT_NOT_CANCEL (fd, file, oflag, mode)
   if (fd != AT_FDCWD && file[0] != '/')
     {
       size_t filelen = strlen (file);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -132,7 +132,7 @@ OPENAT_NOT_CANCEL (fd, file, oflag, mode)
 
   res = INTERNAL_SYSCALL (open, err, 3, file, oflag, mode);
 
-  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
     {
       __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf);
       res = -1;
diff --git a/sysdeps/unix/sysv/linux/posix_fallocate.c b/sysdeps/unix/sysv/linux/posix_fallocate.c
index 477f9f8574..cb75ffc1fa 100644
--- a/sysdeps/unix/sysv/linux/posix_fallocate.c
+++ b/sysdeps/unix/sysv/linux/posix_fallocate.c
@@ -34,7 +34,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
 {
 #ifdef __NR_fallocate
 # ifndef __ASSUME_FALLOCATE
-  if (__builtin_expect (__have_fallocate >= 0, 1))
+  if (__glibc_likely (__have_fallocate >= 0))
 # endif
     {
       INTERNAL_SYSCALL_DECL (err);
@@ -46,7 +46,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
 	return 0;
 
 # ifndef __ASSUME_FALLOCATE
-      if (__builtin_expect (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS, 0))
+      if (__glibc_unlikely (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS))
 	__have_fallocate = -1;
       else
 # endif
diff --git a/sysdeps/unix/sysv/linux/posix_fallocate64.c b/sysdeps/unix/sysv/linux/posix_fallocate64.c
index 73983aed5b..4f5881b96c 100644
--- a/sysdeps/unix/sysv/linux/posix_fallocate64.c
+++ b/sysdeps/unix/sysv/linux/posix_fallocate64.c
@@ -36,7 +36,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
 {
 #ifdef __NR_fallocate
 # ifndef __ASSUME_FALLOCATE
-  if (__builtin_expect (__have_fallocate >= 0, 1))
+  if (__glibc_likely (__have_fallocate >= 0))
 # endif
     {
       INTERNAL_SYSCALL_DECL (err);
@@ -50,7 +50,7 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
 	return 0;
 
 # ifndef __ASSUME_FALLOCATE
-      if (__builtin_expect (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS, 0))
+      if (__glibc_unlikely (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS))
 	__have_fallocate = -1;
       else
 # endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/fchownat.c b/sysdeps/unix/sysv/linux/powerpc/fchownat.c
index 61e0a4dc56..4e3767a6a0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/fchownat.c
+++ b/sysdeps/unix/sysv/linux/powerpc/fchownat.c
@@ -65,7 +65,7 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
   if (fd != AT_FDCWD && file[0] != '/')
     {
       size_t filelen = strlen (file);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -93,7 +93,7 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
   else
     result = INTERNAL_SYSCALL (chown, err, 3, file, owner, group);
 
-  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
     {
       __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
       return -1;
diff --git a/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c b/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
index 0a6aa81fb0..8b37943863 100644
--- a/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
+++ b/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
@@ -49,7 +49,7 @@ __get_clockfreq (void)
     {
       int fd = __open ("/proc/cpuinfo", O_RDONLY);
 
-      if (__builtin_expect (fd != -1, 1))
+      if (__glibc_likely (fd != -1))
 	{
 	  /* The timebase will be in the 1st 1024 bytes for systems with up
 	     to 8 processors.  If the first read returns less then 1024
@@ -87,7 +87,7 @@ __get_clockfreq (void)
 	    {
 	      char *mhz = memmem (buf, n, "timebase", 7);
 
-	      if (__builtin_expect (mhz != NULL, 1))
+	      if (__glibc_likely (mhz != NULL))
 		{
 		  char *endp = buf + n;
 
diff --git a/sysdeps/unix/sysv/linux/readlinkat.c b/sysdeps/unix/sysv/linux/readlinkat.c
index 8fbbd414ac..7d096d3c36 100644
--- a/sysdeps/unix/sysv/linux/readlinkat.c
+++ b/sysdeps/unix/sysv/linux/readlinkat.c
@@ -58,7 +58,7 @@ readlinkat (fd, path, buf, len)
   if (fd != AT_FDCWD && path[0] != '/')
     {
       size_t pathlen = strlen (path);
-      if (__builtin_expect (pathlen == 0, 0))
+      if (__glibc_unlikely (pathlen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -83,7 +83,7 @@ readlinkat (fd, path, buf, len)
 
   result = INTERNAL_SYSCALL (readlink, err, 3, path, buf, len);
 
-  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
     {
       __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, pathbuf);
       result = -1;
diff --git a/sysdeps/unix/sysv/linux/recvmmsg.c b/sysdeps/unix/sysv/linux/recvmmsg.c
index bcb9a6cf5c..04ff42ee72 100644
--- a/sysdeps/unix/sysv/linux/recvmmsg.c
+++ b/sysdeps/unix/sysv/linux/recvmmsg.c
@@ -53,7 +53,7 @@ int
 recvmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags,
 	  const struct timespec *tmo)
 {
-  if (__builtin_expect (have_recvmmsg >= 0, 1))
+  if (__glibc_likely (have_recvmmsg >= 0))
     {
       int ret = __internal_recvmmsg (fd, vmessages, vlen, flags, tmo);
       /* The kernel returns -EINVAL for unknown socket operations.
diff --git a/sysdeps/unix/sysv/linux/renameat.c b/sysdeps/unix/sysv/linux/renameat.c
index 8addae2d57..dbc4c75c01 100644
--- a/sysdeps/unix/sysv/linux/renameat.c
+++ b/sysdeps/unix/sysv/linux/renameat.c
@@ -134,7 +134,7 @@ renameat (oldfd, old, newfd, new)
   if (oldfd != AT_FDCWD && old[0] != '/')
     {
       size_t filelen = strlen (old);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -159,7 +159,7 @@ renameat (oldfd, old, newfd, new)
   if (newfd != AT_FDCWD && new[0] != '/')
     {
       size_t filelen = strlen (new);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -183,7 +183,7 @@ renameat (oldfd, old, newfd, new)
 
   result = INTERNAL_SYSCALL (rename, err, 2, old,  new);
 
-  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
     {
       __atfct_seterrno_2 (INTERNAL_SYSCALL_ERRNO (result, err), newfd, bufnew,
 			  oldfd, bufold);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
index fa7c8c50e5..1c6191b261 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
@@ -182,7 +182,7 @@
 #define INLINE_SYSCALL(name, nr, args...)				      \
   ({									      \
     unsigned int _ret = INTERNAL_SYSCALL (name, , nr, args);		      \
-    if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_ret, ), 0))	      \
+    if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, )))		      \
      {									      \
        __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, ));			      \
        _ret = 0xffffffff;						      \
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
index 020cd9ad45..91fc275585 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
@@ -188,7 +188,7 @@
 #define INLINE_SYSCALL(name, nr, args...)				      \
   ({									      \
     long _ret = INTERNAL_SYSCALL (name, , nr, args);			      \
-    if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_ret, ), 0))	      \
+    if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, )))		      \
      {									      \
        __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, ));			      \
        _ret = -1;							      \
diff --git a/sysdeps/unix/sysv/linux/sched_setaffinity.c b/sysdeps/unix/sysv/linux/sched_setaffinity.c
index 77345338ef..1f8ebba9fc 100644
--- a/sysdeps/unix/sysv/linux/sched_setaffinity.c
+++ b/sysdeps/unix/sysv/linux/sched_setaffinity.c
@@ -32,7 +32,7 @@ static size_t __kernel_cpumask_size;
 int
 __sched_setaffinity_new (pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset)
 {
-  if (__builtin_expect (__kernel_cpumask_size == 0, 0))
+  if (__glibc_unlikely (__kernel_cpumask_size == 0))
     {
       INTERNAL_SYSCALL_DECL (err);
       int res;
diff --git a/sysdeps/unix/sysv/linux/sendmmsg.c b/sysdeps/unix/sysv/linux/sendmmsg.c
index 598ff40d75..f8494be044 100644
--- a/sysdeps/unix/sysv/linux/sendmmsg.c
+++ b/sysdeps/unix/sysv/linux/sendmmsg.c
@@ -52,7 +52,7 @@ static int have_sendmmsg;
 int
 __sendmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
 {
-  if (__builtin_expect (have_sendmmsg >= 0, 1))
+  if (__glibc_likely (have_sendmmsg >= 0))
     {
       int ret = __internal_sendmmsg (fd, vmessages, vlen, flags);
       /* The kernel returns -EINVAL for unknown socket operations.
diff --git a/sysdeps/unix/sysv/linux/shm_open.c b/sysdeps/unix/sysv/linux/shm_open.c
index fef8fd531a..cec6fdbd0c 100644
--- a/sysdeps/unix/sysv/linux/shm_open.c
+++ b/sysdeps/unix/sysv/linux/shm_open.c
@@ -75,10 +75,10 @@ where_is_shmfs (void)
   /* OK, do it the hard way.  Look through the /proc/mounts file and if
      this does not exist through /etc/fstab to find the mount point.  */
   fp = __setmntent ("/proc/mounts", "r");
-  if (__builtin_expect (fp == NULL, 0))
+  if (__glibc_unlikely (fp == NULL))
     {
       fp = __setmntent (_PATH_MNTTAB, "r");
-      if (__builtin_expect (fp == NULL, 0))
+      if (__glibc_unlikely (fp == NULL))
 	/* There is nothing we can do.  Blind guesses are not helpful.  */
 	return;
     }
@@ -208,7 +208,7 @@ shm_open (const char *name, int oflag, mode_t mode)
 	}
 #endif
     }
-  else if (__builtin_expect (errno == EISDIR, 0))
+  else if (__glibc_unlikely (errno == EISDIR))
     /* It might be better to fold this error with EINVAL since
        directory names are just another example for unsuitable shared
        object names and the standard does not mention EISDIR.  */
diff --git a/sysdeps/unix/sysv/linux/sleep.c b/sysdeps/unix/sysv/linux/sleep.c
index 46b731e0a7..3b352c68bc 100644
--- a/sysdeps/unix/sysv/linux/sleep.c
+++ b/sysdeps/unix/sysv/linux/sleep.c
@@ -47,7 +47,7 @@ __sleep (unsigned int seconds)
   unsigned int result;
 
   /* This is not necessary but some buggy programs depend on this.  */
-  if (__builtin_expect (seconds == 0, 0))
+  if (__glibc_unlikely (seconds == 0))
     {
 #ifdef CANCELLATION_P
       CANCELLATION_P (THREAD_SELF);
diff --git a/sysdeps/unix/sysv/linux/symlinkat.c b/sysdeps/unix/sysv/linux/symlinkat.c
index ae9bb359ad..0c5ed3f5f9 100644
--- a/sysdeps/unix/sysv/linux/symlinkat.c
+++ b/sysdeps/unix/sysv/linux/symlinkat.c
@@ -56,7 +56,7 @@ symlinkat (from, tofd, to)
   if (tofd != AT_FDCWD && to[0] != '/')
     {
       size_t tolen = strlen (to);
-      if (__builtin_expect (tolen == 0, 0))
+      if (__glibc_unlikely (tolen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -81,7 +81,7 @@ symlinkat (from, tofd, to)
 
   result = INTERNAL_SYSCALL (symlink, err, 2, from, to);
 
-  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
     {
       __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), tofd, buf);
       result = -1;
diff --git a/sysdeps/unix/sysv/linux/tcgetattr.c b/sysdeps/unix/sysv/linux/tcgetattr.c
index a739100e37..d759f7a417 100644
--- a/sysdeps/unix/sysv/linux/tcgetattr.c
+++ b/sysdeps/unix/sysv/linux/tcgetattr.c
@@ -39,7 +39,7 @@ __tcgetattr (fd, termios_p)
 
   retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios);
 
-  if (__builtin_expect (retval == 0, 1))
+  if (__glibc_likely (retval == 0))
     {
       termios_p->c_iflag = k_termios.c_iflag;
       termios_p->c_oflag = k_termios.c_oflag;
diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c
index 8d808ce373..d257d25977 100644
--- a/sysdeps/unix/sysv/linux/ttyname.c
+++ b/sysdeps/unix/sysv/linux/ttyname.c
@@ -127,7 +127,7 @@ ttyname (int fd)
 
   /* isatty check, tcgetattr is used because it sets the correct
      errno (EBADF resp. ENOTTY) on error.  */
-  if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0))
+  if (__glibc_unlikely (__tcgetattr (fd, &term) < 0))
     return NULL;
 
   if (__fxstat64 (_STAT_VER, fd, &st) < 0)
@@ -148,7 +148,7 @@ ttyname (int fd)
     }
 
   ssize_t len = __readlink (procname, ttyname_buf, buflen);
-  if (__builtin_expect (len != -1, 1))
+  if (__glibc_likely (len != -1))
     {
       if ((size_t) len >= buflen)
 	return NULL;
diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c
index a03d012f8d..6ce85db33b 100644
--- a/sysdeps/unix/sysv/linux/ttyname_r.c
+++ b/sysdeps/unix/sysv/linux/ttyname_r.c
@@ -118,7 +118,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
   /* isatty check, tcgetattr is used because it sets the correct
      errno (EBADF resp. ENOTTY) on error.  */
   struct termios term;
-  if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0))
+  if (__glibc_unlikely (__tcgetattr (fd, &term) < 0))
     return errno;
 
   if (__fxstat64 (_STAT_VER, fd, &st) < 0)
@@ -128,13 +128,13 @@ __ttyname_r (int fd, char *buf, size_t buflen)
   *_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
 
   ssize_t ret = __readlink (procname, buf, buflen - 1);
-  if (__builtin_expect (ret == -1 && errno == ENAMETOOLONG, 0))
+  if (__glibc_unlikely (ret == -1 && errno == ENAMETOOLONG))
     {
       __set_errno (ERANGE);
       return ERANGE;
     }
 
-  if (__builtin_expect (ret != -1, 1))
+  if (__glibc_likely (ret != -1))
     {
 #define UNREACHABLE_LEN strlen ("(unreachable)")
       if (ret > UNREACHABLE_LEN
diff --git a/sysdeps/unix/sysv/linux/unlinkat.c b/sysdeps/unix/sysv/linux/unlinkat.c
index 0925d85800..6366c867e1 100644
--- a/sysdeps/unix/sysv/linux/unlinkat.c
+++ b/sysdeps/unix/sysv/linux/unlinkat.c
@@ -63,7 +63,7 @@ unlinkat (fd, file, flag)
   if (fd != AT_FDCWD && file[0] != '/')
     {
       size_t filelen = strlen (file);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -91,7 +91,7 @@ unlinkat (fd, file, flag)
   else
     result = INTERNAL_SYSCALL (unlink, err, 1, file);
 
-  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
     {
       __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
       result = -1;
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
index 29f0e540d1..5aec8af39c 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
@@ -70,7 +70,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
   if (fd != AT_FDCWD && file[0] != '/')
     {
       size_t filelen = strlen (file);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;
@@ -98,7 +98,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
   else
     res = INTERNAL_SYSCALL (stat, err, 2, file, st);
 
-  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
     {
       __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf);
       res = -1;
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c b/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
index 8f3b521ed7..84e42a1f0a 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
@@ -34,7 +34,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
 {
 #ifdef __NR_fallocate
 # ifndef __ASSUME_FALLOCATE
-  if (__builtin_expect (__have_fallocate >= 0, 1))
+  if (__glibc_likely (__have_fallocate >= 0))
 # endif
     {
       INTERNAL_SYSCALL_DECL (err);
@@ -50,7 +50,7 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
 	return 0;
 
 # ifndef __ASSUME_FALLOCATE
-      if (__builtin_expect (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS, 0))
+      if (__glibc_unlikely (INTERNAL_SYSCALL_ERRNO (res, err) == ENOSYS))
 	__have_fallocate = -1;
       else
 # endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index 4a9a9d90bc..f52690feeb 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -193,7 +193,7 @@
 # define INLINE_SYSCALL(name, nr, args...) \
   ({									      \
     unsigned long int resultvar = INTERNAL_SYSCALL (name, , nr, args);	      \
-    if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0))	      \
+    if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, )))	      \
       {									      \
 	__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));		      \
 	resultvar = (unsigned long int) -1;				      \
@@ -207,7 +207,7 @@
 # define INLINE_SYSCALL_TYPES(name, nr, args...) \
   ({									      \
     unsigned long int resultvar = INTERNAL_SYSCALL_TYPES (name, , nr, args);  \
-    if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0))	      \
+    if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, )))	      \
       {									      \
 	__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));		      \
 	resultvar = (unsigned long int) -1;				      \
diff --git a/sysdeps/unix/sysv/linux/xmknodat.c b/sysdeps/unix/sysv/linux/xmknodat.c
index 62e47e1eed..9e3643f71b 100644
--- a/sysdeps/unix/sysv/linux/xmknodat.c
+++ b/sysdeps/unix/sysv/linux/xmknodat.c
@@ -70,7 +70,7 @@ __xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev)
   if (fd != AT_FDCWD && file[0] != '/')
     {
       size_t filelen = strlen (file);
-      if (__builtin_expect (filelen == 0, 0))
+      if (__glibc_unlikely (filelen == 0))
 	{
 	  __set_errno (ENOENT);
 	  return -1;