2 General PyAFS utilities, such as error handling
7 # otherwise certain headers are unhappy
8 cdef import from "netinet/in.h": pass
9 cdef import from "afs/vice.h": pass
13 # pioctl convenience wrappers
15 cdef extern int pioctl_read(char *dir, afs_int32 op, void *buffer, unsigned short size, afs_int32 follow) except -1:
21 code = pioctl(dir, op, &blob, follow)
27 class AFSException(Exception):
28 def __init__(self, errno):
30 self.strerror = afs_error_message(errno)
33 return "AFSException(%s)" % (self.errno)
36 return "[%s] %s" % (self.errno, self.strerror)
38 def pyafs_error(code):
40 initialize_ACFG_error_table()
41 initialize_KTC_error_table()
42 initialize_PT_error_table()
43 initialize_RXK_error_table()
44 initialize_U_error_table()
49 raise AFSException(code)