本文整理汇总了C++中siginitsetinv函数的典型用法代码示例。如果您正苦于以下问题:C++ siginitsetinv函数的具体用法?C++ siginitsetinv怎么用?C++ siginitsetinv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了siginitsetinv函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:ClarkChen633,项目名称:rtl819x-toolchain,代码行数:33,代码来源:zfcp_erp.c
示例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);
}
开发者ID:Jopie64,项目名称:pjsip,代码行数:31,代码来源:os_core_linux_kernel.c
示例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);
}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:32,代码来源:rt_linux.c
示例4: block_sigs
static void block_sigs(sigset_t *oldset)
{
sigset_t mask;
siginitsetinv(&mask, sigmask(SIGKILL));
sigprocmask(SIG_BLOCK, &mask, oldset);
}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:7,代码来源:dev.c
示例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;
}
开发者ID:125radheyshyam,项目名称:linux-1,代码行数:59,代码来源:nbd.c
示例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;
}
开发者ID:274914765,项目名称:C,代码行数:50,代码来源:sock.c
示例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;
}
开发者ID:dsdbook,项目名称:dsd_orsoc,代码行数:53,代码来源:nbd.c
示例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);
}
}
}
开发者ID:FoXPeeD,项目名称:OS-bwis,代码行数:48,代码来源:context.c
示例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;
}
开发者ID:inzaghi123456789,项目名称:avermedia-a828,代码行数:16,代码来源:osdep_th2.c
示例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;
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:45,代码来源:sock.c
示例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
}
开发者ID:Valantin,项目名称:rtbth,代码行数:38,代码来源:rtbth_hlpr_linux.c
示例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;
}
开发者ID:nosnilwar,项目名称:rtai-raw-gov-3.9.1,代码行数:23,代码来源:crt.c
示例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;
}
开发者ID:smakonin,项目名称:DataExfil,代码行数:37,代码来源:pcspkr.c
示例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;
}
开发者ID:ZolaIII,项目名称:android_kernel_synopsis_deprecated,代码行数:74,代码来源:nbd.c
示例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
//.........这里部分代码省略.........
开发者ID:cpady,项目名称:ndas4linux,代码行数:101,代码来源:xixfs_bitmap.c
示例16: autofs4_wait
//.........这里部分代码省略.........
if (sbi->version < 5) {
if (notify == NFY_MOUNT)
type = autofs_ptype_missing;
else
type = autofs_ptype_expire_multi;
} else {
if (notify == NFY_MOUNT)
type = autofs_type_trigger(sbi->type) ?
autofs_ptype_missing_direct :
autofs_ptype_missing_indirect;
else
type = autofs_type_trigger(sbi->type) ?
autofs_ptype_expire_direct :
autofs_ptype_expire_indirect;
}
DPRINTK("new wait id = 0x%08lx, name = %.*s, nfy=%d\n",
(unsigned long) wq->wait_queue_token, wq->name.len,
wq->name.name, notify);
/* autofs4_notify_daemon() may block */
autofs4_notify_daemon(sbi, wq, type);
} else {
wq->wait_ctr++;
mutex_unlock(&sbi->wq_mutex);
kfree(qstr.name);
DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d",
(unsigned long) wq->wait_queue_token, wq->name.len,
wq->name.name, notify);
}
/*
* wq->name.name is NULL iff the lock is already released
* or the mount has been made catatonic.
*/
if (wq->name.name) {
/* Block all but "shutdown" signals while waiting */
sigset_t oldset;
unsigned long irqflags;
spin_lock_irqsave(¤t->sighand->siglock, irqflags);
oldset = current->blocked;
siginitsetinv(¤t->blocked, SHUTDOWN_SIGS & ~oldset.sig[0]);
recalc_sigpending();
spin_unlock_irqrestore(¤t->sighand->siglock, irqflags);
wait_event_interruptible(wq->queue, wq->name.name == NULL);
spin_lock_irqsave(¤t->sighand->siglock, irqflags);
current->blocked = oldset;
recalc_sigpending();
spin_unlock_irqrestore(¤t->sighand->siglock, irqflags);
} else {
DPRINTK("skipped sleeping");
}
status = wq->status;
/*
* For direct and offset mounts we need to track the requester's
* uid and gid in the dentry info struct. This is so it can be
* supplied, on request, by the misc device ioctl interface.
* This is needed during daemon resatart when reconnecting
* to existing, active, autofs mounts. The uid and gid (and
* related string values) may be used for macro substitution
* in autofs mount maps.
*/
if (!status) {
struct autofs_info *ino;
struct dentry *de = NULL;
/* direct mount or browsable map */
ino = autofs4_dentry_ino(dentry);
if (!ino) {
/* If not lookup actual dentry used */
de = d_lookup(dentry->d_parent, &dentry->d_name);
if (de)
ino = autofs4_dentry_ino(de);
}
/* Set mount requester */
if (ino) {
spin_lock(&sbi->fs_lock);
ino->uid = wq->uid;
ino->gid = wq->gid;
spin_unlock(&sbi->fs_lock);
}
if (de)
dput(de);
}
/* Are we the last process to need status? */
mutex_lock(&sbi->wq_mutex);
if (!--wq->wait_ctr)
kfree(wq);
mutex_unlock(&sbi->wq_mutex);
return status;
}
开发者ID:CallMeVentus,项目名称:i9070_kernel_CoCore-P,代码行数:101,代码来源:waitq.c
示例17: dpram_thread
static int dpram_thread(void *data)
{
int ret = 0;
//unsigned long flags;
struct file *filp;
dpram_task = current;
daemonize("dpram_thread");
//reparent_to_init(); // for 2.6 kernel porting : this seems not to be used in driver
// current->tty = NULL; // for 2.6 kernel porting
strcpy(current->comm, "multipdp");
/* set signals to accept */
//spin_lock_irqsave(¤t->sigmask_lock, flags); // for 2.6 kernel proting
siginitsetinv(¤t->blocked, sigmask(SIGUSR1));
//recalc_sigpending(current);
recalc_sigpending();
//spin_unlock_irqrestore(¤t->sigmask_lock, flags); // for 2.6 kernel proting
filp = dpram_open();
if (filp == NULL) {
goto out;
}
dpram_filp = filp;
/* send start signal */
complete(&dpram_complete);
while (1) {
ret = dpram_poll(filp);
if (ret == -ERESTARTSYS) {
if (sigismember(¤t->pending.signal, SIGUSR1)) {
sigdelset(¤t->pending.signal, SIGUSR1);
recalc_sigpending();
ret = 0;
break;
}
}
else if (ret < 0) {
EPRINTK("dpram_poll() failed\n");
break;
}
else {
char ch;
dpram_read(dpram_filp, &ch, sizeof(ch));
if (ch == 0x7f) {
pdp_demux();
}
}
try_to_freeze();
}
dpram_close(filp);
dpram_filp = NULL;
out:
dpram_task = NULL;
/* send finish signal and exit */
complete_and_exit(&dpram_complete, ret);
}
开发者ID:AustinBleax,项目名称:Bali_SK4G,代码行数:68,代码来源:multipdp.c
示例18: cachemiss_thread
static int cachemiss_thread (void *data)
{
tux_req_t *req;
struct k_sigaction *ka;
DECLARE_WAITQUEUE(wait, current);
iothread_t *iot = data;
int nr = iot->ti->cpu, wake_up;
Dprintk("iot %p/%p got started.\n", iot, current);
drop_permissions();
spin_lock(&iot->async_lock);
iot->threads++;
sprintf(current->comm, "async IO %d/%d", nr, iot->threads);
spin_lock_irq(¤t->sighand->siglock);
ka = current->sighand->action + SIGCHLD-1;
ka->sa.sa_handler = SIG_IGN;
siginitsetinv(¤t->blocked, sigmask(SIGCHLD));
recalc_sigpending();
spin_unlock_irq(¤t->sighand->siglock);
spin_unlock(&iot->async_lock);
#ifdef CONFIG_SMP
{
cpumask_t mask;
if (cpu_isset(nr, cpu_online_map)) {
cpus_clear(mask);
cpu_set(nr, mask);
set_cpus_allowed(current, mask);
}
}
#endif
add_wait_queue_exclusive(&iot->async_sleep, &wait);
for (;;) {
while (!list_empty(&iot->async_queue) &&
(req = get_cachemiss(iot))) {
if (!req->atom_idx) {
add_tux_atom(req, flush_request);
add_req_to_workqueue(req);
continue;
}
tux_schedule_atom(req, 1);
if (signal_pending(current))
flush_all_signals();
}
if (signal_pending(current))
flush_all_signals();
if (!list_empty(&iot->async_queue))
continue;
if (iot->shutdown) {
Dprintk("iot %p/%p got shutdown!\n", iot, current);
break;
}
__set_current_state(TASK_INTERRUPTIBLE);
if (list_empty(&iot->async_queue)) {
Dprintk("iot %p/%p going to sleep.\n", iot, current);
schedule();
Dprintk("iot %p/%p got woken up.\n", iot, current);
}
__set_current_state(TASK_RUNNING);
}
remove_wait_queue(&iot->async_sleep, &wait);
wake_up = 0;
spin_lock(&iot->async_lock);
if (!--iot->threads)
wake_up = 1;
spin_unlock(&iot->async_lock);
Dprintk("iot %p/%p has finished shutdown!\n", iot, current);
if (wake_up) {
Dprintk("iot %p/%p waking up master.\n", iot, current);
wake_up(&iot->wait_shutdown);
}
return 0;
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:84,代码来源:cachemiss.c
示例19: dpram_thread
static int dpram_thread(void *data)
{
int ret = 0;
int i;
struct file *filp;
struct sched_param schedpar;
dpram_task = current;
daemonize("dpram_thread");
strcpy(current->comm, "multipdp");
schedpar.sched_priority = 1;
sched_setscheduler(current, SCHED_FIFO, &schedpar);
/* set signals to accept */
siginitsetinv(¤t->blocked, sigmask(SIGUSR1));
recalc_sigpending();
for (i = 0; i < 10; i++) {
filp = dpram_open();
if (filp == NULL) {
EPRINTK("dpram_open failed! retry\n");
msleep(1000);
} else
break;
}
if (filp == NULL) {
EPRINTK("dpram_open failed!\n");
goto out;
}
dpram_filp = filp;
/* send start signal */
complete(&dpram_complete);
while (1) {
ret = dpram_poll(filp);
if (ret == -ERESTARTSYS) {
if (sigismember(¤t->pending.signal, SIGUSR1)) {
sigdelset(¤t->pending.signal, SIGUSR1);
recalc_sigpending();
ret = 0;
break;
}
}
else if (ret < 0) {
EPRINTK("dpram_poll() failed\n");
break;
}
else {
char ch;
ret = dpram_read(dpram_filp, &ch, sizeof(ch));
if(ret < 0) {
return ret;
}
if (ch == 0x7f) {
pdp_demux();
}
}
}
dpram_close(filp);
dpram_filp = NULL;
out:
dpram_task = NULL;
/* send finish signal and exit */
complete_and_exit(&dpram_complete, ret);
}
开发者ID:ARMP,项目名称:samsung_kernel_cooper,代码行数:77,代码来源:multipdp.c
示例20: ncp_do_request
static int ncp_do_request(struct ncp_server *server, int size,
void* reply, int max_reply_size)
{
struct file *file;
struct socket *sock;
int result;
if (server->lock == 0) {
printk(KERN_ERR "ncpfs: Server not locked!\n");
return -EIO;
}
if (!ncp_conn_valid(server)) {
return -EIO;
}
#ifdef CONFIG_NCPFS_PACKET_SIGNING
if (server->sign_active)
{
sign_packet(server, &size);
}
#endif /* CONFIG_NCPFS_PACKET_SIGNING */
file = server->ncp_filp;
sock = &file->f_dentry->d_inode->u.socket_i;
/* N.B. this isn't needed ... check socket type? */
if (!sock) {
printk(KERN_ERR "ncp_rpc_call: socki_lookup failed\n");
result = -EBADF;
} else {
mm_segment_t fs;
sigset_t old_set;
unsigned long mask, flags;
spin_lock_irqsave(¤t->sigmask_lock, 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->sig->action[SIGINT - 1].sa.sa_handler == SIG_DFL)
mask |= sigmask(SIGINT);
if (current->sig->action[SIGQUIT - 1].sa.sa_handler == SIG_DFL)
mask |= sigmask(SIGQUIT);
}
siginitsetinv(¤t->blocked, mask);
recalc_sigpending(current);
spin_unlock_irqrestore(¤t->sigmask_lock, flags);
fs = get_fs();
set_fs(get_ds());
if (sock->type == SOCK_STREAM)
result = do_ncp_tcp_rpc_call(server, size, reply, max_reply_size);
else
result = do_ncp_rpc_call(server, size, reply, max_reply_size);
set_fs(fs);
spin_lock_irqsave(¤t->sigmask_lock, flags);
current->blocked = old_set;
recalc_sigpending(current);
spin_unlock_irqrestore(¤t->sigmask_lock, flags);
}
DDPRINTK("do_ncp_rpc_call returned %d\n", result);
if (result < 0) {
/* There was a problem with I/O, so the connections is
* no longer usable. */
ncp_invalidate_conn(server);
}
return result;
}
开发者ID:JBTech,项目名称:ralink_rt5350,代码行数:77,代码来源:sock.c
注:本文中的siginitsetinv函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论