1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see [sun.com URL with a
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright 2008 Sun Microsystems, Inc. All rights reserved
30 * Use is subject to license terms.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
37 #define DEBUG_SUBSYSTEM S_LNET
38 #ifndef AUTOCONF_INCLUDED
39 #include <linux/config.h>
41 #include <linux/module.h>
42 #include <linux/kernel.h>
43 #include <libcfs/libcfs.h>
45 #if defined(CONFIG_KGDB)
49 void cfs_enter_debugger(void)
51 #if defined(CONFIG_KGDB)
53 #elif defined(__arch_um__)
60 void cfs_daemonize(char *str) {
64 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,63))
70 snprintf (current->comm, sizeof (current->comm), "%s", str);
72 SIGNAL_MASK_LOCK(current, flags);
73 sigfillset(¤t->blocked);
75 SIGNAL_MASK_UNLOCK(current, flags);
79 int cfs_daemonize_ctxt(char *str) {
80 struct task_struct *tsk = current;
81 struct fs_struct *fs = NULL;
84 fs = copy_fs_struct(tsk->fs);
94 cfs_get_blockedsigs(void)
99 SIGNAL_MASK_LOCK(current, flags);
100 old = current->blocked;
101 SIGNAL_MASK_UNLOCK(current, flags);
106 cfs_block_allsigs(void)
111 SIGNAL_MASK_LOCK(current, flags);
112 old = current->blocked;
113 sigfillset(¤t->blocked);
115 SIGNAL_MASK_UNLOCK(current, flags);
121 cfs_block_sigs(sigset_t bits)
126 SIGNAL_MASK_LOCK(current, flags);
127 old = current->blocked;
128 current->blocked = bits;
130 SIGNAL_MASK_UNLOCK(current, flags);
135 cfs_restore_sigs (cfs_sigset_t old)
139 SIGNAL_MASK_LOCK(current, flags);
140 current->blocked = old;
142 SIGNAL_MASK_UNLOCK(current, flags);
146 cfs_signal_pending(void)
148 return signal_pending(current);
152 cfs_clear_sigpending(void)
156 SIGNAL_MASK_LOCK(current, flags);
158 SIGNAL_MASK_UNLOCK(current, flags);
162 libcfs_arch_init(void)
168 libcfs_arch_cleanup(void)
173 EXPORT_SYMBOL(libcfs_arch_init);
174 EXPORT_SYMBOL(libcfs_arch_cleanup);
175 EXPORT_SYMBOL(cfs_daemonize);
176 EXPORT_SYMBOL(cfs_daemonize_ctxt);
177 EXPORT_SYMBOL(cfs_block_allsigs);
178 EXPORT_SYMBOL(cfs_block_sigs);
179 EXPORT_SYMBOL(cfs_get_blockedsigs);
180 EXPORT_SYMBOL(cfs_restore_sigs);
181 EXPORT_SYMBOL(cfs_signal_pending);
182 EXPORT_SYMBOL(cfs_clear_sigpending);