• Ultrix doesn’t define MAP_FAILED either

• on Ultrix, mmap() returns a caddr_t instead of a void*, so cast
This commit is contained in:
tg 2008-04-02 16:55:06 +00:00
parent 954352cae3
commit acc2e9a67a
3 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.312 2008/04/01 20:40:20 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.313 2008/04/02 16:55:05 tg Exp $'
#-
# Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI
@ -1013,8 +1013,8 @@ ac_test flock_ex '' 'flock and mmap' <<-'EOF'
#include <sys/mman.h>
#include <fcntl.h>
#include <stdlib.h>
int main(void) { return (mmap(NULL, flock(0, LOCK_EX), PROT_READ,
MAP_PRIVATE, 0, 0) == NULL ? 1 : 0); }
int main(void) { return ((void *)mmap(NULL, flock(0, LOCK_EX),
PROT_READ, MAP_PRIVATE, 0, 0) == (void *)NULL ? 1 : 0); }
EOF
ac_test mkstemp <<-'EOF'

View File

@ -3,7 +3,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.59 2008/03/27 17:59:28 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.60 2008/04/02 16:55:06 tg Exp $");
/*-
* MirOS: This is the default mapping type, and need not be specified.
@ -663,8 +663,8 @@ hist_init(Source *s)
/*
* we have some data
*/
base = mmap(NULL, hsize, PROT_READ, MAP_FILE | MAP_PRIVATE,
histfd, 0);
base = (void *)mmap(NULL, hsize, PROT_READ,
MAP_FILE | MAP_PRIVATE, histfd, 0);
/*
* check on its validity
*/
@ -893,7 +893,7 @@ writehistfile(int lno, char *cmd)
if (sizenow > hsize) {
/* someone has added some lines */
bytes = sizenow - hsize;
base = mmap(NULL, sizenow, PROT_READ,
base = (void *)mmap(NULL, sizenow, PROT_READ,
MAP_FILE | MAP_PRIVATE, histfd, 0);
if (base == (unsigned char *)MAP_FAILED)
goto bad;

4
sh.h
View File

@ -8,7 +8,7 @@
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.201 2008/04/01 22:20:19 tg Exp $"
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.202 2008/04/02 16:55:06 tg Exp $"
#define MKSH_VERSION "R33 2008/04/01"
#if HAVE_SYS_PARAM_H
@ -184,7 +184,7 @@ typedef int bool;
#if !defined(MAP_FAILED)
# if defined(__linux)
#define MAP_FAILED ((void *)-1)
# elif defined(__bsdi__)
# elif defined(__bsdi__) || defined(__ultrix)
#define MAP_FAILED ((caddr_t)-1)
# endif
#endif