Linux-Development-Sys Digest #101, Volume #8     Fri, 25 Aug 00 01:13:12 EDT

Contents:
  Re: Programmatically rebooting the system (Kevin Buhr)
  Re: Embedded linux (Peter Pointner)
  Re: Embedded linux (Wolfgang Denk)
  Re: Network Device Driver Question (Andi Kleen)
  Re: Device driver programming (Andi Kleen)
  Printer driver question (Matthias Mulumba Lumala)
  Re: Linux driver module question (Jonathan Lundell)
  programming nvidia on linux ("Stephen Perez")
  Re: Printer driver question (Grant Edwards)
  Re: Printer driver question (Karl Heyes)
  Re: crypt(3) ([EMAIL PROTECTED])
  Re: Linux server to hold thousands of tcp connections? ("Dan Harpold")
  Re: crypt(3) ("D. Stimits")
  Re: Device Driver for Acer Southbridge 1535 (Pete Zaitcev)
  Re: Linux driver module question (Pete Zaitcev)
  Re: Printer driver question (Matthias Mulumba Lumala)

----------------------------------------------------------------------------

From: [EMAIL PROTECTED] (Kevin Buhr)
Subject: Re: Programmatically rebooting the system
Date: 24 Aug 2000 16:25:17 -0500

"David Beardsley" <[EMAIL PROTECTED]> writes:
> 
> Is it possible to reboot the system from C/C++ code?
> 
> I tried simply using exec to run telinit and shutdown, but even when the
> executable is owned by and executed by root it says permission denied.

The following seems to work fine for me when executed by root.

        doreboot.c:

        #define COMMAND_NAME "/sbin/shutdown"
        #define COMMAND_ARGS { "shutdown", "-r", "+2min", NULL }

        #include <unistd.h>
        #include <stdio.h>

        char *new_argv[] = COMMAND_ARGS;
        char *new_envp[] = { NULL };

        main()
        {
                execve(COMMAND_NAME, new_argv, new_envp);
                perror("execve");
        }

Kevin <[EMAIL PROTECTED]>

------------------------------

From: Peter Pointner <[EMAIL PROTECTED]>
Subject: Re: Embedded linux
Date: 24 Aug 2000 20:52:44 +0200

David <[EMAIL PROTECTED]> wrote:
> Is anyone here working on any embedded Linux systems?  If so, what
> do you use?

I think a lot of people are working on embedded Linux systems. But
what do you expect them to answer? Try to ask a bit more specific.

Peter


------------------------------

From: Wolfgang Denk <[EMAIL PROTECTED]>
Subject: Re: Embedded linux
Date: Thu, 24 Aug 2000 21:12:51 GMT

"David" <[EMAIL PROTECTED]> writes:

>Is anyone here working on any embedded Linux systems?  If so, what
>do you use?

What do you mean? Hardware or software base?

For hardware, see some Embedded PowerPC systems on
http://www.denx.de/embedded-ppc-en.html

For software, there are a lot of releases already, with more  coming.
Check Linuxworks, MontaVista, Elinos, Lineo, ....

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88   Web: www.denx.de
"There was no difference between  the  behavior  of  a  god  and  the
operations of pure chance..."   - Thomas Pynchon, _Gravity's Rainbow_

------------------------------

From: Andi Kleen <[EMAIL PROTECTED]>
Subject: Re: Network Device Driver Question
Date: 25 Aug 2000 00:50:22 +0200

Greg Parrott <[EMAIL PROTECTED]> writes:

> I have a couple of questions relating to network device drivers:
> 
> 1) is there a mechanism for notifying the upper layers that the link level is
> gone (detected loss of light, loss of signal, missing cable, etc.)?  Do I just
> set tbusy until things return to normal?

There is an mechanism in 2.4 (netif_carrier_*), but it is not generally used
except from the isdn stack to signal dial failures.

The consensus seems to be that it is better to use higher level timeouts
to detect link loss.

