]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Tue, 2 Sep 2003 00:49:47 +0000 (00:49 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 2 Sep 2003 00:49:47 +0000 (00:49 +0000)
2003-09-01  Thorsten Kukuk  <kukuk@suse.de>

* nis/nss_compat/compat-spwd.c (getspnam_plususer): Return
NSS_STATUS_SUCCESS if entry was found.
(getspent_next_file): Store user in blacklist after entry
was found, use innetgr.

2003-09-01  Jakub Jelinek  <jakub@redhat.com>

* sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise.c: New.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c: New.

* sysdeps/generic/dl-tls.c (_dl_determine_tlsoffset): Fix tls offset
computation for TCB_AT_TP.  Support l_firstbyte_offset != 0 for
DTV_AT_TP, optimize.

19 files changed:
ChangeLog
linuxthreads/ChangeLog
linuxthreads/Versions
linuxthreads/forward.c
linuxthreads/internals.h
linuxthreads/pthread.c
linuxthreads/sysdeps/pthread/pthread-functions.h
localedata/ChangeLog
localedata/locales/he_IL
localedata/locales/iw_IL
nis/nss_compat/compat-spwd.c
nptl/ChangeLog
nptl/Versions
nptl/forward.c
nptl/init.c
nptl/sysdeps/pthread/pthread-functions.h
sysdeps/generic/dl-tls.c
sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise.c [new file with mode: 0644]
sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c [new file with mode: 0644]

index 43a6791ad70032bd1be06250a1f1ecc73ed87997..a758044c4e0810ee1d8c307091712c15868defa6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2003-09-01  Thorsten Kukuk  <kukuk@suse.de>
+
+       * nis/nss_compat/compat-spwd.c (getspnam_plususer): Return
+       NSS_STATUS_SUCCESS if entry was found.
+       (getspent_next_file): Store user in blacklist after entry
+       was found, use innetgr.
+
+2003-09-01  Jakub Jelinek  <jakub@redhat.com>
+
+       * sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise.c: New.
+       * sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c: New.
+
+       * sysdeps/generic/dl-tls.c (_dl_determine_tlsoffset): Fix tls offset
+       computation for TCB_AT_TP.  Support l_firstbyte_offset != 0 for
+       DTV_AT_TP, optimize.
+
 2003-08-31  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
 
        * sysdeps/unix/sysv/linux/sh/Versions: Add posix_fadvise64 and
index b6a79ea45e8a09585cb2acf7cc0fb662debd1614..20f59046d25bba8437c1260f601932a219ec28fe 100644 (file)
        * tst-tls1modf.c: New.
        * tst-tls2.sh: New test.
 
+       * internals.h (__pthread_cond_timedwait): New prototype.
+       * sysdeps/pthread/pthread-functions.h (struct pthread_functions): Add
+       ptr___pthread_cond_timedwait.
+       * pthread.c (__pthread_functions): Initialize them.
+       * forward.c (pthread_cond_timedwait@GLIBC_2.0,
+       pthread_cond_timedwait@@GLIBC_2.3.2): New forwards.
+       * Versions (libc): Export pthread_cond_timedwait@GLIBC_2.0,
+       pthread_cond_timedwait@@GLIBC_2.3.2.
+
 2003-08-27  Ulrich Drepper  <drepper@redhat.com>
 
        * sysdeps/pthread/pthread.h: Don't mark pthread_exit,
index e10826cb466be5f67b58a6cc36e7c7bbb3e3c42f..423b5ecedb49bcd77d8d63afc5653a4a54776f8d 100644 (file)
@@ -7,6 +7,7 @@ libc {
     pthread_attr_setschedparam; pthread_attr_setschedpolicy;
     pthread_attr_setscope; pthread_cond_broadcast; pthread_cond_destroy;
     pthread_cond_init; pthread_cond_signal; pthread_cond_wait;
+    pthread_cond_timedwait;
     pthread_condattr_destroy; pthread_condattr_init; pthread_equal;
     pthread_exit; pthread_getschedparam; pthread_mutex_destroy;
     pthread_mutex_init; pthread_mutex_lock; pthread_mutex_unlock;
@@ -20,7 +21,7 @@ libc {
     # Changed pthread_cond_t.
     pthread_cond_init; pthread_cond_destroy;
     pthread_cond_wait; pthread_cond_signal;
-    pthread_cond_broadcast;
+    pthread_cond_broadcast; pthread_cond_timedwait;
   }
   GLIBC_PRIVATE {
     # Internal libc interface to libpthread
index 6cc2f99aac86c8f52b4e598c5b9a26d34f8cd24f..46cf53893ec3a7ac5feca034b2fa296b06536135 100644 (file)
@@ -128,6 +128,15 @@ compat_symbol (libc, __pthread_cond_wait_2_0, pthread_cond_wait, GLIBC_2_0);
 #endif
 versioned_symbol (libc, __pthread_cond_wait, pthread_cond_wait, GLIBC_2_3_2);
 
+FORWARD (__pthread_cond_timedwait,
+        (pthread_cond_t *cond, pthread_mutex_t *mutex,
+         const struct timespec *abstime), (cond, mutex, abstime), 0)
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+strong_alias (__pthread_cond_timedwait, __pthread_cond_timedwait_2_0)
+compat_symbol (libc, __pthread_cond_timedwait_2_0, pthread_cond_timedwait, GLIBC_2_0);
+#endif
+versioned_symbol (libc, __pthread_cond_timedwait, pthread_cond_timedwait, GLIBC_2_3_2);
+
 
 FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2),
         (thread1, thread2), 1)
index 69923e9b771800de131032c92d6fd72de583986c..a5ec8b92841b02a3e9bf7fc99be7b5a28425c1a7 100644 (file)
@@ -354,6 +354,9 @@ extern int __pthread_cond_init (pthread_cond_t *cond,
                                const pthread_condattr_t *cond_attr);
 extern int __pthread_cond_destroy (pthread_cond_t *cond);
 extern int __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex);
