20 int fd = -1, sz, isrd, iswr;
28 if(access(name, F_OK))
32 st_report(
"gm_map can't create a file when called with no write access");
36 if(( fd = open( name, O_CREAT | O_RDWR, 0664 )) < 0)
38 st_report(
"gm_map(): File creation failed");
49 isrd = access(name, R_OK)==0;
50 iswr = iswrite && access(name, W_OK)==0;
54 fd = open(name, O_RDWR,0);
59 fd = open(name, O_RDONLY,0);
64 st_report(
"gm_map could not open file %s",name);
68 sz = lseek(fd, 0l, SEEK_END );
76 if( !(pwd = getenv(
"PWD")))
81 st_report(
"gm_map: %s (pwd %s) has %d bytes but expected %d",
96 st_report(
"gm_map could not map to %s", name);
114 int fd = -1, sz, isrd, iswr;
122 if(access(name, F_OK))
126 st_report(
"obj_map() can't create a file when called with no write access");
130 if(( fd = open( name, O_CREAT | O_RDWR, 0664 )) < 0)
132 st_report(
"obj_map(): File creation failed");
139 write(fd, &zero, 1 );
143 isrd = access(name, R_OK)==0;
144 iswr = iswrite && access(name, W_OK)==0;
148 fd = open(name, O_RDWR,0);
153 fd = open(name, O_RDONLY,0);
158 st_report(
"obj_map() could not open file %s",name);
162 sz = lseek(fd, 0l, SEEK_END );
169 if( !(pwd = getenv(
"PWD")))
178 st_report(
"obj_map() abort: Called with no write access");
182 st_report(
"obj_map(): Erasing this file to create another with the correct length");
184 if(( fd = open( name, O_CREAT | O_TRUNC | O_RDWR, 0664 )) < 0)
186 st_report(
"obj_map(): File creation failed");
194 write(fd, &zero, 1 );
206 st_report(
"obj_map() could not map to %s", name);
struct OBJECT_GLOBAL_MEMORY * obj_map()
struct GLOBAL_MEMORY * gm_map()
struct GLOBAL_MEMORY * CGM
struct OBJECT_GLOBAL_MEMORY * OGM