mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
port to linux
This commit is contained in:
@@ -39,14 +39,22 @@
|
||||
* files and then doing a byte at a time memory copy.
|
||||
*
|
||||
*/
|
||||
#ifdef linux
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
|
||||
|
||||
char * Progname;
|
||||
@@ -69,7 +77,11 @@ typedef struct mfile {
|
||||
char *path;
|
||||
int fd;
|
||||
struct stat st;
|
||||
#ifdef linux
|
||||
void *p;
|
||||
#else
|
||||
addr_t p;
|
||||
#endif
|
||||
} mfile_t;
|
||||
|
||||
|
||||
@@ -95,14 +107,18 @@ static struct {
|
||||
FLAG(PROT_READ, FL_PROT),
|
||||
FLAG(PROT_WRITE, FL_PROT),
|
||||
FLAG(PROT_EXEC, FL_PROT),
|
||||
#ifdef __sgi
|
||||
FLAG(PROT_EXECUTE, FL_PROT),
|
||||
#endif
|
||||
FLAG(MAP_SHARED, FL_MAP),
|
||||
FLAG(MAP_PRIVATE, FL_MAP),
|
||||
FLAG(MAP_FIXED, FL_MAP),
|
||||
#ifdef __sgi
|
||||
FLAG(MAP_RENAME, FL_MAP),
|
||||
FLAG(MAP_AUTOGROW, FL_MAP),
|
||||
FLAG(MAP_LOCAL, FL_MAP),
|
||||
FLAG(MAP_AUTORESRV, FL_MAP),
|
||||
#endif
|
||||
FLAG(MAP_NONE, FL_MAP),
|
||||
};
|
||||
|
||||
@@ -139,7 +155,10 @@ main(int argc, char * argv[])
|
||||
ifile->flags[FL_MAP].value = MAP_PRIVATE;
|
||||
ifile->flags[FL_PROT].value = PROT_READ;
|
||||
ifile->flags[FL_OPEN].value = O_RDONLY;
|
||||
ofile->flags[FL_MAP].value = MAP_SHARED|MAP_AUTOGROW;
|
||||
ofile->flags[FL_MAP].value = MAP_SHARED;
|
||||
#ifdef __sgi
|
||||
ofile->flags[FL_MAP].value = MAP_AUTOGROW;
|
||||
#endif
|
||||
ofile->flags[FL_PROT].value = PROT_WRITE;
|
||||
ofile->flags[FL_OPEN].value = O_RDWR|O_CREAT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user