Occasional export failures were found to be caused by truncating 64-bit pointers to 32-bits. Fix by explicitly setting types for all ctype arguments and results.
Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all
Unified · Split
| @@ -204,14 +204,23 @@ from ctypes import * · 203 unmodified lines | ||
| 204 | 204 | libpq = CDLL("libpq.so.5") |
| 205 | 205 | PQconnectdb = libpq.PQconnectdb |
| 206 | 206 | PQconnectdb.restype = c_void_p |
| 207 | +PQconnectdb.argtypes = [ c_char_p ] | |
| 207 | 208 | PQfinish = libpq.PQfinish |
| 209 | +PQfinish.argtypes = [ c_void_p ] | |
| 208 | 210 | PQstatus = libpq.PQstatus |
| 211 | +PQstatus.restype = c_int | |
| 212 | +PQstatus.argtypes = [ c_void_p ] | |
| 209 | 213 | PQexec = libpq.PQexec |
| 210 | 214 | PQexec.restype = c_void_p |
| 215 | +PQexec.argtypes = [ c_void_p, c_char_p ] | |
| 211 | 216 | PQresultStatus = libpq.PQresultStatus |
| 217 | +PQresultStatus.restype = c_int | |
| 218 | +PQresultStatus.argtypes = [ c_void_p ] | |
| 212 | 219 | PQputCopyData = libpq.PQputCopyData |
| 220 | +PQputCopyData.restype = c_int | |
| 213 | 221 | PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ] |
| 214 | 222 | PQputCopyEnd = libpq.PQputCopyEnd |
| 223 | +PQputCopyEnd.restype = c_int | |
| 215 | 224 | PQputCopyEnd.argtypes = [ c_void_p, c_void_p ] |
| 216 | 225 | |
| 217 | 226 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ |