• Techie

    Enable time machine backup to network drive (DNS 323)

    First, enable Time Machine to use network drives: defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1 Follow instructions here: http://www.horto.ca/?p=12 I created a “sparse bundle disk image” which I saved as chimera.sparsebundle with the following options: Volume Name: “Time Machine Backups” Filesystem: MAC OS Extended  (Case Sensitive Journaled). Encryption : None Partition : Single Partition GUID Initial Size: 1 GB. Later I resized it to my final backup disk size : 500 GB However, for Snow Leopard, following changes apply: (a) Name of the sparsebundle is <computer_name>.sparsebundle. eg. [anirbans@chimera:/Users/anirbans]$ hostname chimera so the file name should be chimera.sparsebundle (b) The sparse bundle image must contain a plist file: com.apple.TimeMachine.MachineID.plist DO NOT mount the…

  • 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…