> 
> 2) We are building an ASIC that will implement the TCP/IP stack in silicon.  I
> need to be able to write a device driver that will allow both a hardware stack
> and the existing software stack to coexist.  Do I simply replace the existing
> "socket" calls in the struct proto to do a bit of packet snooping and determine
> whether to forward to the traditional stack or route directly to my hardware?

Ugh, I guess you have lots of work to do. 

Patching proto somewhere might be ok, but there are surely dragons waiting
in form of bugs because AFAIK it has not been tried before.

-Andi


------------------------------

From: Andi Kleen <[EMAIL PROTECTED]>
Subject: Re: Device driver programming
Date: 25 Aug 2000 00:55:28 +0200

Bruno Ascenso <[EMAIL PROTECTED]> writes:

> Hi,
> 
> I' working on device driver for a network card I have. The driver is
> almost done and has a lot of code.
> Since, I didn't need its symbols to be known outside, I simply used the
> macro EXPORT_NO_SYMBOLS;
> and didn't declare any functions as static.
> 
> Now, I need to export a couple of functions to some other module, but
> don't want do remove the macro and polute so much the namespace.
> 
> What I'd like to know is if it's possible to do something to export
> nothing but the symbols I need without going through the code and
> declare everything as static.
> 
> I tried simply EXPORT_SYMBOL() in the symbols I need but it doesn't
> work. I was unable to see the symbol outside.

modprobe does not use the normal symbol table you "see" with nm, 
but only uses the internal table generated by EXPORT_SYMBOL. There is
no easy way to see it except for loading and looking into /proc/ksyms

[actually init_module/cleanup_module are the only exception to that rule,
but in 2.4 you can even keep them static and use the 
module_init/module_exit macros] 

EXPORT_NO_SYMBOLS is also not really needed, the default is to not
export anything.

-Andi

------------------------------

From: Matthias Mulumba Lumala <[EMAIL PROTECTED]>
Subject: Printer driver question
Date: Fri, 25 Aug 2000 01:57:12 +0200

Hi,
        What really is a printer driver? From what I've learned it looks
like there are two layers to a  printer driver: one that translates a
document into a language that a given physical printer can understand (
e.g. Postscript driver or PCL driver) and another whose role is to send
to the printer data that is generated by the first layer( lp.o in
linux). Is this true?
        Can all the commands sent to the printer be expressed using
interpretable languages like Postscript, including those that do not
deal directly with printing (e.g. cleaning or removing cartridges) or do
we have to use special IOCTL's?

                            Thanks in advance,
                                                            Matthias


------------------------------

From: Jonathan Lundell <[EMAIL PROTECTED]>
Subject: Re: Linux driver module question
Date: Thu, 24 Aug 2000 17:54:07 -0700

In article <c%fp5.16595$[EMAIL PROTECTED]>, 
"Norm Dresner" <[EMAIL PROTECTED]> wrote:

> Unless I'm reading your question wrong, you seem to be asking how to 
> prevent
> the kernel from swapping out the physical memory on your PCI board.  The
> only way the kernel can do that is if you don't screw the board down 
> tightly
> enough.

I think you're reading the question wrong. The DSP board is going to DMA 
data to/from a user memory buffer, which buffer needs to be locked in 
memory.

The raw IO code in 2.4.0 calls map_user_kiobuf(), which as I read it 
does what you (Ed) want. It's in mm/memory.c. But I can't find the 
equivalent function in 2.2.x. Did 2.2 not support raw IO?

> Ed Hudson <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> > I am writing a kernel module driver for a custom PCI based DSP board.
> > The board needs access to physical memory locations.  I am using
> > virt_to_phys() to translate the addresses, but I believe I need to
> > implement a locking mechanism so that the locations I refer to are not
> > swapped.  Does any have any suggestions on how I may go about doing
> > this?  Any links to reference materials or example drivers would be
> > much appreciated.

-- 
/Jonathan Lundell.
[EMAIL PROTECTED]

------------------------------

From: "Stephen Perez" <[EMAIL PROTECTED]>
Crossposted-To: 
alt.comp.periphs.videocards.nvidia.programming,alt.comp.periphs.videocards.nvidia,comp.os.linux.development.apps,comp.os.linux.x
Subject: programming nvidia on linux
Date: Fri, 25 Aug 2000 01:25:44 GMT

