Linux-Development-Sys Digest #224, Volume #8     Wed, 18 Oct 00 13:13:15 EDT

Contents:
  Re: registering with /proc fs (Josef Moellers)
  [Q] set up internal buffer size(fragment) of SoundCard (Bomshik Kim)
  Re: What is xchg used for? (Josef Moellers)
  [Q] set up internal buffer size(fragment) of SoundCard (Bomshik Kim)
  Raw partition access? (Erik Hensema)
  System Halt from Kernel Space (Stephen Rousset)
  Re: System Halt from Kernel Space (Greg Alexander)
  Re: basic question(s) on libc5 vs. libc6 (Erno Kuusela)
  problems compiling kernel module ("Keith")
  Re: System Halt from Kernel Space (Erik Hensema)
  Re: select() bug? (Pete Zaitcev)
  Re: select() bug? (Kaz Kylheku)
  Re: Signaling User Process From Device Driver. ([EMAIL PROTECTED])
  Re: ftp performence over wireless lan (Jerome Corre)
  How to turn off kloged and syslogd in my Linux? ("JESSEY")
  Re: select() bug? (Gary Scavone)

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

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: registering with /proc fs
Date: Wed, 18 Oct 2000 12:08:59 +0200

Keith wrote:
> =

> PROBLEM
> =

> I have an array of structures that I want to register with the /proc fi=
le
> system. How do I do this. I realize that a proc file has to be contruct=
ed
> (ie. ctl_table). My problem is representing an array of structures.

You register some functions with the proc filesystem, not data
structures as such.
These functions will be called whenever some process opens an entry in
the /proc FS and reads/writes data. The read functions are responsible
for preparing the data in a portable fashion, i.e. usually as text. The
write functions are responsible for accepting the data written and
acting upon them.

In the Linux source tree there are plenty of examples of how to do it.

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
        If failure had no penalty success would not be a prize (T. Pratchett)

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

From: Bomshik Kim <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,linux.dev.c-programming,alt.os.linux
Subject: [Q] set up internal buffer size(fragment) of SoundCard
Date: Wed, 18 Oct 2000 19:33:30 +0900



When I play voice data with /dev/dsp,
in some case, the voice wobbles and wavers. 
In first time, I think that it's network problem 
because voice is transmitted bia network.

But today, I test voice source as local source.
The same probles occur.

The process is like below.

1.Open /dev/dsp with O_RDWR
2.Setup full duplex :  ioctl( fh , SNDCTL_DSP_SETDUPLEX, 0) == -1
3.Setup fragments size : ioctl( fh, SNDCTL_DSP_SETFRAGMENT,&real_frag)==
-1
 the value of real_flag is 196618
                            = ( Sound_DesiredSize & 0x00ff ) |
                            ( ( Sound_DesiredFrags & 0x00ff ) << 16 );
                      Sound_DesiredSize  = 10; Sound_DesiredFrags = 3;  
4.Setup samples size : ioctl(fh, SNDCTL_DSP_SAMPLESIZE, &format) 
                       format = AFMT_S16_LE
5.Setup channel : ioctl( fh, SNDCTL_DSP_CHANNELS, &channels) == -1 
                  channels : mono
6.Setup Sampling rate :  ioctl( fh, SNDCTL_DSP_SPEED, &speed) == -1
                  speed : 8000
7.Read voice from /dev/dsp  and save it
8. Dummy Delay : sleep 5 
9.Write the saved voice to /dev/dsp

If I remove the step 8 , then the voice doesnot wobble.

Ok. Let's call  the 1~6 steps  setup_soundcard.
and manipulated process(below) does't make wobble-voice. strange...
(setup_soundcard -> read voice -> close file descriptor ->
setup_soundcard -> step 8 -> step 9)


Could you explain this reason?
I guess that some information left in internal soundcard buffer,
it still remains in buffer until writing voice. so that makes
voice wobble. Can I solve this problem by changing the fragment size 
of soundcard? 
(the value of real_flag) 

or Do I have to write mute-voice data when idle time(there is no
voice data to play back) ?

or Is there any ioctl method to solve this problem?

I already try to change the real_flag value. but It's useless.
When I write the voice data to /dev/dsp
I send 1024 bytes data to /dev/dsp and repeat.

Regard.


--
Bomshik Kim, M.S. Candidate   
Programming Language Lab.
Division of CS, Dept. of EECS, KAIST
http://ropas.kaist.ac.kr/~bskim



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

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: What is xchg used for?
Date: Wed, 18 Oct 2000 13:02:45 +0200

Pete Zaitcev wrote:
> =

> On Tue, 17 Oct 2000 16:33:29 +0800, wolf <[EMAIL PROTECTED]> wrote:
> > in asm/system.h there is a strange function xchg(a,b). It is used in
> > many places.
> > i am quite confused about the defination, and what use is it ?
> =

> It's an asm that invokes x86 XCHG instruction.
> Its definition may be found in any book about x86.
> Do not use it outside of platform dependent code.
> Other machines try to emulate it with varying success.
> For instance, sparc cannot atomically swap anything
> smaller than a 32 bits word.

Then use it on an atomic_t variable!
-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
        If failure had no penalty success would not be a prize (T. Pratchett)

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

From: Bomshik Kim <[EMAIL PROTECTED]>
Subject: [Q] set up internal buffer size(fragment) of SoundCard
Date: Wed, 18 Oct 2000 20:46:22 +0900




When I play voice data with /dev/dsp,
in some case, the voice wobbles and wavers. 
In first time, I think that it's network problem 
because voice is transmitted bia network.

But today, I test voice source as local source.
The same probles occur.

The process is like below.

1.Open /dev/dsp with O_RDWR
2.Setup full duplex :  ioctl( fh , SNDCTL_DSP_SETDUPLEX, 0) == -1
3.Setup fragments size : ioctl( fh, SNDCTL_DSP_SETFRAGMENT,&real_frag)== -1
 the value of real_flag is 196618
                            = ( Sound_DesiredSize & 0x00ff ) |
                            ( ( Sound_DesiredFrags & 0x00ff ) << 16 );
                      Sound_DesiredSize  = 10; Sound_DesiredFrags = 3;  
4.Setup samples size : ioctl(fh, SNDCTL_DSP_SAMPLESIZE, &format) 
                       format = AFMT_S16_LE
5.Setup channel : ioctl( fh, SNDCTL_DSP_CHANNELS, &channels) == -1 
                  channels : mono
6.Setup Sampling rate :  ioctl( fh, SNDCTL_DSP_SPEED, &speed) == -1
                  speed : 8000
7.Read voice from /dev/dsp  and save it
8. Dummy Delay : sleep 5 
9.Write the saved voice to /dev/dsp

If I remove the step 8 , then the voice doesnot wobble.

Ok. Let's call  the 1~6 steps  setup_soundcard.
and manipulated process(below) does't make wobble-voice. strange...
(setup_soundcard -> read voice -> close file descriptor ->
setup_soundcard -> step 8 -> step 9)


Could you explain this reason?
I guess that some information left in internal soundcard buffer,
it still remains in buffer until writing voice. so that makes
voice wobble. Can I solve this problem by changing the fragment size 
of soundcard? 
(the value of real_flag) 

or Do I have to write mute-voice data when idle time(there is no
voice data to play back) ?

or Is there any ioctl method to solve this problem?

I already try to change the real_flag value. but It's useless.
When I write the voice data to /dev/dsp
I send 1024 bytes data to /dev/dsp and repeat.

Regard.




--
Bomshik Kim, M.S. Candidate   
Programming Language Lab.
Division of CS, Dept. of EECS, KAIST
http://ropas.kaist.ac.kr/~bskim



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

From: [EMAIL PROTECTED] (Erik Hensema)
Subject: Raw partition access?
Date: Wed, 18 Oct 2000 13:58:08 +0200
Reply-To: [EMAIL PROTECTED]


Hi,

Is raw (uncached) partition access already implemented in Linux? I'd like
to use this interface in a cd-ripping/burning application to prevent
caching on the imagepartition. Caching of this information is quite
useless, since it's a sequential read/write of 600+ megs of data.

I hope not caching the image information will increase the responsiveness
of the system while burning CDR's.

I'm currently running 2.4.0-test9, but I'd also like to know if the
interface is in 2.2 or not.

-- 
Erik Hensema ([EMAIL PROTECTED])
Quoting-HOWTO: http://www.xs4all.nl/~hensema/quote/

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

From: Stephen Rousset <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.embedded
Subject: System Halt from Kernel Space
Date: Wed, 18 Oct 2000 12:48:51 GMT

  Does anyone know how to do a graceful "shutdown" or halt from kernel
 space in the 2.4 kernel?  I can do a machine_restart() [file process.c]

 which performs a triple fault and resets the processor.  But what I
really
 want is to do the equivalent of the command "sync;halt".  I see how to
do it in
 user space, but even in process.c there is no code for machine_halt()
for the
 i386 architecture.  We are also not running any power management (apm
or acpi).

 Any feedback would be appreciated,

 Stephen

--
==============================================
= It's not Rocket Science, It's RocketLogix. =
==============================================
Stephen P. Rousset
Founding Member, Technical Staff
Manager Firmware Development
RocketLogix, Inc.
Wk: (972)930-1130
Fx: (972)930-1199
[EMAIL PROTECTED]
www.rocketlogix.com




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

From: [EMAIL PROTECTED] (Greg Alexander)
Crossposted-To: comp.os.linux.embedded
Subject: Re: System Halt from Kernel Space
Date: 18 Oct 2000 13:53:35 GMT

In article <[EMAIL PROTECTED]>, Stephen Rousset wrote:
>  Does anyone know how to do a graceful "shutdown" or halt from kernel
> space in the 2.4 kernel?  I can do a machine_restart() [file process.c]
>
> which performs a triple fault and resets the processor.  But what I
>really
> want is to do the equivalent of the command "sync;halt".  I see how to
>do it in
> user space, but even in process.c there is no code for machine_halt()
>for the
> i386 architecture.  We are also not running any power management (apm
>or acpi).
>
> Any feedback would be appreciated,

See (at least in linux-2.2.14) drivers/char/sysrq.c   it has a
        case 's': /* S -- emergency sync */
case that I think you will be interested in.
There's lots of good stuff in there actually.

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

From: Erno Kuusela <[EMAIL PROTECTED]>
Subject: Re: basic question(s) on libc5 vs. libc6
Date: 18 Oct 2000 17:03:13 +0300

>>>>> "elleron" == elleron  <[EMAIL PROTECTED]> writes:

 | glibc 2 is libc6. The previous version of libc was libc5. (ie, they
 | restarted the numbers when they changed from calling it libc to glibc)

that's a bit of a simplification...

the libc used in gnu/linux systems before gnu libc 2 was based on gnu
libc 1.x, but was extensively hacked up since gnu libc wasn't
apparently quite complete at the time.

this was "libc 5" and earlier - the shared library filename
and the version number were the same.

later, when gnu libc became more complete and version 2 was released,
the maintainance of the linux-specific fork was dropped. the
shared library was named (on gnu/linux systems) "libc.so.6".

   -- erno

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

From: "Keith" <[EMAIL PROTECTED]>
Subject: problems compiling kernel module
Date: Wed, 18 Oct 2000 10:25:27 -0400

I'm trying to compile a kernel module and for some reason I'm getting parse
error before a bunch of structures defined in the types.h file. This file is
included along with kernel.h, module.h, proc_fs.h. I tried re-arranging the
order.

I am using this to compile the module
   gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c proc_entry.c

Help!!




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

From: [EMAIL PROTECTED] (Erik Hensema)
Crossposted-To: comp.os.linux.embedded
Subject: Re: System Halt from Kernel Space
Date: Wed, 18 Oct 2000 15:55:27 +0200
Reply-To: [EMAIL PROTECTED]

Stephen Rousset ([EMAIL PROTECTED]) wrote:
>  Does anyone know how to do a graceful "shutdown" or halt from
> kernel space in the 2.4 kernel?  I can do a machine_restart() [file
> process.c]

