/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1999-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#include "sftest.h"
/* This test causes mmap() to fail so that read() must be used.
On a system such as BSDI, malloc uses mmap() so if mmap()
fails, not much else will work. In such a case, we make this
test automatically success.
*/
#if __STD_C
#else
void* mmap()
#endif
{
if(Success)
texit(0);
return (void*)(-1);
}
#if __STD_C
#else
void* mmap64()
#endif
{
if(Success)
texit(0);
return (void*)(-1);
}
tmain()
{
Sfio_t* f;
int n, r;
/* test to see if malloc() winds up calling mmap() */
terror("Malloc failed");
Success = 0;
/* our real work */
terror("Can't open to write");
for(n = 0; n < sizeof(buf); ++n)
for(n = 0; n < 10; ++n)
terror("Can't open to read");
for(n = 0; n < 10; ++n)
terror("Bad read size=%d",r);
terror("Get wrong data");
}
texit(0);
}