trv_dbg1.c

来自「mpc8xx driver(led), based on tqm8」· C语言 代码 · 共 104 行

C
104
字号
/*********************************************************************** * * (C) Copyright 2000 * Jean-Jacques Germond, Fr閐閞ic Soulier, Christian Batt; Alcatel * C/O jjg@sxb.bsf.alcatel.fr * * All rights reserved. * * This code is free software; you can redistribute it and/or * modify it under the terms of the GNU *Library* General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This code is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * *Library* General Public License for more details. * * You should have received a copy of the GNU *Library* General Public * License along with this program (see file COPYING.LIB); if not, * write to the Free Software Foundation, Inc., 675 Mass Ave, * Cambridge, MA 02139, USA. * ***********************************************************************//* The "trivial driver" debug-in-a-unix-process module file * Because of compatiblity problems of std include and kern includes * the debug code is dispatched in 2 files: the fisrt file * include stdio.h, stdlib.h,  ... and the second file includes * internal kernel definitions. */#define __NO_VERSION__ #include "stdio.h"#include "stdlib.h"extern void trv_dbg2(void);    int__generic_copy_from_user(void *to, const void *from, unsigned long n){  memcpy(to, from, n);  return 0;    /* Ok return : No error notification yet */}    int__generic_copy_to_user(void *to, const void *from, unsigned long n){  memcpy(to, from, n);  return 0;    /* Ok return : No error notification yet */}int proc_root = 0;void proc_register(void){  return;}void proc_unregister(void){  return;}  voidprintk(char* fmt, int a, int b, int c, int d)     /* I have never been a vararags guru. so ... */{  printf(fmt, a,b,c,d);}   void*kmalloc(size_t size, int unused){  return malloc(size);}   voidkfree(void* ptr){  free (ptr);}   intmain(int argc, char** argv){  printf("dbg starting\n");  trv_dbg2();    /* Go to simulate kernel activity */  printf("dbg ending successfully\n");  exit (0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?