diff options
| author | Keith M Wesolowski <wesolows@foobazco.org> | 2013-09-27 22:00:22 +0000 |
|---|---|---|
| committer | Keith M Wesolowski <wesolows@foobazco.org> | 2013-09-27 22:00:38 +0000 |
| commit | 6e9b3f5c7960aff925cedb83f71a64c153f8d89d (patch) | |
| tree | b47610110a3c95c340f735fa800927a587316828 /usr/src/uts/common/os/sig.c | |
| parent | bfe86d8aef682dd2cc1970ba302b519789fcf539 (diff) | |
| parent | 6ed0a5cff079e25f4aa15cef67c6dd48ee60b018 (diff) | |
| download | illumos-joyent-6e9b3f5c7960aff925cedb83f71a64c153f8d89d.tar.gz | |
[illumos-gate merge]
commit 6ed0a5cff079e25f4aa15cef67c6dd48ee60b018
4090 igb I210/I211 support
commit 75eba5b6d79ed4d2ce3daf7b2806306b6b69a938
4091 e1000g I217/I218 support
4092 Intel 1GBe NIC common code should be shared
commit 80c94ecd7a524eb933a4bb221a9618b9dc490e76
3881 want device driver for HP SmartArray RAID controllers
commit 5e989a96186a37eb528fb7bb4d28a150874ec799
3830 SIGQUEUE_MAX's limit of 32 is too low
commit b9476f453004695da12eaaff383ed9005e7a47c4
4158 want getifaddrs manual page
Conflicts:
usr/src/man/man5/resource_controls.5
usr/src/man/man7d/cpqary3.7d
usr/src/pkg/manifests/driver-storage-cpqary3.mf
usr/src/uts/common/io/cpqary3/cpqary3.c
usr/src/uts/common/Makefile.files
usr/src/uts/intel/cpqary3/Makefile
Manifests:
usr/src/pkg/manifests/driver-network-e1000g.mf
usr/src/pkg/manifests/driver-network-igb.mf
Diffstat (limited to 'usr/src/uts/common/os/sig.c')
| -rw-r--r-- | usr/src/uts/common/os/sig.c | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/usr/src/uts/common/os/sig.c b/usr/src/uts/common/os/sig.c index d3ce92fe24..288a6d57e8 100644 --- a/usr/src/uts/common/os/sig.c +++ b/usr/src/uts/common/os/sig.c @@ -2371,13 +2371,9 @@ sigwillqueue(int sig, int code) return (0); } -#ifndef UCHAR_MAX -#define UCHAR_MAX 255 -#endif - /* - * The entire pool (with maxcount entries) is pre-allocated at - * the first sigqueue/signotify call. + * The pre-allocated pool (with _SIGQUEUE_PREALLOC entries) is + * allocated at the first sigqueue/signotify call. */ sigqhdr_t * sigqhdralloc(size_t size, uint_t maxcount) @@ -2386,16 +2382,22 @@ sigqhdralloc(size_t size, uint_t maxcount) sigqueue_t *sq, *next; sigqhdr_t *sqh; - i = (maxcount * size) + sizeof (sigqhdr_t); - ASSERT(maxcount <= UCHAR_MAX && i <= USHRT_MAX); + /* + * Before the introduction of process.max-sigqueue-size + * _SC_SIGQUEUE_MAX had this static value. + */ +#define _SIGQUEUE_PREALLOC 32 + + i = (_SIGQUEUE_PREALLOC * size) + sizeof (sigqhdr_t); + ASSERT(maxcount <= INT_MAX); sqh = kmem_alloc(i, KM_SLEEP); - sqh->sqb_count = (uchar_t)maxcount; - sqh->sqb_maxcount = (uchar_t)maxcount; - sqh->sqb_size = (ushort_t)i; + sqh->sqb_count = maxcount; + sqh->sqb_maxcount = maxcount; + sqh->sqb_size = i; sqh->sqb_pexited = 0; sqh->sqb_sent = 0; sqh->sqb_free = sq = (sigqueue_t *)(sqh + 1); - for (i = maxcount - 1; i != 0; i--) { + for (i = _SIGQUEUE_PREALLOC - 1; i != 0; i--) { next = (sigqueue_t *)((uintptr_t)sq + size); sq->sq_next = next; sq = next; @@ -2409,8 +2411,9 @@ sigqhdralloc(size_t size, uint_t maxcount) static void sigqrel(sigqueue_t *); /* - * allocate a sigqueue/signotify structure from the per process - * pre-allocated pool. + * Allocate a sigqueue/signotify structure from the per process + * pre-allocated pool or allocate a new sigqueue/signotify structure + * if the pre-allocated pool is exhausted. */ sigqueue_t * sigqalloc(sigqhdr_t *sqh) @@ -2423,12 +2426,20 @@ sigqalloc(sigqhdr_t *sqh) mutex_enter(&sqh->sqb_lock); if (sqh->sqb_count > 0) { sqh->sqb_count--; - sq = sqh->sqb_free; - sqh->sqb_free = sq->sq_next; + if (sqh->sqb_free == NULL) { + /* + * The pre-allocated pool is exhausted. + */ + sq = kmem_alloc(sizeof (sigqueue_t), KM_SLEEP); + sq->sq_func = NULL; + } else { + sq = sqh->sqb_free; + sq->sq_func = sigqrel; + sqh->sqb_free = sq->sq_next; + } mutex_exit(&sqh->sqb_lock); bzero(&sq->sq_info, sizeof (k_siginfo_t)); sq->sq_backptr = sqh; - sq->sq_func = sigqrel; sq->sq_next = NULL; sq->sq_external = 0; } else { |
