clarify the purpose of this project
[nyanglibc.git] / nptl / pthread_getname.s
blobd8463df2398400938c60000e9627c0d696cbf0f9
1 .text
2 .section .rodata.str1.1,"aMS",@progbits,1
3 .LC0:
4 .string "/proc/self/task/%u/comm"
5 .text
6 .p2align 4,,15
7 .globl pthread_getname_np
8 .type pthread_getname_np, @function
9 pthread_getname_np:
10 pushq %r13
11 pushq %r12
12 pushq %rbp
13 pushq %rbx
14 movl $34, %ebx
15 subq $40, %rsp
16 cmpq $15, %rdx
17 jbe .L1
18 cmpq %rdi, %fs:16
19 movq %rdx, %rbp
20 movq %rsi, %r12
21 je .L21
22 movl 720(%rdi), %edx
23 movq %rsp, %rbx
24 leaq .LC0(%rip), %rsi
25 movq %rbx, %rdi
26 xorl %eax, %eax
27 call sprintf@PLT
28 xorl %esi, %esi
29 xorl %eax, %eax
30 movq %rbx, %rdi
31 call __open64_nocancel@PLT
32 cmpl $-1, %eax
33 movl %eax, %r13d
34 jne .L4
35 jmp .L19
36 .p2align 4,,10
37 .p2align 3
38 .L22:
39 movq errno@gottpoff(%rip), %rax
40 movl %fs:(%rax), %ebx
41 cmpl $4, %ebx
42 jne .L8
43 .L4:
44 movq %rbp, %rdx
45 movq %r12, %rsi
46 movl %r13d, %edi
47 call __read_nocancel@PLT
48 cmpq $-1, %rax
49 je .L22
50 testq %rax, %rax
51 js .L23
52 leaq -1(%r12,%rax), %rdx
53 cmpb $10, (%rdx)
54 je .L24
55 cmpq %rbp, %rax
56 movl $34, %ebx
57 je .L8
58 movb $0, (%r12,%rax)
59 xorl %ebx, %ebx
60 .L8:
61 movl %r13d, %edi
62 call __close_nocancel@PLT
63 .L1:
64 addq $40, %rsp
65 movl %ebx, %eax
66 popq %rbx
67 popq %rbp
68 popq %r12
69 popq %r13
70 ret
71 .p2align 4,,10
72 .p2align 3
73 .L21:
74 xorl %eax, %eax
75 movl $16, %edi
76 call prctl@PLT
77 testl %eax, %eax
78 movl %eax, %ebx
79 je .L1
80 .L19:
81 movq errno@gottpoff(%rip), %rax
82 movl %fs:(%rax), %ebx
83 addq $40, %rsp
84 movl %ebx, %eax
85 popq %rbx
86 popq %rbp
87 popq %r12
88 popq %r13
89 ret
90 .p2align 4,,10
91 .p2align 3
92 .L24:
93 movb $0, (%rdx)
94 xorl %ebx, %ebx
95 jmp .L8
96 .L23:
97 movq errno@gottpoff(%rip), %rax
98 movl %fs:(%rax), %ebx
99 jmp .L8
100 .size pthread_getname_np, .-pthread_getname_np