Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: peterf@olivine.csis.dit.csiro.au (Peter A Fletcher)
Subject: Why won't mmap work on my Ultrix 4.2 Decstation 5000 ?
Date: 12 Nov 91 11:50:47 GMT	[thread overview]
Message-ID: <PETERF.91Nov12215047@olivine.csis.dit.csiro.au> (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
-------------------------------------------------------------------------------


             reply	other threads:[~1991-11-12 11:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-11-12 11:50 Peter A Fletcher [this message]
1991-11-13 19:42 ` Why won't mmap work on my Ultrix 4.2 Decstation 5000 ? Jaye Mathisen
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox