Linux-Development-Sys Digest #447, Volume #8     Sat, 27 Jan 01 22:13:09 EST

Contents:
  Re: getche() (Erik de Castro Lopo)
  Re: CHS value of a block (Kasper Dupont)
  Re: booting CD, ramfs -> / in 2.4, some issues (Kasper Dupont)
  Re: The value of HZ (Kasper Dupont)
  Re: Access to beep (echo \a) on embedded system with no console (Kasper Dupont)
  Re: 64-bit i-numbers? (Kasper Dupont)
  Re: Linux Kernel book about linux 2.0 still useful?? (Kaelin Colclasure)
  Re: Controlling things on that other platform (Chris J/#6)
  Re: booting CD, ramfs -> / in 2.4, some issues ([EMAIL PROTECTED])
  Communication between kernel module and user space program ("knightG")
  Re: Controlling things on that other platform ([EMAIL PROTECTED])
  Re: How to build a USB rescue floppy disk ([EMAIL PROTECTED])
  How to build...? ("The Linux Fan!!!")
  Re: The value of HZ ("Norm Dresner")
  Re: Communication between kernel module and user space program ("Norm Dresner")
  Re: Sys call for Available Memory? - Attempts to help, but still no answer after 
months.  :-( (MeekGeek)

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

From: Erik de Castro Lopo <[EMAIL PROTECTED]>
Subject: Re: getche()
Date: Sat, 27 Jan 2001 12:25:21 GMT

root wrote:
> 
> I just wanted a funtion that could get input without need to press enter. I don't
> need to change the echo.
> How can i change the terminal setup from c/c++. Writting to some files?

No, by using functions defined in <termios.h>. 

man tcsetattr

> BTW what are terminal modes. I am really a newbie. Please use basic words.

Linux has an abstract called the terminal. Every program that gets input
from stdin and puts it's output to stdout does so via this terminal
abstraction. The settings for the terminal can be modified by use
of the tcsetattr() function.

For an example of a program which does this (but not exactly what you
want), have a look at:

    http://www.zip.com.au/~erikd/BOOK/list1306_readline.c

Hope this helps,
Erik
-- 
+----------------------------------------------------------+
  Erik de Castro Lopo  [EMAIL PROTECTED] (Yes its valid)
+----------------------------------------------------------+
"A subversive is anyone who can out-argue their government"

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

From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: CHS value of a block
Date: Sat, 27 Jan 2001 13:23:42 +0100

Josef Moellers wrote:
> 
> Marty wrote:
> >
> > How to get the CHS (cylinder, head, sector) value given a block number
> > in a hard disk ?
> >
> > Thanks,
> > Marty.
> 
> Physically speaking, this may not be possible, because you may have a
> solid state disk and these tend to not have cylinders and heads.
> 
> If you have the number of sectors/track (spt) and the number of heads
> (hds), the assumption is that the sector numbers are such that tracks
> fill first, the cylinders, so if you have a linear block address (LBA):
> 
> LBA mod spt + 1= sector (Note sectors are usually numbered 1..spt)
> (LBA div spt) mod hds = head
> LBA div (spt * hds) = cylinder
> 
> The values for spt and hds can be obtained using ioctl(fd,
> HDIO_GETGEO,&buf).
> 
> --
> Josef M�llers (Pinguinpfleger bei FSC)
>         If failure had no penalty success would not be a prize (T.  Pratchett)

In earlier operating systems CHS was used to improve
performance and in some cases because the concept of
sectors was not implemented by hardware but by software.

New medias might have different size cylinders or in
the case of CDs not even that but a single spiral.

Linux does only have CHS values because it is sometimes
needed for compatibility with BIOS and/or other
operating systems.

Unless you need to be compatible with some ancient
software designs don't use it.

-- 
Kasper Dupont

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

From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: booting CD, ramfs -> / in 2.4, some issues
Date: Sat, 27 Jan 2001 13:35:53 +0100

Robert Kaiser wrote:
> 
> In article <[EMAIL PROTECTED]>,
>         [EMAIL PROTECTED] writes:
> 
> > 2.  The "df" command shows nothing but "cat /proc/mounts" works.
> >     Doing "df" on a specific mounted filesystem does work.  Here's
> >     what I get (I've pulled the actual unmounting of /mnt for now):
> >
> 
> This is probably because df dies on a division by zero error. I've
> noticed this with the busybox version of df and I suspect that
> the standard df has the same problem: the statfs syscall, when applied
> to ramfs returns zeroes for the total blocks and free blocks, which df
> is not prepared to handle.
> 

That does not sound likely since df actually works when
given the ramfs as argument. The problem is that for
historical reasons the list of mounted filesystems exist
both in the kernel and in the file /etc/mtab.

Check if some bootup scripts probably found in /etc/rc.d
does nasty things to /etc/mtab.

A quite good way to initialize /etc/mtab is by doing
"cp /proc/monts /etc/mtab" somewhere in the bootup after
the pivot_root call.

Another solution, which have been claimed not to be good
is to let /etc/mtab be a symbolic link to /proc/mounts.
I vote for that solution, if there is any problems with
that they should be fixed by changing the proc filesystem.

-- 
Kasper Dupont

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

From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: The value of HZ
Date: Sat, 27 Jan 2001 14:06:10 +0100

Grant Edwards wrote:
> 
> In article <Pine.GSO.BU-L4.10.10101242151370.16628-100000@bingsun2>, Zhihui Zhang 
>wrote:
> >> In article <Pine.GSO.BU-L4.10.10101241710030.23437-100000@bingsun2>,
> >> Zhihui Zhang <[EMAIL PROTECTED]> wrote:
> >>
> >> > Can anyone explain to me how the value of HZ is set and used in Linux? I
> >> > do not have much time to go over the source, but I guess it should be
> >> > equal to 1 second. Thanks.
> >>
> >> Clock ticks per second. It's system-dependent. 100 is a typical value,
> >> though Alpha, for example, uses 1024.
> >
> >Why value on Alpha is more than 10 times higher?
> 
> They're just showing off.  They (unlike we Intel victems)have computers with
> a non-braindead CPU architecture, and they've got to rub our noses in it.
> 
> Feh!
> 
> --
> Grant Edwards                   grante             Yow!  I'm in ATLANTIC CITY
>                                   at               riding in a comfortable
>                                visi.com            ROLLING CHAIR...

You can change the value in linux/include/asm/param.h.
On my AMD K6/2 350, I tried increasing it from 100 to
1000 and even 10000. The kernel still worked, but with
10000 proclib started complaining. I did use 1000 for
a while, I could use it for higher speed timers in
userspace programs and I also got more accurate CPU
usages in top. But unfortunately it turned out that I
could not use disk at once in cdrecord. There must be
some code somewhere either in the scsi drivers or in
cdrecord that assumes something about the value.

If you need higher speed timers just modify it and
recompile your kernel but be prepared that something
might not work.

-- 
Kasper Dupont

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

From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Access to beep (echo \a) on embedded system with no console
Date: Sat, 27 Jan 2001 14:22:05 +0100

[EMAIL PROTECTED] wrote:
> 
> Folks,
> 
>   I am building an embedded system, and putting together a custom
>   kernel.
> 
>   The hardware is an AMD 486 with 16 meg Flash memory disk, and PCMCIA,
>   where I am running a Lucent wireless card.
> 
>   I am short of space, and wish to have a minimal feature kernel.
> 
>   I wish to have access to the console beep, but I do not need a full
>   console.
> 
>   The hardware has a PC-compatible squeaker, that I want to be able
>   to squeak with 'echo \\a > /dev/console' or something in a shell
>   script.
> 
>   What are the kernel defines I need for the minimum configuration ?
> 
>   I have a single serial port, and wish to be able to log in
>   in emergency there, so I have the following defines,
> 
> CONFIG_SERIAL=y
> CONFIG_SERIAL_CONSOLE=y
> 
>   And I have a getty running from inittab - works great.
> 
>   But even this
> 
> CONFIG_VT=y
> CONFIG_VT_CONSOLE=y
> 
>   Will not let me beep.
> 
>   Suggestions ?
> 
> Cheers,     Andy!
> 
> Sent via Deja.com
> http://www.deja.com/

Try echoing something visible and see if it
appears on the serial line. If that is the
case then try using /dev/tty0 instead of
/dev/console.

It should be possible to beep with much less
than the entire VT, but I don't know how
much you have to mess with the code to do it.

-- 
Kasper Dupont

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

From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: 64-bit i-numbers?
Date: Sat, 27 Jan 2001 14:35:38 +0100

Peter Morreale wrote:
> 
> Has anyone looked at extending VFS' inode->i_ino to a long long?  (ie: 64-bits)
> 
> Can you share the pitfalls, etc you've found?
> 
> Thanks,
> -PWM

I can think of a few possible pitfalls if you
try to do it on a 32-bit architecture.

Long longs are usually implemented using some
lirbary code. That is not necesarily available
in the kernel.

Arguments and return values in systemcalls are
normally in registers which are only 32 bits.
You have to define new syscalls for the 64 bit
versions, and if structures are involved in
the syscall interface you might have to define
two different structures where the one is for
binary compatibility with older executables.
Otherwise you could have to recompile all
programs.

And consider what disasters could happen if
there are still 32-bit binaries left when you
actually have more than 2^31 inodes.

You will also have to verify that all
filesystems still work in the new environment.

On 64-bit architectures I would expect inode
numbers to be 64 bits from the very begining.

Personally I would hope that we get rid of
older 32 bit architectures before I get the
need for that many inodes.

-- 
Kasper Dupont

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

From: Kaelin Colclasure <[EMAIL PROTECTED]>
Subject: Re: Linux Kernel book about linux 2.0 still useful??
Date: 27 Jan 2001 07:25:04 -0800

Carfield Yim <[EMAIL PROTECTED]> writes:

> I have borrow a book of linux kernel call "Linux Kernel Internals"
> http://www.amazon.com/exec/obidos/ASIN/0201331438/qid=980587111/sr=2-
> 3/ref=sc_b_3/105-4344940-5085540
> 
> After scanning through the book, I find that it is a good written book.
> However, the kernel this book discussing is still 2.0, do I still worth
> to put time to read it?

IMO the book is excellent and well worth the time of anyone wanting to
explore the Linux kernel. If you're waiting for a book to be printed
that actually matches the ``current'' version of the Linux kernel, I
suspect Linux will be a historical footnote by then -- along with all
the hardware it presently runs on... :-)

-- Kaelin

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

From: [EMAIL PROTECTED] (Chris J/#6)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Controlling things on that other platform
Reply-To: [EMAIL PROTECTED]
Date: 27 Jan 2001 18:28:11 -0000

Henry Zektser <[EMAIL PROTECTED]> wrote:
>like that. Basically, I've gotten as far as monitoring if the boxen are up
>(ping is my friend). My question is, how can I control SQL Service activity,
>reboot the NT servers remotely, etc. from linux.
>

Have you had a look at VNC (http://www.uk.research.att.com/vnc/) it's a 
program a-la PC-Duo, PC-Anywhere et al, but multiplatform. However you
need to be running X on the client box to use it :)

It's quite good - use it at home & work - but maybe it gives the viewer too
much control over the machine?

Chris...

-- 
Chris Johnson            \  "If not for me then, do it for yourself. If not
[EMAIL PROTECTED]        \  for then do it for the world." -- Stevie Nicks
www.nccnet.co.uk/~sixie/   ~---------------------------------------+
Redclaw chat - http://redclaw.org.uk - telnet redclaw.org.uk 2000   \______

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

From: [EMAIL PROTECTED]
Subject: Re: booting CD, ramfs -> / in 2.4, some issues
Date: Sat, 27 Jan 2001 20:45:14 -0000

On Sat, 27 Jan 2001 13:35:53 +0100 Kasper Dupont <[EMAIL PROTECTED]> wrote:

| A quite good way to initialize /etc/mtab is by doing
| "cp /proc/monts /etc/mtab" somewhere in the bootup after
| the pivot_root call.

I could put that in my cdinit program before it hands off to
init, just in case the rc scripts don't initialize it.


| Another solution, which have been claimed not to be good
| is to let /etc/mtab be a symbolic link to /proc/mounts.
| I vote for that solution, if there is any problems with
| that they should be fixed by changing the proc filesystem.

My concern with that would be mount trying to write to it.
But if /proc/mounts discards writes, I guess it should work.
I've always disliked /etc/mtab since it's not assured to
represent what the kernel actually has mounted.  If mount
only acts to keep /etc/mtab in sync with /proc/mounts then
I think all is well (and old programs get to see what they
expect in /etc/mtab, too).

-- 
=================================================================
| Phil Howard - KA9WGN |   Dallas   | http://linuxhomepage.com/ |
| [EMAIL PROTECTED] | Texas, USA | http://phil.ipal.org/     |
=================================================================

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

From: "knightG" <[EMAIL PROTECTED]>
Subject: Communication between kernel module and user space program
Date: Sat, 27 Jan 2001 00:59:55 +0100

Hello, we've been trying to establish somekind of connection between kernel
and USP(user space programm).
We've decided to use a character device.
The problem is that USP has to read from characted device all the time,
which is stupid.We've tried using SELECT however it doesn't seem to have any
effect because select seems to check if he MAY read the data not checking
the changes.

Does anyone has experience with our program ? Are there any other solutions
for it ?


Thank you in advance,
Gregor Doltar



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

From: [EMAIL PROTECTED]
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Controlling things on that other platform
Date: 28 Jan 2001 00:02:02 +0000

"Henry Zektser" <[EMAIL PROTECTED]> writes:

> I'm currently the sr. developer at a small company in the
> manufacturing field. All of their systems right now run on that
> other OS (ok, a mix of them). I'm slowly but surely trying to make
> converts out of them. My current pet project is to implement a
> linux-based system for monitoring our database and file servers (a
> bunch of them). Namely, I'm working on something rule-based. For
> example, I need to poll the MS SQL (7 and/or 2000) server at a set
> interval. If the machine is up, but the service isnt, try to start
> it, if it doesnt start, try to reboot the box and start it, if it
> doesnt come back up 5 min after the boot, page this person and this
> person. Something like that. Basically, I've gotten as far as
> monitoring if the boxen are up (ping is my friend). My question is,
> how can I control SQL Service activity, reboot the NT servers
> remotely, etc. from linux.

This probably isn't the advice you're looking for, but I'd choose
something else for your "evangelising" project. This app is trivial to
do from a Windows box using WMI & Windows Script Host - whatever you
implement under Linux is (IMHO) bound to be more complicated and more
painful. So when you get it all working your colleagues will look at
the, er, contraption you've produced and go "You want me to switch to
*this*?"

If you are determined to go ahead you might want to look into
SNMP. There's a Windows SNMP service you can run, and I'm pretty sure
you can control SQL from it, given some fiddling. There are doubtless
(?) SNMP utils/libraries for Linux.

--
Edwin


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

From: [EMAIL PROTECTED]
Subject: Re: How to build a USB rescue floppy disk
Date: Sun, 28 Jan 2001 01:50:55 GMT

Thanks, I'll give syslinux a try.

> Once booted from the floppy, getting the kernel to
> read or write a floppy will still be an issue.
This won't be a problem for me. Once linux is up,  I'll the rest of the
stuff off the network.



In article <[EMAIL PROTECTED]>,
  [EMAIL PROTECTED] wrote:
> On Sat, 27 Jan 2001 01:07:27 GMT [EMAIL PROTECTED] wrote:
>
> | Has anybody able to build a usb rescue floppy disk yet.
> |
> | I have a bios support that support booting from usb floppy (ie, it
can
> | boot DOS). I have a linux rescue floppy (that boot off regular
floppy).
> | But when I put the rescue floppy into the USB, the system fail to
boot.
> | Just wondering, if there are any special step that I need to do to
> | build
> | a usb floppy?
> |
> | Here is the error message that I got:
> | Loading ....
> | Uncompressing Linux
> | ran out of input data
> | -- System halt
>
> Try building the floppy image with syslinux.  Syslinux will load
> the kernel and initrd while still in x86 real mode and getting
> BIOS support to read the floppy.
>
> You can get syslinux from ftp.XX.kernel.org where XX is your
> country code to find the nearest mirror.  It's under utils.
> You may have to search for that since each mirror varies
> slightly in where things start.
>
> | I know kernel 2.4 support usb but when I look into the code I could
not
> | find anything specific to USB floppy.
>
> As long as the BIOS supports I/O to the floppy device just the same
> for a USB floppy, then it should work just fine for syslinux, which
> reads everything before jumping into the kernel.  Lilo does this, too,
> so that's another option.
>
> Once booted from the floppy, getting the kernel to read or write a
> floppy will still be an issue.
>
> --
> -----------------------------------------------------------------
> | Phil Howard - KA9WGN |   Dallas   | http://linuxhomepage.com/ |
> | [EMAIL PROTECTED] | Texas, USA | http://phil.ipal.org/     |
> -----------------------------------------------------------------
>


Sent via Deja.com
http://www.deja.com/

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

From: "The Linux Fan!!!" <[EMAIL PROTECTED]>
Subject: How to build...?
Date: Sun, 28 Jan 2001 01:28:18 +0100

How to rebuild an earlier created patch?
I have a patch for 2.2.14 kernel and I would like to rebuild it in order to
patch the new 2.4.0 kernel.
How can I do this?

The patch represents a V4L driver for my radio card.



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

From: "Norm Dresner" <[EMAIL PROTECTED]>
Subject: Re: The value of HZ
Date: Sun, 28 Jan 2001 02:56:04 GMT

If you really need a high clock in a module/driver, you might consider using
Real-Time Linux.  Out 90 MHz Pentium is loafing with a 1300 Hz kernel task
and associated user-space processing kicked off at each clock "tick" by a
message from the kernel to a user task through a (rt) fifo.  I know that
people have successfully used 10KHz real-time tasks even with modest
Pentium's
    http://www.rtlinux.org

    Norm


Kasper Dupont <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Grant Edwards wrote:
> >
> > In article <Pine.GSO.BU-L4.10.10101242151370.16628-100000@bingsun2>,
Zhihui Zhang wrote:
> > >> In article <Pine.GSO.BU-L4.10.10101241710030.23437-100000@bingsun2>,
> > >> Zhihui Zhang <[EMAIL PROTECTED]> wrote:
> > >>
> > >> > Can anyone explain to me how the value of HZ is set and used in
Linux? I
> > >> > do not have much time to go over the source, but I guess it should
be
> > >> > equal to 1 second. Thanks.
> > >>
> > >> Clock ticks per second. It's system-dependent. 100 is a typical
value,
> > >> though Alpha, for example, uses 1024.
> > >
> > >Why value on Alpha is more than 10 times higher?
> >
> > They're just showing off.  They (unlike we Intel victems)have computers
with
> > a non-braindead CPU architecture, and they've got to rub our noses in
it.
> >
> > Feh!
> >
> > --
> > Grant Edwards                   grante             Yow!  I'm in ATLANTIC
CITY
> >                                   at               riding in a
comfortable
> >                                visi.com            ROLLING CHAIR...
>
> You can change the value in linux/include/asm/param.h.
> On my AMD K6/2 350, I tried increasing it from 100 to
> 1000 and even 10000. The kernel still worked, but with
> 10000 proclib started complaining. I did use 1000 for
> a while, I could use it for higher speed timers in
> userspace programs and I also got more accurate CPU
> usages in top. But unfortunately it turned out that I
> could not use disk at once in cdrecord. There must be
> some code somewhere either in the scsi drivers or in
> cdrecord that assumes something about the value.
>
> If you need higher speed timers just modify it and
> recompile your kernel but be prepared that something
> might not work.
>
> --
> Kasper Dupont



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

From: "Norm Dresner" <[EMAIL PROTECTED]>
Subject: Re: Communication between kernel module and user space program
Date: Sun, 28 Jan 2001 02:57:45 GMT

What's wrong with having a thread devoted to reading from the device and
communicating with the remained of the program via global variables or the
usual IPC mechanisms?

    Norm

knightG <[EMAIL PROTECTED]> wrote in message
news:94vnb7$kvt$[EMAIL PROTECTED]...
> Hello, we've been trying to establish somekind of connection between
kernel
> and USP(user space programm).
> We've decided to use a character device.
> The problem is that USP has to read from characted device all the time,
> which is stupid.We've tried using SELECT however it doesn't seem to have
any
> effect because select seems to check if he MAY read the data not checking
> the changes.
>
> Does anyone has experience with our program ? Are there any other
solutions
> for it ?
>
>
> Thank you in advance,
> Gregor Doltar
>
>



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

From: MeekGeek <[EMAIL PROTECTED]>
Subject: Re: Sys call for Available Memory? - Attempts to help, but still no answer 
after months.  :-(
Date: Sun, 28 Jan 2001 03:04:13 GMT

On Sat, 08 Jul 2000 09:15:32 GMT, [EMAIL PROTECTED] wrote:

>On Sat, 08 Jul 2000 03:44:36 GMT MeekGeek <[EMAIL PROTECTED]> wrote:
>
>| Is there any kind of a standard system function that returns how much
>| memory is available?  I'd like to know what memory is available to my
>| process -- both the virtual memory available, and the physical memory
>| installed in the machine.
>|
>| I'm particularly interested in Solaris and Linux.  I found
>| rlimit(RLIMIT_VMEM, ...) for Solaris, but it's not supported under
>| Linux.
>| 
>| Is there a system call that returns the available (and total) system
>| memory under Linux?

>Use RLIMIT_AS.

Unfortuntely, that doesn't seem to return either total, or available
memory,  under either Solaris or Linux.  Instead, it returns the
available address space (thus "AS"), which tends to be 2.1GB all the
time.  I want to be able to do some engineering, based on total and
available memory in the machine at the time of my program starting.
This is actually fairly critical to my product.

The only way I have found to get the memory values is to use
Linux-specific entries in the /proc and then I have to parse those.
My program must run under several Unix variants.

Surely there is some (system) way to find out how much memory is
either installed or available!

Can someone help to point me at a system call for the free memory
value?  One that indicates only the free memory available for my
program is fine, even if that doesn't match what's free in the system.

What I'd really like is virtual memory *available,* and physical
memory total (installed memory).

Anybody?  Is this really such a difficult question?

Thanks,
M

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


** 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 by posting to the
comp.os.linux.development.system newsgroup.

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