Brazilian Planet OpenSolaris

February 18, 2009

Born Planet OpenSolaris in PT_BR !!!

Planet OpenSolaris BR

Planet OpenSolaris BR

Setting keyboard on XWindow

February 14, 2009

It’s a little tip showing how you can change your keyboard layout on X11 when you are not root and you cannot use the console (when you are able to use the console, you can use yourself X11 config file through the startx command).

Well, forget KDE, GNOME and modern X11 clients. Think you are using a simple client as Fluxbox and OpenBox…How do you can change your keyboard layout ?

It’s simple…use setxkbmap. In my case (I have a Sony Vaio with Spanish layout):

setxkbmap es

My two cents ;)

In this week I had to write a little code to remove all IPC Shared Memory segments that were created by one process.

I had already done it on Linux and *BSD systems, but never on (Open)Solaris. Then, I tried to search (googling) some method to do it but without successful.

Linux and *BSD’s have a syscall named sysctl() to interface it, but sunos kernel has not.

Well, after some minutes breaking my brain, I discover a syscall easiest to use than sysctl…look the code below:

#include <stdlib.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
void show_shm (void)
{
  int i;
  int     *buf;
  uint_t  nids;
  uint_t  pnids;
  for (;;)
  {
    if (shmids(buf, nids, &pnids) != 0)
      exit(1);
    if (pnids <= nids)
      break;
    buf = realloc(buf, (nids = pnids) * sizeof (int));
  }
  for (i = 0; i < pnids; i++)
    printf ("%dn", buf[i]);
}

link2_os_blk_125