Linux-Development-Sys Digest #223, Volume #8 Wed, 18 Oct 00 05:13:08 EDT
Contents:
Re: What is Linux equivalent of Mac Toolbox? (Thatcher Ulrich)
Re: What is Linux equivalent of Mac Toolbox? (Dave Platt)
select() bug? (Gary Scavone)
Re: select() bug? (Pete Zaitcev)
Re: select() bug? (Kaz Kylheku)
What is xchg used for? (wolf)
handle_scancode() (Mike McDonald)
Acer CD-rewriter (Willie)
Re: What is xchg used for? (Pete Zaitcev)
Re: What is xchg used for? (The Ghost In The Machine)
Signaling User Process From Device Driver. ("Edward G. Weite III")
Re: handle_scancode() (Mike McDonald)
Re: select() bug? ("St. Otto")
Re: select() bug? (Raimo Kangassalo)
Re: select() bug? (Villy Kruse)
printk vs syslogd ?? (NortonNg)
Re: printk vs syslogd ?? ("[EMAIL PROTECTED]")
----------------------------------------------------------------------------
Crossposted-To: comp.os.linux.x,comp.os.linux.development.apps
From: Thatcher Ulrich <[EMAIL PROTECTED]>
Subject: Re: What is Linux equivalent of Mac Toolbox?
Date: Tue, 17 Oct 2000 19:20:50 GMT
John Hasler <[EMAIL PROTECTED]> wrote:
>
> I don't know what "bluster" you are referring to, but if "pragmatic" means
> "I want to use Qt in a closed source project", I don't see why you
> shouldn't have to pay Troll.
Stop! Pay Troll.
--
Thatcher Ulrich
http://tulrich.com
------------------------------
From: [EMAIL PROTECTED] (Dave Platt)
Crossposted-To: comp.os.linux.x,comp.os.linux.development.apps
Subject: Re: What is Linux equivalent of Mac Toolbox?
Date: Tue, 17 Oct 2000 19:38:58 -0000
In article <[EMAIL PROTECTED]>,
Thatcher Ulrich <[EMAIL PROTECTED]> wrote:
>> I don't know what "bluster" you are referring to, but if "pragmatic" means
>> "I want to use Qt in a closed source project", I don't see why you
>> shouldn't have to pay Troll.
>
>Stop! Pay Troll.
drop bear
--
Dave Platt [EMAIL PROTECTED]
Visit the Jade Warrior home page: http://www.radagast.org/jade-warrior/
I do _not_ wish to receive unsolicited commercial email, and I will
boycott any company which has the gall to send me such ads!
------------------------------
From: Gary Scavone <[EMAIL PROTECTED]>
Subject: select() bug?
Date: Tue, 17 Oct 2000 15:32:35 -0700
I'm not sure if this is the appropriate forum to report possible bugs,
but I think I have one when using the select() function.
I'll describe the behavior here ... example code which demonstrates
this behavior is given at the bottom.
I have a Tcl/Tk GUI which spits out "control" messages to stdout, one
line per message. I have another application which polls stdin using
select (timeout = zero, reset to zero each time) to receive the
control messages.
When the GUI spits out multiple messages at once, select() initially
reports stdin activity and I can read the first message with fgets().
In my app, I only handle one message at a time. On a subsequent call
to select(), however, it retuns zero, indicating no messages to be
read (when I know there are more there). A subsequent message from the
GUI then triggers the correct behavior and all messages are eventually
read. However, another sudden group of messages sent to stdout will
produce the same behavior again.
Here's example code. The c program to read in messages from stdin is
first. Name it something like "test.c" and compile (cc -o test
test.c). The Tcl/Tk GUI is after that. Name it something like
"test.tcl" and test it by running "wish < test.tcl". Finally, put
them together to see what I'm talking about (wish < test.tcl | test).
**************************************************
/* Select() test program ... reads from stdin. Type "Exit" to
quit. */
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/time.h>
int main()
{
fd_set mask, rmask;
struct timeval timeout = {0, 0};
int maxfd;
char message[256];
FD_ZERO(&mask);
FD_SET(fileno(stdin), &mask);
maxfd = fileno(stdin);
for (;;) {
rmask = mask;
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select(maxfd+1, &rmask, (fd_set *)0, (fd_set *)0, &timeout)) {
memset(message, 0, 256);
if (FD_ISSET(fileno(stdin), &rmask)) {
fgets(message, 256, stdin);
if (!strncmp(message, "Exit", 4))
break;
else
printf("%s", message);
}
}
usleep(100000);
}
return 0;
}
*****************************************************
Here's a simple Tcl/Tk GUI to test things with:
*****************************************************
# Tcl/Tk GUI for testing select() function
# Configure main window
wm title . "Test GUI"
. config -bg black
# Configure "note-on" buttons
frame .buttons -bg black
button .buttons.one -text "One Message" -bg grey66 -command { one }
button .buttons.many -text "Many Messages" -bg grey66 -command { many
}
button .buttons.exit -text "Exit Program" -bg grey66 -command myExit
pack .buttons.one -side left -padx 5
pack .buttons.many -side left -padx 5 -pady 10
pack .buttons.exit -side left -padx 5 -pady 10
pack .buttons
# Bind an X windows "close" event with the Exit routine
bind . <Destroy> +myExit
proc myExit {} {
puts stdout [format "ExitProgram"]
flush stdout
close stdout
exit
}
proc one {} {
puts stdout "One Message here"
flush stdout
}
proc many {} {
puts stdout "Many messages here"
flush stdout
puts stdout "Many messages here"
flush stdout
puts stdout "Many messages here"
flush stdout
puts stdout "Many messages here"
flush stdout
puts stdout "Many messages here"
flush stdout
}
**************************************************
*******************************************************
* Gary Scavone *
* Center for Computer Research in Music & Acoustics *
* Stanford University *
* [EMAIL PROTECTED] *
* http://www-ccrma.stanford.edu/~gary/ *
*******************************************************
------------------------------
From: [EMAIL PROTECTED] (Pete Zaitcev)
Subject: Re: select() bug?
Date: Tue, 17 Oct 2000 22:54:17 GMT
>[...]
> When the GUI spits out multiple messages at once, select() initially
> reports stdin activity and I can read the first message with fgets().
> In my app, I only handle one message at a time. On a subsequent call
> to select(), however, it retuns zero, indicating no messages to be
> read (when I know there are more there). [...]
Use fflush() in your GUI.
BTW, the right group is comp.os.linux.development.apps.
--Pete
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: select() bug?
Reply-To: [EMAIL PROTECTED]
Date: Tue, 17 Oct 2000 22:55:17 GMT
On Tue, 17 Oct 2000 15:32:35 -0700, Gary Scavone <[EMAIL PROTECTED]>
wrote:
>
>I'm not sure if this is the appropriate forum to report possible bugs,
>but I think I have one when using the select() function.
That is extremely unlikely. There is a bug in your code.
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.
------------------------------
From: wolf <[EMAIL PROTECTED]>
Subject: What is xchg used for?
Date: Tue, 17 Oct 2000 16:33:29 +0800
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 ?
------------------------------
Reply-To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED] (Mike McDonald)
Subject: handle_scancode()
Date: Tue, 17 Oct 2000 23:08:25 GMT
I'm having difficulties getting a PS2 keyboard driver to work correctly and
have some questions about handle_scancodes(). I haven't been able to locate
any documentation so any pointers would be appreciated.
The prototype is void handle_scancode(unsigned char scancode, int down).
I'm assuming down is non zero for a key press and zero for the release.
Correct?
What encoding is the scancode suppose to be? Are they XT or AT or something
else?
Mike McDonald
[EMAIL PROTECTED]
------------------------------
From: Willie <[EMAIL PROTECTED]>
Subject: Acer CD-rewriter
Date: Tue, 17 Oct 2000 23:10:05 -0000
I am getting the message buffer underrun while trying to copy a disc. I
have no idea what this is caused from. The re-writer was working fine in
another case but will not copy after changing cases. It says not able to
read fast enough. Any ideas would be appreciated. Thanks Willie
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
From: [EMAIL PROTECTED] (Pete Zaitcev)
Subject: Re: What is xchg used for?
Date: Wed, 18 Oct 2000 00:14:22 GMT
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.
--Pete
------------------------------
From: [EMAIL PROTECTED] (The Ghost In The Machine)
Subject: Re: What is xchg used for?
Date: Wed, 18 Oct 2000 01:06:35 GMT
In comp.os.linux.development.system, wolf
<[EMAIL PROTECTED]>
wrote
on Tue, 17 Oct 2000 16:33:29 +0800
<[EMAIL PROTECTED]>:
>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 basically a swap implemented in assembly. The 'xchg'
x86 instruction swaps its two operands, and can take a byte,
a word (short), or a longword (long).
--
[EMAIL PROTECTED] -- insert random misquote here
------------------------------
From: "Edward G. Weite III" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Signaling User Process From Device Driver.
Date: Wed, 18 Oct 2000 01:03:52 -0400
High All and TIA
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.
--
Motto:
" Win2000 virus found on /dev/hda1 formatting ..... "
- Please respond to [EMAIL PROTECTED]
------------------------------
Reply-To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED] (Mike McDonald)
Subject: Re: handle_scancode()
Date: Wed, 18 Oct 2000 05:58:20 GMT
In article <JZ4H5.947$[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Mike McDonald) writes:
> I'm assuming down is non zero for a key press and zero for the release.
> Correct?
Yes.
> What encoding is the scancode suppose to be? Are they XT or AT or something
> else?
The scancode is an XT based scancode. linux/drivers/char/q40_keyb.c is the
only driver I could find that translates from AT scancodes to XT scancodes.
For a list of XT and AT scancodes, check out
http://www.repairfaq.org/filipg/LINK/PORTS/F_Keyboard_FAQ.html#KEYBOARDFAQ_028
Mike McDonald
[EMAIL PROTECTED]
------------------------------
From: "St. Otto" <[EMAIL PROTECTED]>
Subject: Re: select() bug?
Date: Wed, 18 Oct 2000 08:04:24 +0200
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
------------------------------
From: Raimo Kangassalo <[EMAIL PROTECTED]>
Subject: Re: select() bug?
Date: Wed, 18 Oct 2000 09:01:01 +0200
Try to move these lines inside the for loop
FD_ZERO(&mask);
FD_SET(fileno(stdin), &mask);
maxfd = fileno(stdin);
Gary Scavone wrote:
>
> I'm not sure if this is the appropriate forum to report possible bugs,
> but I think I have one when using the select() function.
>
> I'll describe the behavior here ... example code which demonstrates
> this behavior is given at the bottom.
>
> I have a Tcl/Tk GUI which spits out "control" messages to stdout, one
> line per message. I have another application which polls stdin using
> select (timeout = zero, reset to zero each time) to receive the
> control messages.
>
> When the GUI spits out multiple messages at once, select() initially
> reports stdin activity and I can read the first message with fgets().
> In my app, I only handle one message at a time. On a subsequent call
> to select(), however, it retuns zero, indicating no messages to be
> read (when I know there are more there). A subsequent message from the
> GUI then triggers the correct behavior and all messages are eventually
> read. However, another sudden group of messages sent to stdout will
> produce the same behavior again.
>
> Here's example code. The c program to read in messages from stdin is
> first. Name it something like "test.c" and compile (cc -o test
> test.c). The Tcl/Tk GUI is after that. Name it something like
> "test.tcl" and test it by running "wish < test.tcl". Finally, put
> them together to see what I'm talking about (wish < test.tcl | test).
>
> **************************************************
>
> /* Select() test program ... reads from stdin. Type "Exit" to
> quit. */
>
> #include <stdio.h>
> #include <sys/types.h>
> #include <unistd.h>
> #include <sys/time.h>
>
> int main()
> {
> fd_set mask, rmask;
> struct timeval timeout = {0, 0};
> int maxfd;
> char message[256];
>
> FD_ZERO(&mask);
> FD_SET(fileno(stdin), &mask);
> maxfd = fileno(stdin);
>
> for (;;) {
> rmask = mask;
> timeout.tv_sec = 0;
> timeout.tv_usec = 0;
>
> if (select(maxfd+1, &rmask, (fd_set *)0, (fd_set *)0, &timeout)) {
>
> memset(message, 0, 256);
>
> if (FD_ISSET(fileno(stdin), &rmask)) {
> fgets(message, 256, stdin);
> if (!strncmp(message, "Exit", 4))
> break;
> else
> printf("%s", message);
> }
> }
>
> usleep(100000);
> }
>
> return 0;
> }
>
> *****************************************************
>
> Here's a simple Tcl/Tk GUI to test things with:
>
> *****************************************************
> # Tcl/Tk GUI for testing select() function
>
> # Configure main window
> wm title . "Test GUI"
> . config -bg black
>
> # Configure "note-on" buttons
> frame .buttons -bg black
>
> button .buttons.one -text "One Message" -bg grey66 -command { one }
> button .buttons.many -text "Many Messages" -bg grey66 -command { many
> }
> button .buttons.exit -text "Exit Program" -bg grey66 -command myExit
> pack .buttons.one -side left -padx 5
> pack .buttons.many -side left -padx 5 -pady 10
> pack .buttons.exit -side left -padx 5 -pady 10
>
> pack .buttons
>
> # Bind an X windows "close" event with the Exit routine
> bind . <Destroy> +myExit
>
> proc myExit {} {
> puts stdout [format "ExitProgram"]
> flush stdout
> close stdout
> exit
> }
>
> proc one {} {
> puts stdout "One Message here"
> flush stdout
> }
>
> proc many {} {
> puts stdout "Many messages here"
> flush stdout
> puts stdout "Many messages here"
> flush stdout
> puts stdout "Many messages here"
> flush stdout
> puts stdout "Many messages here"
> flush stdout
> puts stdout "Many messages here"
> flush stdout
> }
>
> **************************************************
>
> *******************************************************
> * Gary Scavone *
> * Center for Computer Research in Music & Acoustics *
> * Stanford University *
> * [EMAIL PROTECTED] *
> * http://www-ccrma.stanford.edu/~gary/ *
> *******************************************************
------------------------------
From: [EMAIL PROTECTED] (Villy Kruse)
Subject: Re: select() bug?
Date: 18 Oct 2000 07:07:23 GMT
On Tue, 17 Oct 2000 15:32:35 -0700,
Gary Scavone <[EMAIL PROTECTED]> wrote:
> if (select(maxfd+1, &rmask, (fd_set *)0, (fd_set *)0, &timeout)) {
>
> memset(message, 0, 256);
>
> if (FD_ISSET(fileno(stdin), &rmask)) {
> fgets(message, 256, stdin);
Testing the result of fgets is mandatory here. You might get an EOF
condition in which case you don't know the contents of message.
> if (!strncmp(message, "Exit", 4))
> break;
> else
> printf("%s", message);
> }
Villy
------------------------------
From: NortonNg <[EMAIL PROTECTED]>
Subject: printk vs syslogd ??
Date: Wed, 18 Oct 2000 07:33:04 +0000 (UTC)
hi,
i found that my syslog always have these ugly logs. I think that were
cause by printk(KERN_INFO ), but how to solve it?
i am using RedHat 7.0 with official kernel 2.2.16, egcs 2.91.66.
Oct 18 15:31:06 firewall kernel: <6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
<6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
<6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
<6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
<6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
<6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
<6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
<6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
------------------------------
From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
Subject: Re: printk vs syslogd ??
Date: Wed, 18 Oct 2000 10:48:07 +0200
Hi,
I think this is when no end of line is given in the printk
it this is printk(KERN_ERR "" ); in a loop.
find this offending statement and change it to printk(KERN_ERR "\n" );
Then submit a patch.
Richard.
NortonNg wrote:
>
> hi,
> i found that my syslog always have these ugly logs. I think that were
> cause by printk(KERN_INFO ), but how to solve it?
> i am using RedHat 7.0 with official kernel 2.2.16, egcs 2.91.66.
>
> Oct 18 15:31:06 firewall kernel: <6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
> <6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
> <6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
> <6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
> <6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
> <6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
> <6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
> <6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6><6>
------------------------------
** 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
******************************