]> sourceware.org Git - glibc.git/commitdiff
Use unsigned types for counters in AIO code.
authorRoland McGrath <roland@hack.frob.com>
Thu, 25 Jun 2015 00:43:32 +0000 (17:43 -0700)
committerRoland McGrath <roland@hack.frob.com>
Thu, 25 Jun 2015 00:43:32 +0000 (17:43 -0700)
ChangeLog
sysdeps/nptl/aio_misc.h
sysdeps/pthread/aio_misc.h
sysdeps/pthread/aio_suspend.c
sysdeps/pthread/lio_listio.c

index eb44829cd8853c119bba754102974664314d301d..9d06bc14e97e5bf4652e59cbd7b5d9f33e1438d4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2015-06-24  Roland McGrath  <roland@hack.frob.com>
+
+       * sysdeps/pthread/aio_misc.h (struct waitlist): Change type of field
+       counterp to 'volatile unsigned int *'.
+       * sysdeps/pthread/aio_suspend.c [DONT_NEED_AIO_MISC_COND]
+       (do_aio_misc_wait): Give argument CNTR type 'unsigned int *'.
+       (aio_suspend): Give local variable CNTR type 'unsigned int'.
+       * sysdeps/pthread/lio_listio.c (lio_listio_internal):
+       Give local variable TOTAL type 'volatile unsigned int'.
+       (struct async_waitlist): Change type of field counter to 'unsigned int'.
+
 2015-06-24  H.J. Lu  <hongjiu.lu@intel.com>
 
        [BZ #18383]
index fb69b0ffd141963e99ed106814b1ce9ce435e3f5..d5d1c08d0f161a489cf432a3be296e0ba46cdd6a 100644 (file)
@@ -34,8 +34,8 @@
 
 #define AIO_MISC_WAIT(result, futex, timeout, cancel)                        \
   do {                                                                       \
-    volatile int *futexaddr = &futex;                                        \
-    int oldval = futex;                                                              \
+    volatile unsigned int *futexaddr = &futex;                               \
+    unsigned int oldval = futex;                                             \
                                                                              \
     if (oldval != 0)                                                         \
       {                                                                              \
index ffb0983ea83404ba685e3c1393dabbccfd37a0b1..5d3fb61efacd316a25dcb5158fa26d636f9cc1a3 100644 (file)
@@ -51,7 +51,7 @@ struct waitlist
 #endif
     int *result;
 
-    volatile int *counterp;
+    volatile unsigned int *counterp;
     /* The next field is used in asynchronous `lio_listio' operations.  */
     struct sigevent *sigevp;
 #ifdef BROKEN_THREAD_SIGNALS
index 920f18a414863c7d2cc6574344c72ef5ce6df119..641eafb1bd9f234dd5e72952d2804362dcb270d4 100644 (file)
@@ -94,13 +94,13 @@ cleanup (void *arg)
 #ifdef DONT_NEED_AIO_MISC_COND
 static int
 __attribute__ ((noinline))
-do_aio_misc_wait(int *cntr, const struct timespec *timeout)
+do_aio_misc_wait (unsigned int *cntr, const struct timespec *timeout)
 {
-       int result = 0;
+  int result = 0;
 
-       AIO_MISC_WAIT(result, *cntr, timeout, 1);
+  AIO_MISC_WAIT (result, *cntr, timeout, 1);
 
-       return result;
+  return result;
 }
 #endif
 
@@ -124,7 +124,7 @@ aio_suspend (list, nent, timeout)
   int cnt;
   bool any = false;
   int result = 0;
-  int cntr = 1;
+  unsigned int cntr = 1;
 
   /* Request the mutex.  */
   pthread_mutex_lock (&__aio_requests_mutex);
@@ -180,7 +180,7 @@ aio_suspend (list, nent, timeout)
       pthread_cleanup_push (cleanup, &clparam);
 
 #ifdef DONT_NEED_AIO_MISC_COND
-      result = do_aio_misc_wait(&cntr, timeout);
+      result = do_aio_misc_wait (&cntr, timeout);
 #else
       if (timeout == NULL)
        result = pthread_cond_wait (&cond, &__aio_requests_mutex);
index bfbf2217ed827c870d78d1c0bcc7a49687d5a6f3..ac7ce401c7b61d2f8f478d25f5758f92f2aee3d1 100644 (file)
@@ -35,7 +35,7 @@
 /* We need this special structure to handle asynchronous I/O.  */
 struct async_waitlist
   {
-    int counter;
+    unsigned int counter;
     struct sigevent sigev;
     struct waitlist list[0];
   };
@@ -61,7 +61,7 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent,
   struct sigevent defsigev;
   struct requestlist *requests[nent];
   int cnt;
-  volatile int total = 0;
+  volatile unsigned int total = 0;
   int result = 0;
 
   if (sig == NULL)
@@ -83,7 +83,7 @@ lio_listio_internal (int mode, struct aiocb *const list[], int nent,
 
        requests[cnt] = __aio_enqueue_request ((aiocb_union *) list[cnt],
                                               (list[cnt]->aio_lio_opcode
-                                               | LIO_OPCODE_BASE));
+                                               | LIO_OPCODE_BASE));
 
        if (requests[cnt] != NULL)
          /* Successfully enqueued.  */
This page took 0.121772 seconds and 5 git commands to generate.