* Why won't mmap work on my Ultrix 4.2 Decstation 5000 ?
@ 1991-11-12 11:50 Peter A Fletcher
1991-11-13 19:42 ` Jaye Mathisen
0 siblings, 1 reply; 2+ messages in thread
From: Peter A Fletcher @ 1991-11-12 11:50 UTC (permalink / raw)
Hello everyone!
I have been having some problems with my Decstation; it won't do mmaps
for me. The following piece of code works fine on Suns and Apollos,
but fails with an invalid argument on the mmap call on my Decstation.
Can anyone help ?
-peter.
-----
#include <sys/errno.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/mman.h>
#include <stdio.h>
main()
{
int d;
int len = getpagesize();
char *cp;
int i;
int z;
d = open("test", O_RDWR | O_CREAT | O_TRUNC, 0777);
z = lseek(d, 255, L_XTND);
z = write(d, &i, 1);
#ifdef apollo
cp = mmap(0, &len, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, d, 0);
#else
cp = mmap(0, len, PROT_READ | PROT_WRITE, MAP_SHARED, d, 0);
#endif
if (cp == (char *)-1)
{
perror("tmap");
exit(1);
}
printf("cp = %1u\n",cp);
for (i=0; i<256; i++)
{
cp[i] = i&255;
}
#ifndef mips
#ifdef apollo
z = msync(cp, len);
#else
z = msync(cp, len, 0);
#endif
#endif
z = munmap(cp, len);
z = close(d);
}
-----
--
Peter Fletcher, Internet : peterf@csis.dit.csiro.au
PhD Student Physical : CSIRO Division of Information Technology,
Phone : +61-6-2750914 ANU, Acton, Canberra ACT AUSTRALIA
-------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Why won't mmap work on my Ultrix 4.2 Decstation 5000 ?
1991-11-12 11:50 Why won't mmap work on my Ultrix 4.2 Decstation 5000 ? Peter A Fletcher
@ 1991-11-13 19:42 ` Jaye Mathisen
0 siblings, 0 replies; 2+ messages in thread
From: Jaye Mathisen @ 1991-11-13 19:42 UTC (permalink / raw)
In article <PETERF.91Nov12215047@olivine.csis.dit.csiro.au> peterf@olivine.csis.dit.csiro.au (Peter A Fletcher) writes:
>Hello everyone!
>
>I have been having some problems with my Decstation; it won't do mmaps
>for me. The following piece of code works fine on Suns and Apollos,
>but fails with an invalid argument on the mmap call on my Decstation.
>#include <sys/errno.h>
>#include <sys/file.h>
>#include <sys/types.h>
>#include <sys/uio.h>
>#include <sys/mman.h>
>#include <stdio.h>
>
>main()
>
>{
> int d;
> int len = getpagesize();
> char *cp;
> int i;
> int z;
>
> d = open("test", O_RDWR | O_CREAT | O_TRUNC, 0777);
> z = lseek(d, 255, L_XTND);
> z = write(d, &i, 1);
>
>#ifdef apollo
> cp = mmap(0, &len, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, d, 0);
>#else
> cp = mmap(0, len, PROT_READ | PROT_WRITE, MAP_SHARED, d, 0);
>#endif
mmap as documented on the man page only supports character devices...
--
Jaye Mathisen, COE Systems Manager (406) 994-4780
410 Roberts Hall,Dept. of Computer Science
Montana State University,Bozeman MT 59717
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1991-11-13 19:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1991-11-12 11:50 Why won't mmap work on my Ultrix 4.2 Decstation 5000 ? Peter A Fletcher
1991-11-13 19:42 ` Jaye Mathisen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox