clarify the purpose of this project
[nyanglibc.git] / login / getlogin_r.shared.s
blob180153704268b20976a67823813f02c73693b87a
1 .text
2 #APP
3 memmove = __GI_memmove
4 memset = __GI_memset
5 memcpy = __GI_memcpy
6 #NO_APP
7 .p2align 4,,15
8 .type getlogin_r_fd0, @function
9 getlogin_r_fd0:
10 pushq %r14
11 pushq %r13
12 movl $512, %edx
13 pushq %r12
14 pushq %rbp
15 movq %rdi, %r12
16 pushq %rbx
17 xorl %edi, %edi
18 movq %rsi, %r13
19 subq $1296, %rsp
20 leaq 784(%rsp), %rbp
21 movq %rbp, %rsi
22 call __ttyname_r
23 testl %eax, %eax
24 movl %eax, %ebx
25 je .L12
26 .L1:
27 addq $1296, %rsp
28 movl %ebx, %eax
29 popq %rbx
30 popq %rbp
31 popq %r12
32 popq %r13
33 popq %r14
34 ret
35 .p2align 4,,10
36 .p2align 3
37 .L12:
38 leaq 5(%rbp), %rsi
39 leaq 16(%rsp), %rbp
40 movl $32, %edx
41 leaq 8(%rbp), %rdi
42 call __GI_strncpy
43 #APP
44 # 66 "../sysdeps/unix/getlogin_r.c" 1
45 movl %fs:24,%eax
46 # 0 "" 2
47 #NO_APP
48 testl %eax, %eax
49 movl $1, %edx
50 jne .L3
51 #APP
52 # 47 "../sysdeps/unix/sysv/linux/x86/lowlevellock.h" 1
53 cmpxchgl %edx, __libc_utmp_lock(%rip)
54 # 0 "" 2
55 #NO_APP
56 .L4:
57 call __libc_setutent
58 leaq 8(%rsp), %rdx
59 leaq 400(%rsp), %rsi
60 movq %rbp, %rdi
61 call __libc_getutline_r
62 testl %eax, %eax
63 movl %eax, %ebx
64 jns .L5
65 movq __libc_errno@gottpoff(%rip), %rax
66 movl %fs:(%rax), %ebx
67 movl $2, %eax
68 cmpl $3, %ebx
69 cmove %eax, %ebx
70 .L5:
71 call __libc_endutent
72 #APP
73 # 78 "../sysdeps/unix/getlogin_r.c" 1
74 movl %fs:24,%eax
75 # 0 "" 2
76 #NO_APP
77 testl %eax, %eax
78 jne .L6
79 subl $1, __libc_utmp_lock(%rip)
80 .L7:
81 testl %ebx, %ebx
82 jne .L1
83 movq 8(%rsp), %rax
84 movl $32, %esi
85 leaq 44(%rax), %rbp
86 movq %rbp, %rdi
87 call __GI___strnlen
88 movq %rax, %r14
89 leaq 1(%rax), %rax
90 cmpq %r13, %rax
91 jbe .L8
92 movq __libc_errno@gottpoff(%rip), %rax
93 movl $34, %ebx
94 movl $34, %fs:(%rax)
95 jmp .L1
96 .p2align 4,,10
97 .p2align 3
98 .L8:
99 movq %r14, %rdx
100 movq %rbp, %rsi
101 movq %r12, %rdi
102 call __GI_memcpy@PLT
103 movb $0, (%r12,%r14)
104 jmp .L1
105 .p2align 4,,10
106 .p2align 3
107 .L6:
108 xorl %eax, %eax
109 #APP
110 # 78 "../sysdeps/unix/getlogin_r.c" 1
111 xchgl %eax, __libc_utmp_lock(%rip)
112 # 0 "" 2
113 #NO_APP
114 cmpl $1, %eax
115 jle .L7
116 xorl %r10d, %r10d
117 movl $1, %edx
118 movl $129, %esi
119 leaq __libc_utmp_lock(%rip), %rdi
120 movl $202, %eax
121 #APP
122 # 78 "../sysdeps/unix/getlogin_r.c" 1
123 syscall
125 # 0 "" 2
126 #NO_APP
127 jmp .L7
128 .p2align 4,,10
129 .p2align 3
130 .L3:
131 movl %ebx, %eax
132 lock cmpxchgl %edx, __libc_utmp_lock(%rip)
133 je .L4
134 leaq __libc_utmp_lock(%rip), %rdi
135 call __lll_lock_wait_private
136 jmp .L4
137 .size getlogin_r_fd0, .-getlogin_r_fd0
138 .section .rodata.str1.1,"aMS",@progbits,1
139 .LC0:
140 .string "/proc/self/loginuid"
141 .text
142 .p2align 4,,15
143 .globl __getlogin_r_loginuid
144 .hidden __getlogin_r_loginuid
145 .type __getlogin_r_loginuid, @function
146 __getlogin_r_loginuid:
147 pushq %r15
148 pushq %r14
149 xorl %eax, %eax
150 pushq %r13
151 pushq %r12
152 movq %rsi, %r14
153 pushq %rbp
154 pushq %rbx
155 xorl %esi, %esi
156 subq $1144, %rsp
157 movq %rdi, 8(%rsp)
158 leaq .LC0(%rip), %rdi
159 call __GI___open_nocancel
160 cmpl $-1, %eax
161 je .L18
162 movl %eax, %r12d
163 leaq 36(%rsp), %rbp
164 jmp .L14
165 .p2align 4,,10
166 .p2align 3
167 .L32:
168 movq __libc_errno@gottpoff(%rip), %rax
169 cmpl $4, %fs:(%rax)
170 jne .L31
171 .L14:
172 movl $12, %edx
173 movq %rbp, %rsi
174 movl %r12d, %edi
175 call __GI___read_nocancel
176 cmpq $-1, %rax
177 movq %rax, %r15
178 je .L32
179 movl %r12d, %edi
180 call __GI___close_nocancel
181 testq %r15, %r15
182 jle .L18
183 cmpq $12, %r15
184 je .L18
185 leaq 16(%rsp), %rsi
186 movl $10, %edx
187 movq %rbp, %rdi
188 movb $0, 36(%rsp,%r15)
189 call __GI_strtoul
190 movq 16(%rsp), %rdx
191 movl %eax, %r12d
192 cmpq %rbp, %rdx
193 je .L18
194 cmpb $0, (%rdx)
195 jne .L18
196 cmpl $-1, %eax
197 je .L33
198 leaq 96(%rsp), %rbp
199 movq $1024, 104(%rsp)
200 movl $1024, %ecx
201 leaq 24(%rsp), %rbx
202 leaq 48(%rsp), %r13
203 leaq 16(%rbp), %rdx
204 movq %rdx, 96(%rsp)
205 jmp .L20
206 .p2align 4,,10
207 .p2align 3
208 .L35:
209 movq 104(%rsp), %rcx
210 movq 96(%rsp), %rdx
211 .L20:
212 movq %rbx, %r8
213 movq %r13, %rsi
214 movl %r12d, %edi
215 call __getpwuid_r
216 cmpl $34, %eax
217 movl %eax, %r15d
218 jne .L34
219 movq %rbp, %rdi
220 call __GI___libc_scratch_buffer_grow
221 testb %al, %al
222 jne .L35
223 movl $12, %r15d
224 .L21:
225 movq 96(%rsp), %rdi
226 addq $16, %rbp
227 cmpq %rbp, %rdi
228 je .L13
229 call free@PLT
230 .L13:
231 addq $1144, %rsp
232 movl %r15d, %eax
233 popq %rbx
234 popq %rbp
235 popq %r12
236 popq %r13
237 popq %r14
238 popq %r15
240 .p2align 4,,10
241 .p2align 3
242 .L31:
243 movl %r12d, %edi
244 call __GI___close_nocancel
245 jmp .L13
246 .p2align 4,,10
247 .p2align 3
248 .L34:
249 testl %eax, %eax
250 jne .L26
251 cmpq $0, 24(%rsp)
252 je .L26
253 movq 48(%rsp), %rbx
254 movq %rbx, %rdi
255 call __GI_strlen
256 leaq 1(%rax), %rdx
257 cmpq %r14, %rdx
258 jbe .L23
259 movq __libc_errno@gottpoff(%rip), %rax
260 movl $34, %r15d
261 movl $34, %fs:(%rax)
262 jmp .L21
263 .p2align 4,,10
264 .p2align 3
265 .L26:
266 movl $-1, %r15d
267 jmp .L21
268 .p2align 4,,10
269 .p2align 3
270 .L33:
271 movq __libc_errno@gottpoff(%rip), %rax
272 movl $6, %r15d
273 movl $6, %fs:(%rax)
274 jmp .L13
275 .L23:
276 movq 8(%rsp), %rdi
277 movq %rbx, %rsi
278 call __GI_memcpy@PLT
279 jmp .L21
280 .L18:
281 movl $-1, %r15d
282 jmp .L13
283 .size __getlogin_r_loginuid, .-__getlogin_r_loginuid
284 .p2align 4,,15
285 .globl __GI___getlogin_r
286 .hidden __GI___getlogin_r
287 .type __GI___getlogin_r, @function
288 __GI___getlogin_r:
289 pushq %rbp
290 pushq %rbx
291 movq %rsi, %rbp
292 movq %rdi, %rbx
293 subq $8, %rsp
294 call __getlogin_r_loginuid
295 testl %eax, %eax
296 js .L39
297 addq $8, %rsp
298 popq %rbx
299 popq %rbp
301 .p2align 4,,10
302 .p2align 3
303 .L39:
304 addq $8, %rsp
305 movq %rbp, %rsi
306 movq %rbx, %rdi
307 popq %rbx
308 popq %rbp
309 jmp getlogin_r_fd0
310 .size __GI___getlogin_r, .-__GI___getlogin_r
311 .globl __getlogin_r
312 .set __getlogin_r,__GI___getlogin_r
313 .weak __GI_getlogin_r
314 .hidden __GI_getlogin_r
315 .set __GI_getlogin_r,__getlogin_r
316 .weak getlogin_r
317 .set getlogin_r,__GI_getlogin_r
318 .hidden __getpwuid_r
319 .hidden __lll_lock_wait_private
320 .hidden __libc_endutent
321 .hidden __libc_getutline_r
322 .hidden __libc_setutent
323 .hidden __libc_utmp_lock
324 .hidden __ttyname_r