More cleaning
[invirt/third/libt4.git] / lock_tester.cc
index ac9175b..c192128 100644 (file)
@@ -2,18 +2,10 @@
 // Lock server tester
 //
 
-#include "lock_protocol.h"
 #include "lock_client.h"
-#include "rpc/rpc.h"
 #include <arpa/inet.h>
-#include <vector>
-#include <stdlib.h>
-#include <stdio.h>
-#include "lang/verify.h"
-#include "threaded_log.h"
 #include <sys/types.h>
 #include <unistd.h>
-#include "lock.h"
 
 char log_thread_prefix = 'c';
 
@@ -35,8 +27,8 @@ void check_grant(lock_protocol::lockid_t lid) {
     lock ml(count_mutex);
     int x = lid[0] & 0x0f;
     if (ct[x] != 0) {
-        fprintf(stderr, "error: server granted %s twice\n", lid.c_str());
-        fprintf(stdout, "error: server granted %s twice\n", lid.c_str());
+        cout << "error: server granted " << lid << " twice" << endl;
+        cerr << "error: server granted " << lid << " twice" << endl;
         exit(1);
     }
     ct[x] += 1;
@@ -46,7 +38,7 @@ void check_release(lock_protocol::lockid_t lid) {
     lock ml(count_mutex);
     int x = lid[0] & 0x0f;
     if (ct[x] != 1) {
-        fprintf(stderr, "error: client released un-held lock %s\n",  lid.c_str());
+        cerr << "error: client released un-held lock " << lid << endl;
         exit(1);
     }
     ct[x] -= 1;
@@ -132,7 +124,7 @@ main(int argc, char *argv[])
     srandom((uint32_t)getpid());
 
     if (argc < 2) {
-        fprintf(stderr, "Usage: %s [host:]port [test]\n", argv[0]);
+        cerr << "Usage: " << argv[0] << " [host:]port [test]" << endl;
         exit(1);
     }