Programmatically update XML attributes via XmlDocument and XmlNodeList.Nodes
mpattano, 08/10/2011 | Source: .Net Blog
mpattano, 08/10/2011 | Source: .Net Blog
Fabio Pozzi, 17/07/2011 | Source: Just another personal website
Hi all,
back from oblivion for a new post.
This is mostly a note for me than something new. I found some really good guides on how to add a new syscall to the linux kernel, but they’re all outdated in a way or another, so I decided to write a post to remind me how to do it.
Prerequisites:
First: we need kernel sources.
This guide is based on the latest kernel I have installed on my archlinux box, that is linux 2.6.39.
You can wget it like this:
wget -O http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.1.tar.bz2
So now we can just expand it with the good old
tar xzf linux-2.6.39.1.tar.bz2
Ok now we can start editing files:
We can insert our syscall in an existing file or creating a new one. I decided to create a new file with my custom syscalls so this guide will take this approach.
So we start by creating our syscall file:
cd linux-2.6.39
vim kernel/omg.c
In our newly created source file we’ll insert this code (note that this is a skeleton for a working syscall):
/* adding omg syscall */
#include <linux/kernel.h>
#include <linux/linkage.h>
asmlinkage int sys_omg(){
printk(KERN_EMERG "OMGWTFBBQ!!11\n");
return 0;
}
So we need two includes: linux/kernel to use the printk and linux/linkage to use the asmlinkage tag,
used basically to tell the compiler that we want all the parameters to be passed on the stack.
Now we have to link it to the rest of the kernel
Step 1- let’s add it to the Makefile
vim kernel/Makefile
In the first lines we find a list of <filename>.o, one for each source file located inside the current folder, this is the list of the object files to be compiled.
We have to add our file to this list by adding omg.o to the end of the list, just after “jump_label.o”
Step 2- let’s add it to the syscall lists.
vim arch/x86/include/asm/unistd_32.h
Somewhere around line 352 we see the end of the syscall list.
We can add our syscall to the list like this:
#define __NR_omg 345
and then we can increment the syscall number 4 lines below to 346.
Now we have to edit
vim arch/x86/include/asm/syscalls.h
Around line 45 we can find the X86_32 only section of the file. We can insert our syscall prototype on the line below the #ifdef CONFIG_X86_32 line by adding
asmlinkage int sys_omg();
Last but not least we have to add it to the syscall_table_32.S file:
vim arch/x86/kernel/syscall_table_32.S
We move to the end of the file and we add
.long sys_omg /* 345 */
Ok. Now we can build again our kernel and we should have our new syscall waiting to be used ![]()
How to test it? Let’s build a small C program to invoke it!
#include <sys/syscall.h>
#include <unistd.h>
#include <stdio.h>
#define __NR_omg 345
int omg() {
return (int) syscall(__NR_omg);
};
main () {
printf("The return code from the omg system call is %d\n", omg());
}
Build it and launch it. After that if you launch
dmesg | tail
You should see our custom message.
P.s. This guide is almost copied from this emuboy post, with only some modifications, kudos to him
Damym through his mobile phone, 27/04/2011 | Source: damym@posterous

- Posted using MobyPicture.com
Fabio Pozzi, 19/04/2011 | Source: Just another personal website
Un altro post su Vim, devo dire che più il tempo passa più mi rendo conto di quanto sia ganzo, oltre che gratis, anzi ancora di più, fa addirittura del bene!
Ma veniamo al dunque: recentemente sono tornato ad usare il buon vecchio MacOSX e quindi mi sono deciso a provare janus, una vera e propria distribuzione Vim.
Con distribuzione, in questo caso, intendo una raccolta di script e plugin per Vim, installabili ed aggiornabili in modo semplice e veloce.
Il tutto integrato e pre-configurato e ben integrato con i keybinding di MacVim. Questo non significa che non sia usabile al 90% anche su una normale distro Linux, c’è solo da ritoccare qualcuno dei keybinding ed è perfetto (ad esempio quello assegnato al plugin Command-T.
Installarlo è semplicissimo, a patto che abbiate git, ruby e rake installati sul vostro sistema.
A quel punto vi basterà lanciare
git clone git://github.com/carlhuda/janus.git ~/.vim cd ~/.vim rake
Al resto penserà lo script.
Per aggiornarlo vi basterà ripetere gli ultimi due step: entrare nella directory .vim e lanciare
rake
I plugin più utili? Beh il già citato Command-T è fantastico, permette di trovare il file che si vuole editare in un attimo.
L’altro plugin che uso più spesso in realtà l’ho aggiunto io a mano, e lo potete trovare qui.
Permette di ricercare all’interno di un file o di una cartella, integrandosi con l’utilissimo NERD_Tree.
E’ necessario anche installare ack, se usate brew (cosa che vi consiglio), vi basterà un semplice
brew install ack
Infine basterà scaricare lo script in
~/.vim/plugin/
e il gioco è fatto. Da dentro il NERD_tree potrete posizionarvi su una qualsiasi voce, che sia una cartella o un file, premere ‘m’, poi scegliere ‘s’ ed avrete la possibilità di effettuare una ricerca.
I risultati vi verranno mostrati in un buffer dedicato, fantastico!
Damym, 19/04/2011 | Source: damym@posterous
Cosa mi è piaciuto dell’Olanda:
Cosa non mi è piaciuto:
Stranezze varie:
Damym, 17/04/2011 | Source: damym@posterous
…poi ditemi se è cambiato qualcosa
Damym, 15/04/2011 | Source: damym@posterous
BEEP!
Apro gli occhi. Attaccato allo schienale del sedile davanti al mio c’è il cartello con le dotazioni di sicurezza tipico della Ryanair.
Si è acceso il segnale delle cinture di sicurezza.
Sono su un Boeing 737 blu e giallo. Viaggio da solo. Sento il carrello d’atterraggio che scende. Vedo la pista. Touchdown.
Le trombette che annunciano l’atterraggio suonano.
Damym, 04/04/2011 | Source: damym@posterous
Ieri abbiamo scattato l’ultima foto di gruppo, fuori dall’aeroporto.
Poi sono entrato nel terminal, senza voltarmi, mentre fuori incominciava a piovere.
Quando l’aereo si è staccato da terra ero quasi contento di tornare a casa.
Più che altro avevo accettato l’idea.
La vista delle Alpi con il sole mi ha messo di buon unore.
mpattano, 25/03/2011 | Source: .Net Blog
Damym, 24/03/2011 | Source: damym@posterous
Fermata dell’autobus. Ore 14.15 circa.
Devo dire a Max tutta una serie di cose. Inizio a scrivere un SMS (ovviamente in Inglese). Dopo un po’ mi rendo conto che ci metterò anni prima di avere scritto tutto, e che magari una telefonata con Skype costerebbe meno di tutta la serie di SMS che dovrei inviare. Detto fatto, apro Skype e chiamo. Anche lui ha tutta una serie di cose da dirmi, quindi la cosa va per le lunghe.
Dopo 3,2 secondi dall’inizio della telefonata, realizzo che:
– la totalità della gente alla fermata si è zittita
– 3/4 delle persone mi fissano con sguardo stranito
– una buona metà ridacchia sommessamente
– uno continua a ripetere “ma chi si crede di essere?”