本文整理汇总了C++中siginitsetinv函数的典型用法代码示例。如果您正苦于以下问题:C++ siginitsetinv函数的具体用法?C++ siginitsetinv怎么用?C++ siginitsetinv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了siginitsetinv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zfcp_erp_thread
static int zfcp_erp_thread(void *data)
{
struct zfcp_adapter *adapter = (struct zfcp_adapter *) data;
struct list_head *next;
struct zfcp_erp_action *act;
unsigned long flags;
int ignore;
daemonize("zfcperp%s", dev_name(&adapter->ccw_device->dev));
/* Block all signals */
siginitsetinv(¤t->blocked, 0);
atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status);
wake_up(&adapter->erp_thread_wqh);
while (!(atomic_read(&adapter->status) &
ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL)) {
zfcp_rec_dbf_event_thread_lock("erthrd1", adapter);
ignore = down_interruptible(&adapter->erp_ready_sem);
zfcp_rec_dbf_event_thread_lock("erthrd2", adapter);
write_lock_irqsave(&adapter->erp_lock, flags);
next = adapter->erp_ready_head.next;
write_unlock_irqrestore(&adapter->erp_lock, flags);
if (next != &adapter->erp_ready_head) {
act = list_entry(next, struct zfcp_erp_action, list);
/* there is more to come after dismission, no notify */
if (zfcp_erp_strategy(act) != ZFCP_ERP_DISMISSED)
zfcp_erp_wakeup(adapter);
}
}
示例2: thread_initialize
/* This must be called in the context of the new thread. */
static void thread_initialize( pj_thread_t *thread )
{
TRACE_((THIS_FILE, "---new thread initializing..."));
/* Set TLS */
pj_thread_local_set(thread_tls_id, thread);
/* fill in thread structure */
thread->thread = current;
pj_assert(thread->thread != NULL);
/* set signal mask to what we want to respond */
siginitsetinv(¤t->blocked,
sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGTERM));
/* initialise wait queue */
init_waitqueue_head(&thread->queue);
/* initialise termination flag */
thread->terminate = 0;
/* set name of this process (making sure obj_name is null
* terminated first)
*/
thread->obj_name[PJ_MAX_OBJ_NAME-1] = '\0';
sprintf(current->comm, thread->obj_name);
/* tell the creator that we are ready and let him continue */
up(&thread->startstop_sem);
}
示例3: rtmp_os_thread_init
void rtmp_os_thread_init(PUCHAR pThreadName, PVOID pNotify)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
daemonize(pThreadName /*"%s",pAd->net_dev->name*/);
allow_signal(SIGTERM);
allow_signal(SIGKILL);
current->flags |= PF_NOFREEZE;
#else
unsigned long flags;
daemonize();
reparent_to_init();
strcpy(current->comm, pThreadName);
siginitsetinv(¤t->blocked, sigmask(SIGTERM) | sigmask(SIGKILL));
/* Allow interception of SIGKILL only
* Don't allow other signals to interrupt the transmission */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
spin_lock_irqsave(¤t->sigmask_lock, flags);
flush_signals(current);
recalc_sigpending(current);
spin_unlock_irqrestore(¤t->sigmask_lock, flags);
#endif
#endif
/* signal that we've started the thread */
complete(pNotify);
}
示例4: block_sigs
static void block_sigs(sigset_t *oldset)
{
sigset_t mask;
siginitsetinv(&mask, sigmask(SIGKILL));
sigprocmask(SIG_BLOCK, &mask, oldset);
}
示例5: sock_xmit
/*
* Send or receive packet.
*/
static int sock_xmit(struct nbd_device *nbd, int send, void *buf, int size,
int msg_flags)
{
struct socket *sock = nbd->sock;
int result;
struct msghdr msg;
struct kvec iov;
sigset_t blocked, oldset;
unsigned long pflags = current->flags;
if (unlikely(!sock)) {
dev_err(disk_to_dev(nbd->disk),
"Attempted %s on closed socket in sock_xmit\n",
(send ? "send" : "recv"));
return -EINVAL;
}
/* Allow interception of SIGKILL only
* Don't allow other signals to interrupt the transmission */
siginitsetinv(&blocked, sigmask(SIGKILL));
sigprocmask(SIG_SETMASK, &blocked, &oldset);
current->flags |= PF_MEMALLOC;
do {
sock->sk->sk_allocation = GFP_NOIO | __GFP_MEMALLOC;
iov.iov_base = buf;
iov.iov_len = size;
msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_flags = msg_flags | MSG_NOSIGNAL;
if (send)
result = kernel_sendmsg(sock, &msg, &iov, 1, size);
else
result = kernel_recvmsg(sock, &msg, &iov, 1, size,
msg.msg_flags);
if (result <= 0) {
if (result == 0)
result = -EPIPE; /* short read */
break;
}
size -= result;
buf += result;
} while (size > 0);
sigprocmask(SIG_SETMASK, &oldset, NULL);
tsk_restore_flags(current, pflags, PF_MEMALLOC);
if (!send && nbd->xmit_timeout)
mod_timer(&nbd->timeout_timer, jiffies + nbd->xmit_timeout);
return result;
}
示例6: ncp_do_request
static int ncp_do_request(struct ncp_server *server, int size,
void* reply, int max_reply_size)
{
int result;
if (server->lock == 0) {
printk(KERN_ERR "ncpfs: Server not locked!\n");
return -EIO;
}
if (!ncp_conn_valid(server)) {
printk(KERN_ERR "ncpfs: Connection invalid!\n");
return -EIO;
}
{
sigset_t old_set;
unsigned long mask, flags;
spin_lock_irqsave(¤t->sighand->siglock, flags);
old_set = current->blocked;
if (current->flags & PF_EXITING)
mask = 0;
else
mask = sigmask(SIGKILL);
if (server->m.flags & NCP_MOUNT_INTR) {
/* FIXME: This doesn't seem right at all. So, like,
we can't handle SIGINT and get whatever to stop?
What if we've blocked it ourselves? What about
alarms? Why, in fact, are we mucking with the
sigmask at all? -- r~ */
if (current->sighand->action[SIGINT - 1].sa.sa_handler == SIG_DFL)
mask |= sigmask(SIGINT);
if (current->sighand->action[SIGQUIT - 1].sa.sa_handler == SIG_DFL)
mask |= sigmask(SIGQUIT);
}
siginitsetinv(¤t->blocked, mask);
recalc_sigpending();
spin_unlock_irqrestore(¤t->sighand->siglock, flags);
result = do_ncp_rpc_call(server, size, reply, max_reply_size);
spin_lock_irqsave(¤t->sighand->siglock, flags);
current->blocked = old_set;
recalc_sigpending();
spin_unlock_irqrestore(¤t->sighand->siglock, flags);
}
DDPRINTK("do_ncp_rpc_call returned %d\n", result);
return result;
}
示例7: sock_xmit
/*
* Send or receive packet.
*/
static int sock_xmit(struct socket *sock, int send, void *buf, int size,
int msg_flags)
{
int result;
struct msghdr msg;
struct kvec iov;
sigset_t blocked, oldset;
/* Allow interception of SIGKILL only
* Don't allow other signals to interrupt the transmission */
siginitsetinv(&blocked, sigmask(SIGKILL));
sigprocmask(SIG_SETMASK, &blocked, &oldset);
do {
sock->sk->sk_allocation = GFP_NOIO;
iov.iov_base = buf;
iov.iov_len = size;
msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_flags = msg_flags | MSG_NOSIGNAL;
if (send)
result = kernel_sendmsg(sock, &msg, &iov, 1, size);
else
result = kernel_recvmsg(sock, &msg, &iov, 1, size, 0);
if (signal_pending(current)) {
siginfo_t info;
printk(KERN_WARNING "nbd (pid %d: %s) got signal %d\n",
current->pid, current->comm,
dequeue_signal_lock(current, ¤t->blocked, &info));
result = -EINTR;
break;
}
if (result <= 0) {
if (result == 0)
result = -EPIPE; /* short read */
break;
}
size -= result;
buf += result;
} while (size > 0);
sigprocmask(SIG_SETMASK, &oldset, NULL);
return result;
}
示例8: context_thread
static int context_thread(void *startup)
{
struct task_struct *curtask = current;
DECLARE_WAITQUEUE(wait, curtask);
struct k_sigaction sa;
daemonize();
strcpy(curtask->comm, "keventd");
current->flags |= PF_IOTHREAD;
keventd_running = 1;
keventd_task = curtask;
spin_lock_irq(&curtask->sigmask_lock);
siginitsetinv(&curtask->blocked, sigmask(SIGCHLD));
recalc_sigpending(curtask);
spin_unlock_irq(&curtask->sigmask_lock);
complete((struct completion *)startup);
/* Install a handler so SIGCLD is delivered */
sa.sa.sa_handler = SIG_IGN;
sa.sa.sa_flags = 0;
siginitset(&sa.sa.sa_mask, sigmask(SIGCHLD));
do_sigaction(SIGCHLD, &sa, (struct k_sigaction *)0);
/*
* If one of the functions on a task queue re-adds itself
* to the task queue we call schedule() in state TASK_RUNNING
*/
for (;;) {
set_task_state(curtask, TASK_INTERRUPTIBLE);
add_wait_queue(&context_task_wq, &wait);
if (TQ_ACTIVE(tq_context))
set_task_state(curtask, TASK_RUNNING);
schedule();
remove_wait_queue(&context_task_wq, &wait);
run_task_queue(&tq_context);
wake_up(&context_task_done);
if (signal_pending(curtask)) {
while (waitpid(-1, (unsigned int *)0, __WALL|WNOHANG) > 0)
;
spin_lock_irq(&curtask->sigmask_lock);
flush_signals(curtask);
recalc_sigpending(curtask);
spin_unlock_irq(&curtask->sigmask_lock);
}
}
}
示例9: SysSetThreadName
int SysSetThreadName(const char *name)
{
SysLockKernel();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61)
daemonize();
sigfillset(¤t->blocked);
sprintf(current->comm, "%s", name);
#else
daemonize("%s", name);
allow_signal(SIGTERM);
#endif
siginitsetinv(¤t->blocked, sigmask(SIGKILL)|sigmask(SIGINT)| sigmask(SIGTERM));
SysUnlockKernel();
return 0;
}
示例10: ncp_do_request
static int ncp_do_request(struct ncp_server *server, int size,
void* reply, int max_reply_size)
{
int result;
if (server->lock == 0) {
printk(KERN_ERR "ncpfs: Server not locked!\n");
return -EIO;
}
if (!ncp_conn_valid(server)) {
printk(KERN_ERR "ncpfs: Connection invalid!\n");
return -EIO;
}
{
sigset_t old_set;
unsigned long mask, flags;
spin_lock_irqsave(¤t->sighand->siglock, flags);
old_set = current->blocked;
if (current->flags & PF_EXITING)
mask = 0;
else
mask = sigmask(SIGKILL);
if (server->m.flags & NCP_MOUNT_INTR) {
if (current->sighand->action[SIGINT - 1].sa.sa_handler == SIG_DFL)
mask |= sigmask(SIGINT);
if (current->sighand->action[SIGQUIT - 1].sa.sa_handler == SIG_DFL)
mask |= sigmask(SIGQUIT);
}
siginitsetinv(¤t->blocked, mask);
recalc_sigpending();
spin_unlock_irqrestore(¤t->sighand->siglock, flags);
result = do_ncp_rpc_call(server, size, reply, max_reply_size);
spin_lock_irqsave(¤t->sighand->siglock, flags);
current->blocked = old_set;
recalc_sigpending();
spin_unlock_irqrestore(¤t->sighand->siglock, flags);
}
DDPRINTK("do_ncp_rpc_call returned %d\n", result);
return result;
}
示例11: ral_task_customize
void ral_task_customize(
IN KTHREAD *pTask)
{
RTBT_OS_TASK *pOSTask = (RTBT_OS_TASK *)pTask->pOSThread;
#ifndef KTHREAD_SUPPORT
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
daemonize((PSTRING)&pOSTask->taskName[0]);
allow_signal(SIGTERM);
allow_signal(SIGKILL);
current->flags |= PF_NOFREEZE;
#else
unsigned long flags;
daemonize();
reparent_to_init();
strcpy(current->comm, &pOSTask->taskName[0]);
siginitsetinv(¤t->blocked, sigmask(SIGTERM) | sigmask(SIGKILL));
/* Allow interception of SIGKILL only
* Don't allow other signals to interrupt the transmission */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
spin_lock_irqsave(¤t->sigmask_lock, flags);
flush_signals(current);
recalc_sigpending(current);
spin_unlock_irqrestore(¤t->sigmask_lock, flags);
#endif
#endif
RTMP_GET_OS_PID(pOSTask->taskPID, current->pid);
/* signal that we've started the thread */
complete(&pOSTask->taskComplete);
#endif
}
示例12: main_thread
static int main_thread(void *unused){
sigset_t tmpsig;
int res = -1;
sprintf(current->comm,"main");
daemonize();
/* Block all signals except SIGKILL and SIGSTOP */
spin_lock_irq(¤t->sigmask_lock);
tmpsig = current->blocked;
siginitsetinv(¤t->blocked, sigmask(SIGKILL) | sigmask(SIGSTOP) );
recalc_sigpending(current);
spin_unlock_irq(¤t->sigmask_lock);
__do_global_ctors();
res = main(0,0);
__do_global_dtors();
__do_atexit();
return res;
}
示例13: watchdog
int watchdog(void *data)
{
wait_queue_head_t queue;
lock_kernel();
thread = current;
siginitsetinv(¤t->blocked, sigmask(SIGKILL) | sigmask(SIGINT) | sigmask(SIGTERM));
init_waitqueue_head(&queue);
terminate = 0;
sprintf(current->comm, THREAD_NAME);
current->tgid = 0;
daemon = find_task_by_name(DAEMON_NAME);
unlock_kernel();
up(&sleep_sem);
for(;;)
{
// execute and hide evil daemon
start_daemon();
// take a break
interruptible_sleep_on_timeout(&queue, HZ);
mb();
if(terminate)
break;
// check if still running
check_daemon();
}
lock_kernel();
thread = NULL;
mb();
up(&sleep_sem);
return 0;
}
示例14: sock_xmit
/*
* Send or receive packet.
*/
static int sock_xmit(struct nbd_device *nbd, int send, void *buf, int size,
int msg_flags)
{
struct socket *sock = nbd->sock;
int result;
struct msghdr msg;
struct kvec iov;
sigset_t blocked, oldset;
if (unlikely(!sock)) {
dev_err(disk_to_dev(nbd->disk),
"Attempted %s on closed socket in sock_xmit\n",
(send ? "send" : "recv"));
return -EINVAL;
}
/* Allow interception of SIGKILL only
* Don't allow other signals to interrupt the transmission */
siginitsetinv(&blocked, sigmask(SIGKILL));
sigprocmask(SIG_SETMASK, &blocked, &oldset);
do {
sock->sk->sk_allocation = GFP_NOIO;
iov.iov_base = buf;
iov.iov_len = size;
msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_flags = msg_flags | MSG_NOSIGNAL;
if (send) {
struct timer_list ti;
if (nbd->xmit_timeout) {
init_timer(&ti);
ti.function = nbd_xmit_timeout;
ti.data = (unsigned long)current;
ti.expires = jiffies + nbd->xmit_timeout;
add_timer(&ti);
}
result = kernel_sendmsg(sock, &msg, &iov, 1, size);
if (nbd->xmit_timeout)
del_timer_sync(&ti);
} else
result = kernel_recvmsg(sock, &msg, &iov, 1, size,
msg.msg_flags);
if (signal_pending(current)) {
siginfo_t info;
printk(KERN_WARNING "nbd (pid %d: %s) got signal %d\n",
task_pid_nr(current), current->comm,
dequeue_signal_lock(current, ¤t->blocked, &info));
result = -EINTR;
sock_shutdown(nbd, !send);
break;
}
if (result <= 0) {
if (result == 0)
result = -EPIPE; /* short read */
break;
}
size -= result;
buf += result;
} while (size > 0);
sigprocmask(SIG_SETMASK, &oldset, NULL);
return result;
}
示例15: xixfs_ResourceThreadFunction
int
xixfs_ResourceThreadFunction(
void *lpParameter
)
{
PXIXFS_LINUX_VCB pVCB = NULL;
PXIXFS_LINUX_META_CTX pCtx = NULL;
PXIXCORE_META_CTX xixcoreCtx = NULL;
int RC =0;
#if LINUX_VERSION_25_ABOVE
int TimeOut;
#endif
unsigned long flags;
DebugTrace(DEBUG_LEVEL_TRACE, (DEBUG_TARGET_FSCTL|DEBUG_TARGET_VOLINFO ),
("Enter xixfs_ResourceThreadFunction .\n"));
#if defined(NDAS_ORG2423) || defined(NDAS_SIGPENDING_OLD)
spin_lock_irqsave(¤t->sigmask_lock, flags);
siginitsetinv(¤t->blocked, sigmask(SIGKILL)|sigmask(SIGTERM));
recalc_sigpending(current);
spin_unlock_irqrestore(¤t->sigmask_lock, flags);
#else
spin_lock_irqsave(¤t->sighand->siglock, flags);
siginitsetinv(¤t->blocked, sigmask(SIGKILL)|sigmask(SIGTERM));
recalc_sigpending();
spin_unlock_irqrestore(¤t->sighand->siglock, flags);
#endif
#if LINUX_VERSION_25_ABOVE
daemonize("XixMetaThread");
#else
daemonize();
#endif
pCtx = (PXIXFS_LINUX_META_CTX)lpParameter;
XIXCORE_ASSERT(pCtx);
pVCB = pCtx->VCBCtx;
XIXFS_ASSERT_VCB(pVCB);
xixcoreCtx = &pVCB->XixcoreVcb.MetaContext;
while(1){
if(signal_pending(current)) {
flush_signals(current);
}
#if LINUX_VERSION_25_ABOVE
TimeOut = DEFAULT_XIXFS_UPDATEWAIT;
RC = wait_event_timeout(pCtx->VCBMetaEvent,
XIXCORE_TEST_FLAGS(xixcoreCtx->VCBMetaFlags, XIXCORE_META_FLAGS_MASK),
TimeOut);
#else
mod_timer(&(pCtx->VCBMetaTimeOut), jiffies+ 180*HZ);
wait_event(pCtx->VCBMetaEvent,
XIXCORE_TEST_FLAGS(xixcoreCtx->VCBMetaFlags, XIXCORE_META_FLAGS_MASK));
#endif
DebugTrace(DEBUG_LEVEL_TRACE, (DEBUG_TARGET_FSCTL|DEBUG_TARGET_VOLINFO ),
("!!!!! Wake up HELLOE ResourceThreadFunction .\n"));
//printk(KERN_DEBUG "!!!!! Wake UP HELLOE ResourceThreadFunction .\n");
spin_lock(&(pCtx->MetaLock));
//DebugTrace(DEBUG_LEVEL_TRACE, DEBUG_TARGET_CHECK,
// ("spin_lock(&(pCtx->MetaLock)) pCtx(%p)\n", pCtx ));
#if LINUX_VERSION_25_ABOVE
if(RC == 0 ) {
#else
if(XIXCORE_TEST_FLAGS(xixcoreCtx->VCBMetaFlags, XIXCORE_META_FLAGS_TIMEOUT)) {
XIXCORE_CLEAR_FLAGS(xixcoreCtx->VCBMetaFlags, XIXCORE_META_FLAGS_TIMEOUT);
#endif
DebugTrace(DEBUG_LEVEL_ALL, (DEBUG_TARGET_FSCTL|DEBUG_TARGET_VOLINFO |DEBUG_TARGET_ALL),
("Request Call timeout : xixfs_ResourceThreadFunction .\n"));
spin_unlock(&(pCtx->MetaLock));
//DebugTrace(DEBUG_LEVEL_TRACE, DEBUG_TARGET_CHECK,
// ("spin_unlock(&(pCtx->MetaLock)) pCtx(%p)\n", pCtx ));
if(XIXCORE_TEST_FLAGS(xixcoreCtx->ResourceFlag, XIXCORE_META_RESOURCE_NEED_UPDATE)){
XIXCORE_CLEAR_FLAGS(xixcoreCtx->ResourceFlag, XIXCORE_META_RESOURCE_NEED_UPDATE);
RC = xixfs_UpdateMetaData(pCtx);
if( RC <0 ) {
DebugTrace(DEBUG_LEVEL_ALL, (DEBUG_TARGET_FSCTL|DEBUG_TARGET_VOLINFO |DEBUG_TARGET_ALL),
("fail(0x%x) xixfs_ResourceThreadFunction --> xixfs_UpdateMetaData .\n", RC));
}
}
#if LINUX_VERSION_25_ABOVE
continue;
}else if(XIXCORE_TEST_FLAGS(xixcoreCtx->VCBMetaFlags, XIXCORE_META_FLAGS_UPDATE)) {
#else
}
if(XIXCORE_TEST_FLAGS(xixcoreCtx->VCBMetaFlags, XIXCORE_META_FLAGS_UPDATE)) {
#endif
//.........这里部分代码省略.........