- Test for EINVAL requirement when passing an invalid flag in to msync(2)

- Expect ENOMEM instead of EFAULT when msync'ing a previously munmap'ed region
  on FreeBSD

Submitted by: pho
Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
Enji Cooper 2014-10-24 03:53:49 +00:00
parent 3638ce9c38
commit dfbf472ad8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=273574

View File

@ -170,8 +170,15 @@ ATF_TC_BODY(msync_err, tc)
/*
* Test that invalid flags error out.
*/
#ifdef __FreeBSD__
errno = 0;
ATF_REQUIRE_ERRNO(EINVAL, msync_sync("error", -1) != NULL);
errno = 0;
ATF_REQUIRE_ERRNO(EINVAL, msync_sync("error", INT_MAX) != NULL);
#else
ATF_REQUIRE(msync_sync("error", -1) != NULL);
ATF_REQUIRE(msync_sync("error", INT_MAX) != NULL);
#endif
errno = 0;
@ -185,7 +192,11 @@ ATF_TC_BODY(msync_err, tc)
(void)munmap(map, page);
ATF_REQUIRE(msync(map, page, MS_SYNC) != 0);
#ifdef __FreeBSD__
ATF_REQUIRE(errno == ENOMEM);
#else
ATF_REQUIRE(errno == EFAULT);
#endif
}
ATF_TC(msync_invalidate);