clarify the purpose of this project
[nyanglibc.git] / nptl / pthread_setname.s
blobd60e995e7abd41f6ebb1e11132e8e4aa3d603afd
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_setname_np
8 .type pthread_setname_np, @function
9 pthread_setname_np:
10 pushq %r13
11 pushq %r12
12 movq %rdi, %r13
13 pushq %rbp
14 pushq %rbx
15 movq %rsi, %rdi
16 movq %rsi, %r12
17 movl $34, %ebx
18 subq $40, %rsp
19 call strlen@PLT
20 cmpq $15, %rax
21 ja .L1
22 cmpq %r13, %fs:16
23 je .L20
24 movl 720(%r13), %edx
25 movq %rsp, %rbx
26 leaq .LC0(%rip), %rsi
27 movq %rbx, %rdi
28 movq %rax, %rbp
29 xorl %eax, %eax
30 call sprintf@PLT
31 xorl %eax, %eax
32 movl $2, %esi
33 movq %rbx, %rdi
34 call __open64_nocancel@PLT
35 cmpl $-1, %eax
36 movl %eax, %r13d
37 jne .L4
38 jmp .L18
39 .p2align 4,,10
40 .p2align 3
41 .L21:
42 movq errno@gottpoff(%rip), %rax
43 movl %fs:(%rax), %ebx
44 cmpl $4, %ebx
45 jne .L8
46 .L4:
47 movq %rbp, %rdx
48 movq %r12, %rsi
49 movl %r13d, %edi
50 call __write_nocancel@PLT
51 cmpq $-1, %rax
52 je .L21
53 testq %rax, %rax
54 js .L22
55 xorl %ebx, %ebx
56 cmpq %rbp, %rax
57 setne %bl
58 leal (%rbx,%rbx,4), %ebx
59 .L8:
60 movl %r13d, %edi
61 call __close_nocancel@PLT
62 .L1:
63 addq $40, %rsp
64 movl %ebx, %eax
65 popq %rbx
66 popq %rbp
67 popq %r12
68 popq %r13
69 ret
70 .p2align 4,,10
71 .p2align 3
72 .L20:
73 xorl %eax, %eax
74 movq %r12, %rsi
75 movl $15, %edi
76 call prctl@PLT
77 testl %eax, %eax
78 movl %eax, %ebx
79 je .L1
80 .L18:
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 .L22:
91 movq errno@gottpoff(%rip), %rax
92 movl %fs:(%rax), %ebx
93 jmp .L8
94 .size pthread_setname_np, .-pthread_setname_np