Skip to main content

Posts

Showing posts from January, 2006

Unix half-duplex pipes

The pipe ‘|’ is a type of inter-process communication. Its facilities provide a method for multiple processes to communicate with one another. Simply putting a pipe in between is a method of connecting the standard output of one process to the standard input of another. joset@kee$ ls -l | grep -i foo In the example above, the output of ls is written to the input of grep. Obviously, the output of grep is written to the standard output of the shell, the screen. Here is how a pipe works. #include<stdio.h> #include<unistd.h> #include<sys/types.h> int main(void) { int fd[2], n_bytes; pid_t child; char string[] = "Hello, world!\n"; char readbuf[80]; pipe(fd); if ((child = fork()) == -1){ perror("fork"); exit(1); } if ((child == 0)){ /* child process closes up input side of pipe */ close(fd[0]); /* send "string" through the output side of pipe */ write(fd[1], string, strlen(string)); exit(0); ...

A legal alien?

Yesterday, I was triggered by my ego to attend a session of WMSU’s review for the incoming ICT proficiency exam. Each student spent a total of Php 460.00 for the review and test fee. It started last week. Passers of the said exam are guaranteed to be certified ICT professionals as noted by NCC. I was curious about how the review was being held. I was able to set myself in the classroom without catching much of the professor’s attention. It was my first attempt. I was somehow excited at first, but as the review went on, the professor did not talk that much and started filling up the chalkboard. The topic was about data structures. I was surprised with what I have found out. I bet you have the idea.

A sticky lesson

With a dial-up connection reaching 14kbps at max, an ‘emerge-delta-webrsync’ consuming only 5 minutes of your uptime, a free access from 0000H - 0800H, and a script that does nasty things like disconnect after ‘emerge -f foo’ and switch to ‘init 0′, You will not be able to resist the clamor for an up-to-date box. The lesson began here: root@kee# emerge =sys-devel/gcc-3.4.4 This does not mean dirty! joset@kee$ eix -e gcc * sys-devel/gcc ... Installed: 3.3.6 3.4.4-r1 Homepage: http://www.gnu.org/software/gcc/gcc.html ... Found 1 matches joset@kee$ Not realizing that having multiple GCCs installed is normal, and without following the upgrading-gcc-guide, a stupid action followed. root@kee# emerge -C =sys-devel/gcc-3.3.6 Bang! libstdc++.so.5.0.6, where the hell are you? All programs linked dynamically to this library were paralized! My intention was to clean up gcc-3.3.6 since I have emerged gcc-3.4.4 recently. A...