Lines Matching refs:res

905   void *res;
907 res = REAL(memchr)(s, c, n);
909 res = internal_memchr(s, c, n);
912 void *res = REAL(memchr)(s, c, n);
914 uptr len = res ? (char *)res - (const char *)s + 1 : n;
916 return res;
943 double res = REAL(frexp)(x, exp);
944 return res;
959 float res = REAL(frexpf)(x, exp);
961 return res;
970 long double res = REAL(frexpl)(x, exp);
972 return res;
1011 SSIZE_T res = REAL(read)(fd, ptr, count);
1012 if (res > 0) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, res);
1013 if (res >= 0 && fd >= 0) COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
1014 return res;
1029 SIZE_T res = REAL(fread)(ptr, size, nmemb, file);
1030 if (res > 0) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, res * size);
1031 return res;
1046 SSIZE_T res = REAL(pread)(fd, ptr, count, offset);
1047 if (res > 0) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, res);
1048 if (res >= 0 && fd >= 0) COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
1049 return res;
1064 SSIZE_T res = REAL(pread64)(fd, ptr, count, offset);
1065 if (res > 0) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, res);
1066 if (res >= 0 && fd >= 0) COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
1067 return res;
1080 SSIZE_T res = REAL(readv)(fd, iov, iovcnt);
1081 if (res > 0) write_iovec(ctx, iov, iovcnt, res);
1082 if (res >= 0 && fd >= 0) COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
1083 return res;
1096 SSIZE_T res = REAL(preadv)(fd, iov, iovcnt, offset);
1097 if (res > 0) write_iovec(ctx, iov, iovcnt, res);
1098 if (res >= 0 && fd >= 0) COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
1099 return res;
1112 SSIZE_T res = REAL(preadv64)(fd, iov, iovcnt, offset);
1113 if (res > 0) write_iovec(ctx, iov, iovcnt, res);
1114 if (res >= 0 && fd >= 0) COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
1115 return res;
1128 SSIZE_T res = REAL(write)(fd, ptr, count);
1130 if (res > 0) COMMON_INTERCEPTOR_READ_RANGE(ctx, ptr, res);
1131 return res;
1143 SIZE_T res = REAL(fwrite)(p, size, nmemb, file);
1144 if (res > 0) COMMON_INTERCEPTOR_READ_RANGE(ctx, p, res * size);
1145 return res;
1158 SSIZE_T res = REAL(pwrite)(fd, ptr, count, offset);
1159 if (res > 0) COMMON_INTERCEPTOR_READ_RANGE(ctx, ptr, res);
1160 return res;
1174 SSIZE_T res = REAL(pwrite64)(fd, ptr, count, offset);
1175 if (res > 0) COMMON_INTERCEPTOR_READ_RANGE(ctx, ptr, res);
1176 return res;
1190 SSIZE_T res = REAL(writev)(fd, iov, iovcnt);
1191 if (res > 0) read_iovec(ctx, iov, iovcnt, res);
1192 return res;
1206 SSIZE_T res = REAL(pwritev)(fd, iov, iovcnt, offset);
1207 if (res > 0) read_iovec(ctx, iov, iovcnt, res);
1208 return res;
1222 SSIZE_T res = REAL(pwritev64)(fd, iov, iovcnt, offset);
1223 if (res > 0) read_iovec(ctx, iov, iovcnt, res);
1224 return res;
1239 char *res = REAL(fgets)(s, size, file);
1240 if (res)
1242 return res;
1285 int res = REAL(prctl(option, arg2, arg3, arg4, arg5));
1292 return res;
1304 unsigned long res = REAL(time)(&local_t);
1305 if (t && res != (unsigned long)-1) {
1309 return res;
1331 __sanitizer_tm *res = REAL(localtime)(timep);
1332 if (res) {
1334 unpoison_tm(ctx, res);
1336 return res;
1341 __sanitizer_tm *res = REAL(localtime_r)(timep, result);
1342 if (res) {
1344 unpoison_tm(ctx, res);
1346 return res;
1351 __sanitizer_tm *res = REAL(gmtime)(timep);
1352 if (res) {
1354 unpoison_tm(ctx, res);
1356 return res;
1361 __sanitizer_tm *res = REAL(gmtime_r)(timep, result);
1362 if (res) {
1364 unpoison_tm(ctx, res);
1366 return res;
1374 char *res = REAL(ctime)(timep);
1375 if (res) {
1377 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
1379 return res;
1387 char *res = REAL(ctime_r)(timep, result);
1388 if (res) {
1390 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
1392 return res;
1400 char *res = REAL(asctime)(tm);
1401 if (res) {
1403 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
1405 return res;
1413 char *res = REAL(asctime_r)(tm, result);
1414 if (res) {
1416 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
1418 return res;
1430 long res = REAL(mktime)(tm);
1431 if (res != -1) unpoison_tm(ctx, tm);
1432 return res;
1457 char *res = REAL(strptime)(s, format, tm);
1458 COMMON_INTERCEPTOR_READ_STRING(ctx, s, res ? res - s : 0);
1459 if (res && tm) {
1465 return res;
1481 int res = WRAP(vname)(__VA_ARGS__, ap); \
1483 return res; \
1496 int res = REAL(vname)(__VA_ARGS__); \
1497 if (res > 0) \
1498 scanf_common(ctx, res, allowGnuMalloc, format, aq); \
1500 return res; \
1586 int res = REAL(vname)(__VA_ARGS__); \
1588 return res; \
1600 int res = REAL(vname)(str, __VA_ARGS__); \
1601 if (res >= 0) { \
1602 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, str, res + 1); \
1605 return res; \
1617 int res = REAL(vname)(str, size, __VA_ARGS__); \
1618 if (res >= 0) { \
1619 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, str, Min(size, (SIZE_T)(res + 1))); \
1622 return res; \
1635 int res = REAL(vname)(strp, __VA_ARGS__); \
1636 if (res >= 0) { \
1637 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *strp, res + 1); \
1640 return res; \
1841 int res = REAL(ioctl)(d, request, arg);
1843 if (desc && res != -1) ioctl_common_post(ctx, desc, res, d, request, arg);
1844 return res;
1907 __sanitizer_passwd *res = REAL(getpwnam)(name);
1908 unpoison_passwd(ctx, res);
1909 return res;
1914 __sanitizer_passwd *res = REAL(getpwuid)(uid);
1915 unpoison_passwd(ctx, res);
1916 return res;
1922 __sanitizer_group *res = REAL(getgrnam)(name);
1923 unpoison_group(ctx, res);
1924 return res;
1929 __sanitizer_group *res = REAL(getgrgid)(gid);
1930 unpoison_group(ctx, res);
1931 return res;
1951 int res = REAL(getpwnam_r)(name, pwd, buf, buflen, result);
1952 if (!res && result)
1955 return res;
1964 int res = REAL(getpwuid_r)(uid, pwd, buf, buflen, result);
1965 if (!res && result)
1968 return res;
1978 int res = REAL(getgrnam_r)(name, grp, buf, buflen, result);
1979 if (!res && result)
1982 return res;
1991 int res = REAL(getgrgid_r)(gid, grp, buf, buflen, result);
1992 if (!res && result)
1995 return res;
2010 __sanitizer_passwd *res = REAL(getpwent)(dummy);
2011 unpoison_passwd(ctx, res);
2012 return res;
2017 __sanitizer_group *res = REAL(getgrent)(dummy);
2018 unpoison_group(ctx, res);
2019 return res;
2032 __sanitizer_passwd *res = REAL(fgetpwent)(fp);
2033 unpoison_passwd(ctx, res);
2034 return res;
2039 __sanitizer_group *res = REAL(fgetgrent)(fp);
2040 unpoison_group(ctx, res);
2041 return res;
2058 int res = REAL(getpwent_r)(pwbuf, buf, buflen, pwbufp);
2059 if (!res && pwbufp)
2062 return res;
2071 int res = REAL(getgrent_r)(pwbuf, buf, buflen, pwbufp);
2072 if (!res && pwbufp)
2075 return res;
2092 int res = REAL(fgetpwent_r)(fp, pwbuf, buf, buflen, pwbufp);
2093 if (!res && pwbufp)
2096 return res;
2112 int res = REAL(fgetgrent_r)(fp, pwbuf, buf, buflen, pwbufp);
2113 if (!res && pwbufp)
2116 return res;
2164 int res = REAL(clock_getres)(clk_id, tp);
2165 if (!res && tp) {
2168 return res;
2176 int res = REAL(clock_gettime)(clk_id, tp);
2177 if (!res) {
2180 return res;
2212 int res = REAL(getitimer)(which, curr_value);
2213 if (!res && curr_value) {
2216 return res;
2237 int res = REAL(setitimer)(which, new_value, old_value);
2238 if (!res && old_value) {
2241 return res;
2270 int res = REAL(glob)(pattern, flags, errfunc, pglob);
2271 if ((!res || res == glob_nomatch) && pglob) unpoison_glob_t(ctx, pglob);
2272 return res;
2326 int res = REAL(glob)(pattern, flags, errfunc, pglob);
2335 if ((!res || res == glob_nomatch) && pglob) unpoison_glob_t(ctx, pglob);
2336 return res;
2362 int res = REAL(glob64)(pattern, flags, errfunc, pglob);
2371 if ((!res || res == glob_nomatch) && pglob) unpoison_glob_t(ctx, pglob);
2372 return res;
2390 int res = REAL(wait)(status);
2391 if (res != -1 && status)
2393 return res;
2408 int res = REAL(waitid)(idtype, id, infop, options);
2409 if (res != -1 && infop)
2411 return res;
2419 int res = REAL(waitpid)(pid, status, options);
2420 if (res != -1 && status)
2422 return res;
2430 int res = REAL(wait3)(status, options, rusage);
2431 if (res != -1) {
2435 return res;
2444 int res = REAL(__wait4)(pid, status, options, rusage);
2445 if (res != -1) {
2449 return res;
2459 int res = REAL(wait4)(pid, status, options, rusage);
2460 if (res != -1) {
2464 return res;
2488 char *res = REAL(inet_ntop)(af, src, dst, size);
2489 if (res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
2490 return res;
2500 int res = REAL(inet_pton)(af, src, dst);
2501 if (res == 1) {
2505 return res;
2522 int res = REAL(inet_aton)(cp, dst);
2523 if (res != 0) {
2527 return res;
2541 int res = REAL(pthread_getschedparam)(thread, policy, param);
2542 if (res == 0) {
2546 return res;
2568 int res = REAL(getaddrinfo)(node, service, hints, out);
2569 if (res == 0 && out) {
2582 return res;
2600 int res =
2602 if (res == 0) {
2608 return res;
2624 int res = REAL(getsockname)(sock_fd, addr, addrlen);
2625 if (res == 0) {
2628 return res;
2661 struct __sanitizer_hostent *res = REAL(gethostbyname)(name);
2662 if (res) write_hostent(ctx, res);
2663 return res;
2671 struct __sanitizer_hostent *res = REAL(gethostbyaddr)(addr, len, type);
2672 if (res) write_hostent(ctx, res);
2673 return res;
2679 struct __sanitizer_hostent *res = REAL(gethostent)(fake);
2680 if (res) write_hostent(ctx, res);
2681 return res;
2695 struct __sanitizer_hostent *res = REAL(gethostbyname2)(name, af);
2696 if (res) write_hostent(ctx, res);
2697 return res;
2714 int res = REAL(gethostbyname_r)(name, ret, buf, buflen, result, h_errnop);
2717 if (res == 0 && *result) write_hostent(ctx, *result);
2721 return res;
2737 int res = REAL(gethostent_r)(ret, buf, buflen, result, h_errnop);
2740 if (res == 0 && *result) write_hostent(ctx, *result);
2744 return res;
2763 int res = REAL(gethostbyaddr_r)(addr, len, type, ret, buf, buflen, result,
2767 if (res == 0 && *result) write_hostent(ctx, *result);
2771 return res;
2789 int res =
2793 if (res == 0 && *result) write_hostent(ctx, *result);
2797 return res;
2815 int res = REAL(getsockopt)(sockfd, level, optname, optval, optlen);
2816 if (res == 0)
2818 return res;
2903 double res = REAL(modf)(x, iptr);
2907 return res;
2915 float res = REAL(modff)(x, iptr);
2919 return res;
2927 long double res = REAL(modfl)(x, iptr);
2931 return res;
2964 SSIZE_T res = REAL(recvmsg)(fd, msg, flags);
2965 if (res >= 0) {
2968 write_msghdr(ctx, msg, res);
2972 return res;
2985 int res = REAL(recvmmsg)(fd, msgvec, vlen, flags, timeout);
2986 if (res >= 0) {
2988 for (int i = 0; i < res; ++i) {
2995 return res;
3063 SSIZE_T res = REAL(sendmsg)(fd, msg, flags);
3064 if (common_flags()->intercept_send && res >= 0 && msg)
3065 read_msghdr(ctx, msg, res);
3066 return res;
3082 int res = REAL(sendmmsg)(fd, msgvec, vlen, flags);
3083 if (res >= 0 && msgvec) {
3084 for (int i = 0; i < res; ++i) {
3091 return res;
3107 int res = REAL(getpeername)(sockfd, addr, addrlen);
3108 if (!res && addr && addrlen)
3110 return res;
3124 int res = REAL(sysinfo)(info);
3125 if (!res && info)
3127 return res;
3139 __sanitizer_dirent *res = REAL(opendir)(path);
3140 if (res)
3142 return res;
3151 __sanitizer_dirent *res = REAL(readdir)(dirp);
3152 if (res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, res->d_reclen);
3153 return res;
3163 int res = REAL(readdir_r)(dirp, entry, result);
3164 if (!res) {
3169 return res;
3187 __sanitizer_dirent64 *res = REAL(readdir64)(dirp);
3188 if (res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, res->d_reclen);
3189 return res;
3199 int res = REAL(readdir64_r)(dirp, entry, result);
3200 if (!res) {
3205 return res;
3247 uptr res = REAL(ptrace)(request, pid, addr, data);
3249 if (!res && data) {
3271 return res;
3294 char *res = REAL(setlocale)(category, locale);
3295 if (res) {
3296 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
3299 return res;
3314 char *res = REAL(getcwd)(buf, size);
3315 if (res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
3316 return res;
3330 char *res = REAL(get_current_dir_name)(fake);
3331 if (res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
3332 return res;
3380 INTMAX_T res = REAL(strtoimax)(nptr, &real_endptr, base);
3382 return res;
3392 UINTMAX_T res = REAL(strtoumax)(nptr, &real_endptr, base);
3394 return res;
3411 SIZE_T res = REAL(mbstowcs)(dest, src, len);
3412 if (res != (SIZE_T) - 1 && dest) {
3413 SIZE_T write_cnt = res + (res < len);
3416 return res;
3428 SIZE_T res = REAL(mbsrtowcs)(dest, src, len, ps);
3429 if (res != (SIZE_T)(-1) && dest && src) {
3432 SIZE_T write_cnt = res + !*src;
3435 return res;
3458 SIZE_T res = REAL(mbsnrtowcs)(dest, src, nms, len, ps);
3459 if (res != (SIZE_T)(-1) && dest && src) {
3460 SIZE_T write_cnt = res + !*src;
3463 return res;
3478 SIZE_T res = REAL(wcstombs)(dest, src, len);
3479 if (res != (SIZE_T) - 1 && dest) {
3480 SIZE_T write_cnt = res + (res < len);
3483 return res;
3495 SIZE_T res = REAL(wcsrtombs)(dest, src, len, ps);
3496 if (res != (SIZE_T) - 1 && dest && src) {
3497 SIZE_T write_cnt = res + !*src;
3500 return res;
3523 SIZE_T res = REAL(wcsnrtombs)(dest, src, nms, len, ps);
3524 if (res != ((SIZE_T)-1) && dest && src) {
3525 SIZE_T write_cnt = res + !*src;
3528 return res;
3547 SIZE_T res = REAL(wcrtomb)(local_dest, src, ps);
3548 if (res != ((SIZE_T)-1)) {
3549 CHECK_LE(res, sizeof(local_dest));
3550 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dest, res);
3551 REAL(memcpy)(dest, local_dest, res);
3553 return res;
3569 int res = REAL(wctomb)(local_dest, src);
3570 if (res != -1) {
3571 CHECK_LE(res, sizeof(local_dest));
3572 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dest, res);
3573 REAL(memcpy)(dest, local_dest, res);
3575 return res;
3590 int res = REAL(tcgetattr)(fd, termios_p);
3591 if (!res && termios_p)
3593 return res;
3615 char *res = REAL(realpath)(path, resolved_path);
3616 if (allocated_path && !res) WRAP(free)(allocated_path);
3617 if (res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
3618 return res;
3630 char *res = REAL(canonicalize_file_name)(path);
3631 if (res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
3632 return res;
3647 SIZE_T res = REAL(confstr)(name, buf, len);
3648 if (buf && res)
3649 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, res < len ? res : len);
3650 return res;
3664 int res = REAL(sched_getaffinity)(pid, cpusetsize, mask);
3665 if (mask && !res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, mask, cpusetsize);
3666 return res;
3677 int res = REAL(sched_getparam)(pid, param);
3678 if (!res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, param, struct_sched_param_sz);
3679 return res;
3691 char *res = REAL(strerror)(errnum);
3692 if (res) COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, REAL(strlen)(res) + 1);
3693 return res;
3717 int res = REAL(strerror_r)(errnum, buf, buflen);
3722 return res;
3732 char *res = REAL(strerror_r)(errnum, buf, buflen);
3733 if (res == buf)
3734 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
3736 COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, REAL(strlen)(res) + 1);
3737 return res;
3753 int res = REAL(__xpg_strerror_r)(errnum, buf, buflen);
3757 return res;
3798 int res = REAL(scandir)(dirp, namelist,
3803 if (namelist && res > 0) {
3805 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *namelist, sizeof(**namelist) * res);
3806 for (int i = 0; i < res; ++i)
3810 return res;
3851 int res =
3857 if (namelist && res > 0) {
3859 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *namelist, sizeof(**namelist) * res);
3860 for (int i = 0; i < res; ++i)
3864 return res;
3878 int res = REAL(getgroups)(size, lst);
3879 if (res >= 0 && lst && size > 0)
3880 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, lst, res * sizeof(*lst));
3881 return res;
3909 int res = COMMON_INTERCEPTOR_BLOCK_REAL(poll)(fds, nfds, timeout);
3911 return res;
3927 int res =
3930 return res;
3945 int res = REAL(wordexp)(s, p, flags);
3946 if (!res && p) {
3956 return res;
3971 int res = REAL(sigwait)(set, sig);
3972 if (!res && sig) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, sig, sizeof(*sig));
3973 return res;
3988 int res = REAL(sigwaitinfo)(set, info);
3989 if (res > 0 && info) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, info, siginfo_t_sz);
3990 return res;
4007 int res = REAL(sigtimedwait)(set, info, timeout);
4008 if (res > 0 && info) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, info, siginfo_t_sz);
4009 return res;
4023 int res = REAL(sigemptyset)(set);
4024 if (!res && set) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, set, sizeof(*set));
4025 return res;
4034 int res = REAL(sigfillset)(set);
4035 if (!res && set) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, set, sizeof(*set));
4036 return res;
4052 int res = REAL(sigpending)(set);
4053 if (!res && set) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, set, sizeof(*set));
4054 return res;
4070 int res = REAL(sigprocmask)(how, set, oldset);
4071 if (!res && oldset)
4073 return res;
4089 int res = REAL(pthread_sigmask)(how, set, oldset);
4090 if (!res && oldset)
4092 return res;
4106 int res = REAL(backtrace)(buffer, size);
4107 if (res && buffer)
4108 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buffer, res * sizeof(*buffer));
4109 return res;
4120 char **res = REAL(backtrace_symbols)(buffer, size);
4121 if (res && size) {
4122 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, size * sizeof(*res));
4124 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res[i], REAL(strlen(res[i])) + 1);
4126 return res;
4155 int res = REAL(pthread_mutex_lock)(m);
4156 if (res == errno_EOWNERDEAD)
4158 if (res == 0 || res == errno_EOWNERDEAD)
4160 if (res == errno_EINVAL)
4162 return res;
4169 int res = REAL(pthread_mutex_unlock)(m);
4170 if (res == errno_EINVAL)
4172 return res;
4188 int res = REAL(__pthread_mutex_lock)(m);
4189 if (res == errno_EOWNERDEAD)
4191 if (res == 0 || res == errno_EOWNERDEAD)
4193 if (res == errno_EINVAL)
4195 return res;
4202 int res = REAL(__pthread_mutex_unlock)(m);
4203 if (res == errno_EINVAL)
4205 return res;
4259 __sanitizer_mntent *res = REAL(getmntent)(fp);
4260 if (res) write_mntent(ctx, res);
4261 return res;
4273 __sanitizer_mntent *res = REAL(getmntent_r)(fp, mntbuf, buf, buflen);
4274 if (res) write_mntent(ctx, res);
4275 return res;
4290 int res = REAL(statfs)(path, buf);
4291 if (!res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, struct_statfs_sz);
4292 return res;
4300 int res = REAL(fstatfs)(fd, buf);
4301 if (!res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, struct_statfs_sz);
4302 return res;
4319 int res = REAL(statfs64)(path, buf);
4320 if (!res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, struct_statfs64_sz);
4321 return res;
4329 int res = REAL(fstatfs64)(fd, buf);
4330 if (!res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, struct_statfs64_sz);
4331 return res;
4348 int res = REAL(statvfs)(path, buf);
4349 if (!res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, struct_statvfs_sz);
4350 return res;
4359 int res = REAL(fstatvfs)(fd, buf);
4360 if (!res) {
4365 return res;
4382 int res = REAL(statvfs64)(path, buf);
4383 if (!res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, struct_statvfs64_sz);
4384 return res;
4392 int res = REAL(fstatvfs64)(fd, buf);
4393 if (!res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, struct_statvfs64_sz);
4394 return res;
4408 int res = REAL(initgroups)(user, group);
4409 return res;
4421 char *res = REAL(ether_ntoa)(addr);
4422 if (res) COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, REAL(strlen)(res) + 1);
4423 return res;
4429 __sanitizer_ether_addr *res = REAL(ether_aton)(buf);
4430 if (res) COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, sizeof(*res));
4431 return res;
4448 int res = REAL(ether_ntohost)(hostname, addr);
4449 if (!res && hostname)
4451 return res;
4461 int res = REAL(ether_hostton)(hostname, addr);
4462 if (!res && addr) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, addr, sizeof(*addr));
4463 return res;
4473 int res = REAL(ether_line)(line, addr, hostname);
4474 if (!res) {
4479 return res;
4497 char *res = REAL(ether_ntoa_r)(addr, buf);
4498 if (res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
4499 return res;
4509 __sanitizer_ether_addr *res = REAL(ether_aton_r)(buf, addr);
4510 if (res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, sizeof(*res));
4511 return res;
4527 int res = REAL(shmctl)(shmid, cmd, buf);
4528 if (res >= 0) {
4538 return res;
4552 int res = REAL(random_r)(buf, result);
4553 if (!res && result)
4555 return res;
4576 int res = REAL(fn)(attr, r); \
4577 if (!res && r) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, r, sz); \
4578 return res; \
4603 int res = REAL(pthread_attr_getstack)(attr, addr, size);
4604 if (!res) {
4608 return res;
4661 int res = REAL(pthread_attr_getaffinity_np)(attr, cpusetsize, cpuset);
4662 if (!res && cpusetsize && cpuset)
4664 return res;
4765 char *res = REAL(tmpnam)(s);
4766 if (res) {
4773 COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, REAL(strlen)(res) + 1);
4775 return res;
4789 char *res = REAL(tmpnam_r)(s);
4790 if (res && s) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, s, REAL(strlen)(s) + 1);
4791 return res;
4802 char *res = REAL(ttyname)(fd);
4803 if (res != nullptr)
4804 COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, REAL(strlen)(res) + 1);
4805 return res;
4816 int res = REAL(ttyname_r)(fd, name, namesize);
4817 if (res == 0)
4819 return res;
4832 char *res = REAL(tempnam)(dir, pfx);
4833 if (res) COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, REAL(strlen)(res) + 1);
4834 return res;
4869 int res = REAL(pthread_getname_np)(thread, name, len);
4870 if (!res)
4872 return res;
4925 double res = REAL(remquo)(x, y, quo);
4927 return res;
4935 float res = REAL(remquof)(x, y, quo);
4937 return res;
4953 long double res = REAL(remquol)(x, y, quo);
4955 return res;
4968 double res = REAL(lgamma)(x);
4970 return res;
4975 float res = REAL(lgammaf)(x);
4977 return res;
4990 long double res = REAL(lgammal)(x);
4992 return res;
5007 double res = REAL(lgamma_r)(x, signp);
5009 return res;
5017 float res = REAL(lgammaf_r)(x, signp);
5019 return res;
5035 long double res = REAL(lgammal_r)(x, signp);
5037 return res;
5051 int res = REAL(drand48_r)(buffer, result);
5053 return res;
5061 int res = REAL(lrand48_r)(buffer, result);
5063 return res;
5091 SSIZE_T res = REAL(getline)(lineptr, n, stream);
5092 if (res > 0) {
5095 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *lineptr, res + 1);
5097 return res;
5107 SSIZE_T res = REAL(vname)(lineptr, n, delim, stream); \
5108 if (res > 0) { \
5111 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *lineptr, res + 1); \
5113 return res; \
5150 SIZE_T res = REAL(iconv)(cd, inbuf, inbytesleft, outbuf, outbytesleft);
5155 return res;
5169 __sanitizer_clock_t res = REAL(times)(tms);
5170 if (res != (__sanitizer_clock_t)-1 && tms)
5172 return res;
5191 void *res = REAL(__tls_get_addr)(arg);
5194 DTLS::DTV *dtv = DTLS_on_tls_get_addr(arg, res, tls_begin, tls_end);
5199 return res;
5226 uptr res = __tls_get_offset_wrapper(arg, REAL(__tls_get_offset));
5228 void *ptr = reinterpret_cast<void *>(res + tp);
5236 return res;
5289 SSIZE_T res = REAL(listxattr)(path, list, size);
5291 // buffer, and res contains the desired buffer size.
5292 if (size && res > 0 && list) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, list, res);
5293 return res;
5302 SSIZE_T res = REAL(llistxattr)(path, list, size);
5303 if (size && res > 0 && list) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, list, res);
5304 return res;
5312 SSIZE_T res = REAL(flistxattr)(fd, list, size);
5313 if (size && res > 0 && list) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, list, res);
5314 return res;
5334 SSIZE_T res = REAL(getxattr)(path, name, value, size);
5335 if (size && res > 0 && value) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, value, res);
5336 return res;
5347 SSIZE_T res = REAL(lgetxattr)(path, name, value, size);
5348 if (size && res > 0 && value) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, value, res);
5349 return res;
5359 SSIZE_T res = REAL(fgetxattr)(fd, name, value, size);
5360 if (size && res > 0 && value) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, value, res);
5361 return res;
5378 int res = REAL(getresuid)(ruid, euid, suid);
5379 if (res >= 0) {
5384 return res;
5392 int res = REAL(getresgid)(rgid, egid, sgid);
5393 if (res >= 0) {
5398 return res;
5417 int res = REAL(getifaddrs)(ifap);
5418 if (res == 0 && ifap) {
5438 return res;
5453 char *res = REAL(if_indextoname)(ifindex, ifname);
5454 if (res && ifname)
5456 return res;
5481 int res = REAL(capget)(hdrp, datap);
5482 if (res == 0 && datap)
5487 return res;
5611 int res = REAL(ftime)(tp);
5614 return res;
5657 int res = REAL(F)(xdrs, p); \
5658 if (res && p && xdrs->x_op == __sanitizer_XDR_DECODE) \
5660 return res; \
5705 int res = REAL(xdr_bytes)(xdrs, p, sizep, maxsize);
5709 if (res && *p && *sizep) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, *p, *sizep);
5711 return res;
5725 int res = REAL(xdr_string)(xdrs, p, maxsize);
5728 if (res && *p)
5731 return res;
5777 void *res = REAL(tsearch)(key, rootp, compar);
5778 if (res && *(void **)res == key)
5779 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, sizeof(void *));
5780 return res;
5810 int res = REAL(__uflow)(fp);
5812 return res;
5817 int res = REAL(__underflow)(fp);
5819 return res;
5824 int res = REAL(__overflow)(fp, ch);
5826 return res;
5831 int res = REAL(__wuflow)(fp);
5833 return res;
5838 int res = REAL(__wunderflow)(fp);
5840 return res;
5845 int res = REAL(__woverflow)(fp, ch);
5847 return res;
5866 __sanitizer_FILE *res = REAL(fopen)(path, mode);
5867 COMMON_INTERCEPTOR_FILE_OPEN(ctx, res, path);
5868 if (res) unpoison_file(res);
5869 return res;
5875 __sanitizer_FILE *res = REAL(fdopen)(fd, mode);
5876 if (res) unpoison_file(res);
5877 return res;
5886 __sanitizer_FILE *res = REAL(freopen)(path, mode, fp);
5887 COMMON_INTERCEPTOR_FILE_OPEN(ctx, res, path);
5888 if (res) unpoison_file(res);
5889 return res;
5905 __sanitizer_FILE *res = REAL(fopen64)(path, mode);
5906 COMMON_INTERCEPTOR_FILE_OPEN(ctx, res, path);
5907 if (res) unpoison_file(res);
5908 return res;
5917 __sanitizer_FILE *res = REAL(freopen64)(path, mode, fp);
5918 COMMON_INTERCEPTOR_FILE_OPEN(ctx, res, path);
5919 if (res) unpoison_file(res);
5920 return res;
5936 __sanitizer_FILE *res = REAL(open_memstream)(ptr, sizeloc);
5937 if (res) {
5940 unpoison_file(res);
5942 SetInterceptorMetadata(res, file);
5944 return res;
5950 __sanitizer_FILE *res = REAL(open_wmemstream)(ptr, sizeloc);
5951 if (res) {
5954 unpoison_file(res);
5956 SetInterceptorMetadata(res, file);
5958 return res;
5967 __sanitizer_FILE *res = REAL(fmemopen)(buf, size, mode);
5968 if (res) unpoison_file(res);
5969 return res;
5993 int res = REAL(_obstack_begin_1)(obstack, sz, align, alloc_fn, free_fn);
5994 if (res) initialize_obstack(obstack);
5995 return res;
6002 int res = REAL(_obstack_begin)(obstack, sz, align, alloc_fn, free_fn);
6003 if (res) initialize_obstack(obstack);
6004 return res;
6026 int res = REAL(fflush)(fp);
6032 return res;
6045 int res = REAL(fclose)(fp);
6050 return res;
6063 void *res = REAL(dlopen)(filename, flag);
6065 COMMON_INTERCEPTOR_LIBRARY_LOADED(filename, res);
6066 return res;
6072 int res = REAL(dlclose)(handle);
6075 return res;
6090 char *res = REAL(getpass)(prompt);
6091 if (res) COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, REAL(strlen)(res)+1);
6092 return res;
6107 int res = REAL(timerfd_settime)(fd, flags, new_value, old_value);
6108 if (res != -1 && old_value)
6110 return res;
6116 int res = REAL(timerfd_gettime)(fd, curr_value);
6117 if (res != -1 && curr_value)
6119 return res;
6202 int res = real_close ? real_close(wrapped_cookie->real_cookie) : 0;
6204 return res;
6215 __sanitizer_FILE *res =
6218 return res;
6235 int res = REAL(sem_init)(s, pshared, value);
6236 return res;
6242 int res = REAL(sem_destroy)(s);
6243 return res;
6249 int res = COMMON_INTERCEPTOR_BLOCK_REAL(sem_wait)(s);
6250 if (res == 0) {
6253 return res;
6259 int res = COMMON_INTERCEPTOR_BLOCK_REAL(sem_trywait)(s);
6260 if (res == 0) {
6263 return res;
6270 int res = COMMON_INTERCEPTOR_BLOCK_REAL(sem_timedwait)(s, abstime);
6271 if (res == 0) {
6274 return res;
6281 int res = REAL(sem_post)(s);
6282 return res;
6288 int res = REAL(sem_getvalue)(s, sval);
6289 if (res == 0) {
6293 return res;
6311 int res = REAL(pthread_setcancelstate)(state, oldstate);
6312 if (res == 0 && oldstate != nullptr)
6314 return res;
6320 int res = REAL(pthread_setcanceltype)(type, oldtype);
6321 if (res == 0 && oldtype != nullptr)
6323 return res;
6336 int res = REAL(mincore)(addr, length, vec);
6337 if (res == 0) {
6342 return res;
6356 SSIZE_T res = REAL(process_vm_readv)(pid, local_iov, liovcnt, remote_iov,
6358 if (res > 0)
6359 write_iovec(ctx, local_iov, liovcnt, res);
6360 return res;
6369 SSIZE_T res = REAL(process_vm_writev)(pid, local_iov, liovcnt, remote_iov,
6371 if (res > 0)
6372 read_iovec(ctx, local_iov, liovcnt, res);
6373 return res;
6386 char *res = REAL(ctermid)(s);
6387 if (res) {
6388 COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, REAL(strlen)(res) + 1);
6390 return res;
6401 char *res = REAL(ctermid_r)(s);
6402 if (res) {
6403 COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, REAL(strlen)(res) + 1);
6405 return res;
6417 SSIZE_T res = REAL(recv)(fd, buf, len, flags);
6418 if (res > 0) {
6419 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, Min((SIZE_T)res, len));
6421 if (res >= 0 && fd >= 0) COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
6422 return res;
6434 SSIZE_T res = REAL(recvfrom)(fd, buf, len, flags, srcaddr, addrlen);
6435 if (res > 0) {
6436 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, Min((SIZE_T)res, len));
6441 return res;
6458 SSIZE_T res = REAL(send)(fd, buf, len, flags);
6459 if (common_flags()->intercept_send && res > 0)
6460 COMMON_INTERCEPTOR_READ_RANGE(ctx, buf, Min((SIZE_T)res, len));
6461 return res;
6473 SSIZE_T res = REAL(sendto)(fd, buf, len, flags, dstaddr, addrlen);
6474 if (common_flags()->intercept_send && res > 0)
6475 COMMON_INTERCEPTOR_READ_RANGE(ctx, buf, Min((SIZE_T)res, len));
6476 return res;
6490 int res = REAL(eventfd_read)(fd, value);
6491 if (res == 0) {
6495 return res;
6504 int res = REAL(eventfd_write)(fd, value);
6505 return res;
6520 int res = REAL(stat)(path, buf);
6521 if (!res)
6523 return res;
6536 int res = REAL(lstat)(path, buf);
6537 if (!res)
6539 return res;
6552 int res = REAL(__xstat)(version, path, buf);
6553 if (!res)
6555 return res;
6568 int res = REAL(__xstat64)(version, path, buf);
6569 if (!res)
6571 return res;
6584 int res = REAL(__lxstat)(version, path, buf);
6585 if (!res)
6587 return res;
6600 int res = REAL(__lxstat64)(version, path, buf);
6601 if (!res)
6603 return res;
6616 void *res = REAL(getutent)(dummy);
6617 if (res)
6618 COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, __sanitizer::struct_utmp_sz);
6619 return res;
6624 void *res = REAL(getutid)(ut);
6625 if (res)
6626 COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, __sanitizer::struct_utmp_sz);
6627 return res;
6632 void *res = REAL(getutline)(ut);
6633 if (res)
6634 COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, __sanitizer::struct_utmp_sz);
6635 return res;
6649 void *res = REAL(getutxent)(dummy);
6650 if (res)
6651 COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, __sanitizer::struct_utmpx_sz);
6652 return res;
6657 void *res = REAL(getutxid)(ut);
6658 if (res)
6659 COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, __sanitizer::struct_utmpx_sz);
6660 return res;
6665 void *res = REAL(getutxline)(ut);
6666 if (res)
6667 COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, __sanitizer::struct_utmpx_sz);
6668 return res;
6675 void *res = REAL(pututxline)(ut);
6676 if (res)
6677 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, __sanitizer::struct_utmpx_sz);
6678 return res;
6693 int res = REAL(getloadavg)(loadavg, nelem);
6694 if (res > 0)
6695 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, loadavg, res * sizeof(*loadavg));
6696 return res;
6721 SIZE_T res = REAL(wcslen)(s);
6722 COMMON_INTERCEPTOR_READ_RANGE(ctx, s, sizeof(wchar_t) * (res + 1));
6723 return res;
6729 SIZE_T res = REAL(wcsnlen)(s, n);
6730 COMMON_INTERCEPTOR_READ_RANGE(ctx, s, sizeof(wchar_t) * Min(res + 1, n));
6731 return res;
6797 SIZE_T res = REAL(strxfrm)(dest, src, len, ##__VA_ARGS__); \
6798 if (res < len) \
6799 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dest, sizeof(*src) * (res + 1)); \
6800 return res; \
6889 int res;
6893 res = REAL(uid_from_user)(name, uid);
6896 return res;
6921 int res;
6925 res = REAL(gid_from_group)(group, gid);
6928 return res;
6965 int res;
6971 res = REAL(getgrouplist)(name, basegid, groups, ngroups);
6972 if (!res && groups && ngroups) {
6976 return res;
6988 int res;
6993 res = REAL(getgroupmembership)(name, basegid, groups, maxgrp, ngroups);
6994 if (!res && groups && ngroups) {
6998 return res;
7011 SSIZE_T res = REAL(readlink)(path, buf, bufsiz);
7012 if (res > 0)
7013 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, res);
7014 return res;
7028 SSIZE_T res = REAL(readlinkat)(dirfd, path, buf, bufsiz);
7029 if (res > 0)
7030 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, res);
7031 return res;
7053 int res = REAL(name_to_handle_at)(dirfd, pathname, handle, mount_id, flags);
7054 if (!res) {
7065 return res;
7101 SIZE_T res;
7108 res = REAL(strlcpy)(dst, src, size);
7110 return res;
7204 DEVNAME_R_RETTYPE res = REAL(devname_r)(dev, type, path, len);
7205 if (DEVNAME_R_SUCCESS(res))
7207 return res;
7524 int res = REAL(regcomp)(preg, pattern, cflags);
7525 if (!res)
7527 return res;
7537 int res = REAL(regexec)(preg, string, nmatch, pmatch, eflags);
7538 if (!res && pmatch)
7540 return res;
7548 SIZE_T res = REAL(regerror)(errcode, preg, errbuf, errbuf_size);
7551 return res;
7581 SSIZE_T res = REAL(regnsub)(buf, bufsiz, sub, rm, str);
7582 if (res > 0 && buf)
7584 return res;
7597 SSIZE_T res = REAL(regasub)(buf, sub, rm, sstr);
7598 if (res > 0 && buf) {
7602 return res;
7695 int res = REAL(sysctl)(name, namelen, oldp, oldlenp, newp, newlen);
7696 if (!res) {
7703 return res;
7719 int res = REAL(sysctlbyname)(sname, oldp, oldlenp, newp, newlen);
7720 if (!res) {
7727 return res;
7738 int res = REAL(sysctlnametomib)(sname, name, namelenp);
7739 if (!res) {
7746 return res;
7763 void *res = REAL(asysctl)(name, namelen, len);
7764 if (res && len) {
7766 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, *len);
7768 return res;
7776 void *res = REAL(asysctlbyname)(sname, len);
7777 if (res && len) {
7779 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, *len);
7781 return res;
7805 int res = REAL(sysctlgetmibinfo)(sname, name, namelenp, cname, csz, rnode, v);
7806 if (!res) {
7818 return res;
7940 int res = REAL(statvfs1)(path, buf, flags);
7941 if (!res) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, struct_statvfs_sz);
7942 return res;
7948 int res = REAL(fstatvfs1)(fd, buf, flags);
7949 if (!res) {
7954 return res;
9257 __sanitizer_FILE *res = REAL(popen)(command, type);
9258 COMMON_INTERCEPTOR_FILE_OPEN(ctx, res, nullptr);
9259 if (res) unpoison_file(res);
9260 return res;
9292 __sanitizer_FILE *res = REAL(popenve)(path, argv, envp, type);
9293 COMMON_INTERCEPTOR_FILE_OPEN(ctx, res, nullptr);
9294 if (res) unpoison_file(res);
9295 return res;
9308 int res = REAL(pclose)(fp);
9313 return res;
9359 int res = real_close(wrapped_cookie->real_cookie);
9361 return res;
9379 __sanitizer_FILE *res =
9385 if (res)
9386 unpoison_file(res);
9387 return res;
9443 int res = real_close(wrapped_cookie->real_cookie);
9445 return res;
9464 __sanitizer_FILE *res =
9471 if (res)
9472 unpoison_file(res);
9473 return res;
9518 char *res = REAL(getusershell)();
9519 if (res)
9520 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
9521 return res;
9533 void *res = REAL(sl_init)();
9534 if (res)
9535 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, __sanitizer::struct_StringList_sz);
9536 return res;
9546 int res = REAL(sl_add)(sl, item);
9547 if (!res)
9549 return res;
9559 char *res = REAL(sl_find)(sl, item);
9560 if (res)
9561 COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, REAL(strlen)(res) + 1);
9562 return res;
9603 char *res = REAL(crypt)(key, salt);
9604 if (res != nullptr)
9605 COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1);
9606 return res;
9619 char *res = REAL(crypt_r)(key, salt, data);
9620 if (res != nullptr) {
9623 COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1);
9625 return res;