#include "config.h"
#include "util/log.h"
#include "util/rbtree.h"
#include "util/locks.h"
#include "util/fptr_wlist.h"
Data Structures | |
| struct | order_id |
| keep track of lock id in lock-verify application More... | |
| struct | order_lock |
| a lock More... | |
| struct | lock_ref |
| reference to a lock in a rbtree set More... | |
Defines | |
| #define | STRMAX 1024 |
| max length of strings: filenames and function names. | |
Functions | |
| static void | usage () |
| print program usage help | |
| static int | read_header (FILE *in) |
| read header entry. | |
| 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. | |
| 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 | |
Variables | |
| static int | errors_detected = 0 |
| count of errors detected | |
| static int | verb = 0 |
| verbose? | |
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 |
| static int read_header | ( | FILE * | in | ) | [static] |
read header entry.
| in,: | file to read header of. |
References fatal_exit().
Referenced by readinput().
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().
1.5.6