pei lin | 12 Jul 2008 19:24
Picon

Some questions about linux termios

Hi,buddy
   I am puzzled by the linux termios.
    First Question about /dev/tty0 and /dev/tty,this two devices is
the same one?
    When i am in X terminal,as /dev/pts/0 , i do "echo hello >
/dev/pts/0 and echo hello > /dev/tty ", they return the same like that
"hello" on the screen .This means /dev/tty ->/dev/pts/0? But "echo
hello > /dev/tty0",there is nothing on the screen.And when i go to
Init 3 mode ,like /dev/tty1,when i do "echo hello > /dev/tty1 and echo
hello > .dev/tty and echo hello > /dev/tty0" ,They return the same all
print hello on the screen.Do they all point to the /dev/tty1?

    The second Question is that i write a small program to get
keyboard input like below.When i run it in X terminal ,when i press
keyboard it can return but can not get the press and release event.And
in the console,like tty1,it doesn't work .i don't know why.

file : get_keyboard.c

#include <stdio.h>
#include <linux/keyboard.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/kd.h>
#include <termios.h>
#include <unistd.h>
int main()
{
	int fd,len,i;
	struct kbentry entry;
(Continue reading)

Jonathan Isom | 12 Jul 2008 19:34
Picon

Re: Some questions about linux termios

in Sat, Jul 12, 2008 at 12:24 PM, pei lin <telent998 <at> gmail.com> wrote:
> Hi,buddy
>   I am puzzled by the linux termios.
>    First Question about /dev/tty0 and /dev/tty,this two devices is
> the same one?
>    When i am in X terminal,as /dev/pts/0 , i do "echo hello >
> /dev/pts/0 and echo hello > /dev/tty ", they return the same like that
> "hello" on the screen .This means /dev/tty ->/dev/pts/0? But "echo
> hello > /dev/tty0",there is nothing on the screen.And when i go to
> Init 3 mode ,like /dev/tty1,when i do "echo hello > /dev/tty1 and echo
> hello > .dev/tty and echo hello > /dev/tty0" ,They return the same all
> print hello on the screen.Do they all point to the /dev/tty1?

/dev/tty is a pointer to the current tty. whether it be /dev/tty1 or
/dev/pts/0.  when you login you are assigned a tty and if you
don't know it you can just use /dev/tty and it will open the current
tty

>    The second Question is that i write a small program to get
> keyboard input like below.When i run it in X terminal ,when i press
> keyboard it can return but can not get the press and release event.And
> in the console,like tty1,it doesn't work .i don't know why.
>
> file : get_keyboard.c
>
> #include <stdio.h>
> #include <linux/keyboard.h>
> #include <sys/ioctl.h>
> #include <fcntl.h>
> #include <linux/kd.h>
(Continue reading)

bkerin | 17 Jul 2008 05:55

malloc interposition how?


I'm trying to do these things simultaneously:

use glib
use gc (Hans-Boehm)
use my own library of random code

I dont want to have to do manual garbage collection at least in the
prototype stage.

However, I haven't found a way to link the above together that works.

I use the set_vtable function in glib to hopefully make it use the GC_malloc
etc. from gc

I include fcnts malloc/free/realloc in my library and the compiler/linker
doesn't complain
(presumably libc contains some special goop to not complain about these
getting redefined
in client code).  My malloc etc. of course just call GC_* fctns.

I believe I have all the right -I -L -Wl,-rpath etc. crud.

When I look at bins and my .so file with ldd everything appears to look for
the correct libraries.

When I use nm on my .so I see symbols like malloc supposedly in the text
secion (marked with T).

When I step with the debugger and a breakpoint in malloc (or realloc etc.) I
(Continue reading)

Leslie P. Polzer | 17 Jul 2008 09:39
Picon
Gravatar

Re: malloc interposition how?


Check the -M argument to ld to see where your malloc comes from
(well, presumably from libc, but let's be sure).

Supposedly your set_vtable stuff isn't working at all,
and you need to put the gc libs higher in the linking
order (before libc).

  Leslie

--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Gmane