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