Imported Upstream version 5.3.21
[platform/upstream/libdb.git] / dist / validate / s_chk_ext_method_calls
1 #!/bin/sh -
2 #
3 # $Id: s_chk_ext_method_calls,v 0f73af5ae3da 2010/05/10 05:38:40 alexander $
4 #
5 # Check that DB doesn't call DB or DB_ENV methods internally.
6
7 d=../..
8 [ -f $d/LICENSE ] || {
9         echo 'FAIL: cannot find source distribution directory.'
10         exit 1
11 }
12
13 s=$d/src
14
15 t=__1
16
17 echo ========================================================
18 echo "Check that DB doesn't call DB or DB_ENV methods internally."
19 echo ========================================================
20 m=`grep '(\*[a-z][_a-z]*)' $s/dbinc/db.in |
21    sed -e 's/^[^(]*(\*//' \
22        -e 's/).*//' \
23        -e '/alt_close/d' \
24        -e '/am_bulk/d' \
25        -e '/am_close/d' \
26        -e '/am_del/d' \
27        -e '/am_destroy/d' \
28        -e '/am_get/d' \
29        -e '/am_put/d' \
30        -e '/am_remove/d' \
31        -e '/am_rename/d' \
32        -e '/am_writelock/d' \
33        -e '/app_dispatch/d' \
34        -e '/db_append_recno/d' \
35        -e '/db_errcall/d' \
36        -e '/db_event_func/d' \
37        -e '/db_feedback/d' \
38        -e '/db_free/d' \
39        -e '/db_malloc/d' \
40        -e '/db_paniccall/d' \
41        -e '/db_realloc/d' \
42        -e '/dbt_usercopy/d' \
43        -e '/dup_compare/d' \
44        -e '/s_callback/d' |
45    sort -u`
46
47 (cd $s && for i in $m; do
48         #echo "$i..." > /dev/stderr
49         egrep -- "->$i\(" */*.[ch]
50 done) |
51 sed \
52     -e '/Wrapper function for/d' \
53     -e '/\/db.h:/d' \
54     -e '/^[^:]*:[        ]*\*[   ]/d' \
55     -e '/^common\/db_getlong.c:/d' \
56     -e '/^common\/util_cache.c:/d' \
57     -e '/^common\/util_log.c:/d' \
58     -e '/^common\/util_sig.c:/d' \
59     -e '/^dbm\//d' \
60     -e '/^hsearch\//d' \
61     -e '/^mutex\/tm.c:/d' \
62     -e '/closeme->close() is a wrapper;/d' \
63     -e '/crypto.c.*db_cipher->close/d' \
64     -e '/db_err.c:.*dbenv->db_msgcall(dbenv, buf);/d' \
65     -e '/db_iface.c:.*(txn->commit(txn, nosync ? DB_TXN_NOSYNC : 0));/d' \
66     -e '/db_iface.c:.*if ((t_ret = txn->abort(txn)) != 0)/d' \
67     -e '/db_iface.c:.*return (dbenv->txn_begin(dbenv, NULL, txnidp, 0));/d' \
68     -e '/db_iface.c:.*return (dbp->get(dbp, txn, key, &data, flags));/d' \
69     -e '/dbenv->is_alive(/d' \
70     -e '/dbenv->thread_id(/d' \
71     -e '/dbenv->thread_id_string(/d' \
72     -e '/rep_util.c:.*ret = dbenv->rep_send(/d' \
73     -e '/test_mutex.c:/d' \
74     -e '/xa.c:/d' \
75     -e '/repmgr\/repmgr_net.c.*env->close()/d'\
76     -e '/repmgr\/repmgr_method.c.*DB_CHANNEL->send_request()/d' \
77     -e '/dbinc\/repmgr.h.*set_config()/d' \
78     -e '/db_vrfyutil.c:.*vdp->txn->commit/d' \
79 >$t
80
81 test -s $t && {
82         cat $t
83         echo "FAIL: found DB/DB_ENV method calls DB library."
84         exit 1
85 }
86
87 rm -f $t
88
89 exit 0