> which performs a triple fault and resets the processor.  But what I
>really want is to do the equivalent of the command "sync;halt".  I see
>how to do it in user space, but even in process.c there is no code for
>machine_halt() for the i386 architecture.  We are also not running any
>power management (apm or acpi).

> Any feedback would be appreciated,

Just disable interrupts and go to an endless loop. This will effectively
lock up the machine, which is what you want.

-- 
Erik Hensema ([EMAIL PROTECTED])
Quoting-HOWTO: http://www.xs4all.nl/~hensema/quote/

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

From: [EMAIL PROTECTED] (Pete Zaitcev)
Subject: Re: select() bug?
Date: Wed, 18 Oct 2000 15:46:00 GMT

On Wed, 18 Oct 2000 08:04:24 +0200, St. Otto <[EMAIL PROTECTED]> wrote:
> Gary Scavone wrote:
> > ......  Name it something like "test.c" and compile (cc -o test
> > test.c).
> 
> Never use "test" as name of a prog. There is a "test" in /usr/bin.
> 
> Steffen

Study the output of "man sh" and learn to use ./test :)

--Pete

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

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: select() bug?
Reply-To: [EMAIL PROTECTED]
Date: Wed, 18 Oct 2000 15:42:26 GMT

On Wed, 18 Oct 2000 09:01:01 +0200, Raimo Kangassalo <[EMAIL PROTECTED]>
wrote:
>  Try to move these lines inside the for loop
>
>  FD_ZERO(&mask);
>  FD_SET(fileno(stdin), &mask);
>  maxfd = fileno(stdin);

Incorrect advice. He has created a mask beforehand which he copies with an
assignment statement at each loop iteration. (Whether copying fd_set objects
is portable is another matter, but it works when fd_set is a struct.)

Also, you don't actually expect fileno(stdin) to produce more than one value in
a program that does not call freopen() on stdin?

-- 
Any hyperlinks appearing in this article were inserted by the unscrupulous
operators of a Usenet-to-web gateway, without obtaining the proper permission
of the author, who does not endorse any of the linked-to products or services.

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

From: [EMAIL PROTECTED]
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Signaling User Process From Device Driver.
Date: Wed, 18 Oct 2000 16:31:08 -0000

In article <[EMAIL PROTECTED]>,
Edward G. Weite III <[EMAIL PROTECTED]> wrote:

>Solaris has a  nice call that knows the path to the process that has a
>device open, and allows you to
>send a signal ( SIGUSR1, SIGURG, etc.) to that process. This allows you
>to send a signal to a user process
>from the kernel code.  Can someone help me with some example code
>either using a named pipe or some IPC
>code that will allow me to replace this solaris call in a port that I am
>doing. Maybe launching a  seect()  in a thread on the device. would be a
>way.

Try "grep SIG /usr/src/linux/drivers/char/*.c"

--
http://www.spinics.net/linux

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

From: Jerome Corre <[EMAIL PROTECTED]>
Subject: Re: ftp performence over wireless lan
Date: Wed, 18 Oct 2000 16:26:44 GMT

In article <[EMAIL PROTECTED]>,
  [EMAIL PROTECTED] wrote:
> On Tue, 17 Oct 2000 12:14:41 -0500, Matthew Patterson
<[EMAIL PROTECTED]> wrote:
>
> [ Please don't top-post! Replies go below the quotes. ]
>
> >Jerome Corre wrote:
> >>
> >>  hi,
> >>
> >> I have set up a wireless lan between two pc (both running redhat
6.1)
> >> using two Wavelan IEEE turbo (now call orinico) and two range
extender.
> >>
> >> I wanted to test what sort of speed i could get over the wireless
link,
> >> using ftp if first tryed 'get a22kfile /dev/null' I get rate
between
> >> 100kbyte per sec and 640kbyte per sec. which i am happy with
> >>
> >> but when i try bigger file the performance goes down completely:
> >> 'get a300kfile /dev/null' or 'get a 1Mfile /dev/null' give rates
around
> >> 1kbyte per second, and i can't figure out what the problem is?
> >>
> >> I have look through old post in the newsgroup but could not find
> >> anything useful.
> >
> >something that i've noticed about ftp: when you do a transfer, if
the actual
> >transfer takes less than 1 second, the transfer rate is completely
inaccurate.
> >However, when you do a transfer that takes more than one second, it
gives a more
> >accurate report.
>
> Not quite. Only the measurement of an FTP send is grossly inaccurate
for small
> transfers, because you are really measuring the bandwidth between FTP
and your
> kernel's network buffers. The measurement of FTP receives is better,
because it
> measures the actual rate of arrival of bytes into the FTP client. The
kernel
> does not delay the forwarding of received data to the application
unless there
> are holes in it due to dropped or out of order frames; it's not going
to block
> receives until it has a large chunk and then deliver it all at once.
Note that
> the article you are replying to is talking about receive (ftp get)
> measurements. A 1K per second link is normally not going to look like
100K per
> second on small file receives!
>
> I would suggest this: use a network analysis tool like tcpdump or
Ethereal to
> see what is going on. It sounds like there are errors on the link
which are
> slowing down the transfer.  When a TCP connection starts, it is in a
> congestion-avoiding slow start mode, which could explain why tiny
files are
> transferred quickly; it could be that the error rate goes up when the
network
> is asked to work harder. Or there could be intermittent problems with
the
> datalink; rare enough to allow a small file to quickly sneak through,
but
> frequent enough to cause a serious interference with large
transfers.  Another
> thing to try is to just use the old fashioned FTP client and turn on
the hash
> mark printing. This will tell you whether you are getting a
continuous receive,
> or whether it comes in large, fast bursts interrupted by stalls. The
latter
> indicate datalink problems.
>

thanks for the advice i have installed ethereal and i am looking at it
now, I have notice something else which might help to find the problem.
When i start an ftp session (using 'ftp server'), I get the message
'Connected to server' but then i take a good 1-2 minute before i get
another line of text with the name of the server, the port the type of
server etc.. and a line asking me for a login name.
Are the two problem related or is this just something else?
i'll post the result from using ethereal later

thanks for any help

Jerome

Jerome Corre


Sent via Deja.com http://www.deja.com/
Before you buy.

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

From: "JESSEY" <[EMAIL PROTECTED]>
Subject: How to turn off kloged and syslogd in my Linux?
Date: Thu, 19 Oct 2000 00:41:39 +0800

Deat All:
How to turn off kloged and syslogd in my Linux?
I don't hope kloged and syslogd running  in my startup.
regards



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

From: Gary Scavone <[EMAIL PROTECTED]>
Subject: Re: select() bug?
Date: Wed, 18 Oct 2000 09:57:28 -0700


I think Kaz nailed the problem ... thanks.  Unfortunately for me, I
can't use select() for non-blocking stdin polling (without reading all
available messages at once) as I originally intended, but I can think
of at least one work-around.

--gary scavone

On Tue, 17 Oct 2000, Kaz Kylheku wrote:

>>Note that it's possible for the stdin stream to have buffered input data
>>ready, and for the underlying descriptor to have nothing. Your loop will
>>then ignore the buffered data until more data arrives on the descriptor.
>>
>>It then looks like select() is not working; you know there is more data,
>>but why isn't select reporting it? Because the standard I/O library has
>>already snarfed it into the stream's buffer.
>>
>>The right thing to do is to make the socket non-blocking. Whenver it selects
>>positive for input, use getc() or fgets() or whatever to read *all* of the
>>input, until these functions indicate a failure due to EWOULDBLOCK. Then do
>>clearerr(stdin) to reset the streams error indicator, and select on the file
>>descriptor for another round of the same thing.
>>
>>Whenever you mix higher level input buffering with select() or poll() on the
>>low level descriptor, you must ensure that the two are in sync.
>>
>>-- 
>>Any hyperlinks appearing in this article were inserted by the unscrupulous
>>operators of a Usenet-to-web gateway, without obtaining the proper permission
>>of the author, who does not endorse any of the linked-to products or services.
>>


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


** 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