Linux-Development-Sys Digest #45, Volume #7 Thu, 12 Aug 99 02:14:30 EDT
Contents:
Re: moving driver to 2.2 (ellis)
Re: Device driver programming (ellis)
berzerko mouse from hell (Johan Kullstam)
Re: Can a process be "out schedualed" while in a system call? (ellis)
Caldera kernel really 2.2.5?? (Michael Kahl)
Re: can't compile SMP driver with -D__SMP__ in 2.2.X ([EMAIL PROTECTED])
Re: Code for security: chroot and child processes (Mike Khalili)
Re: processes (Karl Heyes)
Re: Can a process be "out schedualed" while in a system call? (Alexander Viro)
Re: Can a process be "out schedualed" while in a system call? (Kaz Kylheku)
Re: How to program PC-speaker to beep using C under Linux without being root? (Olav
Woelfelschneider)
Re: Can a process be "out schedualed" while in a system call? (Kaz Kylheku)
Re: How to program PC-speaker to beep using C under Linux without being root? (Kaz
Kylheku)
which mirror for Linux kernel (Phil Howard)
----------------------------------------------------------------------------
From: [EMAIL PROTECTED] (ellis)
Subject: Re: moving driver to 2.2
Date: 12 Aug 1999 00:15:44 GMT
In article <[EMAIL PROTECTED]>,
Joseph M Nemetz <[EMAIL PROTECTED]> wrote:
> I'm porting a driver I wrote for kernel 2.0 to 2.2 and am having
>problems extracing the correct
>MINOR # from the inode in the release method.
>Has the prototype changed?
Yes. Take a look at:
http://www.atnf.csiro.au/~rgooch/linux/docs/porting-to-2.2.html
--
http://www.fnet.net/~ellis/photo/linux.html
------------------------------
From: [EMAIL PROTECTED] (ellis)
Subject: Re: Device driver programming
Date: 12 Aug 1999 00:11:54 GMT
In article <[EMAIL PROTECTED]>, root <[EMAIL PROTECTED]> wrote:
> I am new to Red hat Linux...Even though I have done device drivers
>for NT and some embedded systems.. I am trying to write a dummy device
>driver....Can somebody point to resources that can help me
Here are some resources:
You can look at examples in the kernel source.
Writing Linux Device Drivers
href=http://www.redhat.com/~johnsonm/devices.html
Writing Character Device Driver for Linux
ftp://ftp.llp.fu-berlin.de/pub/linux/LINUX-LAB/whitepapers/drivers.ps.gz
Linux Device Drivers</b> by Alessandro Rubini, Andy Oram (Editor)
http://www.amazon.com/exec/obidos/ASIN/1565922921/ricksphotograpag
--
http://www.fnet.net/~ellis/photo/linux.html
------------------------------
Subject: berzerko mouse from hell
From: Johan Kullstam <[EMAIL PROTECTED]>
Date: 11 Aug 1999 20:12:00 -0400
i have a berzerko mouse from hell.
you may have seen some posts about this in the smp kernel list. i
didn't post there, but i have the same problem. the ps/2 mouse
doesn't work for me in X when in smp mode.
# cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3
0: 87911 77862 127247 87661 IO-APIC-edge timer
1: 56 60 39 56 IO-APIC-edge keyboard
2: 0 0 0 0 XT-PIC cascade
8: 0 1 0 1 IO-APIC-edge rtc
10: 7531 7537 7583 7575 IO-APIC-level aic7xxx
11: 3445 3527 3604 3576 IO-APIC-level eth0
12: 24 23 25 24 IO-APIC-level PS/2 Mouse
13: 1 0 0 0 XT-PIC fpu
NMI: 0
ERR: 0
when i enter X and move/use the mouse, the screen freezes and the
keyboard usually locks. if i am lucky, i can initiate a shutdown from
an rxvt i have displayed on a nearby networked box. sometimes even
this is dead and i must punch the hardware reset button.
scrounging about in the newsgroups/mailing lists indicates that people
believe this is some sort of PIC flavor or timer issue.
the system works fine in uniproc mode where all interrupts are XT-PIC.
i guess i could set `noapic' at boot. however, i have a multi-cpu box
and i do not wish to punish things that do work, e.g., scsi and ether
cards. it'd be nice to have X windows working. when i'm outside of
X, everything is fine.
there are various hints as to the existance of a kernel patch which
would allow making the PIC setting of an individual IRQ. i searched
but couldn't find it. i wasn't able to comprehend
linux/arch/i386/kernel/irq.c enough on my own to do anything useful.
the machine is an alr revolution quad6. it has four ppro-200s. i can
post more info if anyone wants.
--
J o h a n K u l l s t a m
[[EMAIL PROTECTED]]
Don't Fear the Penguin!
------------------------------
From: [EMAIL PROTECTED] (ellis)
Subject: Re: Can a process be "out schedualed" while in a system call?
Date: 12 Aug 1999 00:20:00 GMT
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote:
>If no here comes another question. In a charter device driver this was
>in the read function:
>while(lock & 0xBF ==0);
>If the contdition was true this would go on forever, right?
If it stayed true, you'd never leave the loop.
>Another question:
>What do the cli()/sti() pair do? disable intrerupts?
Yes.
--
http://www.fnet.net/~ellis/photo/linux.html
------------------------------
From: [EMAIL PROTECTED] (Michael Kahl)
Subject: Caldera kernel really 2.2.5??
Date: Wed, 11 Aug 1999 20:04:21 -0400
I'm running Caldera OpenLinux 2.2. The kernel claims to be 2.2.5; rpm -q
calls it 2.2.5-1. The other day Caldera came out with 2.2.5-2, which
turns out to be exactly the same as 2.2.5-1 except for a single additional
patch.
The patch in question came out with the 2.2.10 kernel, which got me
wondering, so I downloaded the source rpm and took it apart.
It turns out that it's not even a 2.2.5 kernel at all! It's a 2.2.4
kernel with a handful (not even most!) of the 2.2.5 patches, plus a slew
of additional patches. Some of these extra patches seem to be from later
kernels, but most come from god-knows-where.
Where does Caldera get off calling this a 2.2.5 kernel when it is missing
most of the 2.2.5 patches? Do I need all these additional patches? If I
want to upgrade my kernel, do I just start applying the official patches
from 2.2.6 on and hope for the best? Should I start by installing the
remainder of the 2.2.5 patches? Or should I just toss Caldera's patches
altogether and start clean with an officially released kernel? Will my
system even still work if I do that (Caldera may have modified other
components of the system to match their hacked-up kernel)?
Do these problems exist with other distros as well? What's a poor kernel
hacker to do?
Mike
======
Michael Kahl
<[EMAIL PROTECTED]>
------------------------------
From: [EMAIL PROTECTED]
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.hardware
Subject: Re: can't compile SMP driver with -D__SMP__ in 2.2.X
Date: Thu, 12 Aug 1999 01:35:33 GMT
Hi Robert !
Well, I can give you the reason why your first experiment fails. There
is simply no .config file in /usr/src/linux/. You need to go there and
type "make menuconfig". Make sure that the SMP option is set
appropriate. Then exit that program shit and viola you get a .config
file. Thats it ! What you are doing in the 2nd experiment is weird. I
believe there is not gonna be a reason after you did what I told you.
Question 2 can be answered like this: While compiling the file
/usr/include/linux/version.h will be used and inside you will find a
kernel version string containing unfortunately "2.2.5-15". So go ahead
ignore that warning and load with -f !
Cheers,
Matthias
In article <7nhj1a$l0j$[EMAIL PROTECTED]>,
"robert_c" <[EMAIL PROTECTED]> wrote:
> Hello:
>
> Could someone tell me the answer about compiling error in SMP
case(and I
> make two experiments for this problem).
>
> [Experiment1:]
>
> Question 1:
> when I compile a program(it works fine in kernel 2.0.X, ie. in UP)
> with -D__SMP__, gcc told me some errors like following.
>
> [root@robert MyDriver]# gcc -D__SMP__ -O -w -c MyDriver.c
> /usr/include/asm/smp.h: In function hard_smp_processor_id':
> In file included from /usr/include/linux/smp.h:11,
> from /usr/include/linux/sched.h:20,
> from MyDriver.h:23,------------------------->ie.
#include
> <linux/sched.h>
> /usr/include/asm/smp.h:209: APIC_BASE' undeclared (first use in this
> function)
> /usr/include/asm/smp.h:209: (Each undeclared identifier is reported
only
> once
> /usr/include/asm/smp.h:209: for each function it appears in.)
> /usr/include/asm/smp.h:209: APIC_ID' undeclared (first use in this
function)
> [root@robert MyDriver]#
>
============================================================================
> -----------------------------------------
> MyDriver.h like following.
>
> #ifndef __KERNEL__
> # define __KERNEL__
> #endif
> #ifndef MODULE
> # define MODULE
> #endif
>
> #include <linux/modules.h>
> #include <linux/sched.h>
> #include <linux/kernel.h>
> ............
>
> [Experiment 2:]
>
> But, when I make a change from -D__SMP__ (in compile time) to write
the
> definition inside MYDriver.h like following and try again, compiling
is OK,
> but insmod MYDriver.o has some error.
>
> MyDriver.h:
>
> #include <linux/config.h>
> #ifdef
>
CONFIG_SMP<-----------------------------------------------------------------
>
============================================================================
> -------
> #undef __SMP__ <----------------------
> #define __SMP__1<-----------------------
> #endif <----------------------
> #ifndef __KERNEL__
> # define __KERNEL__
> #endif
> #ifndef MODULE
> # define MODULE
> #endif
> ....
> +++++++++++++++++++++++++++++++++++++++++++++++++
> Error like this:
>
> [root@robert MyDriver]# gcc -O -w -c MyDriver.c
> <--------Compile OK.
> [root@robert MyDriver]# insmod -f Mydriver
> Warning: kernel-module version mismatch
> Question 2:
> ./MyDriver.o was compiled for kernel version
2.2.5-15<------Why UP,
> not SMP?(because I have define __SMP__ like above MyDriver.h
> while this kernel is version 2.2.5-15smp
>
> ./MyDriver.o: unresolved symbol schedule_timeout
> ./MyDriver.o: unresolved symbol request_region
> ./MyDriver.o: unresolved symbol kmalloc
> ./MyDriver.o: unresolved symbol unregister_chrdev
> ./MyDriver.o: unresolved symbol register_chrdev
> ./MyDriver.o: unresolved symbol release_region
> ./MyDriver.o: unresolved symbol boot_cpu_data
> ./MyDriver.o: unresolved symbol kfree
> ./MyDriver.o: unresolved symbol __verify_write
> ./MyDriver.o: unresolved symbol memcpy_fromfs
> ./MyDriver.o: unresolved symbol check_region
> ./MyDriver.o: unresolved symbol jiffies
> ./MyDriver.o: unresolved symbol printk
> ./MyDriver.o: unresolved symbol add_timer
>
> Question 3:
> And Why has many unresolved symbols like above? (I can't make sure it
is
> relavant with -DMODVERSIONS or not, because I didn't use -DMODVERSIONS
> option in compile time). I still make third experiment,ie. copy
MYDriver.o
> to /lib/modules/2.2.5-15smp/misc directory, and issues comand like:
> insmod -f MyDriver.o, but still fail.
>
> So, Could you give any advives.
>
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
From: [EMAIL PROTECTED] (Mike Khalili)
Crossposted-To: comp.os.linux.security,comp.os.linux.development.apps
Subject: Re: Code for security: chroot and child processes
Date: 12 Aug 1999 02:01:12 GMT
Reply-To: [EMAIL PROTECTED]
On Wed, 11 Aug 1999 16:59:14 -0700, Sean O'Dell <[EMAIL PROTECTED]> wrote:
>Thank you for your help! It works great, but now I've run into something
>else I'm not sure about. When the program is run, I use seteuid to change
>the uid of the process to the uid of the owner of the file interpreted by
>the program, for security reasons. I also chroot to the user's home
>directory, just for further safety. However, there are some functions to
>the program which I need to seteuid back to root and also see the file
>system hierarchy above where I chroot'ed (just temporarily). I haven't
>figured out how to "undo" the chroot...is it possible?
No, it is not. Once you chroot() you're stuck with it.
If I may offer a sugestion, if you have the means, pick up "Advanced
Programming in the Unix environment" by Richard Stevens. It's a really,
really good book, and answers all the questions you have asked.
------------------------------
From: Karl Heyes <[EMAIL PROTECTED]>
Subject: Re: processes
Date: Tue, 10 Aug 1999 13:34:45 +0100
James Stevenson wrote:
> Hi
>
> is there a system call under linux to find out what processes are running
> or do i need to parse the proc filesystem to get information on other processes
>
there is a libproc that you could use. not sure what thew funtions are but thats
what you are looking for.
karl.
------------------------------
From: [EMAIL PROTECTED] (Alexander Viro)
Subject: Re: Can a process be "out schedualed" while in a system call?
Date: 11 Aug 1999 22:57:13 -0400
In article <[EMAIL PROTECTED]>,
Kaz Kylheku <[EMAIL PROTECTED]> wrote:
>On Wed, 11 Aug 1999 14:57:13 GMT, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>>If no here comes another question. In a charter device driver this was
>>in the read function:
>>while(lock & 0xBF ==0);
>>If the contdition was true this would go on forever, right?
>
>If you cause an infinite loop in kernel code, you will hang the machine.
>The Linux kernel is non-preemptible. (Under SMP, if you cause an infinite loop
>in such a way that other processors are never prevented from entering any code,
>the system might remain runnable).
Yes, except that the bottom half may change the value of 'lock'. And unless you
are blocking interrupts the bottom halves may interrupt the upper half.
--
"You're one of those condescending Unix computer users!"
"Here's a nickel, kid. Get yourself a better computer" - Dilbert.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Can a process be "out schedualed" while in a system call?
Date: Thu, 12 Aug 1999 02:27:50 GMT
On Wed, 11 Aug 1999 14:57:13 GMT, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>If no here comes another question. In a charter device driver this was
>in the read function:
>while(lock & 0xBF ==0);
>If the contdition was true this would go on forever, right?
If you cause an infinite loop in kernel code, you will hang the machine.
The Linux kernel is non-preemptible. (Under SMP, if you cause an infinite loop
in such a way that other processors are never prevented from entering any code,
the system might remain runnable).
>Another question:
>What do the cli()/sti() pair do? disable intrerupts?
This used to be the case in the 2.0 kernels. Under SMP in 2.2, what happens is
that cli() and sti() work that way on a single processor kernel, but under SMP
are ``emulated'' in a kludgy way to provide backward compatibility. I believe
that there is a slight compromise: cli() under SMP will lock out all tasks from
the critical region, as well as any local interrupts (on the same processor).
But interrupts will still be able to happen on other processors. So it's not a
full lockout.
In contexts in which you don't know whether interrupts are already disabled
or not, you do this instead:
long flags;
save_flags(flags); cli();
/*...*/
restore_flags(flags);
In modern Linux code, you should use spinlocks instead. If you need to disable
and enable interrupts on the current processor use __cli() and __sti().
Or __save_flags(), __cli() and __restore_flags().
The spin_lock_irqsave() and spin_unlock_irqrestore() functions are nice because
they can be used to protect a critical region in any context. So you can easily
write code that can be reentered by another processor, or by an interrupt
happening on any processor. These functions use __save_flags(), __cli() and
__restore_flags() in order to gain atomicity on the local processor, and
acquire a spinlock to keep out other processors.
------------------------------
From: Olav Woelfelschneider <[EMAIL PROTECTED]>
Subject: Re: How to program PC-speaker to beep using C under Linux without being root?
Date: Wed, 11 Aug 1999 20:04:39 +0200
MyName <[EMAIL PROTECTED]> wrote:
M> as subject. thank you.
Too bad you didn't give a realname and real email address.
I wrote a program which plays melodies from commandline (You know,
GSM Phone quality...). Hedgehog song already included ;-)
You were close, but no cigar...
--
Olav "Mac" W�lfelschneider [EMAIL PROTECTED]
PGP fingerprint = 06 5F 66 B3 2A AD 7D 2D B7 19 67 3C 95 A7 9D AF
Wo (WO??) ist das Problem?
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Can a process be "out schedualed" while in a system call?
Date: Thu, 12 Aug 1999 03:14:15 GMT
On 11 Aug 1999 22:57:13 -0400, Alexander Viro <[EMAIL PROTECTED]> wrote:
>In article <[EMAIL PROTECTED]>,
>Kaz Kylheku <[EMAIL PROTECTED]> wrote:
>>On Wed, 11 Aug 1999 14:57:13 GMT, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>>>If no here comes another question. In a charter device driver this was
>>>in the read function:
>>>while(lock & 0xBF ==0);
>>>If the contdition was true this would go on forever, right?
>>
>>If you cause an infinite loop in kernel code, you will hang the machine.
>>The Linux kernel is non-preemptible. (Under SMP, if you cause an infinite loop
>>in such a way that other processors are never prevented from entering any code,
>>the system might remain runnable).
>
>Yes, except that the bottom half may change the value of 'lock'. And unless you
>are blocking interrupts the bottom halves may interrupt the upper half.
I see. In that case, what the driver should have done is suspend the process on
a queue, and have the interrupt wake up the process. Maybe the driver was
expeciting such a fast response from the bottom half that this wasn't
considered worthwhile. If that's the case, the device might as well be driven
by programmed I/O, and the loop repeatedly check a status register.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: How to program PC-speaker to beep using C under Linux without being root?
Date: Thu, 12 Aug 1999 05:31:05 GMT
On Sun, 08 Aug 1999 21:37:56 +0800, MyName <[EMAIL PROTECTED]> wrote:
>as subject. thank you.
You can set the duration and pitch by sending a special escape sequence to the
console. Then you issue the alert character, '\a'. The console driver creates
a beep.
Concretely, to set the pitch, do something like this:
printf("\033[10;%d]", hertz); fflush(stdout);
The duration is set by a string constructed like this:
printf("\033[11;%d]", milliseconds); fflush(stdout);
Then you beep:
putchar('\a'); fflush(stdout);
No kernel hacking is necessary.
------------------------------
From: [EMAIL PROTECTED] (Phil Howard)
Subject: which mirror for Linux kernel
Date: Thu, 12 Aug 1999 05:40:23 GMT
Can someone tell me which mirror site (in US) is most reliable, is
mostly likely to stay around, and (this is important) keeps the
timestamps consistent? I'm trying to make a continuing mirror of
the kernel files, and because the mirror sites are inconsistent I
have to mirror from a single site. I already have most files, so
I don't want to download them all over again (which would happen
where the timestamps are goofed).
--
Phil Howard KA9WGN
[EMAIL PROTECTED] [EMAIL PROTECTED]
------------------------------
** 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
******************************