screenshot from a documentation tool which is readthedocs.org

CLICK ON THE IMAGE TO ENLARGE

Screenshot from 2015-07-14 22:24:13
Linux Kernel Developer Work Spaces: Stephane Graber

verify for a running udevd daemon using ps and grep

$ps -ef | grep udev
root      4696     1  0 23:40 ?        00:00:00 /lib/systemd/systemd-udevd
$

Hacking with ANSI C signal Handling

$sudo strace -e trace=signal -p 1 
[sudo] password for jeffrin: 
Process 1 attached
kill(4659, SIGTERM)                     = 0
kill(4659, SIGCONT)                     = 0

$gcc crtlc1-p1.c 
$./a.out 
Hello world 
Hello world 
Hello world 
Hello world 
Hello world 
Hello world 
Hello world 
Hello world 
Hello world 
^Ci got a signal 2
Hello world 
Hello world 
^C
$cat crtlc1-p1.c 
#include 
#include 
#include 

void ouch(int sig)
{

  printf("i got a signal %d\n",sig);
  (void) signal(SIGINT, SIG_DFL);
}

int main()
{

  (void) signal(SIGINT,ouch);

  while(1)
    {
      printf("Hello world \n");
      sleep(1);
    }
}
$

Collecting information from sysfs about cpu events

$sudo cat /sys/devices/cpu/events/cache-misses 
event=0x81
$sudo cat /sys/devices/cpu/type 
4
$sudo cat /sys/devices/cpu/events/branch-instructions 
event=0xc2
$sudo cat /sys/devices/cpu/events/branch-instructions 
event=0xc2
$sudo cat /sys/devices/cpu/events/branch-instructions 
event=0xc2
$sudo cat /sys/devices/cpu/events/branch-instructions 
event=0xc2
$sudo cat /sys/devices/cpu/events/branch-misses 
event=0xc3
$sudo cat /sys/devices/cpu/events/branch-misses 
event=0xc3
$sudo cat /sys/devices/cpu/events/cache-references 
event=0x80
$sudo cat /sys/devices/cpu/events/cpu-cycles 
event=0x76
$sudo cat /sys/devices/cpu/events/instructions 
event=0xc0
$

Example related — Recovering typical deleted file in GNU/Linux

$which glxgears
/usr/bin/glxgears
$rm /usr/bin/glxgears 
rm: remove write-protected regular file ‘/usr/bin/glxgears’? y
rm: cannot remove ‘/usr/bin/glxgears’: Permission denied
$sudo rm /usr/bin/glxgears 
[sudo] password for jeffrin: 
$ps aux | grep glxgears
jeffrin   2469  4.4  0.6 157656 20888 pts/0    Sl+  22:43   0:07 glxgears
jeffrin   2515  0.0  0.0  12656  1560 pts/1    S+   22:46   0:00 grep glxgears
$sudo cat /proc/246
2466/ 2467/ 2469/ 
$sudo cat /proc/2469/exe > /usr/bin/glxgears
bash: /usr/bin/glxgears: Permission denied
$sudo cat /proc/2469/exe > /usr/bin/glxgears
bash: /usr/bin/glxgears: Permission denied
$su
Password: 
root>cat /proc/2469/exe > /usr/bin/glxgears
root>exit
$/usr/bin/glx
glxdemo   glxheads  glxinfo   
$ls -l /usr/bin/glxgears 
-rw-r--r-- 1 root root 23088 May 13 22:47 /usr/bin/glxgears
$ls -l /usr/bin/gl
glib-compile-resources  glib-genmarshal         glib-mkenums            glxdemo                 glxheads
glib-compile-schemas    glib-gettextize         glilypond               glxgears                glxinfo
$ls -l /usr/bin/glxdemo 
-rwxr-xr-x 1 root root 10376 Jul  8  2014 /usr/bin/glxdemo
$ls -l /usr/bin/glxgears 
-rw-r--r-- 1 root root 23088 May 13 22:47 /usr/bin/glxgears
$sudo chmod +x /usr/bin/glxgears 
$ls -l /usr/bin/glxgears 
-rwxr-xr-x 1 root root 23088 May 13 22:47 /usr/bin/glxgears
$/usr/bin/glxgears 
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
379 frames in 5.0 seconds = 75.789 FPS
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
      after 1627 requests (1627 known processed) with 0 events remaining.
$




Copyright © 2009,  2010,  2011,  2012,  2013, 2014, 2015     BeautifulWork Project    e-mail:  ahiliation@yahoo.co.in
BeautifulWork Project comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.