diff options
author | Rusty Russell <rusty@linuxcare.com.au> | 2000-09-04 09:45:54 +0000 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2000-09-04 09:45:54 +0000 |
commit | 62527ce5f0ffaa5b18aa118f64c21af238ddc156 (patch) | |
tree | 744ca9a736d9e07e319b27a703ba6f23fb0e3ae7 /libiptc | |
parent | 061063f26e1a0eae9395acd2a3bbf8d13363abd1 (diff) |
Finally fixed sparc64 counter bug (I hope).
Diffstat (limited to 'libiptc')
-rw-r--r-- | libiptc/libiptc.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c index 99481578..9db28c58 100644 --- a/libiptc/libiptc.c +++ b/libiptc/libiptc.c @@ -1445,11 +1445,6 @@ subtract_counters(STRUCT_COUNTERS *answer, { answer->pcnt = a->pcnt - b->pcnt; answer->bcnt = a->bcnt - b->bcnt; - - fprintf(stderr, "pcnt: %llu - %llu = %llu\n", - a->pcnt, b->pcnt, answer->pcnt); - fprintf(stderr, "bcnt: %llu - %llu = %llu\n", - a->bcnt, b->bcnt, answer->bcnt); } int @@ -1516,15 +1511,6 @@ TC_COMMIT(TC_HANDLE_T *handle) return 0; } -#if 1 - fprintf(stderr, "Before adjust:\n"); - for (i = 0; i < (*handle)->new_number; i++) { - fprintf(stderr, "counter %i/%i = %llu,%llu\n", - i, (*handle)->new_number, - repl->counters[i].pcnt, - repl->counters[i].bcnt); - } -#endif /* Put counters back. */ strcpy(newcounters->name, (*handle)->info.name); newcounters->num_counters = (*handle)->new_number; @@ -1561,15 +1547,21 @@ TC_COMMIT(TC_HANDLE_T *handle) break; } } -#if 1 - fprintf(stderr, "After adjust:\n"); - for (i = 0; i < (*handle)->new_number; i++) { - fprintf(stderr, "counter %i/%i = %llu,%llu\n", - i, (*handle)->new_number, - newcounters->counters[i].pcnt, - newcounters->counters[i].bcnt); + +#ifdef KERNEL_64_USERSPACE_32 + { + /* Kernel will think that pointer should be 64-bits, and get + padding. So we accomodate here (assumption: alignment of + `counters' is on 64-bit boundary). */ + u_int64_t *kernptr = (u_int64_t *)&newcounters->counters; + if ((unsigned long)&newcounters->counters % 8 != 0) { + fprintf(stderr, + "counters alignment incorrect! Mail rusty!\n"); + abort(); + } + *kernptr = newcounters->counters; } -#endif +#endif /* KERNEL_64_USERSPACE_32 */ if (setsockopt(sockfd, TC_IPPROTO, SO_SET_ADD_COUNTERS, newcounters, counterlen) < 0) { |