Hi. I am wondering if anyone out there has an example piece of code that
does all the low-level stuff to change graphics modes, color a pixel on the
screen, and return to text mode(from a linux console). I could and have
looked at the nvidia drivers that come with X but I would really like a more
minimal/simple example than a full blown driver(they rely on X for too many
things-making it difficult to trace). Also, I don't want to use X(or install
it for that matter), I just want to do some simple rendering using my nvidia
TNT2 card. Anyway, just wondering.

Thanks in advance. Please email me directly.

Stephen



------------------------------

From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: Printer driver question
Date: Fri, 25 Aug 2000 01:36:27 GMT

In article <[EMAIL PROTECTED]>, Matthias Mulumba Lumala wrote:

>        What really is a printer driver? From what I've learned it looks
>like there are two layers to a  printer driver: one that translates a
>document into a language that a given physical printer can understand (
>e.g. Postscript driver or PCL driver) and another whose role is to send
>to the printer data that is generated by the first layer( lp.o in
>linux). Is this true?

Yes, exactly.  On most Linux systems, applications generate postscript and
ghostview is used to translate that into a printer-specific language.  Then
a kernel module is used to send the data to the printer.  If you're using a
draditional parallel printer port, that's the "lp" module.  It could also be
sent via serial port, TCP, etc.

>        Can all the commands sent to the printer be expressed using
>interpretable languages like Postscript, including those that do not
>deal directly with printing (e.g. cleaning or removing cartridges) or do
>we have to use special IOCTL's?

I have no idea.  With all the printers I've used, a person had to physically
remove and/or clean the cartridge.

-- 
Grant Edwards                   grante             Yow!  Bo Derek ruined
                                  at               my life!
                               visi.com            

------------------------------

From: Karl Heyes <[EMAIL PROTECTED]>
Subject: Re: Printer driver question
Date: Fri, 25 Aug 2000 03:02:58 +0000

In article <[EMAIL PROTECTED]>, 
Matthias Mulumba Lumala <[EMAIL PROTECTED]> wrote:
> Hi,
>         What really is a printer driver? From what I've learned it looks
> like there are two layers to a  printer driver: one that translates a
> document into a language that a given physical printer can understand (
> e.g. Postscript driver or PCL driver) and another whose role is to send
> to the printer data that is generated by the first layer( lp.o in
> linux). Is this true?

more or less correct.  There are also print filters available within apps
like staroffice and also at the printcap level. 

>         Can all the commands sent to the printer be expressed using
> interpretable languages like Postscript, including those that do not
> deal directly with printing (e.g. cleaning or removing cartridges) or do
> we have to use special IOCTL's?

IOCTL's are for kernel aware drivers. printer drivers are user space only.
no point in putting them in the kernel. Printers can be a pain to setup
right, and there's no standard convention for talking to them, except
ASCII.

Postscript / PCL seem to cover quite a wide range but not all, so enter
ghostscript.....

karl.


> 
>                             Thanks in advance,
>                                                             Matthias
> 




------------------------------

From: [EMAIL PROTECTED]
Subject: Re: crypt(3)
Date: Fri, 25 Aug 2000 02:55:00 GMT

Fro-Man <[EMAIL PROTECTED]> wrote:
> Hmmm, threads are relatively new to me.  Hence, why I am trying to fool
> around with them right now.  I've been trying to read along with the
> arguements in the NG here, though.  Now, is there a place to get a listing
> of those _r functions?  Or is there a standard library of them?

A listing? I guess you could rum nm over libc and grep for them. There
tends to be one for every function that's not reentrant on most
systems with threads. I'm not sure if there's any standard compelling
them to be there though.

-- 
Matt Gauthier <[EMAIL PROTECTED]>

------------------------------

From: "Dan Harpold" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.networking,comp.protocols.tcp-ip
Subject: Re: Linux server to hold thousands of tcp connections?
Date: Thu, 24 Aug 2000 22:00:40 -0500

