summaryrefslogtreecommitdiff
path: root/mcon/U/d_shmat.U
blob: be8b4bd5262d8a5eec98d13b1e67018cd93581ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
?RCS: $Id$
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: $Log: d_shmat.U,v $
?RCS: Revision 3.0.1.3  1995/07/25  14:04:23  ram
?RCS: patch56: use findhdr to find <sys/shm.h>, to get the right one (ADO)
?RCS:
?RCS: Revision 3.0.1.2  1994/05/13  15:18:56  ram
?RCS: patch27: added new symbol HAS_SHMAT_PROTOTYPE (ADO)
?RCS:
?RCS: Revision 3.0.1.1  1994/05/06  14:54:18  ram
?RCS: patch23: new Shmat_t symbol to declare return type of shmat()
?RCS:
?RCS: Revision 3.0  1993/08/18  12:07:18  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:d_shmat shmattype d_shmatprototype: Trylink Setvar cat
?MAKE:	-pick add $@ %<
?S:d_shmat:
?S:	This variable conditionally defines the HAS_SHMAT symbol, which
?S:	indicates to the C program that the shmat() routine is available.
?S:.
?S:shmattype:
?S:	This symbol contains the type of pointer returned by shmat().
?S:	It can be 'void *' or 'char *'.
?S:.
?S:d_shmatprototype:
?S:	This variable conditionally defines the HAS_SHMAT_PROTOTYPE 
?S:	symbol, which indicates that sys/shm.h has a prototype for
?S:	shmat.
?S:.
?C:HAS_SHMAT:
?C:	This symbol, if defined, indicates that the shmat() routine is
?C:	available to attach a shared memory segment to the process space.
?C:.
?C:Shmat_t:
?C:	This symbol holds the return type of the shmat() system call.
?C:	Usually set to 'void *' or 'char *'.
?C:.
?C:HAS_SHMAT_PROTOTYPE:
?C:	This symbol, if defined, indicates that the sys/shm.h includes
?C:	a prototype for shmat().  Otherwise, it is up to the program to
?C:	guess one.  Shmat_t shmat _((int, Shmat_t, int)) is a good guess,
?C:	but not always right so it should be emitted by the program only
?C:	when HAS_SHMAT_PROTOTYPE is not defined to avoid conflicting defs.
?C:.
?H:#$d_shmat HAS_SHMAT		/**/
?H:#define Shmat_t $shmattype	/**/
?H:#$d_shmatprototype HAS_SHMAT_PROTOTYPE	/**/
?H:.
?LINT:set d_shmat d_shmatprototype
: see if shmat exists
$cat >try.c <<EOC
#include <sys/shm.h>
int main(void)
{
	static int id, flags;
	static void *addr;
	(void) shmat(id, addr, flags);
	return 0;
}
EOC
cyn=shmat
set d_shmat 
eval $trylink

case "$d_shmat" in
"$define")
	$cat >try.c <<EOC
#include <sys/shm.h>
extern void shmat(void);
int main(void) { return 0; }
EOC
	cyn="whether <sys/shm.h> contains the shmat() prototype"
	set val
	eval $trylink
	case "$val" in
	"$define")	val="$undef";;
	*)		val="$define";;
	esac
	;;
*)	val="$undef";;
esac

set d_shmatprototype
eval $setvar

case "$d_shmat" in
"$define")
	echo " "
	echo "Looking for the correct shmat prototype..." >&4
	;;
esac

case "$d_shmat" in
"$define")
	$cat >try.c <<EOC
#include <sys/shm.h>
extern void *shmat(int, const void *, int);
int main(void) { return 0; }
EOC
	set val
	eval $trylink
	;;
esac

case "$d_shmat" in
"$define")
	$cat >try.c <<EOC
#include <sys/shm.h>
extern void *shmat(int, void *, int);
int main(void) { return 0; }
EOC
	set val
	eval $trylink
	case "$val" in
	"$define") shmattype='void *';;
	esac
	;;
esac

case "$d_shmat" in
"$define")
	$cat >try.c <<EOC
#include <sys/shm.h>
extern char *shmat(int, char *, int);
int main(void) { return 0; }
EOC
	set val
	eval $trylink
	case "$val" in
	"$define") shmattype='char *';;
	esac
	;;
esac

case "$d_shmat" in
"$define") echo "shmat() returns $shmattype";;
esac