annotate src/os/unix/ngx_sunpro_x86.il @ 8910:f3510cb959d1

Events: fixed EPOLLRDHUP with FIONREAD (ticket #2367). When reading exactly rev->available bytes, rev->available might become 0 after FIONREAD usage introduction in efd71d49bde0. On the next call of ngx_readv_chain() on systems with EPOLLRDHUP this resulted in return without any actions, that is, with rev->ready set, and this in turn resulted in no timers set in event pipe, leading to socket leaks. Fix is to reset rev->ready in ngx_readv_chain() when returning due to rev->available being 0 with EPOLLRDHUP, much like it is already done in ngx_unix_recv(). This ensures that if rev->available will become 0, on systems with EPOLLRDHUP support appropriate EPOLLRDHUP-specific handling will happen on the next ngx_readv_chain() call. While here, also synced ngx_readv_chain() to match ngx_unix_recv() and reset rev->ready when returning due to rev->available being 0 with kqueue. This is mostly cosmetic change, as rev->ready is anyway reset when rev->available is set to 0.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 15 Jul 2022 15:19:32 +0300
parents 2cd019520210
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1 /
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2 / Copyright (C) Igor Sysoev
4412
d620f497c50f Copyright updated.
Maxim Konovalov <maxim@nginx.com>
parents: 2818
diff changeset
3 / Copyright (C) Nginx, Inc.
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
4 /
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
5
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
6 / ngx_atomic_uint_t ngx_atomic_cmp_set(ngx_atomic_t *lock,
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
7 / ngx_atomic_uint_t old, ngx_atomic_uint_t set);
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
8 /
2818
7e02df612521 preserve Solaris binary hardware capabilities
Igor Sysoev <igor@sysoev.ru>
parents: 1309
diff changeset
9 / the arguments are passed on stack (%esp), 4(%esp), 8(%esp)
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
10
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
11 .inline ngx_atomic_cmp_set,0
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
12 movl (%esp), %ecx
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
13 movl 4(%esp), %eax
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
14 movl 8(%esp), %edx
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
15 lock
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
16 cmpxchgl %edx, (%ecx)
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
17 setz %al
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
18 movzbl %al, %eax
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
19 .end
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
20
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
21
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
22 / ngx_atomic_int_t ngx_atomic_fetch_add(ngx_atomic_t *value,
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
23 / ngx_atomic_int_t add);
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
24 /
2818
7e02df612521 preserve Solaris binary hardware capabilities
Igor Sysoev <igor@sysoev.ru>
parents: 1309
diff changeset
25 / the arguments are passed on stack (%esp), 4(%esp)
561
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
26
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
27 .inline ngx_atomic_fetch_add,0
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
28 movl (%esp), %ecx
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
29 movl 4(%esp), %eax
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
30 lock
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
31 xaddl %eax, (%ecx)
e48ebafc6939 nginx-0.3.2-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
32 .end
1309
08c6ee7a1b11 Sun Studio 12 compatibility
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
33
08c6ee7a1b11 Sun Studio 12 compatibility
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
34
08c6ee7a1b11 Sun Studio 12 compatibility
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
35 / ngx_cpu_pause()
2818
7e02df612521 preserve Solaris binary hardware capabilities
Igor Sysoev <igor@sysoev.ru>
parents: 1309
diff changeset
36 /
7e02df612521 preserve Solaris binary hardware capabilities
Igor Sysoev <igor@sysoev.ru>
parents: 1309
diff changeset
37 / the "rep; nop" is used instead of "pause" to avoid the "[ PAUSE ]" hardware
7e02df612521 preserve Solaris binary hardware capabilities
Igor Sysoev <igor@sysoev.ru>
parents: 1309
diff changeset
38 / capability added by linker because Solaris/i386 does not know about it:
7e02df612521 preserve Solaris binary hardware capabilities
Igor Sysoev <igor@sysoev.ru>
parents: 1309
diff changeset
39 /
7e02df612521 preserve Solaris binary hardware capabilities
Igor Sysoev <igor@sysoev.ru>
parents: 1309
diff changeset
40 / ld.so.1: nginx: fatal: hardware capability unsupported: 0x2000 [ PAUSE ]
1309
08c6ee7a1b11 Sun Studio 12 compatibility
Igor Sysoev <igor@sysoev.ru>
parents: 561
diff changeset
41
6474
Ruslan Ermilov <ru@nginx.com>
parents: 4412
diff changeset
42 .inline ngx_cpu_pause,0
Ruslan Ermilov <ru@nginx.com>
parents: 4412
diff changeset
43 rep; nop
Ruslan Ermilov <ru@nginx.com>
parents: 4412
diff changeset
44 .end