📄 linux-prim.c
字号:
/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: * * Copyright (c) 2002, 2003 Cluster File Systems, Inc. * * This file is part of Lustre, http://www.lustre.org. */#define DEBUG_SUBSYSTEM S_LNET#ifndef AUTOCONF_INCLUDED#include <linux/config.h>#endif#include <linux/module.h>#include <linux/kernel.h>#include <libcfs/libcfs.h>#if defined(CONFIG_KGDB)#include <asm/kgdb.h>#endifvoid cfs_enter_debugger(void){#if defined(CONFIG_KGDB) BREAKPOINT();#elif defined(__arch_um__) asm("int $3");#else /* nothing */#endif}void cfs_daemonize(char *str) { unsigned long flags; lock_kernel();#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,63)) daemonize(str);#else daemonize(); exit_files(current); reparent_to_init(); snprintf (current->comm, sizeof (current->comm), "%s", str);#endif SIGNAL_MASK_LOCK(current, flags); sigfillset(¤t->blocked); RECALC_SIGPENDING; SIGNAL_MASK_UNLOCK(current, flags); unlock_kernel();}int cfs_daemonize_ctxt(char *str) { struct task_struct *tsk = current; struct fs_struct *fs = NULL; cfs_daemonize(str); fs = copy_fs_struct(tsk->fs); if (fs == NULL) return -ENOMEM; exit_fs(tsk); tsk->fs = fs; return 0;}sigset_tcfs_get_blockedsigs(void){ unsigned long flags; sigset_t old; SIGNAL_MASK_LOCK(current, flags); old = current->blocked; SIGNAL_MASK_UNLOCK(current, flags); return old;}sigset_tcfs_block_allsigs(void){ unsigned long flags; sigset_t old; SIGNAL_MASK_LOCK(current, flags); old = current->blocked; sigfillset(¤t->blocked); RECALC_SIGPENDING; SIGNAL_MASK_UNLOCK(current, flags); return old;}sigset_tcfs_block_sigs(sigset_t bits){ unsigned long flags; sigset_t old; SIGNAL_MASK_LOCK(current, flags); old = current->blocked; current->blocked = bits; RECALC_SIGPENDING; SIGNAL_MASK_UNLOCK(current, flags); return old;}voidcfs_restore_sigs (cfs_sigset_t old){ unsigned long flags; SIGNAL_MASK_LOCK(current, flags); current->blocked = old; RECALC_SIGPENDING; SIGNAL_MASK_UNLOCK(current, flags);}intcfs_signal_pending(void){ return signal_pending(current);}voidcfs_clear_sigpending(void){ unsigned long flags; SIGNAL_MASK_LOCK(current, flags); CLEAR_SIGPENDING; SIGNAL_MASK_UNLOCK(current, flags);}intlibcfs_arch_init(void){ return 0;}voidlibcfs_arch_cleanup(void){ return;}EXPORT_SYMBOL(libcfs_arch_init);EXPORT_SYMBOL(libcfs_arch_cleanup);EXPORT_SYMBOL(cfs_daemonize);EXPORT_SYMBOL(cfs_daemonize_ctxt);EXPORT_SYMBOL(cfs_block_allsigs);EXPORT_SYMBOL(cfs_block_sigs);EXPORT_SYMBOL(cfs_get_blockedsigs);EXPORT_SYMBOL(cfs_restore_sigs);EXPORT_SYMBOL(cfs_signal_pending);EXPORT_SYMBOL(cfs_clear_sigpending);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -