summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/dist/s_errno
blob: 1bfc5e7f1a0352c3d379eb171ef536d0df5099f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#! /bin/sh

# Complain about code that returns a system error value without an associated
# verbose message.
#
# This script is a kluge and isn't run by default.

t=__wt.$$
trap 'rm -f $t' 0 1 2 3 13 15

cd ..

# Strip out a list of errors that will be flagged, but are OK.
error_ok()
{
	sed -e '/ERET(/d' \
	    -e '/WT_ERR_MSG(/d' \
	    -e '/WT_ERR_TEST(/d' \
	    -e '/WT_PANIC_ERR(/d' \
	    -e '/WT_PANIC_RET(/d' \
	    -e '/WT_RET_MSG(/d' \
	    -e '/\/intpack.i:.*EINVAL/d'\
	    -e '/\/intpack.i:.*ENOMEM/d'\
	    -e '/\/pack_impl.c:.*EINVAL/d'\
	    -e '/\/pack_impl.c:.*ENOMEM/d'\
	    -e '/\/pack_stream.c:.*ENOMEM/d'\
	    -e '/\/packing.i:.*EINVAL/d'\
	    -e '/__config_err(/d' \
	    -e '/__wt_block_panic(/d' \
	    -e '/__wt_err(/d' \
	    -e '/__wt_errx(/d' \
	    -e '/csv_error(/d' \
	    -e '/nop_error(/d' \
	    -e '/rotn_error(/d' \
	    -e '/zlib_error(/d'
}

# Loop through source files.
for f in `find ext src -name '*.[ci]'`; do
	if expr "$f" : 'src/os_win/os_winerr.c' > /dev/null; then
		continue
	fi
	if expr "$f" : 'src/utilities/.*' > /dev/null; then
		continue
	fi

	# Strip include files,
	# then use the C preprocessor to strip comments,
	# then turn each file into a single line,
	# then chunk the file by semicolons,
	# then search for explicit error returns (ignoring EBUSY),
	# then prepend the file name to each line,
	# then skip known calls that include verbose messages.
	sed '/^#include/d' $f |
	${CC:-cc} -E - |
	tr -s '\012' ' ' | tr ';' '\012' |
	egrep -w 'EPERM|ENOENT|ESRCH|EINTR|EIO|ENXIO|E2BIG|ENOEXEC|EBADF|ECHILD|EDEADLK|ENOMEM|EACCES|EFAULT|ENOTBLK|EEXIST|EXDEV|ENODEV|ENOTDIR|EISDIR|EINVAL|ENFILE|EMFILE|ENOTTY|ETXTBSY|EFBIG|ENOSPC|ESPIPE|EROFS|EMLINK|EPIPE|EDOM|ERANGE|EAGAIN|EWOULDBLOCK|EINPROGRESS|EALREADY|ENOTSOCK|EDESTADDRREQ|EMSGSIZE|EPROTOTYPE|ENOPROTOOPT|EPROTONOSUPPORT|ESOCKTNOSUPPORT|EOPNOTSUPP|ENOTSUP|EPFNOSUPPORT|EAFNOSUPPORT|EADDRINUSE|EADDRNOTAVAIL|ENETDOWN|ENETUNREACH|ENETRESET|ECONNABORTED|ECONNRESET|ENOBUFS|EISCONN|ENOTCONN|ESHUTDOWN|ETOOMANYREFS|ETIMEDOUT|ECONNREFUSED|ELOOP|ENAMETOOLONG|EHOSTDOWN|EHOSTUNREACH|ENOTEMPTY|EPROCLIM|EUSERS|EDQUOT|ESTALE|EREMOTE|EBADRPC|ERPCMISMATCH|EPROGUNAVAIL|EPROGMISMATCH|EPROCUNAVAIL|ENOLCK|ENOSYS|EFTYPE|EAUTH|ENEEDAUTH|EIDRM|ENOMSG|EOVERFLOW|ECANCELED|EILSEQ|ENOATTR|EDOOFUS|EBADMSG|EMULTIHOP|ENOLINK|EPROTO|ENOTCAPABLE|ECAPMODE|ENOTRECOVERABLE|EOWNERDEAD|ELAST|ERESTART|EJUSTRETURN|ENOIOCTL|EDIRIOCTL' |
	sed -e 's/^[ 	]*//' \
	    -e "s;^;$f: ;" |
	    error_ok
done > $t

test -s $t && {
	echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
	echo 'Unexpected error usage.'
	echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
	cat $t
	exit 1
}
exit 0