Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drm_prime_handle_to_fd_ioctl: translate O_ flags for Linuxulator #35

Merged
merged 1 commit into from
Nov 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions drivers/gpu/drm/drm_prime.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
*
*/

#if defined(__FreeBSD__)
#include <sys/sysent.h>
#define LINUX_O_RDWR 00000002
#define LINUX_O_CLOEXEC 02000000
#endif

#include <linux/export.h>
#include <linux/dma-buf.h>
#include <linux/rbtree.h>
Expand Down Expand Up @@ -519,6 +525,11 @@ int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
return -ENOSYS;

/* check flags are valid */
#if defined(__FreeBSD__) && defined(SV_ABI_LINUX)
if (SV_CURPROC_ABI() == SV_ABI_LINUX)
args->flags = ((args->flags & LINUX_O_CLOEXEC) ? DRM_CLOEXEC : 0)
| ((args->flags & LINUX_O_RDWR) ? DRM_RDWR : 0);
#endif
if (args->flags & ~(DRM_CLOEXEC | DRM_RDWR))
return -EINVAL;

Expand Down