Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
b=22079 Moving definition of cfs_trace_buf_type_t back to linux-tracefile.h
[fs/lustre-release.git]
/
libcfs
/
libcfs
/
user-prim.c
diff --git
a/libcfs/libcfs/user-prim.c
b/libcfs/libcfs/user-prim.c
index
07678e0
..
f5de83b
100644
(file)
--- a/
libcfs/libcfs/user-prim.c
+++ b/
libcfs/libcfs/user-prim.c
@@
-117,32
+117,45
@@
void cfs_waitq_wait(struct cfs_waitlink *link, cfs_task_state_t state)
{
LASSERT(link != NULL);
(void)link;
+
+ /* well, wait for something to happen */
+ cfs_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;
+ cfs_call_wait_handler(timeout);
return 0;
}
-void cfs_schedule_timeout(cfs_task_state_t state, int64_t timeout)
+void cfs_schedule_timeout
_and_set_state
(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
*/
@@
-156,22
+169,13
@@
void cfs_timer_init(cfs_timer_t *l, cfs_timer_func_t *func, void *arg)
{
CFS_INIT_LIST_HEAD(&l->tl_list);
l->function = func;
- l->data = (u
nsigned long
)arg;
+ l->data = (u
long_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;
@@
-185,8
+189,7
@@
void cfs_timer_arm(cfs_timer_t *l, cfs_time_t deadline)
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;
}
@@
-199,7
+202,7
@@
long cfs_timer_deadline(cfs_timer_t *l)
*/
struct lustre_thread_arg {
- cfs_thread_t f;
+ cfs_thread_t f;
void *arg;
};
static void *cfs_thread_helper(void *data)
@@
-209,7
+212,7
@@
static void *cfs_thread_helper(void *data)
void *arg = targ->arg;
free(targ);
-
+
(void)f(arg);
return NULL;
}
@@
-222,11
+225,11
@@
int cfs_create_thread(cfs_thread_t func, void *arg)
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);
@@
-239,22
+242,20
@@
uid_t cfs_curproc_uid(void)
return getuid();
}
-
int cfs_parse_int_tunable(int *value, char *name
)
+
gid_t cfs_curproc_gid(void
)
{
- char *env = getenv(name);
- char *end;
-
- if (env == NULL)
- return 0;
-
- *value = strtoull(env, &end, 0);
- if (*end == 0)
- return 0;
+ return getgid();
+}
- CERROR("Can't parse tunable %s=%s\n", name, env);
- return -EINVAL;
+uid_t cfs_curproc_fsuid(void)
+{
+ return getuid();
}
+gid_t cfs_curproc_fsgid(void)
+{
+ return getgid();
+}
void cfs_enter_debugger(void)
{
@@
-290,7
+291,7
@@
cfs_sigset_t cfs_block_sigs(cfs_sigset_t blocks)
{
cfs_sigset_t old;
int rc;
-
+
rc = sigprocmask(SIG_SETMASK, &blocks, &old);
LASSERT (rc == 0);