コード例 #1
0
ファイル: io.c プロジェクト: MCherifiOSS/stblinux-2.6.37
void to_kernel(struct atmsvc_msg *msg)
{
    int wrote;

    diag("KERNEL",DIAG_DEBUG,"TO KERNEL: %s (%d) for %s/%s",
      as_name[msg->type],msg->reply,kptr_print(&msg->vcc),
      kptr_print(&msg->listen_vcc));
	/* should be "IO" ... */
    trace_kernel("TO KERNEL",msg);
    wrote = write(kernel,msg,sizeof(*msg));
    if (wrote == sizeof(*msg)) return;
    if (wrote < 0) {
	perror("kernel write");
	return;
    }
    diag(COMPONENT,DIAG_ERROR,"bad kernel write: wanted %d, wrote %d",
      sizeof(*msg),wrote);
}
コード例 #2
0
ファイル: io.c プロジェクト: MCherifiOSS/stblinux-2.6.37
static void recv_kernel(void)
{
    static unsigned char buffer[sizeof(struct atmsvc_msg)+1];
    int size;

    if (!need_connect) size = read(kernel,buffer,sizeof(buffer));
    else {
	size = un_recv_connect(kernel,buffer,sizeof(buffer));
	need_connect = 0;
    }
    if (size < 0) {
	diag(COMPONENT,DIAG_ERROR,"read kernel: %s",strerror(errno));
	return;
    }
    if (size != sizeof(struct atmsvc_msg))
	diag(COMPONENT,DIAG_FATAL,"kernel message size %d != %d",size,
	  sizeof(struct atmsvc_msg));
    trace_kernel("FROM KERNEL",(struct atmsvc_msg *) buffer);
    from_kernel((struct atmsvc_msg *) buffer,size);
}
コード例 #3
0
ファイル: trace_sysprof.c プロジェクト: snake1361222/LVS
static void timer_notify(struct pt_regs *regs, int cpu)
{
    struct trace_array_cpu *data;
    struct stack_frame_user frame;
    struct trace_array *tr;
    const void __user *fp;
    int is_user;
    int i;

    if (!regs)
        return;

    tr = sysprof_trace;
    data = tr->data[cpu];
    is_user = user_mode(regs);

    if (!current || current->pid == 0)
        return;

    if (is_user && current->state != TASK_RUNNING)
        return;

    __trace_special(tr, data, 0, 0, current->pid);

    if (!is_user)
        i = trace_kernel(regs, tr, data);
    else
        i = 0;

    /*
     * Trace user stack if we are not a kernel thread
     */
    if (current->mm && i < sample_max_depth) {
        regs = (struct pt_regs *)current->thread.sp0 - 1;

        fp = (void __user *)regs->bp;

        __trace_special(tr, data, 2, regs->ip, 0);

        while (i < sample_max_depth) {
            frame.next_fp = NULL;
            frame.return_address = 0;
            if (!copy_stack_frame(fp, &frame))
                break;
            if ((unsigned long)fp < regs->sp)
                break;

            __trace_special(tr, data, 2, frame.return_address,
                            (unsigned long)fp);
            fp = frame.next_fp;

            i++;
        }

    }

    /*
     * Special trace entry if we overflow the max depth:
     */
    if (i == sample_max_depth)
        __trace_special(tr, data, -1, -1, -1);

    __trace_special(tr, data, 3, current->pid, i);
}