]>
Commit | Line | Data |
---|---|---|
23a7453b | 1 | /* Copyright (C) 1998, 2003, 2006, 2012 Free Software Foundation, Inc. |
73bc8117 RH |
2 | This file is part of the GNU C Library. |
3 | ||
4 | The GNU C Library is free software; you can redistribute it and/or | |
3214b89b AJ |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
73bc8117 RH |
8 | |
9 | The GNU C Library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
3214b89b | 12 | Lesser General Public License for more details. |
73bc8117 | 13 | |
3214b89b | 14 | You should have received a copy of the GNU Lesser General Public |
ab84e3ff PE |
15 | License along with the GNU C Library. If not, see |
16 | <http://www.gnu.org/licenses/>. */ | |
73bc8117 RH |
17 | |
18 | #include <sysdep.h> | |
19 | #define _ERRNO_H 1 | |
20 | #include <bits/errno.h> | |
44422d11 | 21 | #include <kernel-features.h> |
73bc8117 | 22 | |
ebcd2cd1 RH |
23 | .text |
24 | ||
23a7453b | 25 | #if defined PIC && defined DO_VERSIONING |
ebcd2cd1 RH |
26 | #define WAIT4 __wait4_tv64 |
27 | #else | |
28 | #define WAIT4 __wait4 | |
29 | #endif | |
30 | ||
31 | #if defined __ASSUME_TIMEVAL64 | |
32 | PSEUDO(WAIT4, wait4, 4) | |
33 | ret | |
34 | PSEUDO_END(WAIT4) | |
35 | #else | |
73bc8117 RH |
36 | /* The problem here is that initially we made struct timeval compatible with |
37 | OSF/1, using int32. But we defined time_t with uint64, and later found | |
38 | that POSIX requires tv_sec to be time_t. | |
39 | ||
40 | So now we have to do compatibility stuff. */ | |
41 | ||
42 | /* The variable is shared between all wrappers around signal handling | |
43 | functions which have RT equivalents. */ | |
44 | .comm __libc_missing_axp_tv64, 4 | |
45 | ||
edc43054 | 46 | LEAF(WAIT4, 32) |
73bc8117 RH |
47 | ldgp gp, 0(pv) |
48 | subq sp, 32, sp | |
49 | #ifdef PROF | |
50 | .set noat | |
51 | lda AT, _mcount | |
52 | jsr AT, (AT), _mcount | |
53 | .set at | |
54 | #endif | |
55 | .prologue 1 | |
56 | ||
57 | ldl t0, __libc_missing_axp_tv64 | |
58 | ||
59 | /* Save arguments in case we do need to fall back. */ | |
60 | stq a0, 0(sp) | |
61 | stq a1, 8(sp) | |
62 | stq a2, 16(sp) | |
63 | stq a3, 24(sp) | |
64 | ||
65 | bne t0, $do32 | |
66 | ||
67 | ldi v0, SYS_ify(wait4) | |
68 | callsys | |
69 | bne a3, $err64 | |
70 | ||
71 | /* Everything ok. */ | |
72 | addq sp, 32, sp | |
73 | ret | |
74 | ||
75 | /* If we didn't get ENOSYS, it is a real error. */ | |
76 | .align 3 | |
77 | $err64: cmpeq v0, ENOSYS, t0 | |
edc43054 | 78 | beq t0, $error |
73bc8117 RH |
79 | stl t0, __libc_missing_axp_tv64 |
80 | ||
81 | /* Recover the saved arguments. */ | |
82 | ldq a3, 24(sp) | |
83 | ldq a2, 16(sp) | |
84 | ldq a1, 8(sp) | |
85 | ldq a0, 0(sp) | |
86 | ||
87 | .align 3 | |
88 | $do32: ldi v0, SYS_ify(osf_wait4) | |
89 | callsys | |
90 | bne a3, $error | |
91 | ||
92 | /* Copy back to proper format. */ | |
edc43054 | 93 | ldq a3, 24(sp) |
73bc8117 RH |
94 | beq a3, 2f |
95 | ldl t0, 0(a3) # ru_utime.tv_sec | |
96 | ldl t1, 4(a3) # ru_utime.tv_usec | |
97 | ldl t2, 8(a3) # ru_stime.tv_sec | |
98 | ldl t3, 12(a3) # ru_stime.tv_usec | |
99 | ldt $f15, 16(a3) # ru_maxrss | |
100 | ldt $f16, 24(a3) # ru_ixrss | |
101 | ldt $f17, 32(a3) # ru_idrss | |
102 | ldt $f18, 40(a3) # ru_isrss | |
103 | ldt $f19, 48(a3) # ru_minflt | |
104 | ldt $f20, 56(a3) # ru_majflt | |
105 | ldt $f21, 64(a3) # ru_nswap | |
106 | ldt $f22, 72(a3) # ru_inblock | |
107 | ldt $f23, 80(a3) # ru_oublock | |
108 | ldt $f24, 88(a3) # ru_msgsend | |
109 | ldt $f25, 96(a3) # ru_msgrcv | |
110 | ldt $f26, 104(a3) # ru_nsignals | |
111 | ldt $f27, 112(a3) # ru_nvcsw | |
edc43054 | 112 | .set noat |
73bc8117 RH |
113 | ldt $f28, 120(a3) # ru_nivcsw |
114 | stq t0, 0(a3) | |
115 | stq t1, 8(a3) | |
116 | stq t2, 16(a3) | |
117 | stq t3, 24(a3) | |
118 | stt $f15, 32(a3) | |
119 | stt $f16, 40(a3) | |
120 | stt $f17, 48(a3) | |
121 | stt $f18, 56(a3) | |
122 | stt $f19, 64(a3) | |
123 | stt $f20, 72(a3) | |
124 | stt $f21, 80(a3) | |
125 | stt $f22, 88(a3) | |
126 | stt $f23, 96(a3) | |
127 | stt $f24, 104(a3) | |
128 | stt $f25, 112(a3) | |
129 | stt $f26, 120(a3) | |
130 | stt $f27, 128(a3) | |
131 | stt $f28, 136(a3) | |
edc43054 | 132 | .set at |
73bc8117 RH |
133 | |
134 | 2: addq sp, 32, sp | |
135 | ret | |
136 | ||
137 | .align 3 | |
138 | $error: | |
73bc8117 | 139 | addq sp, 32, sp |
d5a256ad | 140 | SYSCALL_ERROR_HANDLER |
73bc8117 | 141 | |
edc43054 | 142 | END(WAIT4) |
ebcd2cd1 | 143 | #endif /* __ASSUME_TIMEVAL64 */ |
73bc8117 | 144 | |
23a7453b | 145 | #if defined PIC && defined DO_VERSIONING |
73bc8117 RH |
146 | default_symbol_version (__wait4_tv64, __wait4, GLIBC_2.1) |
147 | ||
148 | /* It seems to me to be a misfeature of the assembler that we can only | |
149 | have one version-alias per symbol. So create an alias ourselves. | |
150 | The 'p' is for 'public'. *Shrug* */ | |
151 | strong_alias (__wait4_tv64, __wait4_tv64p) | |
152 | default_symbol_version (__wait4_tv64p, wait4, GLIBC_2.1) | |
edc43054 UD |
153 | #else |
154 | weak_alias (__wait4, wait4) | |
155 | #endif |