From: D Scott Phillips <d.scott.phillips@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 09/29] igt: replace mmap64() with mmap()
Date: Tue, 10 Dec 2019 16:52:15 -0800 [thread overview]
Message-ID: <20191211005235.67897-10-d.scott.phillips@intel.com> (raw)
In-Reply-To: <20191211005235.67897-1-d.scott.phillips@intel.com>
mmap64 is the variant syscall with 64-bit off_t. On 64-bit
platforms mmap == mmap64. On 32-bit platforms mmap == mmap64 when
_FILE_OFFSET_BITS=64, which we get with AC_SYS_LARGEFILE in
autoconf and by default with meson. Other platforms don't
necessarily have an mmap64 syscall or function.
Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
lib/i915/gem_mman.c | 2 +-
lib/igt_vgem.c | 2 +-
tests/i915/gem_mmap_gtt.c | 22 +++++++++++-----------
tests/i915/gem_mmap_offset.c | 18 +++++++++---------
4 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c
index 6256627b..056f9382 100644
--- a/lib/i915/gem_mman.c
+++ b/lib/i915/gem_mman.c
@@ -62,7 +62,7 @@ void *__gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot)
if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg))
return NULL;
- ptr = mmap64(0, size, prot, MAP_SHARED, fd, mmap_arg.offset);
+ ptr = mmap(0, size, prot, MAP_SHARED, fd, mmap_arg.offset);
if (ptr == MAP_FAILED)
ptr = NULL;
else
diff --git a/lib/igt_vgem.c b/lib/igt_vgem.c
index 7f933b23..468383c7 100644
--- a/lib/igt_vgem.c
+++ b/lib/igt_vgem.c
@@ -76,7 +76,7 @@ void *__vgem_mmap(int fd, struct vgem_bo *bo, unsigned prot)
if (drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &arg))
return NULL;
- ptr = mmap64(0, bo->size, prot, MAP_SHARED, fd, arg.offset);
+ ptr = mmap(0, bo->size, prot, MAP_SHARED, fd, arg.offset);
if (ptr == MAP_FAILED)
return NULL;
diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
index af87ebc3..cd6ab489 100644
--- a/tests/i915/gem_mmap_gtt.c
+++ b/tests/i915/gem_mmap_gtt.c
@@ -103,11 +103,11 @@ test_access(int fd)
mmap_arg.handle = handle;
do_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg);
- igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+ igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, mmap_arg.offset));
/* Check that the same offset on the other fd doesn't work. */
- igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+ igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
MAP_SHARED, fd2, mmap_arg.offset) == MAP_FAILED);
igt_assert(errno == EACCES);
@@ -118,7 +118,7 @@ test_access(int fd)
/* Recheck that it works after flink. */
/* Check that the same offset on the other fd doesn't work. */
- igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
+ igt_assert(mmap(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
MAP_SHARED, fd2, mmap_arg.offset));
}
@@ -149,11 +149,11 @@ test_short(int fd)
for (pages = 1; pages <= OBJECT_SIZE / PAGE_SIZE; pages <<= 1) {
uint8_t *r, *w;
- w = mmap64(0, pages * PAGE_SIZE, PROT_READ | PROT_WRITE,
+ w = mmap(0, pages * PAGE_SIZE, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, mmap_arg.offset);
igt_assert(w != MAP_FAILED);
- r = mmap64(0, pages * PAGE_SIZE, PROT_READ,
+ r = mmap(0, pages * PAGE_SIZE, PROT_READ,
MAP_SHARED, fd, mmap_arg.offset);
igt_assert(r != MAP_FAILED);
@@ -371,13 +371,13 @@ test_isolation(int i915)
close(B);
- ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+ ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
igt_assert(ptr != MAP_FAILED);
munmap(ptr, 4096);
close(A);
- ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+ ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
igt_assert(ptr == MAP_FAILED);
}
@@ -387,7 +387,7 @@ test_close_race(int i915)
const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
_Atomic uint32_t *handles;
- handles = mmap64(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+ handles = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
igt_assert(handles != MAP_FAILED);
igt_fork(child, ncpus + 1) {
@@ -405,7 +405,7 @@ test_close_race(int i915)
&mmap_arg) != -1) {
void *ptr;
- ptr = mmap64(0, 4096,
+ ptr = mmap(0, 4096,
PROT_WRITE, MAP_SHARED, i915,
mmap_arg.offset);
if (ptr != MAP_FAILED) {
@@ -431,7 +431,7 @@ test_flink_race(int i915)
const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
_Atomic uint32_t *handles;
- handles = mmap64(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+ handles = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
igt_assert(handles != MAP_FAILED);
igt_fork(child, ncpus + 1) {
@@ -456,7 +456,7 @@ test_flink_race(int i915)
&mmap_arg) != -1) {
void *ptr;
- ptr = mmap64(0, 4096,
+ ptr = mmap(0, 4096,
PROT_WRITE, MAP_SHARED, fd,
mmap_arg.offset);
if (ptr != MAP_FAILED) {
diff --git a/tests/i915/gem_mmap_offset.c b/tests/i915/gem_mmap_offset.c
index 95e1e3e6..277ffd83 100644
--- a/tests/i915/gem_mmap_offset.c
+++ b/tests/i915/gem_mmap_offset.c
@@ -76,7 +76,7 @@ __mmap_offset(int i915, uint32_t handle, uint64_t offset, uint64_t size,
if (mmap_offset_ioctl(i915, &arg))
return NULL;
- ptr = mmap64(0, size, prot, MAP_SHARED, i915, arg.offset + offset);
+ ptr = mmap(0, size, prot, MAP_SHARED, i915, arg.offset + offset);
if (ptr == MAP_FAILED)
ptr = NULL;
else
@@ -224,34 +224,34 @@ static void isolation(int i915)
t->name, B, b, offset_b);
errno = 0;
- ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, i915, offset_a);
+ ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, i915, offset_a);
igt_assert(ptr == MAP_FAILED);
igt_assert_eq(errno, EACCES);
errno = 0;
- ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, i915, offset_b);
+ ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, i915, offset_b);
igt_assert(ptr == MAP_FAILED);
igt_assert_eq(errno, EACCES);
errno = 0;
- ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, B, offset_a);
+ ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, B, offset_a);
igt_assert(ptr == MAP_FAILED);
igt_assert_eq(errno, EACCES);
errno = 0;
- ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_b);
+ ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_b);
igt_assert(ptr == MAP_FAILED);
igt_assert_eq(errno, EACCES);
close(B);
- ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+ ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
igt_assert(ptr != MAP_FAILED);
munmap(ptr, 4096);
close(A);
- ptr = mmap64(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
+ ptr = mmap(0, 4096, PROT_READ, MAP_SHARED, A, offset_a);
igt_assert(ptr == MAP_FAILED);
}
}
@@ -286,7 +286,7 @@ static void close_race(int i915, int timeout)
_Atomic uint32_t *handles;
size_t len = ALIGN((ncpus + 1) * sizeof(uint32_t), 4096);
- handles = mmap64(0, len, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+ handles = mmap(0, len, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
igt_assert(handles != MAP_FAILED);
igt_fork(child, ncpus + 1) {
@@ -305,7 +305,7 @@ static void close_race(int i915, int timeout)
&mmap_arg) != -1) {
void *ptr;
- ptr = mmap64(0, 4096,
+ ptr = mmap(0, 4096,
PROT_WRITE, MAP_SHARED, i915,
mmap_arg.offset);
if (ptr != MAP_FAILED) {
--
2.23.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-12-11 0:59 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 01/29] Remove unused includes D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 02/29] lib/igt_chipset: Add missing libdrm dependency D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 03/29] lib/igt_core: update longjmp buffers to type sigjmp_buf D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 04/29] Include <sys/wait.h>, <limits.h>, and <signal.h> where appropriate D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 05/29] Use /bin/sh for shell scripts D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 06/29] tools/intel_gpu_top: Use POSIX signal handler type definition D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 07/29] kms_atomic: change `PAGE_SIZE` to `page_size` D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 08/29] lib: remove open-coded card index fetching D Scott Phillips
2019-12-11 0:52 ` D Scott Phillips [this message]
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 10/29] drm-uapi: patch sync_file.h to depend on drm.h D Scott Phillips
2019-12-12 11:01 ` Jani Nikula
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 11/29] i915/pm_backlight: use POSIX basename D Scott Phillips
2019-12-16 13:31 ` Petri Latvala
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 12/29] Include Linux specific headers only on Linux D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 13/29] lib/igt_core: skip oom_adjustments on non-Linux platforms D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 14/29] i915/gem: Omit Linux-specific madvise, mmap, and sched flags on non-Linux D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 15/29] lib/igt_aux: add null implementation D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 16/29] lib/igt_kmod: " D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 17/29] lib/igt_perf: " D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 18/29] runner: Add support for non-Linux operating systems D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 19/29] Use ETIMEDOUT in place of ETIME on FreeBSD D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 20/29] ilog2: Use libc provided fls() " D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 21/29] lib: undefine FreeBSD libc's ALIGN macro D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 22/29] lib: Add FreeBSD-specific pthread logic D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 23/29] lib/igt_kms: Add FreeBSD support D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 24/29] lib/ioctl_wrappers: Support FreeBSD in igt_require_gem D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 25/29] lib/intel_os: Implement get_avail_ram and get_total_swap for FreeBSD D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 26/29] lib/igt_device: Implement get_card_index " D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 27/29] lib/igt_debugfs: Implement mount() " D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 28/29] build: Add support for building on non-Linux D Scott Phillips
2019-12-11 0:52 ` [igt-dev] [PATCH i-g-t 29/29] lib/igt_device_scan: add null implementation D Scott Phillips
2019-12-11 8:11 ` [igt-dev] ✗ GitLab.Pipeline: warning for Add FreeBSD Support Patchwork
2019-12-12 11:14 ` [igt-dev] [PATCH i-g-t 00/30] " Jani Nikula
2019-12-12 18:20 ` D Scott Phillips
2019-12-16 13:55 ` Petri Latvala
2019-12-27 9:38 ` Arkadiusz Hiler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191211005235.67897-10-d.scott.phillips@intel.com \
--to=d.scott.phillips@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.