Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F5295600
raw.txt
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
markj
Sep 24 2019, 9:15 PM
2019-09-24 21:15:02 (UTC+0)
Size
909 B
Referenced Files
None
Subscribers
None
raw.txt
View Options
#include <sys/param.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <err.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int
main(int argc, char **argv)
{
char template[PATH_MAX];
void *addr;
size_t sz;
int fd;
sz = 16 * 4096;
(void)snprintf(template, sizeof(template), "test.XXXXXX");
fd = mkstemp(template);
if (fd < 0)
err(1, "mkostemp");
if (fchmod(fd, 0700) < 0)
err(1, "fchmod");
if (ftruncate(fd, sz) < 0)
err(1, "ftruncate");
addr = mmap(NULL, sz, PROT_MAX(PROT_READ) | PROT_READ, MAP_SHARED, fd, 0);
if (addr == MAP_FAILED)
err(1, "mmap");
if (mlock(addr, sz) != 0)
err(1, "mlock");
if (ftruncate(fd, 0) != 0)
err(1, "ftruncate");
if (ftruncate(fd, sz) != 0)
err(1, "ftruncate");
(void)close(fd);
fd = open(template, O_EXEC);
if (fd < 0)
err(1, "open");
fexecve(fd, argv, NULL);
err(1, "fexecve");
return (0);
}
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2212058
Default Alt Text
raw.txt (909 B)
Attached To
Mode
P319 Masterwork From Distant Lands
Attached
Detach File
Event Timeline
Log In to Comment