Files
rocm-systems/projects/rocr-runtime/libhsakmt/src/libhsakmt.c
T

26 regels
565 B
C

#include <stdio.h>
#include <errno.h>
#include <sys/ioctl.h>
#include "libhsakmt.h"
2017-04-20 08:25:00 -04:00
/* Call ioctl, restarting if it is interrupted */
int kmtIoctl(int fd, unsigned long request, void *arg)
{
2017-04-20 08:25:00 -04:00
int ret;
2017-04-20 08:25:00 -04:00
do {
ret = ioctl(fd, request, arg);
} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
2020-04-01 20:11:42 -07:00
if (ret == -1 && errno == EBADF) {
/* In case pthread_atfork didn't catch it, this will
* make any subsequent hsaKmt calls fail in CHECK_KFD_OPEN.
*/
pr_err("KFD file descriptor not valid in this process\n");
is_forked_child();
}
2017-04-20 08:25:00 -04:00
return ret;
}