* in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see [sun.com URL with a
- * copy of GPLv2].
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
{
LASSERT(link != NULL);
(void)link;
+
+ /* well, wait for something to happen */
+ call_wait_handler(0);
}
-int64_t cfs_waitq_timedwait(struct cfs_waitlink *link, cfs_task_state_t state,
+int64_t cfs_waitq_timedwait(struct cfs_waitlink *link, cfs_task_state_t state,
int64_t timeout)
{
LASSERT(link != NULL);
(void)link;
+ call_wait_handler(timeout);
return 0;
}
void cfs_schedule_timeout(cfs_task_state_t state, int64_t timeout)
{
- cfs_waitlink_t l;
+ cfs_waitlink_t l;
/* sleep(timeout) here instead? */
cfs_waitq_timedwait(&l, state, timeout);
}
-void
+void
cfs_pause(cfs_duration_t d)
{
struct timespec s;
-
+
cfs_duration_nsec(d, &s);
nanosleep(&s, NULL);
}
+int cfs_need_resched(void)
+{
+ return 0;
+}
+
+void cfs_cond_resched(void)
+{
+}
+
/*
* Timer
*/
{
CFS_INIT_LIST_HEAD(&l->tl_list);
l->function = func;
- l->data = (unsigned long)arg;
+ l->data = (ulong_ptr_t)arg;
return;
}
-#define cfs_jiffies \
-({ \
- unsigned long _ret = 0; \
- struct timeval tv; \
- if (gettimeofday(&tv, NULL) == 0) \
- _ret = tv.tv_sec; \
- _ret; \
-})
-
int cfs_timer_is_armed(cfs_timer_t *l)
{
- if (cfs_time_before(cfs_jiffies, l->expires))
+ if (cfs_time_before(cfs_time_current(), l->expires))
return 1;
else
return 0;
void cfs_timer_disarm(cfs_timer_t *l)
{
}
-
-long cfs_timer_deadline(cfs_timer_t *l)
+cfs_time_t cfs_timer_deadline(cfs_timer_t *l)
{
return l->expires;
}
*/
struct lustre_thread_arg {
- cfs_thread_t f;
+ cfs_thread_t f;
void *arg;
};
static void *cfs_thread_helper(void *data)
void *arg = targ->arg;
free(targ);
-
+
(void)f(arg);
return NULL;
}
if ( targ_p == NULL )
return -ENOMEM;
-
+
targ_p->f = func;
targ_p->arg = arg;
- pthread_attr_init(&tattr);
+ 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 getuid();
}
-int cfs_parse_int_tunable(int *value, char *name)
-{
- char *env = getenv(name);
- char *end;
-
- if (env == NULL)
- return 0;
-
- *value = strtoull(env, &end, 0);
- if (*end == 0)
- return 0;
-
- CERROR("Can't parse tunable %s=%s\n", name, env);
- return -EINVAL;
-}
-
-
void cfs_enter_debugger(void)
{
/*
{
cfs_sigset_t old;
int rc;
-
+
rc = sigprocmask(SIG_SETMASK, &blocks, &old);
LASSERT (rc == 0);
/* __linux__ */
#endif
-void lbug_with_loc(char *file, const char *func, const int line)
+void lbug_with_loc(const char *file, const char *func, const int line)
{
/* No libcfs_catastrophe in userspace! */
libcfs_debug_msg(NULL, 0, D_EMERG, file, func, line, "LBUG\n");