<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5364908714708273545</id><updated>2012-01-09T02:12:59.480-08:00</updated><category term='system call'/><category term='knowledge'/><category term='idea'/><category term='tricks'/><category term='extensions'/><category term='linker'/><category term='tools'/><category term='function call'/><category term='hello'/><category term='debugging'/><category term='indent'/><category term='assembler'/><category term='algorithm'/><category term='tracing'/><category term='blog'/><category term='asm'/><category term='stack'/><category term='compilation'/><category term='linked list'/><category term='kernel'/><category term='todo'/><category term='gcc'/><category term='standards'/><category term='frame'/><category term='dmidecode'/><category term='Floyd'/><category term='preprocessor'/><category term='hardware'/><title type='text'>Interrupt Enable</title><subtitle type='html'>Life is a series of rude awakenings</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://interruptenable.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://interruptenable.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Daniel Băluță</name><uri>http://www.blogger.com/profile/09955949494641268279</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_t9BeJ81cm7k/STFzvqlD-EI/AAAAAAAABLE/WvvddCWfAlY/S220/Picture+198.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5364908714708273545.post-5039937946025493790</id><published>2011-06-30T13:36:00.000-07:00</published><updated>2011-06-30T14:10:29.382-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='todo'/><category scheme='http://www.blogger.com/atom/ns#' term='blog'/><category scheme='http://www.blogger.com/atom/ns#' term='knowledge'/><category scheme='http://www.blogger.com/atom/ns#' term='kernel'/><title type='text'>/* TODO */</title><content type='html'>This is a list of topics I plan to write some posts about:&lt;br /&gt;&lt;br /&gt;* softlockup and hung tasks. &lt;br /&gt;* kernel debugging tools: kmememleak, lockdep, kmemcheck, perf &lt;br /&gt;* how to submit patches to Linux kernel. &lt;br /&gt;* getting started with the Linux kernel. &lt;br /&gt;* anatomy of the TCP/IP Linux stack.&lt;br /&gt;* analyze TCP connection setup using tcpdump.&lt;br /&gt;* kernel/userspace communication.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5364908714708273545-5039937946025493790?l=interruptenable.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interruptenable.blogspot.com/feeds/5039937946025493790/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5364908714708273545&amp;postID=5039937946025493790' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/5039937946025493790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/5039937946025493790'/><link rel='alternate' type='text/html' href='http://interruptenable.blogspot.com/2011/06/todo.html' title='/* TODO */'/><author><name>Daniel Băluță</name><uri>http://www.blogger.com/profile/09955949494641268279</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_t9BeJ81cm7k/STFzvqlD-EI/AAAAAAAABLE/WvvddCWfAlY/S220/Picture+198.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5364908714708273545.post-1753673374552834735</id><published>2009-05-06T01:50:00.000-07:00</published><updated>2009-05-06T03:46:29.796-07:00</updated><title type='text'>Introducing pread</title><content type='html'>There are many situations when you just want to read some data from a file starting with a given offset. The usual way of doing this is:&lt;pre&gt; &lt;br /&gt;     lseek(fd, offset, SEEK_SET);&lt;br /&gt;     read(fd, buffer, LEN);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You can do this in one function call using &lt;i&gt;pread(2) &lt;/i&gt;. The above code is equivalent with:&lt;pre&gt;&lt;br /&gt;    pread(fd, buffer, LEN, offset);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;In a similar manner you can notice the existence of &lt;i&gt;pwrite(2)&lt;/i&gt; which writes some data into a file at a given position.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5364908714708273545-1753673374552834735?l=interruptenable.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interruptenable.blogspot.com/feeds/1753673374552834735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5364908714708273545&amp;postID=1753673374552834735' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/1753673374552834735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/1753673374552834735'/><link rel='alternate' type='text/html' href='http://interruptenable.blogspot.com/2009/05/introducing-pread.html' title='Introducing pread'/><author><name>Daniel Băluță</name><uri>http://www.blogger.com/profile/09955949494641268279</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_t9BeJ81cm7k/STFzvqlD-EI/AAAAAAAABLE/WvvddCWfAlY/S220/Picture+198.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5364908714708273545.post-5585453039330546160</id><published>2009-03-18T02:59:00.000-07:00</published><updated>2009-03-18T09:50:15.966-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='frame'/><category scheme='http://www.blogger.com/atom/ns#' term='function call'/><category scheme='http://www.blogger.com/atom/ns#' term='stack'/><title type='text'>call stack without words</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_t9BeJ81cm7k/ScDGXubMsbI/AAAAAAAABuA/6ySZOeEm6Xc/s1600-h/Call_stack.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 399px; height: 299px;" src="http://1.bp.blogspot.com/_t9BeJ81cm7k/ScDGXubMsbI/AAAAAAAABuA/6ySZOeEm6Xc/s400/Call_stack.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5314465671198585266" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5364908714708273545-5585453039330546160?l=interruptenable.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interruptenable.blogspot.com/feeds/5585453039330546160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5364908714708273545&amp;postID=5585453039330546160' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/5585453039330546160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/5585453039330546160'/><link rel='alternate' type='text/html' href='http://interruptenable.blogspot.com/2009/03/call-stack-without-words.html' title='call stack without words'/><author><name>Daniel Băluță</name><uri>http://www.blogger.com/profile/09955949494641268279</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_t9BeJ81cm7k/STFzvqlD-EI/AAAAAAAABLE/WvvddCWfAlY/S220/Picture+198.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_t9BeJ81cm7k/ScDGXubMsbI/AAAAAAAABuA/6ySZOeEm6Xc/s72-c/Call_stack.png' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5364908714708273545.post-3316903853720871744</id><published>2009-03-11T00:29:00.000-07:00</published><updated>2009-03-11T00:57:17.927-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><category scheme='http://www.blogger.com/atom/ns#' term='tracing'/><category scheme='http://www.blogger.com/atom/ns#' term='debugging'/><title type='text'>ltrace</title><content type='html'>&lt;span style="font-style: italic;"&gt;Usage: ltrace [option ...] [command [arg ...]]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://linux.die.net/man/1/ltrace"&gt;ltrace&lt;/a&gt; is a tool that simply runs the specified command until it exits. It intercepts and records the dynamic library calls which are called by the executed process.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;dan@lemon:~/playground$ ltrace -n 8 -C date&lt;br /&gt;__libc_start_main(0x8049780, 1, 0xbfb1e874, 0x8052c50, 0x8052c40 &lt;unfinished&gt;&lt;br /&gt;       setlocale(6, "")                                                                         = "en_US.UTF-8"&lt;br /&gt;       bindtextdomain("coreutils", "/usr/share/locale")                                         = "/usr/share/locale"&lt;br /&gt;       textdomain("coreutils")                                                                  = "coreutils"&lt;br /&gt;       __cxa_atexit(0x804cd70, 0, 0, 0xb7ee4ff4, 0xbfb1e7d8)                                    = 0&lt;br /&gt;       getopt_long(1, 0xbfb1e874, "d:f:I::r:Rs:u", 0x8053ea0, NULL)                             = -1&lt;br /&gt;       nl_langinfo(131180, 0xbfb1e874, 0x8053e85, 0x8053ea0, 0)                                 = 0xb7ef3915&lt;br /&gt;       clock_gettime(0, 0xbfb1e7b8, 0xb7dae8f5, 0xb7ee4ff4, 0)                                  = 0&lt;br /&gt;       localtime(0xbfb1e6c8)                                                                    = 0xb7ee8380&lt;br /&gt;       strftime(" Wed", 1024, " %a", 0xb7ee8380)                                                = 4&lt;br /&gt;       fwrite("Wed", 3, 1, 0xb7ee54c0)                                                          = 1&lt;br /&gt;       fputc(' ', 0xb7ee54c0)                                                                   = 32&lt;br /&gt;       strftime(" Mar", 1024, " %b", 0xb7ee8380)                                                = 4&lt;br /&gt;       fwrite("Mar", 3, 1, 0xb7ee54c0)                                                          = 1&lt;br /&gt;       fputc(' ', 0xb7ee54c0)                                                                   = 32&lt;br /&gt;       fwrite("11", 2, 1, 0xb7ee54c0)                                                           = 1&lt;br /&gt;       fputc(' ', 0xb7ee54c0)                                                                   = 32&lt;br /&gt;       fputc('0', 0xb7ee54c0)                                                                   = 48&lt;br /&gt;       fwrite("9", 1, 1, 0xb7ee54c0)                                                            = 1&lt;br /&gt;       fputc(':', 0xb7ee54c0)                                                                   = 58&lt;br /&gt;       fwrite("38", 2, 1, 0xb7ee54c0)                                                           = 1&lt;br /&gt;       fputc(':', 0xb7ee54c0)                                                                   = 58&lt;br /&gt;       fwrite("33", 2, 1, 0xb7ee54c0)                                                           = 1&lt;br /&gt;       fputc(' ', 0xb7ee54c0)                                                                   = 32&lt;br /&gt;       strlen("EET")                                                                            = 3&lt;br /&gt;       fwrite("EET", 3, 1, 0xb7ee54c0)                                                          = 1&lt;br /&gt;       fputc(' ', 0xb7ee54c0)                                                                   = 32&lt;br /&gt;       fwrite("2009", 4, 1, 0xb7ee54c0)                                                         = 1&lt;br /&gt;       __overflow(0xb7ee54c0, 10, 0x1e08f70c, 0, 0x1e08f70cWed Mar 11 09:38:33 EET 2009&lt;br /&gt;)                                    = 10&lt;br /&gt;       exit(0 &lt;unfinished&gt;&lt;br /&gt;               __fpending(0xb7ee54c0, 0xb7f20ff4, 0x8048704, 0xb7ee4ff4, 0)                     = 0&lt;br /&gt;               fclose(0xb7ee54c0)                                                               = 0&lt;br /&gt;               __fpending(0xb7ee5560, 0xb7f20ff4, 0x8048704, 0xb7ee4ff4, 0)                     = 0&lt;br /&gt;               fclose(0xb7ee5560)                                                               = 0&lt;br /&gt;+++ exited (status 0) +++&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;ltrace accepts a lot of options. You can trace also for system calls, count time , follow forks etc. A short list with options can be found below:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  -a, --align=COLUMN  align return values in a secific column.&lt;br /&gt;  -c                  count time and calls, and report a summary on exit.&lt;br /&gt;  -C, --demangle      decode low-level symbol names into user-level names.&lt;br /&gt;  -d, --debug         print debugging info.&lt;br /&gt;  -e expr             modify which events to trace.&lt;br /&gt;  -f                  follow forks.&lt;br /&gt;  -h, --help          display this help and exit.&lt;br /&gt;  -i                  print instruction pointer at time of library call.&lt;br /&gt;  -l, --library=FILE  print library calls from this library only.&lt;br /&gt;  -L                  do NOT display library calls.&lt;br /&gt;  -n, --indent=NR     indent output by NR spaces for each call level nesting.&lt;br /&gt;  -o, --output=FILE   write the trace output to that file.&lt;br /&gt;  -p PID              attach to the process with the process ID pid.&lt;br /&gt;  -r                  print relative timestamps.&lt;br /&gt;  -s STRLEN           specify the maximum string size to print.&lt;br /&gt;  -S                  display system calls.&lt;br /&gt;  -t, -tt, -ttt       print absolute timestamps.&lt;br /&gt;  -T                  show the time spent inside each call.&lt;br /&gt;  -u USERNAME         run command with the userid, groupid of username.&lt;br /&gt;  -V, --version       output version information and exit.&lt;br /&gt;  -x NAME             treat the global NAME like a library subroutine.&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5364908714708273545-3316903853720871744?l=interruptenable.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interruptenable.blogspot.com/feeds/3316903853720871744/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5364908714708273545&amp;postID=3316903853720871744' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/3316903853720871744'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/3316903853720871744'/><link rel='alternate' type='text/html' href='http://interruptenable.blogspot.com/2009/03/ltrace.html' title='ltrace'/><author><name>Daniel Băluță</name><uri>http://www.blogger.com/profile/09955949494641268279</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_t9BeJ81cm7k/STFzvqlD-EI/AAAAAAAABLE/WvvddCWfAlY/S220/Picture+198.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5364908714708273545.post-2887966474671563985</id><published>2009-03-03T04:10:00.000-08:00</published><updated>2009-03-03T04:29:21.736-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><category scheme='http://www.blogger.com/atom/ns#' term='dmidecode'/><title type='text'>dmidecode</title><content type='html'>&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;dmidecode&lt;/span&gt;&lt;/span&gt; is a tool for dumping a computer's &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;DMI&lt;/span&gt; table contents in a human readable format. This table contains information regarding system's hardware components as described in BIOS.&lt;br /&gt;&lt;br /&gt;More information you can find &lt;a href="http://www.nongnu.org/dmidecode/"&gt;here&lt;/a&gt; or in &lt;a href="http://linux.die.net/man/8/dmidecode"&gt;dmidecode(8)&lt;/a&gt; manpage.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5364908714708273545-2887966474671563985?l=interruptenable.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interruptenable.blogspot.com/feeds/2887966474671563985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5364908714708273545&amp;postID=2887966474671563985' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/2887966474671563985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/2887966474671563985'/><link rel='alternate' type='text/html' href='http://interruptenable.blogspot.com/2009/03/dmidecode.html' title='dmidecode'/><author><name>Daniel Băluță</name><uri>http://www.blogger.com/profile/09955949494641268279</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_t9BeJ81cm7k/STFzvqlD-EI/AAAAAAAABLE/WvvddCWfAlY/S220/Picture+198.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5364908714708273545.post-1066164623389512904</id><published>2009-02-22T02:40:00.001-08:00</published><updated>2009-02-22T02:55:32.949-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='assembler'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc'/><category scheme='http://www.blogger.com/atom/ns#' term='preprocessor'/><category scheme='http://www.blogger.com/atom/ns#' term='compilation'/><category scheme='http://www.blogger.com/atom/ns#' term='linker'/><title type='text'>Compilation without words</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_t9BeJ81cm7k/SaEubOGPS7I/AAAAAAAABp0/VHTye5DAN4E/s1600-h/compilation.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 102px;" src="http://3.bp.blogspot.com/_t9BeJ81cm7k/SaEubOGPS7I/AAAAAAAABp0/VHTye5DAN4E/s400/compilation.png" alt="" id="BLOGGER_PHOTO_ID_5305572881194765234" border="0" /&gt;&lt;/a&gt;Click on the image to have a better view.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5364908714708273545-1066164623389512904?l=interruptenable.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interruptenable.blogspot.com/feeds/1066164623389512904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5364908714708273545&amp;postID=1066164623389512904' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/1066164623389512904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/1066164623389512904'/><link rel='alternate' type='text/html' href='http://interruptenable.blogspot.com/2009/02/compilation-without-words.html' title='Compilation without words'/><author><name>Daniel Băluță</name><uri>http://www.blogger.com/profile/09955949494641268279</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_t9BeJ81cm7k/STFzvqlD-EI/AAAAAAAABLE/WvvddCWfAlY/S220/Picture+198.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_t9BeJ81cm7k/SaEubOGPS7I/AAAAAAAABp0/VHTye5DAN4E/s72-c/compilation.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5364908714708273545.post-4365066337099014297</id><published>2009-02-13T23:09:00.000-08:00</published><updated>2009-02-13T23:55:58.326-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><category scheme='http://www.blogger.com/atom/ns#' term='indent'/><category scheme='http://www.blogger.com/atom/ns#' term='kernel'/><title type='text'>Lindent</title><content type='html'>&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;Lindent&lt;/span&gt; is a script  that changes the appearance of a C program according to linux kernel coding style. It can be found in &lt;span style="font-style: italic;"&gt;linux/scripts&lt;/span&gt;/ and it makes use of &lt;span style="font-style: italic;"&gt;indent&lt;/span&gt;.(see indent(1) manual page).&lt;br /&gt;&lt;br /&gt;For a debian based distribution running Lindent is straightforward:&lt;br /&gt;&lt;br /&gt;#install indent&lt;br /&gt;apt-get install indent&lt;br /&gt;#run Lindent over a file&lt;br /&gt;linux/scripts/Lindent file.c&lt;br /&gt;&lt;br /&gt;The&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;preferred coding style used in linux kernel  is described in &lt;span style="font-style: italic;"&gt;linux/Documentation/CodingStyle&lt;/span&gt;.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5364908714708273545-4365066337099014297?l=interruptenable.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interruptenable.blogspot.com/feeds/4365066337099014297/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5364908714708273545&amp;postID=4365066337099014297' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/4365066337099014297'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/4365066337099014297'/><link rel='alternate' type='text/html' href='http://interruptenable.blogspot.com/2009/02/lindent.html' title='Lindent'/><author><name>Daniel Băluță</name><uri>http://www.blogger.com/profile/09955949494641268279</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_t9BeJ81cm7k/STFzvqlD-EI/AAAAAAAABLE/WvvddCWfAlY/S220/Picture+198.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5364908714708273545.post-1144834463399509210</id><published>2008-12-08T04:59:00.000-08:00</published><updated>2009-01-04T06:42:11.808-08:00</updated><title type='text'>Top 10 interview questions of 2008</title><content type='html'>Hi all,&lt;p&gt;&lt;br /&gt;     Feel free to add a comment with interesting technical questions that you received in interviews during this year.&lt;br /&gt;&lt;br /&gt;     At the end of the week i will collect the best ten of them and publish here.Also i would like you to share the company that interviewed you but this is not really necessary.&lt;/p&gt;&lt;span style="font-style: italic;"&gt;Due to small number of comments received the top is canceled this year.&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5364908714708273545-1144834463399509210?l=interruptenable.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interruptenable.blogspot.com/feeds/1144834463399509210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5364908714708273545&amp;postID=1144834463399509210' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/1144834463399509210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/1144834463399509210'/><link rel='alternate' type='text/html' href='http://interruptenable.blogspot.com/2008/12/top-10-interview-question-of-2008.html' title='Top 10 interview questions of 2008'/><author><name>Daniel Băluță</name><uri>http://www.blogger.com/profile/09955949494641268279</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_t9BeJ81cm7k/STFzvqlD-EI/AAAAAAAABLE/WvvddCWfAlY/S220/Picture+198.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5364908714708273545.post-29171723906357503</id><published>2008-12-03T08:58:00.000-08:00</published><updated>2008-12-03T12:19:06.114-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linked list'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='Floyd'/><title type='text'>Cycle detection in linked lists</title><content type='html'>&lt;i&gt;Find if a linked list has a cycle given a pointer to it's first element.&lt;/i&gt;&lt;br&gt;&lt;br /&gt;There are several ways of solving this problem.&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;iterate over the list and insert elements into a hash table. We have a cycle if we insert the same element twice. This solution requires &lt;b&gt;0(n)&lt;/b&gt; time and &lt;b&gt;0(n)&lt;/b&gt; memory.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;adapt the list to this particular situation. Insert a field that marks the node as visited or not. This solution has the drawback of modifying the list which is not always possible.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Floyd algorithm which will be presented below its an efficient and easy to understand algorithm and requires &lt;b&gt; O(n) &lt;/b&gt; time and &lt;b&gt; O(1) &lt;/b&gt; additional memory. &lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;Also known as the &lt;span style="font-style:italic;"&gt;tortoise and hare&lt;/span&gt; algorithm it uses two pointers &lt;span style="font-style:italic;"&gt;a&lt;/span&gt; and &lt;span style="font-style:italic;"&gt;b&lt;/span&gt; , where &lt;span style="font-style:italic;"&gt;a&lt;/span&gt; moves two times faster than &lt;span style="font-style:italic;"&gt;b&lt;/span&gt;.&lt;br /&gt;The pseudocode for the algorithm is as follows:&lt;br /&gt;&lt;pre&gt; &lt;br /&gt;      a &lt;- list_head&lt;br /&gt;      b &lt;- list_head&lt;br /&gt;      do&lt;br /&gt;           a &lt;- a.next.next&lt;br /&gt;           b &lt;- b.next&lt;br /&gt;      while a &lt;&gt; b &lt;br /&gt;//if there is a cycle then a will be equal at some point with b. &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;An immediate application of Floyd's algorithm is retrieving the element in the middle of a list without computing it's length.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5364908714708273545-29171723906357503?l=interruptenable.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interruptenable.blogspot.com/feeds/29171723906357503/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5364908714708273545&amp;postID=29171723906357503' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/29171723906357503'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/29171723906357503'/><link rel='alternate' type='text/html' href='http://interruptenable.blogspot.com/2008/12/cycle-detection-in-linked-lists.html' title='Cycle detection in linked lists'/><author><name>Daniel Băluță</name><uri>http://www.blogger.com/profile/09955949494641268279</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_t9BeJ81cm7k/STFzvqlD-EI/AAAAAAAABLE/WvvddCWfAlY/S220/Picture+198.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5364908714708273545.post-6448265413923344352</id><published>2008-12-01T06:21:00.000-08:00</published><updated>2008-12-01T10:17:33.826-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='extensions'/><category scheme='http://www.blogger.com/atom/ns#' term='gcc'/><category scheme='http://www.blogger.com/atom/ns#' term='standards'/><title type='text'>GCC hacks in the Linux kernel</title><content type='html'>Discover GCC extensions for the C language &lt;a href="http://www.ibm.com/developerworks/linux/library/l-gcc-hacks/index.html?ca=dgr-lnxw09GCCKernel&amp;S_Tact=105AGX59&amp;S_CMP=GRsitelnxw09"&gt; here&lt;/a&gt;.&lt;br /&gt;This article talks about &lt;span style="font-style:italic;"&gt;functionality extensions &lt;/span&gt; that bring new functionality from GCC and about &lt;span style="font-style:italic;"&gt;optimization extensions&lt;/span&gt; that are used for generating more efficient code.&lt;br /&gt;&lt;br /&gt;One thing that it's easy to remember is using ranges with case statements.&lt;br&gt; So instead of:&lt;br /&gt;&lt;pre&gt;  switch(level){&lt;br /&gt;         case 1:&lt;br /&gt;         case 2:&lt;br /&gt;         case 3: /* do something */&lt;br /&gt;         ......&lt;br /&gt;         default: /* */&lt;br /&gt;        }&lt;br /&gt;&lt;/pre&gt;you can use:&lt;br /&gt;&lt;pre&gt;  switch(level){&lt;br /&gt;         case 1..3: /* do something */&lt;br /&gt;         break;&lt;br /&gt;       }&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5364908714708273545-6448265413923344352?l=interruptenable.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interruptenable.blogspot.com/feeds/6448265413923344352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5364908714708273545&amp;postID=6448265413923344352' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/6448265413923344352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/6448265413923344352'/><link rel='alternate' type='text/html' href='http://interruptenable.blogspot.com/2008/12/gcc-hacks-in-linux-kernel.html' title='GCC hacks in the Linux kernel'/><author><name>Daniel Băluță</name><uri>http://www.blogger.com/profile/09955949494641268279</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_t9BeJ81cm7k/STFzvqlD-EI/AAAAAAAABLE/WvvddCWfAlY/S220/Picture+198.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5364908714708273545.post-6479974304428607743</id><published>2008-11-30T02:42:00.000-08:00</published><updated>2008-12-01T06:21:53.080-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='idea'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithm'/><title type='text'>isTwoPower</title><content type='html'>Very simple and elegant function to test if a number is a power of two.&lt;pre&gt;&lt;br /&gt;int isTwoPower(int n){&lt;br /&gt;     if( n &lt; 1 )&lt;br /&gt;         return 0;&lt;br /&gt;     return !(n &amp; (n-1));&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5364908714708273545-6479974304428607743?l=interruptenable.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interruptenable.blogspot.com/feeds/6479974304428607743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5364908714708273545&amp;postID=6479974304428607743' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/6479974304428607743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/6479974304428607743'/><link rel='alternate' type='text/html' href='http://interruptenable.blogspot.com/2008/11/istwopower.html' title='isTwoPower'/><author><name>Daniel Băluță</name><uri>http://www.blogger.com/profile/09955949494641268279</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_t9BeJ81cm7k/STFzvqlD-EI/AAAAAAAABLE/WvvddCWfAlY/S220/Picture+198.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5364908714708273545.post-2375251380106594038</id><published>2008-11-29T06:37:00.000-08:00</published><updated>2008-11-29T08:33:33.187-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='system call'/><category scheme='http://www.blogger.com/atom/ns#' term='hello'/><category scheme='http://www.blogger.com/atom/ns#' term='asm'/><title type='text'>Hello World!</title><content type='html'>&lt;code&gt;&lt;pre&gt;.data&lt;br /&gt;hello:&lt;br /&gt;   .ascii "Hello World!\n"&lt;br /&gt;   len = . - hello&lt;br /&gt;.text&lt;br /&gt;   .global _start&lt;br /&gt;_start:&lt;br /&gt;   movl $4,     %eax&lt;br /&gt;   movl $1,     %ebx&lt;br /&gt;   movl $hello, %ecx&lt;br /&gt;   movl $len,   %edx&lt;br /&gt;   int $0x80&lt;br /&gt;&lt;br /&gt;   movl $1, %eax&lt;br /&gt;   movl $0, %ebx&lt;br /&gt;   int $0x80 &lt;/pre&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5364908714708273545-2375251380106594038?l=interruptenable.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://interruptenable.blogspot.com/feeds/2375251380106594038/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5364908714708273545&amp;postID=2375251380106594038' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/2375251380106594038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5364908714708273545/posts/default/2375251380106594038'/><link rel='alternate' type='text/html' href='http://interruptenable.blogspot.com/2008/11/hello-world.html' title='Hello World!'/><author><name>Daniel Băluță</name><uri>http://www.blogger.com/profile/09955949494641268279</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/_t9BeJ81cm7k/STFzvqlD-EI/AAAAAAAABLE/WvvddCWfAlY/S220/Picture+198.jpg'/></author><thr:total>0</thr:total></entry></feed>