+extern int __pthread_cond_timedwait (pthread_cond_t *cond,
+                                    pthread_mutex_t *mutex,
+                                    const struct timespec *abstime);
 extern int __pthread_cond_signal (pthread_cond_t *cond);
 extern int __pthread_cond_broadcast (pthread_cond_t *cond);
 extern int __pthread_condattr_init (pthread_condattr_t *attr);
index f261f8e8f478cc31e00bacf2b51e8442a3eebc0c..5d5368f4d7fd1e5b1140acf8b2e3266c8f7565b3 100644 (file)
@@ -260,6 +260,7 @@ struct pthread_functions __pthread_functions =
     .ptr___pthread_cond_init = __pthread_cond_init,
     .ptr___pthread_cond_signal = __pthread_cond_signal,
     .ptr___pthread_cond_wait = __pthread_cond_wait,
+    .ptr___pthread_cond_timedwait = __pthread_cond_timedwait,
     .ptr_pthread_equal = __pthread_equal,
     .ptr___pthread_exit = __pthread_exit,
     .ptr_pthread_getschedparam = __pthread_getschedparam,
index f47b46ff6ec99084042902e356a139da79290504..e2d17f78c5a3751af1ac931824620a032b40e306 100644 (file)
@@ -54,6 +54,8 @@ struct pthread_functions
                                  const pthread_condattr_t *);
   int (*ptr___pthread_cond_signal) (pthread_cond_t *);
   int (*ptr___pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *);
+  int (*ptr___pthread_cond_timedwait) (pthread_cond_t *, pthread_mutex_t *,
+                                      const struct timespec *);
   int (*ptr_pthread_equal) (pthread_t, pthread_t);
   void (*ptr___pthread_exit) (void *);
   int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *);
