Linux-Development-Sys Digest #794, Volume #8 Mon, 18 Jun 01 06:13:07 EDT
Contents:
nfs mount sycall usage (victor cruceru)
Re: stat ("Karl Heyes")
Re: Module zombies (Kasper Dupont)
Re: strange select() behaviour ?! (Kasper Dupont)
Re: memory mapping of files in ramdisk/ramfs (Kasper Dupont)
Re: "Locked Directory" for floppy & CDROM (Kasper Dupont)
Re: stat (Kasper Dupont)
Re: Waking up a user thread from kernel code (Kasper Dupont)
Re: nfs mount sycall usage (Kasper Dupont)
Re: VFS and mount (Kasper Dupont)
Re: Waking up a user thread from kernel code (Pete Zaitcev)
Re: how to do a boot floppy for RH6.2 with reiserfs? ("Roy Batty")
Re: Module zombies (Clifford Kite)
where can I find the format of ELF? ("wordless")
why doesn't return write() EPIPE ? (Oliver Kowalke)
Be invoked when a file attribute changes ? (Olivier Beaudoux)
Re: how to do a boot floppy for RH6.2 with reiserfs? ("gdm")
Re: where can I find the format of ELF? (Dmitry Fedorov)
Re: multiple .c files into a single device drive module? (Arne Driescher)
----------------------------------------------------------------------------
From: [EMAIL PROTECTED] (victor cruceru)
Subject: nfs mount sycall usage
Date: 17 Jun 2001 06:23:31 -0700
Linux question: There is any way to call mount(2)syscall from user
space (a Linux program) in order to mount a nfs directory from a nfs
server?
If not, there are another syscal to do this?
The way with fork/exec is not accesptabel.
------------------------------
From: "Karl Heyes" <[EMAIL PROTECTED]>
Subject: Re: stat
Date: Sun, 17 Jun 2001 14:29:53 +0100
In article <[EMAIL PROTECTED]>, "Dekang Lin"
<[EMAIL PROTECTED]> wrote:
> The stat(2) function should return zero on success. However, when the file
> is larger than 2GB, it returns -1. Is this a known bug? (I am using Red Hat
> Linux release 7.0, Kernel 2.2.18pre11-va1.1 on an i686).
What is errno set to.
karl.
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Module zombies
Date: Sun, 17 Jun 2001 14:53:29 +0000
What shows up in the output from ps is not a module, it is a
process. Surely a module and a process is something
different, a module is nothing but some pieces of code. But
a module may create a process using the kernel_thread(),
only a few modules need to do this. The module may even
create multiple processes, in this case it seems it wants to
create one pr. unit. I guess the _0 in the process name is
the unit number.
Before the module can be unloaded the processes have to be
stopped. Obviously removing the code of a runing process can
lead to a crash. The Z in the output means that the process
is really stopped, but the parent process has not yet been
informed about this. If a process stays in the zombie state
for a very long time, it usually indicate that there is a
problem with the parent process. But in this particular case
I would expect that the parent process is the init process,
and that program is probably one of the worlds most used
programs, so a bug in init sounds like an unlikely
explanation.
Perhaps the output from "ps -fA --forest" can show something
interesting.
If the modules have to be removed in a particular order, the
kernel should refuce to remove them in the wrong order. In
case of symbol dependencies the loader and the kernel will
ensure this. Other dependencies have to be implemented by
increasing and decreasing the module usage counter. In some
cases a buggy module can be removed while it is still in
use.
The load is computed as the number of processes runing,
ready to run, or in an uninterruptible sleep. Usually a
process will only stay in an uninterruptible sleep for a
very short time, but some of the kernel threads will stay in
an uninterruptible sleep most of the time. The loopd process
used by the loopback blockdevice is an example of such a
process. It doesn't do any harm, it only makes the system
look more loaded than it really is.
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: strange select() behaviour ?!
Date: Sun, 17 Jun 2001 15:13:22 +0000
Oliver Kowalke wrote:
>
> Hello,
>
> I've a problem with the select() function. Maybe I did someting wrong (I
> followed the instructions by 'UNIX network programing, Vol. 1' from
> R.W.Stevens).
> the problem:
> The descriptor of a connected socket (returned by accept() function) is
> marked as readable by select() after(!!!) a read() from this descriptor.
> I thought that select() should indicate that the descriptor is readable
> only if the remote client writes some additional bytes to the socket.
> Something is wrong.
>
> Could you give me some hints, please.
>
> with regards,
> Oliver
If select() marks the fd as readable just
after a read it means one of three things:
- There is more data than the amount you
just read. You can call read() again to
get it.
- More data has just arrived, you can call
read() again to get it.
- The end of the stream has been reached,
there will not come anymore data. You
can call read() and get a return value
of 0 indicating end of stream.
If it still doesn't work try posting your
code.
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: memory mapping of files in ramdisk/ramfs
Date: Sun, 17 Jun 2001 15:19:04 +0000
[EMAIL PROTECTED] wrote:
>
> How is memory mapping done when the file being mapped is in ramfs
> or ramdisk? Is the virtual memory literally sharing the same
> memory the file is stored in, or is it copied from there into
> swappable memory even if copy on write never happens?
>
> I'm wondering how much memory would be used, and maybe any other
> impact as a result of, keeping several shared libraries in ramfs.
>
> --
> -----------------------------------------------------------------
> | Phil Howard - KA9WGN | Dallas | http://linuxhomepage.com/ |
> | [EMAIL PROTECTED] | Texas, USA | http://phil.ipal.org/ |
> -----------------------------------------------------------------
I believe ramfs does share the memory. (Copy on
write pages in the case of MAP_PRIVATE.)
If it is a ramdisk sharing would not be posible,
because the fs used on the ramdisk could be using
allocation units smaller than one page. OTOH this
will be more space efficient when there is
currently no mappings of the file.
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: "Locked Directory" for floppy & CDROM
Date: Sun, 17 Jun 2001 15:21:21 +0000
Jose W. Shermanson wrote:
>
> Kasper,
>
> Sorry about the use of -1 vs. -l. The font I am using makes the difference
> almost indestinguishable. I followed your suggestion to run the series of
> commands immediatly after I rebooted (this was my 3rd reboot) and
> everything works just fine. I don't understand what I did to fix the
> problem but I don't know how I broke the system, either ;) Thanks ever so
> much for your help. Jose
Perhaps you removed the floppy or cdrom while
it was still in use. (Just a wild guess.)
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: stat
Date: Sun, 17 Jun 2001 15:25:55 +0000
Dekang Lin wrote:
>
> The stat(2) function should return zero on success. However, when the
> file is larger than 2GB, it returns -1. Is this a known bug? (I am
> using Red Hat Linux release 7.0, Kernel 2.2.18pre11-va1.1 on an
> i686).
>
> Dekang
The stat function is supposed to return the size of the file
in a 32bit signed integer. That is imposible if the file is
larger than 2GB, thus the call is unsuccesfull. I believe
there exist a stat64() function that can be used instead.
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Waking up a user thread from kernel code
Date: Sun, 17 Jun 2001 15:28:14 +0000
galonius wrote:
>
> I have the following problem :
>
> I am writing a driver that needs, in some cases, to wake up
> a user thread that is waiting on a semaphore.
> Obviously, I can use neither a user-space semaphore nor a kernel-apce one.
>
> Any ideas ?
You need to explain your problem in a little more detail.
Why do you want to do this, what are you trying to achieve.
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: nfs mount sycall usage
Date: Sun, 17 Jun 2001 15:29:46 +0000
victor cruceru wrote:
>
> Linux question: There is any way to call mount(2)syscall from user
> space (a Linux program) in order to mount a nfs directory from a nfs
> server?
> If not, there are another syscal to do this?
> The way with fork/exec is not accesptabel.
Try looking at the sourcecode of the mount program
to see how it does.
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: VFS and mount
Date: Sun, 17 Jun 2001 15:34:27 +0000
Petric Frank wrote:
>
> Reply to my own post ...
>
> Petric Frank schrieb:
> >
> > Hello Alexander,
> >
> > Alexander Viro wrote:
> > >
> > > In article <[EMAIL PROTECTED]>,
> > > Petric Frank <[EMAIL PROTECTED]> wrote:
> > >
> > > >But how is Samba doing it ?
> > > >As i digged out recently you can do a
> > > > mount -t smbfs //MACHINE/SHARE <mount point>
> > >
> > > Do strace on it. You'll see that it's special-cased in mount - it
> > > calls a separate helper (mount.smb) which passes it in the same
> > > way normal mount would pass -o <options>.
> >
> > Thanks.
> > I'll have a look to the mount source. I've seen a file named mount.smbfs
> > which does the mount for samba.
> > Maybe there is a generic rule in mount to call mount.<filesystem> if
> > available ...
>
> The generic rule is indeed the one i thought above.
> mount is searching for a /bin/mount.<filesystem> file and if it is there
> he calls it.
> Here (in my distribution) it calls in case of samba the script
> mount.smbfs which calls smbmount.
> This one converts the parameters and calls smbmnt.
> smbmnt does a system call mount (see man 2 mount) which passes in the
> first parameter '//MACHINE/SHARE' (as like the original mount does).
>
> Here i am stuck actually. I was not able to find the source of this
> function. Is there anyone here in this echo which can give me a hint
> where to find it ?
>
> regards
> Petric
Is it sys_mount() that you are looking for?
find /usr/src/linux-2.4.1 -type f | xargs grep -l sys_mount
/usr/src/linux-2.4.1/fs/super.c
--
Kasper Dupont
------------------------------
From: [EMAIL PROTECTED] (Pete Zaitcev)
Subject: Re: Waking up a user thread from kernel code
Date: 17 Jun 2001 17:06:49 GMT
> From: galonius <[EMAIL PROTECTED]>
> I am writing a driver that needs, in some cases, to wake up
> a user thread that is waiting on a semaphore.
> Obviously, I can use neither a user-space semaphore nor a kernel-apce one.
Use a messenger thread that blocks in your driver, then
driver wakes it up and the thread unblocks the thread
in question.
There may be some other way but you did not explain the
problem in sufficient detail to find one.
-- Pete
------------------------------
From: "Roy Batty" <[EMAIL PROTECTED]>
Subject: Re: how to do a boot floppy for RH6.2 with reiserfs?
Date: Sun, 17 Jun 2001 21:34:33 +0200
You can download one from
ftp://ftp.lugoj.org/pub/reiserfs/
- Roy
"gdm" <[EMAIL PROTECTED]> wrote in message
news:9gauru$g7g$[EMAIL PROTECTED]...
> how to do a boot floppy for RH6.2 with reiserfs?
>
> gdm
>
>
>
>
>
------------------------------
From: Clifford Kite <[EMAIL PROTECTED]>
Subject: Re: Module zombies
Date: Sun, 17 Jun 2001 21:18:51 -0500
Kasper Dupont <[EMAIL PROTECTED]> wrote:
> What shows up in the output from ps is not a module, it is a
> process. Surely a module and a process is something
> different, a module is nothing but some pieces of code. But
> a module may create a process using the kernel_thread(),
> only a few modules need to do this. The module may even
> create multiple processes, in this case it seems it wants to
> create one pr. unit. I guess the _0 in the process name is
> the unit number.
Okay.
> Before the module can be unloaded the processes have to be
> stopped. Obviously removing the code of a runing process can
> lead to a crash. The Z in the output means that the process
Nothing has crashed yet. The modules do unload after the device
is unmounted, I guess since then nothing is using them - they are
being used when the camera CompactFlach is mounted and the zombied
ones won't unmount while they are in use.
> is really stopped, but the parent process has not yet been
> informed about this. If a process stays in the zombie state
> for a very long time, it usually indicate that there is a
> problem with the parent process. But in this particular case
Would that be khubd?
> I would expect that the parent process is the init process,
> and that program is probably one of the worlds most used
> programs, so a bug in init sounds like an unlikely
> explanation.
> Perhaps the output from "ps -fA --forest" can show something
> interesting.
root 8 1 0 Jun14 ? 00:00:00 [khubd]
root 2590 8 0 Jun15 ? 00:00:00 \_ [usb-storage-0 <defunct>]
root 2591 8 0 Jun15 ? 00:00:00 \_ [scsi_eh_0 <defunct>]
root 2601 8 0 Jun15 ? 00:00:00 \_ [usb-storage-0 <defunct>]
root 2602 8 0 Jun15 ? 00:00:00 \_ [scsi_eh_0 <defunct>]
root 2660 8 0 Jun15 ? 00:00:00 \_ [usb-storage-0 <defunct>]
root 2661 8 0 Jun15 ? 00:00:00 \_ [scsi_eh_0 <defunct>]
root 2670 8 0 Jun15 ? 00:00:00 \_ [usb-storage-0 <defunct>]
root 2671 8 0 Jun15 ? 00:00:00 \_ [scsi_eh_0 <defunct>]
root 2686 8 0 Jun15 ? 00:00:00 \_ [usb-storage-0 <defunct>]
root 2687 8 0 Jun15 ? 00:00:00 \_ [scsi_eh_0 <defunct>]
root 2719 8 0 Jun15 ? 00:00:00 \_ [usb-storage-0 <defunct>]
root 2720 8 0 Jun15 ? 00:00:00 \_ [scsi_eh_0 <defunct>]
root 2759 8 0 Jun15 ? 00:00:00 \_ [usb-storage-0 <defunct>]
root 2760 8 0 Jun15 ? 00:00:00 \_ [scsi_eh_0 <defunct>]
root 2791 8 0 Jun15 ? 00:00:00 \_ [usb-storage-0 <defunct>]
root 2792 8 0 Jun15 ? 00:00:00 \_ [scsi_eh_0 <defunct>]
root 2802 8 0 Jun15 ? 00:00:00 \_ [usb-storage-0 <defunct>]
root 2803 8 0 Jun15 ? 00:00:00 \_ [scsi_eh_0 <defunct>]
root 2847 8 0 Jun15 ? 00:00:00 \_ [usb-storage-0 <defunct>]
root 2848 8 0 Jun15 ? 00:00:00 \_ [scsi_eh_0 <defunct>]
root 2863 8 0 Jun15 ? 00:00:00 \_ [usb-storage-0 <defunct>]
root 2864 8 0 Jun15 ? 00:00:00 \_ [scsi_eh_0 <defunct>]
ect. There's more, but this is likely enough, especially for anyone
who can understand what it means. I'm not in that group of people
although I'd guess that hkubd is a thread and the parent. The core for
USB is compiled directly into the kernel - maybe khubd comes from that?
Do you have any ideas on what process/thread or module is doing
the wrong thing? Or how to do a workaround to prevent the zombies?
I know they don't really hurt except to sop us process numbers but
their continued existence and growing number are annoying.
I understand what's happening a little better now - thanks for that.
But if nobody here can help to cure this problem then I'll need to
try the linux-usb-users mailing list mentioned in the usb-help.txt
file in the kernel source tree.
--
Clifford Kite <Email: [EMAIL PROTECTED] with X=kite, Y=inetport, Z=com>
------------------------------
From: "wordless" <[EMAIL PROTECTED]>
Subject: where can I find the format of ELF?
Date: Mon, 18 Jun 2001 14:26:01 +0800
I want to write a program which manipulate the ELF excutables. While there
is a BFD library, I have little idea of how to use it. Can anybody tell me
where can I find some documents of ELF format or how to use BFD library?
Thank u in advance.
------------------------------
From: Oliver Kowalke <[EMAIL PROTECTED]>
Subject: why doesn't return write() EPIPE ?
Date: Mon, 18 Jun 2001 09:19:17 +0200
Reply-To: [EMAIL PROTECTED]
Hello,
why doesn't write() return EPIPE ?
If the peer has closed its socket connection the second write to this
socket should return -1 and errno should be set to EPIPE (if SIGPIPE is set
to be ignored). Why does the second write to the socket never go into the
error detection?
with best regards,
Oliver
(writen() is a member function of my socket C++-class)
ssize_t
sock::writen( const void * vptr, size_t n)
{
size_t nleft;
ssize_t nwritten;
const char *ptr;
ptr = static_cast< char * >( vptr);
nleft = n;
struct sigaction new_sa;
struct sigaction old_sa;
new_sa.sa_handler = SIG_IGN;
::sigemptyset( & new_sa.sa_mask);
new_sa.sa_flags = 0;
::sigaction( SIGPIPE, & new_sa, & old_sa);
while ( nleft > 0)
{
if ( ( nwritten = ::write( m_handle, ptr, nleft) ) <= 0)
{
if ( errno == EINTR)
nwritten = 0; /* and call write() again */
else if ( errno == EPIPE)
return EOF; /* write to socket with no
readers */
else
throw net_io_ex( ::strerror( errno), "writen()",
__FILE__); /* error */
}
nleft -= nwritten;
ptr += nwritten;
}
/* set to its previous action */
::sigaction( SIGPIPE, & old_sa, 0);
return n;
}
------------------------------
From: Olivier Beaudoux <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Be invoked when a file attribute changes ?
Date: Mon, 18 Jun 2001 09:27:00 +0200
Reply-To: [EMAIL PROTECTED]
Hi,
I write something like a file manager application. I need to be informed
when a file attribute changes (after a "chmod" for example) or when its
content changes (when users do "file/save" actions for example).
Does Linux kernel provides a such invocation mecanism ?
Thanks for your help,
Bod
--
Olivier Beaudoux
ESEO
4 rue Merlet de la Boulaye, BP 926
49009 Angers cedex 01
Tel: +33 (2) 41-86-67-67
+33 (2) 41-86-67-05 (ligne directe)
Fax: +33 (2) 41-87-99-27
Email: [EMAIL PROTECTED]
------------------------------
From: "gdm" <[EMAIL PROTECTED]>
Subject: Re: how to do a boot floppy for RH6.2 with reiserfs?
Date: Mon, 18 Jun 2001 11:27:53 +0200
"Roy Batty" <[EMAIL PROTECTED]> a �crit dans le message news:
9gj0ol$qg$[EMAIL PROTECTED]
> You can download one from
> ftp://ftp.lugoj.org/pub/reiserfs/
> - Roy
> "gdm" <[EMAIL PROTECTED]> wrote in message
> news:9gauru$g7g$[EMAIL PROTECTED]...
> > how to do a boot floppy for RH6.2 with reiserfs?
Thanks for the url. That url shows me only kernel2.2.18. But I am looking
for a patch reiserFS for kernel 2.2.14. Where could I find a patch RiserFs
for kernel 2.2.14 ?
gdm
------------------------------
From: [EMAIL PROTECTED] (Dmitry Fedorov)
Subject: Re: where can I find the format of ELF?
Date: 18 Jun 2001 09:23:39 GMT
Reply-To: [EMAIL PROTECTED]
In article <9gk6sd$npn$[EMAIL PROTECTED]>, wordless wrote:
>I want to write a program which manipulate the ELF excutables. While there
>is a BFD library, I have little idea of how to use it. Can anybody tell me
>where can I find some documents of ELF format or how to use BFD library?
type 'info bfd' and read through it.
------------------------------
From: Arne Driescher <[EMAIL PROTECTED]>
Subject: Re: multiple .c files into a single device drive module?
Date: Mon, 18 Jun 2001 12:02:40 +0200
Jerry Walden wrote:
>
> Greetings:
>
> I have am porting a device driver from a "generic source library".
> The current tree consists of several .c source files. Is there
> another way to create a single .o file from several source files short
> of having a single .c file #include the rest?
>
> Thanks for any hel.
Hi,
you may have a look at the Makefile
in
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/me2600/me2600/
to get an example for linking multiple c-files into one
driver.
-Arne
------------------------------
** 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
******************************