If you are hosting 300,000 active sessions on one box, you are taking a big
risk. You must spread that load across multiple boxes. Just think if you
_are_ able to spend the time to get it to work, one hardware failure will
crash all 300,000 connections. You need to have some load balancing and
redundancy.


"Laurens Holst" <[EMAIL PROTECTED]> wrote in message
news:8o2ll3$b9jea$[EMAIL PROTECTED]...
> > > Will the performance decrease significantly when connections wave up
to
> 300
> > > thousand or so?
> >
> > You can't sustain 300,000 TCP connections on any operating system I
> > know of.
>
> I think it can be done if you program everything in Assembly. However,
this
> is a *nasty* job, for even the OS and Network-controls have to be coded
> again (to gain max speed). And it will be unlikely that this
implementation
> is very good, because Assembly becomes very untransparant if it becomes
too
> large and complex. And time must certainly not be an issue.
>
> But I think, in theory, it can be done (if I can do it for a 3.57 MHz
8-bit
> Z80, it is certainly possible on a 32-bit (or is it 64-bit?) AMD Athlon
> 1000). However I also think it's best to divide the job over several
> computers.
>
> By the way, what terrible big system are you setting up if you expect to
> handle up to 300.000 simultaneous connections???
>
>
> ~Grauw
>
>
> --
> >>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<
>  email me: [EMAIL PROTECTED] or ICQ: 10196372
>       visit my homepage at http://grauw.blehq.org/
> >>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<
>
>



------------------------------

Date: Thu, 24 Aug 2000 21:21:13 -0600
From: "D. Stimits" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: Re: crypt(3)

Fro-Man wrote:
> 
> Hopefully this is a simple question:
> 
> /* excerpt from man page */
>        #define _XOPEN_SOURCE
>        #include <unistd.h>
> 
>        char *crypt(const char *key, const char *salt);
> /* end of excerpt */
> 
> The char* that crypt returns, what is it?  Is it malloc()'d memory or
> static somewhere?  I have tried compiling it with with free()'ing the
> returned pointer, but it segfaults.  If it isn't malloc()'d, where'd it
> come from?
> 
> Also, for some reason when I try to compile I do not seem to be getting
> the correct include files.  Or atleast the declaration for the crypt
> function does not seem to exist where the man pages says it does.  I can
> easily get the error to go away if I just declare it within my program,
> but that seems kind of messy.  I'd just rather inlcude it correctly.
> 
> ~/src/example/crypt > gcc -Wall encrypt.c -c
> encrypt.c: In function `main':
> encrypt.c:13: warning: implicit declaration of function `crypt'
> encrypt.c:13: warning: assignment makes pointer from integer without a
> cast
> ~/src/example/crypt > gcc -Wall encrypt.o -lcrypt
> ~/src/example/crypt >
> 
> TIA
> 
> # Aaron Day # [EMAIL PROTECTED] # http://www.csis.gvsu.edu/~daya #
> 
> Ever get that feeling you are being watched?...
>                                                 Its a skunk.

Here is an old C snippet for you, very basic:
#define ENCRYPTED_WORD_LEN 13

        char encrypted[ENCRYPTED_WORD_LEN + 1];
        encrypted[ENCRYPTED_WORD_LEN + 1] = (char )NULL;
        strncpy(encrypted, crypt(word, seed), ENCRYPTED_WORD_LEN + 1);
        encrypted[ENCRYPTED_WORD_LEN] = '\0';

"seed" is just a 3 character array. char 3 is for NULL, but if you don't
use something requiring the NULL, don't bother. In this case memory is
on the local stack, and no free() or delete() is used.

------------------------------

From: [EMAIL PROTECTED] (Pete Zaitcev)
Crossposted-To: comp.os.linux.development.embedded,linux.dev.kernel
Subject: Re: Device Driver for Acer Southbridge 1535
Date: Fri, 25 Aug 2000 03:53:01 GMT