index d2af0ad64394c346a17c970d77dc47b066c2acf2..a12ff53d9013ffb5d655a50dbd1fd913ef9cf9f4 100644 (file)
@@ -1,3 +1,9 @@
+2003-09-01  Petter Reinholdtsen  <pere@hungry.com>
+
+       * locales/iw_IL: Add comment stating why there are two locales for
+       Hebrew in Israel, and that he_IL replaces iw_IL.
+       * locales/he_IL: Likewise.
+
 2003-08-25  Ulrich Drepper  <drepper@redhat.com>
 
        * locales/an_ES: Fix locale header information.
index 4ead30b3d922ecd383712edd22a461576d9fa4c6..bfd4d4aa65b8057bf9f88244dcb2237b974f1360 100644 (file)
@@ -18,6 +18,10 @@ escape_char  /
 % Charset: ISO-8859-8
 % Distribution and use is free, also
 % for commercial purposes.
+%
+% This locale replaces iw_IL, as the ISO-639 code for Hebrew was changed
+% from 'iw' to 'he' in 1989, according to Bruno Haible on libc-alpha
+% 2003-09-01.
 
 LC_IDENTIFICATION
 title      "Hebrew locale for Israel"
index 683c696346a3ca9a2f5c7472deb499bc33427b9f..d72aa05c6bd1aa3617e571b36665f1d63e5c97ad 100644 (file)
@@ -18,6 +18,9 @@ escape_char  /
 % Charset: ISO-8859-8
 % Distribution and use is free, also
 % for commercial purposes.
+%
+% Obsolete locale.  The ISO-639 code for Hebrew was changed from 'iw'
+% to 'he' in 1989, according to Bruno Haible on libc-alpha 2003-09-01.
 
 LC_IDENTIFICATION
 title      "Hebrew locale for Israel"
index ed6bcff7dfceb75fef5ca64bacdfebcc39633258..55db10eadb6ae019c8d9d6e5e28bc63e9989a8f8 100644 (file)
@@ -435,7 +435,7 @@ getspnam_plususer (const char *name, struct spwd *result, ent_t *ent,
   copy_spwd_changes (result, &pwd, p, plen);
   give_spwd_free (&pwd);
   /* We found the entry.  */
-  return NSS_STATUS_RETURN;
+  return NSS_STATUS_SUCCESS;
 }
 
 static enum nss_status
