Tuesday, March 31, 2009
Linux Process: execve()
Ini adalah system call untuk membuat proses di UNIX. Di Linux, ketika sebuah proses keluar maka proses tersebut akan mengirimkan signal SIGCHLD ke parent, ini yang dipakai oleh varian system call wait() mem-blocking sampai signal ini diterima (reaping).
RTAI on TCT

Stuck lagi, RTOS diminta oleh client kami (katanya dalam spec). So, patch RTAI, compile kernel. Distro yang digunakan mungkin Debian Lenny dengan direcfb-gtk. TCT harus punya GUI untuk interaksi. Shit!
Realtime Application Interface
Sunday, March 29, 2009
Gnome's Empathy

Have you try Empathy? an instant messaging for GNOME's desktop, it support multi-protocol messaging network (Jabber, Google Talk, YM, AIM, etc). I noticed it's speed and one protocol i considered to be missing is a IRC protocol. I prefer to use Pidgin since it has IRC support. I use Pidgin's IRC protocol to chat in #gtk+, #gnome in GNOME's IRC server. Have it a try...
Empathy
Pidgin
Socket Programming: Dynamic sized data
I have been posted on linux-c-programming@vger.kernel.org regarding receiving dynamic size data using TCP/IP socket, and now resolved:
struct foo {
char *name;
unsigned int id;
};
int ret, len;
struct foo *bar = malloc (sizeof(struct foo));
/* fill bar */
len = strlen (name);
send (s, &len, sizeof(len), 0);
send (s, bar->name, len, 0);
send (s, &bar->id, sizeof(bar->id), 0);
And for the receiver:
recv (s, &len, sizeof(len), 0);
/* allocate bar->name for len bytes */
recv (s, bar->name, len, 0);
Notice there are no error checking and network byte ordering here.
struct foo {
char *name;
unsigned int id;
};
int ret, len;
struct foo *bar = malloc (sizeof(struct foo));
/* fill bar */
len = strlen (name);
send (s, &len, sizeof(len), 0);
send (s, bar->name, len, 0);
send (s, &bar->id, sizeof(bar->id), 0);
And for the receiver:
recv (s, &len, sizeof(len), 0);
/* allocate bar->name for len bytes */
recv (s, bar->name, len, 0);
Notice there are no error checking and network byte ordering here.
pfSense: Load balance + squid
Di kamar, dua koneksi: ADSL dan WAN ingin disatukan. Load balance dengan pfSense, karena squid tidak bekerja untuk load balance di pfSense, kemudian buat box Linux. Router (pfSense) yang saya konfigurasi untuk tidak melayani semua koneksi LAN kecuali box Linux dengan squid (10.0.0.1/8)
10.0.0.1/8 --> ALL PROTO --> DMZ share
192.168.100.1/24 --> TCP --> WAN (ADSL)
172.16.10.1/16 --> TCP --> OPT1 (WAN)
Sekarang hanya squid yang bisa mengakses (gateway) langsung router, hanya untuk mengingat-ingat lagi waktu di ISP dulu ;).
pfSense
Squid
Saturday, March 28, 2009
Squid Cache: Filtering

Kernel & Firewall:
#echo 1 > /proc/sys/net/ipv4/ip_forward
#/sbin/iptables -t nat -A POSTROUTING -s [network]/[subnet] -o [interface] -j MASQUERADE
#/sbin/iptables -t nat -A PREROUTING -p tcp -s [network]/[subnet] --dport [http_port] -j REDIRECT --to-ports [squid_port]
squid.conf:
http_port [squid_port] transparent
acl allowed_client src "/path/to/allowed_client"
acl blocked_url url_regex "/path/to/blocked_url"
acl blocked_file url_regex -i "/path/to/blocked_file"
http_access deny !allowed_client
http_access deny blocked_url
http_access deny blocked_file
http_access allow allowed_client
Squid's log rotate with crontab:
0 0 1 * * /path/to/squid -k rotate
this will rotate squid's log for 1 month interval.
Reconfigure Squid
#/patch/to/squid -k reconfigure
Happy caching...
Squid
Friday, March 27, 2009
libgda: GNOME Database Library
Huh... baru dengar nih, thanks to aruiz at #gtk+ GNOME's IRC Channel
The GNOME-DB project aims to provide a free unified data access architecture to the GNOME project. GNOME-DB is useful for any application that accesses persistent data (not only databases, but data), since it now contains a pretty good data management API.
GNOME-DB consists of the following components:
* Libgda: a data abstraction layer. It can manage data stored in databases and can be used by non GNOME applications, it depends on the GLib (and integrates with it), and LibXML.
* Libgnomedb: a database widget library with data bound widgets and more. It depends on GTK+.
* Mergeant: front-end for database administrators and database application developers.
This site now refers to features which are available in the current V4 series starting with Libgda 4.0.0, Libgnomedb is still in an unstable state (even though it's already useable).
http://www.gnome-db.org
Thursday, March 26, 2009
Ubuntu Repo: indika.net.id
Sudah berapa lama ini saya mencoba Ubuntu 8.10 (Intrepid Ibex) di IBM Thinkpad saya, saya baru tahu kalo fetch repository lokal server di http://indika.net.id itu tidak lengkap, buktinya waktu saya mengganti server ke main server (US) package monitor langsung menyatakan kalau new updates tersedia ;). Di lokal server koneksi cepat tapi tidak lengkap, main server koneksi standar tapi lengkap.
Suicide & Redemption K.H.
Shit, saya baru tahu kalo di Death Magnetic (Metallica) ada lagu keren ini, too metal! that's why i love this band!
Wednesday, March 04, 2009
Linux Scheduler
Dari milis kernel.org:
Answer 1:
Asker response:
Pertanyaan dan jawaban yang baik.
I have written a small thread program in C using the pthreads. I am able to set the threads priority with pthread_setschedparam() API when I login as ROOT. If I login as a normal user other than ROOT, then the API returns the error number 1 (EPERM). Please let me know whether a normal user can set the pthreads priority with pthread_setschedparam API or not.
Answer 1:
Yes, subject to certain restrictions, which are detailed in the sched_setscheduler() manpage. In particular, a non-privileged process cannot set the real-time priority higher than its RLIMIT_RTPRIO setting. You can change this with an "rtprio" entry in /etc/security/limits.conf (settings are applied on login, so changes won't affect existing login sessions). Privilege is determined by the CAP_SYS_NICE capability.
Asker response:
I am able to run the programs as a normal user after setting the soft as
well as hard values in /etc/security/limits.conf values. However, without setting the hard limit, I am not able to run the programs. So, by setting the soft and hard values to 100, I am able to run.
domain type item value
@srinivasg soft rtprio 100
@srinivasg hard rtprio 100
Thanks for the right information.
Pertanyaan dan jawaban yang baik.
Subscribe to:
Posts (Atom)