On Thu, 24 Aug 2000 14:09:29 -0500, Stephen Rousset <[EMAIL PROTECTED]> 
wrote:
> 
>   Does anyone know where I may be able to find the source code for
> a device driver for the Acer 1535 Southbridge.  The only drivers found
> so far were for Windows and were only binaries.

Stephen, what is it in that chip that needs a driver?
I used to poke around 153x, 1543C, etc. There was absolutely
nothing special about them. Unless 1535 has something
unusual, such as IEEE-1394, I do not see how it may need
a special driver.

--Pete

------------------------------

From: [EMAIL PROTECTED] (Pete Zaitcev)
Subject: Re: Linux driver module question
Date: Fri, 25 Aug 2000 03:58:38 GMT

Hehe, a witty response! Ed's wording was not very good but I guess
he asked how to pin down user pages in the way of bp_mapin()
in Solaris, or some such. I did not answer because the canonical
answer is "You cannot do that. Use kmalloc() and copy_to_user().".
This is not the whole story, as some people pushed for DMA
into a user memory, for instance Werner Almesberger (sp?) did
something about it in the context of ATM support. Apparently,
2.4 is supposed to have some user memory DMA support.
Also, you can do get_free_pages() than remap this into
user space with remap_page_range() when user calls mmap(2).
However, it's only a partial solution.

--Pete

On Thu, 24 Aug 2000 20:57:44 GMT, Norm Dresner <[EMAIL PROTECTED]> wrote:
> Unless I'm reading your question wrong, you seem to be asking how to prevent
> the kernel from swapping out the physical memory on your PCI board.  The
> only way the kernel can do that is if you don't screw the board down tightly
> enough.
> 
>     Norm
> 
> Ed Hudson <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> > I am writing a kernel module driver for a custom PCI based DSP board.
> > The board needs access to physical memory locations.  I am using
> > virt_to_phys() to translate the addresses, but I believe I need to
> > implement a locking mechanism so that the locations I refer to are not
> > swapped.  Does any have any suggestions on how I may go about doing
> > this?  Any links to reference materials or example drivers would be
> > much appreciated.
> >
> >
> > Thanks,
> > Ed Hudson

------------------------------

From: Matthias Mulumba Lumala <[EMAIL PROTECTED]>
Subject: Re: Printer driver question
Date: Fri, 25 Aug 2000 06:59:31 +0200



Grant Edwards wrote:

> In article <[EMAIL PROTECTED]>, Matthias Mulumba Lumala wrote:
>
> >        What really is a printer driver? From what I've learned it looks
> >like there are two layers to a  printer driver: one that translates a
> >document into a language that a given physical printer can understand (
> >e.g. Postscript driver or PCL driver) and another whose role is to send
> >to the printer data that is generated by the first layer( lp.o in
> >linux). Is this true?
>
> Yes, exactly.  On most Linux systems, applications generate postscript and
> ghostview is used to translate that into a printer-specific language.  Then
> a kernel module is used to send the data to the printer.  If you're using a
> draditional parallel printer port, that's the "lp" module.  It could also be
> sent via serial port, TCP, etc.
>
> >        Can all the commands sent to the printer be expressed using
> >interpretable languages like Postscript, including those that do not
> >deal directly with printing (e.g. cleaning or removing cartridges) or do
> >we have to use special IOCTL's?
>
> I have no idea.  With all the printers I've used, a person had to physically
> remove and/or clean the cartridge.
>
> --Thank you very much. I would still want to know how this type of dialog is
> carried out. For my Optra 40, a postscript printer, the cartridge won't move
> to the centre ready to be removed unless one uses an utility provided by
> Lexmark (under Windows only?).How are such controls done?
> Grant Edwards                   grante             Yow!  Bo Derek ruined
>                                   at               my life!
>                                visi.com


------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: [EMAIL PROTECTED]

You can send mail to the entire list (and comp.os.linux.development.system) via:

    Internet: [EMAIL PROTECTED]

Linux may be obtained via one of these FTP sites:
    ftp.funet.fi                                pub/Linux
    tsx-11.mit.edu                              pub/linux
    sunsite.unc.edu                             pub/Linux

End of Linux-Development-System Digest
******************************

Reply via email to