* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- cfs_waitlink_t l;
- /* sleep(timeout) here instead? */
- cfs_waitq_timedwait(&l, state, timeout);
+ wait_queue_t l;
+ /* sleep(timeout) here instead? */
+ waitq_timedwait(&l, state, timeout);
-int cfs_create_thread(cfs_thread_t func, void *arg, unsigned long flags)
+void *kthread_run(cfs_thread_t func, void *arg, const char namefmt[], ...)
- pthread_attr_init(&tattr);
- pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED);
- rc = pthread_create(&tid, &tattr, cfs_thread_helper, targ_p);
- pthread_attr_destroy(&tattr);
- return -rc;
+ pthread_attr_init(&tattr);
+ pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED);
+ rc = pthread_create(&tid, &tattr, cfs_thread_helper, targ_p);
+ pthread_attr_destroy(&tattr);
+ return ERR_PTR(rc);
+/* Read the environment variable of current process specified by @key. */
+int cfs_get_environ(const char *key, char *value, int *val_len)
+{
+ char *entry;
+ int len;
+
+ entry = getenv(key);
+ if (entry == NULL)
+ return -ENOENT;
+
+ len = strlcpy(value, entry, *val_len);
+ if (len >= *val_len)
+ return -EOVERFLOW;
+
+ return 0;
+}
+
}
/* Block all signals except for the @sigs. It's only used in
* Linux kernel, just a dummy here. */
}
/* Block all signals except for the @sigs. It's only used in
* Linux kernel, just a dummy here. */
- /* Return old blocked sigs */
- rc = sigprocmask(SIG_SETMASK, NULL, &old);
- LASSERT(rc == 0);
+ /* Return old blocked sigs */
+ rc = sigprocmask(SIG_SETMASK, NULL, &old);
+ LASSERT(rc == 0);
- libcfs_debug_msg(NULL, 0, D_EMERG, file, func, line, "LBUG\n");
+ libcfs_debug_msg(msgdata, "LBUG\n");