sigqueue.c revision f841f6ad96ea6675d6c6b35c749eaac601799fdf
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sysmacros.h>
static int
{
proc_t *p;
int error;
return (EINVAL);
if (pid == -1) {
} else if (pid > 0) {
else {
}
} else {
int nfound = 0;
if (pid == 0)
else
error = 0;
nfound++;
}
}
if (nfound == 0)
}
return (error);
}
/*
* for implementations that don't require binary compatibility,
* the kill system call may be made into a library call to the
* sigsend system call
*/
int
{
int error;
sigsend_t v;
bzero(&v, sizeof (v));
v.checkperm = 1;
return (0);
}
/*
* The handling of small unions, like the sigval argument to sigqueue,
* is architecture dependent. We have adopted the convention that the
* value itself is passed in the storage which crosses the kernel
* protection boundary. This procedure will accept a scalar argument,
* and store it in the appropriate value member of the sigsend_t structure.
*/
int
{
int error;
sigsend_t v;
/* The si_code value must indicate the signal will be queued */
/* Allocate sigqueue pool first time */
mutex_enter(&p->p_lock);
/* hang the pool head on proc */
} else {
/* another lwp allocated the pool, free ours */
}
mutex_exit(&p->p_lock);
}
do {
bzero(&v, sizeof (v));
v.checkperm = 1;
break;
/* block waiting for another chance to allocate a sigqueue_t */
break;
}
}
if (error)
return (0);
}
#ifdef _SYSCALL32_IMPL
/*
* sigqueue32 - System call entry point for 32-bit callers on LP64 kernel,
* needed to handle the 32-bit sigvals as correctly as we can. We always
* assume that a 32-bit caller is passing an int. A 64-bit recipient
* that expects an int will therefore get it correctly. A 32-bit
* recipient will also get it correctly since siginfo_kto32() uses
* sival_int in the conversion. Since a 32-bit pointer has the same
* size and address in the sigval, it also converts correctly so that
* two 32-bit apps can exchange a pointer value. However, this means
* that a pointer sent by a 32-bit caller will be seen in the upper half
* by a 64-bit recipient, and only the upper half of a 64-bit pointer will
* be seen by a 32-bit recipient. This is the best solution that does
* not require severe hacking of the sigval union. Anyways, what it
* means to be sending pointers between processes with dissimilar
* models is unclear.
*/
int
{
}
#endif