Chinaunix首页 | 论坛 | 博客

分类: LINUX

2012-02-16 11:32:38

今天早上编译了一个键盘程序,下载到开发板运行时却出现了:
[root@FriendlyARM plg]# ./buttons_test                                         
open device buttons: Device or resource busy 

原因:
因为我在之前测试过一个键盘程序,退出进程时是按ctrl+z(其实是挂起进程),并没有完全将进程退出,所以进程依然占据着/dev/buttons/。ctrl+c可以结束进程。

解决办法:
1、ps查看当前正在运行的进程
[root@FriendlyARM plg]# ps                                                     
  PID USER       VSZ STAT COMMAND                                              
    1 root      3068 S    init                                                 
    2 root         0 SW   [kthreadd]                                           
    3 root         0 SW   [ksoftirqd/0]                                        
    4 root         0 SW   [events/0]                                           
    5 root         0 SW   [khelper]                                            
   11 root         0 SW   [async/mgr]                                          
  209 root         0 SW   [sync_supers]                                        
  211 root         0 SW   [bdi-default]                                        
  213 root         0 SW   [kblockd/0]                                          
  222 root         0 SW   [khubd]                                              
  228 root         0 SW   [kmmcd]                                              
  244 root         0 SW   [rpciod/0]                                           
  251 root         0 SW   [kswapd0]                                            
  298 root         0 SW   [aio/0]                                              
  302 root         0 SW   [nfsiod]                                             
  306 root         0 SW   [crypto/0]                                           
  416 root         0 SW   [mtdblockd]                                          
  628 root         0 SW   [usbhid_resumer]                                     
  672 root      3068 S    syslogd                                              
  675 root      3388 S    /usr/sbin/inetd                                      
  679 root      1940 S    /usr/sbin/boa                                        
  682 root      1416 S    /usr/bin/led-player                                  
  691 root     18568 S    /opt/Qtopia/bin/qpe                                  
  692 root      3392 S    -/bin/sh                                             
  693 root      3068 S    init                                                 
  694 root      3068 S    init                                                 
  696 root      3068 S    init                                                 
  709 root      8892 S <  /opt/Qtopia/bin/qss                                  
  710 root     12432 S N  /opt/Qtopia/bin/quicklauncher                        
  739 root      1412 T    ./buttons_test                                       
  740 root         0 SW   [flush-31:0]                                         
  751 root      3392 R    ps   
//找到./buttons_test的进程号为739。
2、用kill命令终止进程:
[root@FriendlyARM plg]# kill -9 739                                          
[1] + Killed                     ./buttons_test   
//其中-9表示强迫进程立即停止,739是上面./buttons_test的进程号

阅读(8055) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~