This file checks the lock traces generated by checklock.c. More...
|keep track of lock id in lock-verify application More...|
|a lock More...|
|reference to a lock in a rbtree set More...|
|max length of strings: filenames and function names. More...|
|static void||usage ()|
|print program usage help |
|static int||read_header (FILE *in)|
|read header entry. More...|
|static int||readup_str (char **str, FILE *in)|
|read a string from file, false on error |
|static void||read_create (rbtree_t *all, FILE *in)|
|read creation entry |
|static struct order_lock *||insert_lock (rbtree_t *all, struct order_id *id)|
|insert lock entry (empty) into list |
|static void||read_lock (rbtree_t *all, FILE *in, int val)|
|read lock entry |
|static void||readinput (rbtree_t *all, char *file)|
|read input file |
|static void||found_cycle (struct lock_ref *visit, int level)|
|print cycle message |
|static int||detect_cycle (struct lock_ref *visit, struct lock_ref *from)|
|Detect cycle by comparing visited now with all (unvisited) bigger nodes. |
|static void||search_cycle (struct lock_ref *visit, int level, struct lock_ref *from)|
|recursive function to depth first search for cycles. More...|
|static void||check_order_lock (struct order_lock *lock)|
|Check ordering of one lock. |
|static void||check_order (rbtree_t *all_locks)|
|Check ordering of locks. |
|int||main (int argc, char *argv)|
|main program to verify all traces passed |
|static int||errors_detected = 0|
|count of errors detected |
|static int||verb = 0|
This file checks the lock traces generated by checklock.c.
Checks if locks are consistently locked in the same order. If not, this can lead to deadlock if threads execute the different ordering at the same time.
|#define STRMAX 1024|
max length of strings: filenames and function names.
Referenced by readup_str().
recursive function to depth first search for cycles.
|visit,:||the lock visited at this step. its dfs_next pointer gives the visited lock up in recursion. same as lookfor at level 0.|
|level,:||depth of recursion. 0 is start.|
|from,:||search for matches from unvisited node upwards.|
References order_lock::create_file, order_lock::create_line, detect_cycle(), order_lock::dfs_next, fatal_exit(), found_cycle(), order_lock::id, order_id::instance, lock_ref::lock, RBTREE_FOR, order_lock::smaller, order_id::thr, verb, and order_lock::visited.
Referenced by check_order_lock().