getpid-20050429
[openafs.git] / src / afs / afs_osi_pag.c
index 7f191b4..eb51996 100644 (file)
@@ -141,39 +141,40 @@ getpag(void)
 
 static int afs_pag_sleepcnt = 0;
 
-static int 
-afs_pag_sleep(struct AFS_UCRED **acred) 
+static int
+afs_pag_sleep(struct AFS_UCRED **acred)
 {
-  int rv = 0;
-  if(!afs_suser(acred)) {
-    if(osi_Time() - pag_epoch < pagCounter) {
-      rv = 1;
+    int rv = 0;
+
+    if (!afs_suser(acred)) {
+       if(osi_Time() - pag_epoch < pagCounter) {
+           rv = 1;
+       }
     }
-  }
 
-  return rv;
+    return rv;
 }
 
-static int 
+static int
 afs_pag_wait(struct AFS_UCRED **acred)
 {
-  if(afs_pag_sleep(acred)) {
-    if(!afs_pag_sleepcnt) {
-      printf("%s() PAG throttling triggered, pid %d... sleeping.  sleepcnt %d\n",
-            __func__, getpid(), afs_pag_sleepcnt);
+    if (afs_pag_sleep(acred)) {
+       if (!afs_pag_sleepcnt) {
+           printf("%s() PAG throttling triggered, pid %d... sleeping.  sleepcnt %d\n",
+                  "afs_pag_wait", osi_getpid(), afs_pag_sleepcnt);
+       }
+
+       afs_pag_sleepcnt++;
+
+       do {
+           /* XXX spins on EINTR */
+           afs_osi_Wait(1000, (struct afs_osi_WaitHandle *)0, 0);
+       } while (afs_pag_sleep(acred));
+
+       afs_pag_sleepcnt--;
     }
-    
-    afs_pag_sleepcnt++;
-    
-    do {
-      /* XXX spins on EINTR */
-      afs_osi_Wait(1000, (struct afs_osi_WaitHandle *)0, 0);
-    } while(afs_pag_sleep(acred));
-    
-    afs_pag_sleepcnt--;
-  }
-
-  return 0;
+
+    return 0;
 }
 
 int
@@ -189,7 +190,7 @@ afs_setpag(void)
 #if     defined(AFS_SUN5_ENV)
     struct AFS_UCRED **acred = *credpp;
 #elif  defined(AFS_OBSD_ENV)
-    struct AFS_UCRED **acred = p->p_ucred;
+    struct AFS_UCRED **acred = &p->p_ucred;
 #else
     struct AFS_UCRED **acred = NULL;
 #endif
@@ -285,7 +286,7 @@ afs_setpag_val(int pagval)
 #if     defined(AFS_SUN5_ENV)
     struct AFS_UCRED **acred = *credp;
 #elif  defined(AFS_OBSD_ENV)
-    struct AFS_UCRED **acred = p->p_ucred;
+    struct AFS_UCRED **acred = &p->p_ucred;
 #else
     struct AFS_UCRED **acred = NULL;
 #endif