@@ -539,18 +539,23 @@ getspent_next_file (struct spwd *result, ent_t *ent,
       if (result->sp_namp[0] == '+' && result->sp_namp[1] != '\0'
          && result->sp_namp[1] != '@')
        {
+         size_t len = strlen (result->sp_namp);
+         char buf[len];
          enum nss_status status;
 
          /* Store the User in the blacklist for the "+" at the end of
             /etc/passwd */
-         blacklist_store_name (&result->sp_namp[1], ent);
+         memcpy (buf, &result->sp_namp[1], len);
          status = getspnam_plususer (&result->sp_namp[1], result, ent,
                                      buffer, buflen, errnop);
+         blacklist_store_name (buf, ent);
 
          if (status == NSS_STATUS_SUCCESS)     /* We found the entry. */
            break;
-         else if (status == NSS_STATUS_RETURN  /* We couldn't parse the entry */
-                  || status == NSS_STATUS_NOTFOUND)    /* entry doesn't exist */
+         /* We couldn't parse the entry */
+         else if (status == NSS_STATUS_RETURN
+                  /* entry doesn't exist */
+                  || status == NSS_STATUS_NOTFOUND)
            continue;
          else
            {
@@ -653,6 +658,9 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent,
              return NSS_STATUS_TRYAGAIN;
            }
 
+          /* Terminate the line for any case.  */
+         buffer[buflen - 1] = '\0';
+
          /* Skip leading blanks.  */
          while (isspace (*p))
            ++p;
@@ -686,21 +694,8 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent,
       if (result->sp_namp[0] == '-' && result->sp_namp[1] == '@'
          && result->sp_namp[2] != '\0')
        {
-         /* XXX Do not use fixed length buffers.  */
-         char buf2[1024];
-         char *user, *host, *domain;
-         struct __netgrent netgrdata;
-
-         bzero (&netgrdata, sizeof (struct __netgrent));
-         __internal_setnetgrent (&result->sp_namp[2], &netgrdata);
-         while (__internal_getnetgrent_r (&host, &user, &domain, &netgrdata,
-                                          buf2, sizeof (buf2), errnop))
-           {
-             if (user != NULL && user[0] != '-')
-               if (strcmp (user, name) == 0)
-                 return NSS_STATUS_NOTFOUND;
-           }
-         __internal_endnetgrent (&netgrdata);
+         if (innetgr (&result->sp_namp[2], NULL, name, NULL))
+           return NSS_STATUS_NOTFOUND;
          continue;
        }
 
@@ -708,25 +703,18 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent,
       if (result->sp_namp[0] == '+' && result->sp_namp[1] == '@'
          && result->sp_namp[2] != '\0')
        {
-         char *buf = strdupa (&result->sp_namp[2]);
-         int status;
-
-         ent->netgroup = TRUE;
-         ent->first = TRUE;
-         copy_spwd_changes (&ent->pwd, result, NULL, 0);
+         enum nss_status status;
 
-         do
+         if (innetgr (&result->sp_namp[2], NULL, name, NULL))
            {
-             status = getspent_next_nss_netgr (name, result, ent, buf,
-                                               buffer, buflen, errnop);
+             status = getspnam_plususer (name, result, ent, buffer,
+                                         buflen, errnop);
+
              if (status == NSS_STATUS_RETURN)
                continue;
 
-             if (status == NSS_STATUS_SUCCESS
-                 && strcmp (result->sp_namp, name) == 0)
-               return NSS_STATUS_SUCCESS;
+             return status;
            }
-         while (status == NSS_STATUS_SUCCESS);
          continue;
        }
 
@@ -767,8 +755,12 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent,
          status = getspnam_plususer (name, result, ent,
                                      buffer, buflen, errnop);
 
-         if (status == NSS_STATUS_RETURN)      /* We couldn't parse the entry */
-           return NSS_STATUS_NOTFOUND;
+         if (status == NSS_STATUS_SUCCESS)
+           /* We found the entry. */
+            break;
+          else if (status == NSS_STATUS_RETURN)
+           /* We couldn't parse the entry */
+            return NSS_STATUS_NOTFOUND;
          else
            return status;
        }
@@ -796,10 +788,8 @@ _nss_compat_getspnam_r (const char *name, struct spwd *pwd,
 
   result = internal_setspent (&ent, 0);
 
-  if (result != NSS_STATUS_SUCCESS)
-    return result;
-
-  result = internal_getspnam_r (name, pwd, &ent, buffer, buflen, errnop);
+  if (result == NSS_STATUS_SUCCESS)
+    result = internal_getspnam_r (name, pwd, &ent, buffer, buflen, errnop);
 
   internal_endspent (&ent);
 
index 3ad2323a6a8d88057471e858446ec55f680cdb50..b27479fbe056bbce3ef2f663147add2c9d34b4cf 100644 (file)
        * tst-tls5modf.c: New.
        * tst-tls6.sh: New test.
 
+       * sysdeps/pthread/pthread-functions.h (struct pthread_functions): Add
+       ptr___pthread_cond_timedwait and ptr___pthread_cond_timedwait_2_0.
+       * init.c (pthread_functions): Initialize them.
+       * forward.c (pthread_cond_timedwait@GLIBC_2.0,
+       pthread_cond_timedwait@@GLIBC_2.3.2): New forwards.
+       * Versions (libc): Export pthread_cond_timedwait@GLIBC_2.0,
+       pthread_cond_timedwait@@GLIBC_2.3.2.
+
 2003-09-01  Jakub Jelinek  <jakub@redhat.com>
 
        * sysdeps/unix/sysv/linux/alpha/timer_create.c: New file.
index 8eb863d0f42803417dc1cb80af2bbfe24823668e..611ed9b7bcf4531d002c772046c4cbf48d18881b 100644 (file)
@@ -9,6 +9,7 @@ libc {
     pthread_condattr_destroy; pthread_condattr_init;
     pthread_cond_broadcast; pthread_cond_destroy;
     pthread_cond_init; pthread_cond_signal; pthread_cond_wait;
+    pthread_cond_timedwait;
     pthread_equal; pthread_exit;
     pthread_getschedparam; pthread_setschedparam;
     pthread_mutex_destroy; pthread_mutex_init;
@@ -23,7 +24,7 @@ libc {
     # Changed pthread_cond_t.
     pthread_cond_init; pthread_cond_destroy;
     pthread_cond_wait; pthread_cond_signal;
-    pthread_cond_broadcast;
+    pthread_cond_broadcast; pthread_cond_timedwait;
   }
   GLIBC_PRIVATE {
     # Internal libc interface to libpthread
index 1f4cd482c62d0a6344f2f5015756242fb7dda17a..407fd092d989e036f9e4514aee145cd5402dc9f2 100644 (file)
@@ -136,6 +136,19 @@ FORWARD (__pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex),
 versioned_symbol (libc, __pthread_cond_wait, pthread_cond_wait,
                  GLIBC_2_3_2);
 
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+FORWARD (__pthread_cond_timedwait_2_0,
+        (pthread_cond_2_0_t *cond, pthread_mutex_t *mutex,
+         const struct timespec *abstime), (cond, mutex, abstime), 0)
+compat_symbol (libc, __pthread_cond_timedwait_2_0, pthread_cond_timedwait,
+              GLIBC_2_0);
+#endif
+FORWARD (__pthread_cond_timedwait,
+        (pthread_cond_t *cond, pthread_mutex_t *mutex,
+         const struct timespec *abstime), (cond, mutex, abstime), 0)
+versioned_symbol (libc, __pthread_cond_timedwait, pthread_cond_timedwait,
+                 GLIBC_2_3_2);
+
 
 FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2),
         (thread1, thread2), 1)
index c7d26acff7027350a0bcc812a36f26e54a15b6de..7b8b2b0c54fd5ce25da7a969a96e73f89fd3d981 100644 (file)
@@ -95,12 +95,14 @@ static struct pthread_functions pthread_functions =
     .ptr___pthread_cond_init = __pthread_cond_init,
     .ptr___pthread_cond_signal = __pthread_cond_signal,
     .ptr___pthread_cond_wait = __pthread_cond_wait,
+    .ptr___pthread_cond_timedwait = __pthread_cond_timedwait,
 # if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2)
     .ptr___pthread_cond_broadcast_2_0 = __pthread_cond_broadcast_2_0,
     .ptr___pthread_cond_destroy_2_0 = __pthread_cond_destroy_2_0,
     .ptr___pthread_cond_init_2_0 = __pthread_cond_init_2_0,
     .ptr___pthread_cond_signal_2_0 = __pthread_cond_signal_2_0,
     .ptr___pthread_cond_wait_2_0 = __pthread_cond_wait_2_0,
+    .ptr___pthread_cond_timedwait_2_0 = __pthread_cond_timedwait_2_0,
 # endif
     .ptr_pthread_equal = __pthread_equal,
     .ptr___pthread_exit = __pthread_exit,
index 93ba0899828342adfb2fcf836e928002dc0187a5..38155e240ff6e1d2745effab033d449b1adbc478 100644 (file)
@@ -52,12 +52,17 @@ struct pthread_functions
                                  const pthread_condattr_t *);
   int (*ptr___pthread_cond_signal) (pthread_cond_t *);
   int (*ptr___pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *);
+  int (*ptr___pthread_cond_timedwait) (pthread_cond_t *, pthread_mutex_t *,
+                                      const struct timespec *);
   int (*ptr___pthread_cond_broadcast_2_0) (pthread_cond_2_0_t *);
   int (*ptr___pthread_cond_destroy_2_0) (pthread_cond_2_0_t *);
   int (*ptr___pthread_cond_init_2_0) (pthread_cond_2_0_t *,
                                      const pthread_condattr_t *);
   int (*ptr___pthread_cond_signal_2_0) (pthread_cond_2_0_t *);
   int (*ptr___pthread_cond_wait_2_0) (pthread_cond_2_0_t *, pthread_mutex_t *);
+  int (*ptr___pthread_cond_timedwait_2_0) (pthread_cond_2_0_t *,
+                                          pthread_mutex_t *,
+                                          const struct timespec *);
   int (*ptr_pthread_equal) (pthread_t, pthread_t);
   void (*ptr___pthread_exit) (void *);
   int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *);
