Example #1
0
static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	struct vfile_data *p = data;

	if (p == NULL) {	/* Dump header. */
		if (priv->count == -1U) {
			xnvfile_printf(it,
				       "state=%s", *priv->owner ?
				       "locked" : "unlocked");
			if (*priv->owner)
				xnvfile_printf(it, " (%s)\n", priv->owner);
			else
				xnvfile_printf(it, "\n");
		} else
			xnvfile_printf(it, "value=%u\n", priv->count);
		if (it->nrdata > 0)
			/* Semaphore is pended -- dump waiters */
			xnvfile_printf(it, "-------------------------------------------\n");
	} else
		xnvfile_printf(it, "%.*s\n",
			       (int)sizeof(p->name), p->name);

	return 0;
}
Example #2
0
static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	RT_BUFFER *bf = xnvfile_priv(it->vfile);
	struct vfile_data *p = data;
	struct xnthread *thread;
	struct xnpqueue *waitq;

	if (priv->curr == NULL) { /* Attempt to switch queues. */
		if (!priv->input)
			/* Finished output side, we are done. */
			return 0;
		priv->input = 0;
		waitq = xnsynch_wait_queue(&bf->osynch_base);
		priv->curr = getheadpq(waitq);
		if (priv->curr == NULL)
			return 0;
	} else
		waitq = priv->input ? xnsynch_wait_queue(&bf->isynch_base) :
			xnsynch_wait_queue(&bf->osynch_base);

	/* Fetch current waiter, advance list cursor. */
	thread = link2thread(priv->curr, plink);
	priv->curr = nextpq(waitq, priv->curr);
	/* Collect thread name to be output in ->show(). */
	strncpy(p->name, xnthread_name(thread), sizeof(p->name));
	p->input = priv->input;

	return 1;
}
Example #3
0
static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	RT_EVENT *event = xnvfile_priv(it->vfile);
	struct vfile_data *p = data;
	struct xnthread *thread;
	RT_TASK *task;

	priv->value = event->value; /* Refresh as we collect. */

	if (priv->curr == NULL)
		return 0;	/* We are done. */

	/* Fetch current waiter, advance list cursor. */
	thread = link2thread(priv->curr, plink);
	priv->curr = nextpq(xnsynch_wait_queue(&event->synch_base),
			    priv->curr);

	/* Collect thread name to be output in ->show(). */
	strncpy(p->name, xnthread_name(thread), sizeof(p->name));
	task = thread2rtask(thread);
	p->mode = task->wait_args.event.mode;
	p->mask = task->wait_args.event.mask;

	return 1;
}
Example #4
0
static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	struct uiflag *flag = xnvfile_priv(it->vfile);
	struct vfile_data *p = data;
	struct xnthread *thread;
	struct uitask *task;

	priv->value = flag->flgvalue; /* Refresh as we collect. */

	if (priv->curr == NULL)
		return 0;	/* We are done. */

	/* Fetch current waiter, advance list cursor. */
	thread = link2thread(priv->curr, plink);
	priv->curr = nextpq(xnsynch_wait_queue(&flag->synchbase),
			    priv->curr);

	/* Collect thread name to be output in ->show(). */
	strncpy(p->name, xnthread_name(thread), sizeof(p->name));
	task = thread2uitask(thread);
	p->wfmode = task->wargs.flag.wfmode;
	p->waiptn = task->wargs.flag.waiptn;

	return 1;
}
Example #5
0
File: proc.c Project: ArcEye/RTAI
static void *next_dev(struct xnvfile_regular_iterator *it)
{
	struct vfile_device_data *priv = xnvfile_iterator_priv(it);
	struct list_head *next;

	next = priv->curr->next;
seek:
	if (next == priv->devmap + priv->h) {
		/* Done with the current hash slot, let's progress. */
		if (priv->h >= priv->hmax) {
			next = NULL; /* all done. */
			goto out;
		}

		priv->h++;
		next = next_devlist(priv);
		if (next) {
			next = next->next; /* skip head. */
			goto seek;
		}
	}
out:
	priv->curr = next;

	return next;
}
Example #6
0
static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	wind_sem_t *sem = xnvfile_priv(it->vfile);
	struct xnthread *owner;

	sem = wind_h2obj_active((SEM_ID)sem, WIND_SEM_MAGIC, wind_sem_t);
	if (sem == NULL)
		return -EIDRM;

	priv->curr = getheadpq(xnsynch_wait_queue(&sem->synchbase));
	priv->type = sem->vtbl->type;

	if (sem->vtbl == &semm_vtbl) {
		owner = xnsynch_owner(&sem->synchbase);
		if (owner)
			strncpy(priv->owner, xnthread_name(owner),
				sizeof(priv->owner));
		else
			*priv->owner = 0;
		priv->count = -1U;
	} else
		priv->count = sem->count;

	return xnsynch_nsleepers(&sem->synchbase);
}
Example #7
0
File: proc.c Project: ArcEye/RTAI
static void *named_begin(struct xnvfile_regular_iterator *it)
{
	struct vfile_device_data *priv = xnvfile_iterator_priv(it);
	struct list_head *devlist;
	loff_t pos = 0;

	priv->devmap = rtdm_named_devices;
	priv->hmax = devname_hashtab_size;
	priv->h = 0;

	devlist = next_devlist(priv);
	if (devlist == NULL)
		return NULL;	/* All devlists empty. */

	priv->curr = devlist->next;	/* Skip head. */

	/*
	 * priv->curr now points to the first device; advance to the requested
	 * position from there.
	 */
	while (priv->curr && pos++ < it->pos)
		priv->curr = next_dev(it);

	if (pos == 1)
		/* Output the header once, only if some device follows. */
		xnvfile_puts(it, "Hash\tName\t\t\t\tDriver\t\t/proc\n");

	return priv->curr;
}
Example #8
0
static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	struct vrtxsem *sem = xnvfile_priv(it->vfile);

	priv->curr = getheadpq(xnsynch_wait_queue(&sem->synchbase));
	priv->count = sem->count;

	return xnsynch_nsleepers(&sem->synchbase);
}
Example #9
0
static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	struct vrtxmb *mb = xnvfile_priv(it->vfile);

	priv->curr = getheadpq(xnsynch_wait_queue(&mb->synchbase));
	priv->msg = mb->msg;

	return xnsynch_nsleepers(&mb->synchbase);
}
Example #10
0
static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	struct uiflag *flag = xnvfile_priv(it->vfile);

	priv->curr = getheadpq(xnsynch_wait_queue(&flag->synchbase));
	priv->value = flag->flgvalue;

	return xnsynch_nsleepers(&flag->synchbase);
}
Example #11
0
static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
{
    struct vfile_priv *priv = xnvfile_iterator_priv(it);
    RT_COND *cond = xnvfile_priv(it->vfile);

    cond = xeno_h2obj_validate(cond, XENO_COND_MAGIC, RT_COND);
    if (cond == NULL)
        return -EIDRM;

    priv->curr = getheadpq(xnsynch_wait_queue(&cond->synch_base));

    return xnsynch_nsleepers(&cond->synch_base);
}
Example #12
0
File: proc.c Project: ArcEye/RTAI
static int named_show(struct xnvfile_regular_iterator *it, void *data)
{
	struct vfile_device_data *priv = xnvfile_iterator_priv(it);
	struct list_head *curr = data;
	struct rtdm_device *device;

	device = list_entry(curr, struct rtdm_device, reserved.entry);
	xnvfile_printf(it, "%02X\t%-31s\t%-15s\t%s\n",
		       priv->h, device->device_name,
		       device->driver_name,
		       device->proc_name);

	return 0;
}
Example #13
0
static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	struct vfile_data *p = data;

	if (p == NULL) {	/* Dump header. */
		if (it->nrdata == 0)
			xnvfile_printf(it, "=%p\n", priv->msg);
	} else
		xnvfile_printf(it, "%.*s\n",
			       (int)sizeof(p->name), p->name);

	return 0;
}
Example #14
0
static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	RT_EVENT *event = xnvfile_priv(it->vfile);

	event = xeno_h2obj_validate(event, XENO_EVENT_MAGIC, RT_EVENT);
	if (event == NULL)
		return -EIDRM;

	priv->curr = getheadpq(xnsynch_wait_queue(&event->synch_base));
	priv->value = event->value;

	return xnsynch_nsleepers(&event->synch_base);
}
Example #15
0
static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	struct vfile_data *p = data;

	if (p == NULL) {	/* Dump header. */
		xnvfile_printf(it, "value=%lu\n", priv->count);
		if (it->nrdata > 0)
			/* Semaphore is pended -- dump waiters */
			xnvfile_printf(it, "-------------------------------------------\n");
	} else
		xnvfile_printf(it, "%.*s\n",
			       (int)sizeof(p->name), p->name);

	return 0;
}
Example #16
0
static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	wind_msgq_t *q = xnvfile_priv(it->vfile);

	q = wind_h2obj_active((MSG_Q_ID)q, WIND_MSGQ_MAGIC, wind_msgq_t);
	if (q == NULL)
		return -EIDRM;

	priv->curr = getheadpq(xnsynch_wait_queue(&q->synchbase));
	priv->flags = xnsynch_test_flags(&q->synchbase, XNSYNCH_PRIO);
	priv->mlength = q->msg_length;
	priv->mcount = countq(&q->msgq);

	return xnsynch_nsleepers(&q->synchbase);
}
Example #17
0
static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	struct vrtxmx *mx = xnvfile_priv(it->vfile);
	struct xnthread *owner;

	priv->curr = getheadpq(xnsynch_wait_queue(&mx->synchbase));

	owner = xnsynch_owner(&mx->synchbase);
	if (owner)
		strncpy(priv->owner, xnthread_name(owner),
			sizeof(priv->owner));
	else
		*priv->owner = 0;

	return xnsynch_nsleepers(&mx->synchbase);
}
Example #18
0
static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	RT_HEAP *heap = xnvfile_priv(it->vfile);

	heap = xeno_h2obj_validate(heap, XENO_HEAP_MAGIC, RT_HEAP);
	if (heap == NULL)
		return -EIDRM;

	priv->curr = getheadpq(xnsynch_wait_queue(&heap->synch_base));
	priv->mode = heap->mode;
	priv->usable_mem = xnheap_usable_mem(&heap->heap_base);
	priv->used_mem = xnheap_used_mem(&heap->heap_base);
	priv->nrmaps = heap->heap_base.archdep.numaps;

	return xnsynch_nsleepers(&heap->synch_base);
}
Example #19
0
File: proc.c Project: ArcEye/RTAI
static int proto_show(struct xnvfile_regular_iterator *it, void *data)
{
	struct vfile_device_data *priv = xnvfile_iterator_priv(it);
	struct list_head *curr = data;
	struct rtdm_device *device;
	char pnum[32];

	device = list_entry(curr, struct rtdm_device, reserved.entry);

	snprintf(pnum, sizeof(pnum), "%u:%u",
		 device->protocol_family, device->socket_type);

	xnvfile_printf(it, "%02X\t%-31s\t%-15s\t%s\n",
		       priv->h,
		       pnum, device->driver_name,
		       device->proc_name);
	return 0;
}
Example #20
0
static int vfile_next(struct xnvfile_snapshot_iterator *it, void *data)
{
    struct vfile_priv *priv = xnvfile_iterator_priv(it);
    RT_COND *cond = xnvfile_priv(it->vfile);
    struct vfile_data *p = data;
    struct xnthread *thread;

    if (priv->curr == NULL)
        return 0;	/* We are done. */

    /* Fetch current waiter, advance list cursor. */
    thread = link2thread(priv->curr, plink);
    priv->curr = nextpq(xnsynch_wait_queue(&cond->synch_base),
                        priv->curr);
    /* Collect thread name to be output in ->show(). */
    strncpy(p->name, xnthread_name(thread), sizeof(p->name));

    return 1;
}
Example #21
0
static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	struct vfile_data *p = data;

	if (p == NULL) {	/* Dump header. */
		if (*priv->owner) {
			xnvfile_printf(it, "locked by %s\n", priv->owner);
			if (it->nrdata > 0)
				/* Mutex is pended -- dump waiters */
				xnvfile_printf(it, "-------------------------------------------\n");
		} else
			xnvfile_printf(it, "unlocked\n");
	} else
		xnvfile_printf(it, "%.*s\n",
			       (int)sizeof(p->name), p->name);

	return 0;
}
Example #22
0
static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	struct vfile_data *p = data;

	if (p == NULL) {	/* Dump header. */
		/* Always dump current flag value. */
		xnvfile_printf(it, "=0x%lx\n", priv->value);
		if (it->nrdata > 0)
			xnvfile_printf(it, "\n%10s  %4s  %s\n",
				       "WAITPN", "WFMODE", "WAITER");
	} else
		xnvfile_printf(it, "0x%-8x  %4s  %.*s\n",
			       p->waiptn,
			       p->wfmode & TWF_ORW ? "OR" : "AND",
			       (int)sizeof(p->name), p->name);

	return 0;
}
Example #23
0
static int vfile_rewind(struct xnvfile_snapshot_iterator *it)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	RT_BUFFER *bf = xnvfile_priv(it->vfile);

	bf = xeno_h2obj_validate(bf, XENO_BUFFER_MAGIC, RT_BUFFER);
	if (bf == NULL)
		return -EIDRM;

	/* Start collecting records from the input wait side. */
	priv->curr = getheadpq(xnsynch_wait_queue(&bf->isynch_base));
	priv->mode = bf->mode;
	priv->bufsz = bf->bufsz;
	priv->fillsz = bf->fillsz;
	priv->input = 1;

	return xnsynch_nsleepers(&bf->isynch_base) +
		xnsynch_nsleepers(&bf->osynch_base);
}
Example #24
0
static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	struct vfile_data *p = data;

	if (p == NULL) {	/* Dump header. */
		/* Always dump current event mask value. */
		xnvfile_printf(it, "=0x%lx\n", priv->value);
		if (it->nrdata > 0)
			xnvfile_printf(it, "\n%10s  %4s  %s\n",
				       "MASK", "MODE", "WAITER");
	} else
		xnvfile_printf(it, "0x%-8lx  %4s  %.*s\n",
			       p->mask,
			       p->mode & EV_ANY ? "any" : "all",
			       (int)sizeof(p->name), p->name);

	return 0;
}
Example #25
0
static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	struct vfile_data *p = data;

	if (p == NULL) {	/* Dump header. */
		xnvfile_printf(it, 
			       "porder=%s:mlength=%u:mcount=%d\n",
			       priv->flags ? "prio" : "fifo",
			       priv->mlength,
			       priv->mcount);
		if (it->nrdata > 0)
			/* Queue is pended -- dump waiters */
			xnvfile_printf(it, "-------------------------------------------\n");
	} else
		xnvfile_printf(it, "%.*s\n",
			       (int)sizeof(p->name), p->name);

	return 0;
}
Example #26
0
static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	struct vfile_data *p = data;

	if (p == NULL) {	/* Dump header. */
		xnvfile_printf(it, "%4s  %9s  %9s\n",
			       "TYPE", "TOTALMEM", "USEDMEM");
		xnvfile_printf(it, "%s  %9Zu  %9Zu\n",
			       priv->mode & B_PRIO ? "PRIO" : "FIFO",
			       priv->bufsz, priv->fillsz);
		if (it->nrdata > 0)
			/* Buffer is pended -- dump waiters */
			xnvfile_printf(it, "\n%3s  %s\n", "WAY", "WAITER");
	} else
		xnvfile_printf(it, "%3s  %.*s\n",
			       p->input ? "in" : "out",
			       (int)sizeof(p->name), p->name);

	return 0;
}
Example #27
0
static int vfile_show(struct xnvfile_snapshot_iterator *it, void *data)
{
	struct vfile_priv *priv = xnvfile_iterator_priv(it);
	struct vfile_data *p = data;

	if (p == NULL) {	/* Dump header. */
		xnvfile_printf(it, "%5s  %9s  %9s  %s\n",
			       "TYPE", "TOTALMEM", "USEDMEM", "NRMAPS");
		xnvfile_printf(it, "%5s  %9Zu  %9Zu  %d\n",
			       priv->mode & H_SHARED ? "shared" :
			       (priv->mode & H_MAPPABLE) ? "mappable" : "kernel",
			       priv->usable_mem,
			       priv->used_mem,
			       priv->nrmaps);
		if (it->nrdata > 0)
			/* Heap is pended -- dump waiters */
			xnvfile_printf(it, "\n%7s  %s\n", "REQSZ", "WAITER");
	} else
		xnvfile_printf(it, "%7Zu  %.*s\n",
			       p->size, (int)sizeof(p->name), p->name);

	return 0;
}