how to print on the terminal with server - Minix

This is a discussion on how to print on the terminal with server - Minix ; I want to print with the instruction "printf" on the terminal when I use my server. I don't know how to do it but in a prevoius post Jens told me that the servers ' print statements are directed to ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: how to print on the terminal with server

  1. how to print on the terminal with server

    I want to print with the instruction "printf" on the terminal when I
    use my server.
    I don't know how to do it but in a prevoius post Jens told me that
    the servers ' print statements are directed to tty0 for default.


    Thank you in advance

  2. Re: how to print on the terminal with server

    puntino wrote:
    > I want to print with the instruction "printf" on the terminal when I
    > use my server.
    > I don't know how to do it but in a prevoius post Jens told me that
    > the servers ' print statements are directed to tty0 for default.


    Are you using X?

    Jens

    --
    Jens de Smit
    Student Computer Science | Vrije Universiteit Amsterdam
    jfdsmit@few.vu.nl | http://www.few.vu.nl/~jfdsmit
    "[In the end, people] get furious at IT that the goddamn magic isn't working"
    -- Stewart Dean

  3. Re: how to print on the terminal with server

    On Jun 24, 10:43 am, "J.F. de Smit" wrote:
    > puntino wrote:
    > > I want to print with the instruction "printf" on the terminal when I
    > > use my server.
    > > I don't know how to do it but in a prevoius post Jens told me that
    > > the servers ' print statements are directed to tty0 for default.

    >
    > Are you using X?

    no
    >
    > Jens
    >
    > --
    > Jens de Smit
    > Student Computer Science | Vrije Universiteit Amsterdam
    > jfds...@few.vu.nl |http://www.few.vu.nl/~jfdsmit
    > "[In the end, people] get furious at IT that the goddamn magic isn't working"
    > -- Stewart Dean



  4. Re: how to print on the terminal with server

    Dear Jens, thank you for your help.
    I fixed it and I think to have understood what was going wrong.
    When you write a server the "printf" statement works as you said
    by printing on tty0 for default.
    If you want to use the printf as you are accustomed (see output on
    the terminal)
    you have to include in your header the statements #include sysutil.h> , #define _MINIX 1
    and in your makefile the sysutil library.
    My original problem was that I added minix/sysutil.h in my header
    but I forgot to link the library sysulit with the makefile.
    That's all.
    I think it's a good idea to summarize here the general instruction
    to deal with this stupid programming mistake.
    Please Jens, take a look at it and let me know if you're
    agree with the following instructions, this is could be a helpful
    post
    for other minix users.

    ************************************************** ***
    In order to make your server print on the terminal with
    the statement "printf" you can follow this step:

    1 include in your header minix/sysutil.h

    #define _MINIX 1 /* tell headers to include MINIX
    stuff */
    #include

    2 You need to link the syslib library with your file otherwise
    the cc compiler gives you back an "undefined reference" error
    for example if your server is developed within two files:
    my server.c and myserver.h
    (in the least there is the include statement
    as I explained before)

    all: myserver.o
    cc -o server myserver.o -lsysutil

    myserver.o: myserver.c myserver.h
    cc -c myserver.c

    ************************************************** *


  5. Re: how to print on the terminal with server

    On 24 jun, 13:18, puntino wrote:
    > ************************************************** ***
    > In order to make your server print on the terminal with
    > the statement "printf" *you can follow this step:
    >
    > 1 include in your header minix/sysutil.h
    >
    > *#define _MINIX * * * * * * 1 * */* tell headers to include MINIX
    > stuff */
    > *#include
    >
    > 2 You need to link the syslib library with your file otherwise
    > the cc compiler gives you back *an "undefined reference" error
    > for example if your server is developed within two files:
    > my server.c and myserver.h
    > (in the least there is the include statement
    > as I explained before)
    >
    > all: myserver.o
    > * * * cc -o *server myserver.o -lsysutil
    >
    > myserver.o: myserver.c myserver.h
    > * * * * * * * *cc -c myserver.c
    >
    > ************************************************** *


    I did all of the above, but I'm still not getting any output to the
    console.
    My server is part of the boot image. Should that make a difference?

  6. Re: how to print on the terminal with server


    > I did all of the above, but I'm still not getting any output to the
    > console.
    > My server is part of the boot image. Should that make a difference?


    I don't know but looking at servers' makefile I noticed
    that they also link the lsys library,
    have you done this?

  7. Re: how to print on the terminal with server

    On 24 jun, 15:25, puntino wrote:
    > > I did all of the above, but I'm still not getting any output to the
    > > console.
    > > My server is part of the boot image. Should that make a difference?

    >
    > I don't know but looking at servers' makefile I noticed
    > that they also link the lsys library,
    > have you done this?


    Yes, I have. I have also tried compiling it without the syslib, same
    results.
    I also tried calling panic() inside the server, as a test. This
    terminated the server, but it didn't print any output.

  8. Re: how to print on the terminal with server

    I managed to get the output by changing the OUTPUT_PROC_NR from
    LOG_PROC_NR to TTY_PROC_NR in /usr/src/include/minix.config.h

+ Reply to Thread