• Techie

    Linux Git repo

    #git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-2.6 Git repository quick howto: http://landley.net/writing/git-quick.html http://linux.yyz.us/git-howto.html

  • Techie

    Dump gcc built-in #defs

    This is very useful if you have say two different compilers compiling the same piece of code and you want to execute some special code only for one of the compilers. Do this: #> gcc -E -dD - ctrl-D This will dump all the inbuilt #defs. For example, if gcc was cross compiled for mips target, you’d have something like this somewhere in that dump: ... # 1 "<built-in>" #define __mips__ 1 # 1 "<built-in>" #define _mips 1 # 1 "<built-in>" #define mips 1 # 1 "<built-in>" #define __mips64 1 # 1 "<built-in>" ... and if your compiler was compiled with target intel, you’d see this: ... # 1 "<built-in>"…

  • Techie

    signal handlers are executed in the context of their own private stack frame

    See arch specific setup_frame() function in the kernel. For mips, it installs the signal trampoline, the user context (the registers) and the siginfo (when appropriate). The trampoline is just a syscall trap to the kernel to call sigreturn(). The address of the trampoline is set in the RA register, the arguments (signr, siginfo and the signal context) in registers 4, 5 and 6 respectively, pc points to the sighandler, reg# 29 (stack ptr) points to the allocated stack frame and off you go! On completion of the handler, the user land code returns to the address pointed to by RA register which has the trampoline. This it traps to the…

  • Techie

    malloc() does not necessarily unmap free’d pages

    Glibc’s malloc uses a combination of brk() and mmap() (where available) system calls depending upon the size of the chunk being allocated and some other factors like holes in the address space. a brk() only increases the data segment of a process in turn increasing the address space of that process. When you free() it, libc only marks this chunk as un-available but it still remains mapped. If malloc() uses mmap(), a free would so a munmap() and then later on accessing a freed memory will result in a seg-fault. There’s a comment in glibc’s mmap.c that says: Define HAVE_MMAP as true to optionally make malloc() use mmap() to allocate…

  • Vancouver Diaries

    Gene Roddenberry had a point!

    So this thought has been lingering in my mind for a while now. Gene Roddenberry had a point when he introduced the concept of universal translator in the Star Trek universe. I remember having a conversation with my supervisor at grad school about this. He told me that he thought one such device could change the world, solve a lot of the current challenges in a modern society and even prevent wars. I didn’t delve into this thought any further in those days. However, I now think that he did indeed had a good point. If you think about it, often we spend so many years of our lives trying…

  • Vancouver Diaries

    (500) Days of Summer

    “If Tom had learned anything… it was that you can’t ascribe great cosmic significance to a simple earthly event. Coincidence. That’s all anything ever is. Nothing more than coincidence. There are no miracles. There is no such thing as fate. Nothing is meant to be …” So this year, on my way towards visiting my folks in India, I watched this movie on our Lufthansa flight (twice over). Whereas I am still trying to digest the movie, one thought kept lingering in my mind as I closed my eyes and tried to sleep. This thought has prompted me to turn on my laptop while we are flying at about 35000…

  • Vancouver Diaries

    Are developer egos a problem in the open source development model in general?

    Response from Con Kolivas to APC magazine: I think any problem with anydevelopment model has multiple factors,and ultimately, it is humans that make decisions. I won't commenton the humans themselves.If there is any one big problem with kerneldevelopment and Linux it is the complete disconnection of thedevelopment process from normal users. You know, the ones whoconstitute 99.9% of the Linux user base.The Linux kernel mailing listis the way to communicate with the kernel developers. To put itmildly, the Linux kernel mailing list (lkml) is about as scary acommunication forum as they come. Most people are absolutely terrified of mailing the list lest they get flamed for their inexperience, an inappropriate…

  • Vancouver Diaries

    Why swine flu is good for you

    The world is going crazy and paranoid over this certain new strand of the fluvirus. But really, you should be happy to get one.Why? (a) Once you have it, you realize, really, really, this is JUST ANOTHER type of FLU dammit! Granted, you feel lousy for a day or two but then in a week, you are back to your old charming self. For most people.(b) Finally you get to stay away from work and devote more time to that book you've been meaning to read or the movie you've been meaning to watch or that project you've been putting off.(c) You're no longer in the dilemma whether or not…

  • Vancouver Diaries

    “Unaccustomed Earth” – Some thoughts …

    Recently, I finally finished reading Lahiri’s latest book. Oh boy, I am still immersed in it’s thoughts, thinking about the fate of some of the characters and the messages the stories tried to convey. This blog will give some of my impressions and thoughts on the book. The readers should be aware that there might be spoilers here and there. So if you haven’t read the book and do not want any inkling about the storyline, you should probably not read this blog. If you have previously read Lahiri’s earlier book, The Namesake, you would like and love this book as much. Just like Namesake, Lahiri’s writings deal with the…