-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
312 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <lib_rt_check.h> | ||
|
||
int main() | ||
{ | ||
realtime_context rc; | ||
|
||
[[ maybe_unused ]] auto res = calloc (1024, 4); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include <sys/mman.h> | ||
#include <sys/stat.h> | ||
#include <sys/types.h> | ||
#include <fcntl.h> | ||
#include <unistd.h> | ||
#include <lib_rt_check.h> | ||
|
||
int main() | ||
{ | ||
int fd = open("/usr/bin/awk", O_RDONLY); | ||
|
||
if (fd == -1) | ||
{ | ||
std::cout << "ERROR: open failed\n"; | ||
return 0; | ||
} | ||
|
||
struct stat s; | ||
int status = fstat (fd, &s); | ||
auto size = s.st_size; | ||
|
||
char* map = nullptr; | ||
|
||
{ | ||
realtime_context rc; | ||
map = (char *) mmap (0, size, PROT_READ, MAP_PRIVATE, fd, 0); | ||
} | ||
|
||
if (map == MAP_FAILED) | ||
{ | ||
std::cout << "ERROR: MAP_FAILED\n"; | ||
return 0; | ||
} | ||
|
||
if (munmap(map, size) == -1) | ||
{ | ||
std::cout << "ERROR: munmap failed\n"; | ||
return 0; | ||
} | ||
|
||
close(fd); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <sys/mman.h> | ||
#include <sys/stat.h> | ||
#include <sys/types.h> | ||
#include <fcntl.h> | ||
#include <unistd.h> | ||
#include <lib_rt_check.h> | ||
|
||
int main() | ||
{ | ||
int fd = open("/usr/bin/awk", O_RDONLY); | ||
|
||
if (fd == -1) | ||
{ | ||
std::cout << "ERROR: open failed\n"; | ||
return 0; | ||
} | ||
|
||
struct stat s; | ||
int status = fstat (fd, &s); | ||
auto size = s.st_size; | ||
|
||
auto map = (char *) mmap (0, size, PROT_READ, MAP_PRIVATE, fd, 0); | ||
|
||
if (map == MAP_FAILED) | ||
{ | ||
std::cout << "ERROR: MAP_FAILED\n"; | ||
return 0; | ||
} | ||
|
||
int res; | ||
|
||
{ | ||
realtime_context rc; | ||
res = munmap(map, size); | ||
} | ||
|
||
if (res == -1) | ||
{ | ||
std::cout << "ERROR: munmap failed\n"; | ||
return 0; | ||
} | ||
|
||
close(fd); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <unistd.h> | ||
#include <lib_rt_check.h> | ||
|
||
int main() | ||
{ | ||
timespec req; | ||
|
||
realtime_context rc; | ||
nanosleep(&req, nullptr); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <lib_rt_check.h> | ||
|
||
int main() | ||
{ | ||
realtime_context rc; | ||
|
||
void* p; | ||
[[ maybe_unused ]] auto res = posix_memalign (&p, 32, 128); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <lib_rt_check.h> | ||
|
||
int main() | ||
{ | ||
auto res = malloc (1024); | ||
|
||
realtime_context rc; | ||
res = realloc (res, 1024 * 4); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <unistd.h> | ||
#include <lib_rt_check.h> | ||
|
||
int main() | ||
{ | ||
realtime_context rc; | ||
sleep(1); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <chrono> | ||
#include <thread> | ||
#include <lib_rt_check.h> | ||
|
||
int main() | ||
{ | ||
using namespace std::chrono_literals; | ||
|
||
realtime_context rc; | ||
std::this_thread::sleep_for (1ns); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <unistd.h> | ||
#include <lib_rt_check.h> | ||
|
||
int main() | ||
{ | ||
realtime_context rc; | ||
usleep(100); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <lib_rt_check.h> | ||
|
||
int main() | ||
{ | ||
realtime_context rc; | ||
|
||
[[ maybe_unused ]] auto res = valloc (1024); | ||
|
||
return 0; | ||
} |