index 48d90ab8bbf8c285bf39980e06da7f8dc7431701..e0ffcc06d33f6d9b252acc353b541d7878fe55bb 100644 (file)
@@ -117,10 +117,9 @@ internal_function
 _dl_determine_tlsoffset (void)
 {
   struct dtv_slotinfo *slotinfo;
-  size_t max_align;
-  size_t offset;
+  size_t max_align = TLS_TCB_ALIGN;
+  size_t offset, freetop = 0, freebottom = 0;
   size_t cnt;
-  size_t freebytes;
 
   /* The first element of the dtv slot info list is allocated.  */
   assert (GL(dl_tls_dtv_slotinfo_list) != NULL);
@@ -128,6 +127,8 @@ _dl_determine_tlsoffset (void)
      dl_tls_dtv_slotinfo_list list.  */
   assert (GL(dl_tls_dtv_slotinfo_list)->next == NULL);
 
+  slotinfo = GL(dl_tls_dtv_slotinfo_list)->slotinfo;
+
   /* Determining the offset of the various parts of the static TLS
      block has several dependencies.  In addition we have to work
      around bugs in some toolchains.
@@ -158,88 +159,90 @@ _dl_determine_tlsoffset (void)
 
 # if TLS_TCB_AT_TP
   /* We simply start with zero.  */
-  slotinfo = GL(dl_tls_dtv_slotinfo_list)->slotinfo;
-  max_align = slotinfo[1].map != NULL ? slotinfo[1].map->l_tls_align : 1;
   offset = 0;
-  freebytes = 0;
 
   for (cnt = 1; slotinfo[cnt].map != NULL; ++cnt)
     {
       assert (cnt < GL(dl_tls_dtv_slotinfo_list)->len);
 
-      size_t blsize = (slotinfo[cnt].map->l_tls_blocksize
-                      + slotinfo[cnt].map->l_tls_firstbyte_offset);
+      size_t firstbyte = (-slotinfo[cnt].map->l_tls_firstbyte_offset
+                         & (slotinfo[cnt].map->l_tls_align - 1));
+      size_t off;
+      max_align = MAX (max_align, slotinfo[cnt].map->l_tls_align);
 
-      if (blsize <= freebytes)
+      if (freebottom - freetop >= slotinfo[cnt].map->l_tls_blocksize)
        {
-         /* When we come here the amount of memory we was "wasted"
-             for the correct alignment of the previous block is larger
-             than what we need for this module.  So use it.  */
-         size_t n = (freebytes - blsize) / slotinfo[cnt].map->l_tls_align;
-         freebytes = (n * slotinfo[cnt].map->l_tls_align
-                      + slotinfo[cnt].map->l_tls_firstbyte_offset);
+         off = roundup (freetop + slotinfo[cnt].map->l_tls_blocksize
+                        - firstbyte, slotinfo[cnt].map->l_tls_align)
+               + firstbyte;
+         if (off <= freebottom)
+           {
+             freetop = off;
+
+             /* XXX For some architectures we perhaps should store the
+                negative offset.  */
+             slotinfo[cnt].map->l_tls_offset = off;
+             continue;
+           }
        }
-      else
+
+      off = roundup (offset + slotinfo[cnt].map->l_tls_blocksize - firstbyte,
+                    slotinfo[cnt].map->l_tls_align) + firstbyte;
+      if (off > offset + slotinfo[cnt].map->l_tls_blocksize
+               + (freebottom - freetop))
        {
-         /* There is either no gap from the bottom of the static TLS
-             block to the first used byte or the gap is too small.
-             Extend the static TLS block.  */
-         offset += roundup (blsize, max_align);
-         freebytes = slotinfo[cnt].map->l_tls_firstbyte_offset;
+         freetop = offset;
+         freebottom = off - slotinfo[cnt].map->l_tls_blocksize;
        }
-
-      max_align = MAX (max_align, slotinfo[cnt].map->l_tls_align);
+      offset = off;
 
       /* XXX For some architectures we perhaps should store the
         negative offset.  */
-      slotinfo[cnt].map->l_tls_offset = offset - freebytes;
+      slotinfo[cnt].map->l_tls_offset = off;
     }
 
-  /* The thread descriptor (pointed to by the thread pointer) has its
-     own alignment requirement.  Adjust the static TLS size
-     and TLS offsets appropriately.  */
-  // XXX How to deal with this.  We cannot simply add zero bytes
-  // XXX after the first (closest to the TCB) TLS block since this
-  // XXX would invalidate the offsets the linker creates for the LE
-  // XXX model.
-
   GL(dl_tls_static_used) = offset;
-  GL(dl_tls_static_size) = (offset + roundup (TLS_STATIC_SURPLUS, max_align)
+  GL(dl_tls_static_size) = (roundup (offset + TLS_STATIC_SURPLUS, max_align)
                            + TLS_TCB_SIZE);
 # elif TLS_DTV_AT_TP
   /* The TLS blocks start right after the TCB.  */
   offset = TLS_TCB_SIZE;
-  max_align = __alignof (void *);
 
-  /* The first block starts right after the TCB.  */
-  slotinfo = GL(dl_tls_dtv_slotinfo_list)->slotinfo;
-  if (slotinfo[1].map != NULL)
+  for (cnt = 1; slotinfo[cnt].map != NULL; ++cnt)
     {
-      size_t prev_size;
+      assert (cnt < GL(dl_tls_dtv_slotinfo_list)->len);
 
-      offset = roundup (offset, slotinfo[1].map->l_tls_align);
-      slotinfo[1].map->l_tls_offset = offset;
-      max_align = slotinfo[1].map->l_tls_align;
-      prev_size = slotinfo[1].map->l_tls_blocksize;
+      size_t firstbyte = (-slotinfo[cnt].map->l_tls_firstbyte_offset
+                         & (slotinfo[cnt].map->l_tls_align - 1));
+      size_t off;
+      max_align = MAX (max_align, slotinfo[cnt].map->l_tls_align);
 
-      for (cnt = 2; slotinfo[cnt].map != NULL; ++cnt)
+      if (slotinfo[cnt].map->l_tls_blocksize >= freetop - freebottom)
        {
-         assert (cnt < GL(dl_tls_dtv_slotinfo_list)->len);
-
-         max_align = MAX (max_align, slotinfo[cnt].map->l_tls_align);
-
-         /* Compute the offset of the next TLS block.  */
-         offset = roundup (offset + prev_size,
-                           slotinfo[cnt].map->l_tls_align);
+         off = roundup (freebottom, slotinfo[cnt].map->l_tls_align);
+         if (off - freebottom < firstbyte)
+           off += slotinfo[cnt].map->l_tls_align;
+         if (off + slotinfo[cnt].map->l_tls_blocksize - firstbyte <= freetop)
+           {
+             slotinfo[cnt].map->l_tls_offset = off - firstbyte;
+             freebottom = off + slotinfo[cnt].map->l_tls_blocksize
+                          - firstbyte;
+             continue;
+           }
+       }
 
-         /* XXX For some architectures we perhaps should store the
-            negative offset.  */
-         slotinfo[cnt].map->l_tls_offset = offset;
+      off = roundup (offset, slotinfo[cnt].map->l_tls_align);
+      if (off - offset < firstbyte)
+       off += slotinfo[cnt].map->l_tls_align;
 
-         prev_size = slotinfo[cnt].map->l_tls_blocksize;
+      slotinfo[cnt].map->l_tls_offset = off - firstbyte;
+      if (off - firstbyte - offset > freetop - freebottom)
+       {
+         freebottom = offset;
+         freetop = off - firstbyte;
        }
 
-      offset += prev_size;
+      offset = off + slotinfo[cnt].map->l_tls_blocksize - firstbyte;
     }
 
   GL(dl_tls_static_used) = offset;
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise.c
new file mode 100644 (file)
index 0000000..15b7054
--- /dev/null
@@ -0,0 +1,40 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sysdep.h>
+
+/* Advice the system about the expected behaviour of the application with
+   respect to the file associated with FD.  */
+
+int
+posix_fadvise (int fd, off_t offset, off_t len, int advise)
+{
+#ifdef __NR_fadvise64
+  INTERNAL_SYSCALL_DECL (err);
+  int ret = INTERNAL_SYSCALL (fadvise64, err, 6, fd, 0,
+                             __LONG_LONG_PAIR (offset >> 31, offset), len,
+                             advise);
+  if (INTERNAL_SYSCALL_ERROR_P (ret, err))
+    return INTERNAL_SYSCALL_ERRNO (ret, err);
+  return 0;
+#else
+  return ENOSYS;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/posix_fadvise64.c
new file mode 100644 (file)
index 0000000..edc21f6
--- /dev/null
@@ -0,0 +1,77 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sysdep.h>
+#include <kernel-features.h>
+
+int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise);
+int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise);
+
+/* Advice the system about the expected behaviour of the application with
+   respect to the file associated with FD.  */
+
+int
+__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
+{
+#ifdef __NR_fadvise64_64
+  INTERNAL_SYSCALL_DECL (err);
+  int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, advise,
+                             __LONG_LONG_PAIR ((long)(offset >> 32), (long)offset),
+                             __LONG_LONG_PAIR ((long)(len >> 32), (long)len));
+  if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
+    return 0;
+# ifndef __ASSUME_FADVISE64_64_SYSCALL
+  if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS)
+# endif
+   return INTERNAL_SYSCALL_ERRNO (ret, err);
+#endif
+#ifndef __ASSUME_FADVISE64_64_SYSCALL
+# ifdef __NR_fadvise64
+  if (len != (off_t) len)
+    return EOVERFLOW;
+
+  INTERNAL_SYSCALL_DECL (err2);
+  int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 6, fd, 0,
+                              __LONG_LONG_PAIR ((long)(offset >> 32), (long)offset),
+                              (off_t) len, advise);
+  if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2))
+    return 0;
+  return INTERNAL_SYSCALL_ERRNO (ret2, err2);
+# else
+  return ENOSYS;
+# endif
+#endif
+}
+
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)
+
+int
+__posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise)
+{
+  return __posix_fadvise64_l64 (fd, offset, len, advise);
+}
+
+versioned_symbol (libc, __posix_fadvise64_l64, posix_fadvise64, GLIBC_2_3_3);
+compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2);
+#else
+strong_alias (__posix_fadvise64_l64, posix_fadvise64);
+#endif