Linux-Development-Sys Digest #613, Volume #8      Thu, 5 Apr 01 07:13:11 EDT

Contents:
  Re: How to control time to wait when opening a socket ? (Josef Moellers)
  Glibc 2.2.2 Make Check Errors (Repost) ("Fruitbat")
  Re: Editting filter for masquerading ("Brian Krahmer")
  Re: did anyone have problems with Daylight Savings changeover? (Juergen Pfann)
  Re: How can I use the SCI inside linux module for DSM?? (khaled Ragab)
  color text base (maher)
  Re: file reading from kernel again (khaled Ragab)
  Zombies and daemons ("Hubert")
  Re: How can I use the SCI inside linux module for DSM?? (Emmanuel CECCHET)
  Re: file reading from kernel again (Massimiliano Caovilla)
  Re: file reading from kernel again (Massimiliano Caovilla)
  Re: file reading from kernel again (Massimiliano Caovilla)
  Re: How can I use the SCI inside linux module for DSM?? (khaled Ragab)
  Re: Need your recommendation for a full-featured text editor ("crg")

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

From: Josef Moellers <[EMAIL PROTECTED]>
Subject: Re: How to control time to wait when opening a socket ?
Date: Thu, 05 Apr 2001 08:17:09 +0200

[EMAIL PROTECTED] wrote:
> =

> How to control time to wait when opening a socket ?
> =

> Thanks for reading this,
> =

> Do you know how to control the timeout of the "socket" connect
> function. I think it is possible to do with the sysctl executable.
> Better yet, do you know the proper syntax for the C function "sysctl"
> which will control this,

The common way of doing this is to start a timer with the alarm() system
call, specifying that system calls are not to be restarted (I'm not sure
whether socket and connect are restartable anyway). The handler for
SIGALRM just returns, maybe sets a global flag and when you return from
socket/connect with a -1 and errno =3D=3D EINTR, you can check the flag a=
nd
act appropriate.

-- =

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

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

From: "Fruitbat" <[EMAIL PROTECTED]>
Subject: Glibc 2.2.2 Make Check Errors (Repost)
Date: Thu, 05 Apr 2001 06:18:56 GMT

After checking Deja News it seems like my original post has been lost, if
not my apologies for the repost, apparently my ISP has had some server
problems that should be resolved by now.

Hi, I have just built Glibc 2.2.2 on my Redhat 6.2 based pentium II  system
using GCC 2.95.3, and a 2.4.2 kernel with the following options:
--prefix=/usr
--enable-add-ons
--enable-kernel=2.4.0
--disable-profile

Everything builds ok, but when I run "make check",  check fails in the
linuxthreads directory with the following output:

make[2]: Entering directory `/usr/src/glibc-2.2.2/linuxthreads'
gcc
Examples/ex4.c -c -O2 -Wall -Winline -Wstrict-prototypes -Wwrite-strings -g
     -I../include -I. -I/usr/src/biuld/linuxthreads -I.. -I../libio  -I/usr/
src/biuld -I../sysdeps/i386/elf -I../linuxthreads/sysdeps/unix/sysv/linux/i3
86 -I../linuxthreads/sysdeps/unix/sysv/linux -I../linuxthreads/sysdeps/pthre
ad -I../linuxthreads/sysdeps/unix/sysv -I../linuxthreads/sysdeps/unix -I../l
inuxthreads/sysdeps/i386/i686 -I../linuxthreads/sysdeps/i386 -I../sysdeps/un
ix/sysv/linux/i386/i686 -I../sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/
sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman
-I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -I../sysdeps/unix/sysv -I
../sysdeps/unix/i386/i686 -I../sysdeps/unix/i386/i586 -I../sysdeps/unix/i386
 -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/i386/i686/fpu -I../sysdep
s/i386/i686 -I../sysdeps/i386/i486 -I../sysdeps/i386/fpu -I../sysdeps/i386 -
I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/db
l-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/e
lf -I../sysdeps/generic   -D_LIBC_REENTRANT -include
../include/libc-symbols.h     -o /usr/src/biuld/linuxthreads/ex4.o
gcc -nostdlib -nostartfiles -o
usr/src/biuld/linuxthreads/ex4  -Wl,-dynamic-linker=/lib/ld-linux.so.2
/usr/src/biuld/csu/crt1.o /usr/src/biuld/csu/crti.o
`gcc --print-file-name=crtbegin.o` /usr/src/biuld/linuxthreads/ex4.o
/usr/src/biuld/linuxthreads/libpthread.so  -Wl,-rpath-link=/usr/src/biuld:/u
sr/src/biuld/math:/usr/src/biuld/elf:/usr/src/biuld/dlfcn:/usr/src/biuld/nss
:/usr/src/biuld/nis:/usr/src/biuld/rt:/usr/src/biuld/resolv:/usr/src/biuld/c
rypt:/usr/src/biuld/linuxthreads /usr/src/biuld/libc.so.6
/usr/src/biuld/libc_nonshared.a -lgcc `gcc --print-file-name=crtend.o`
/usr/src/biuld/csu/crtn.o
GCONV_PATH=/usr/src/biuld/iconvdata LC_ALL=C
/usr/src/biuld/elf/ld-linux.so.2 --library-path
/usr/src/biuld:/usr/src/biuld/math:/usr/src/biuld/elf:/usr/src/biuld/dlfcn:/
usr/src/biuld/nss:/usr/src/biuld/nis:/usr/src/biuld/rt:/usr/src/biuld/resolv
:/usr/src/biuld/crypt:/usr/src/biuld/linuxthreads
/usr/src/biuld/linuxthreads/ex4  > /usr/src/biuld/linuxthreads/ex4.out
make[2]: *** [/usr/src/biuld/linuxthreads/ex4.out] Error 139
make[2]: Leaving directory `/usr/src/glibc-2.2.2/linuxthreads'
make[1]: *** [linuxthreads/tests] Error 2
make[1]: Leaving directory `/usr/src/glibc-2.2.2'
make: *** [check] Error 2

Can any one tell me if it is safe to install Glibc with  this check failure,
and what Error 139 may possibly be?

Also has anyone else had this error and know the cause?

Much appreciated

--

Regards Geoff :)
==================
[EMAIL PROTECTED]



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

From: "Brian Krahmer" <[EMAIL PROTECTED]>
Subject: Re: Editting filter for masquerading
Date: Thu, 05 Apr 2001 06:55:52 GMT

I would imagine that the current masquerading code has examples for FTP,
streaming media, IRC, etc.  Any of the 'specialty' handlers probably modify
the outgoing and incoming packets to handle such cases.

brian

> I have a networked app that I need to run through a Linux box that
> does masquerading.  The app transmits its own IP number and port,
> which the other half of the app on the other side is supposed to
> connect to.  This obviously will not work with masquerading.  I do not
> have source code for the app so fixing things that way is not an
> option.  What I want to do is install a filter that will recognize and
> edit the packet with the IP/port info to send the other side app to a
> redirected port on the Linux box.  I'm comfortable programming under
> Linux, but I have never done anything like try to hook a kernel
> service like this before.
>
> Is there such a thing in existance already?  It would save me a lot of
> work.  If not, any suggestions for how to go about doing this,
> especially avoiding security risks, would be appreciated.




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

From: Juergen Pfann <[EMAIL PROTECTED]>
Subject: Re: did anyone have problems with Daylight Savings changeover?
Date: Thu, 05 Apr 2001 08:44:16 +0200

"H�kon Alstadheim" wrote:
> 
> 
> As we all know local time changes an hour in each direction every
> year. Also computers have been known to move. When these things happen
> we do *not* want the date a file was last changed to be affected.
> System time should be UTC.
> 

IMHO, that's a good argument for keeping the HW clock in UTC. 
I've got another from a German magazine article last week or 
so : Even the Win9x/ME and NT/2k OS families differ from each 
other, regarding the way they interpret a file's timestamp 
(which is *always* UTC in NT/2k, but local time in 9x, if I got 
that right - was a bit confused, I admit...). 
Maybe you don't know that, if you chose UTC in 9x or NT _and_ 
deactivate the appropriate checkbox, then Micros~1 leaves 
the HW clock untouched for the DST change. 
I, for one with a dual-/triple-/multi-boot system, can live 
fine with the 1-hour/2-hour offset for "dumb" OSes - 
knowing that the timestamp of a file will that way *always* 
be UTC, thus interpreted correctly by "advanced" UNIX-like 
OSes, and my HW clock stays untouched - except for manual 
correction of <5 sec. once or twice a month, which is 
accurate enough for me. BTW : I do this adjusting not 
while Linux is running, but in the BIOS setup - with my 
BP6, I noticed several times, that the HW date jumped 
back to Jan 1, 1999, 00:00 when I rebooted after changing 
HW clock in Linux - funny, isn't it ? 

Juergen

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

From: khaled Ragab <[EMAIL PROTECTED]>
Subject: Re: How can I use the SCI inside linux module for DSM??
Date: Thu, 05 Apr 2001 11:13:50 +0200

Hi,  Emmanuel CECCHET
Many thanks for your interest to reply me.

> Why do you try to use it as a device ? You can directly call the functions
> that are exported in the kernel by the driver. Which driver do you use ?

I used PCISCI for Dolphin  PCI-SCI adapter D310.

> That's just a segmentation fault in the kernel. You're trying to
> access a NULL pointer. You must check every returned value
> to prevent this kind of things.

Of course, I know it is segmentation fault in the kernel. I'll do by your
advice for checking the pointer value.

> You can get a 'struct file' by using the same code as sys_open()
> is fs/open.c. After the call to filp_open(...) don't forget to check
> if everything was ok with the IS_ERR(..) macro.
> In the struct file, you have the f_op field that is a structure of
> file system operations specific to each file system. You can use
> the specific read/write operations by using f->f_op->read(...)
> or f->f_op->write(...)/
> Be careful when using buffers in the kernel, the memory is
> really limited !

I did that before, but when I called f->f_op->open I received segmentation
fault in kernel too.
Please tell me how can I determine the f and f->f_op pointers, where struct
file *f.
Many thanks again for your interest,
Yours,
Khaled.


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

From: maher <[EMAIL PROTECTED]>
Subject: color text base
Date: Thu, 05 Apr 2001 17:15:15 +0500

Hi there,

I would like to change my font color in text based mode.If i'm not
mistaken, I need to change in /usr/src/linux/drivers/char/console.c .May
I know the green color in hax mode?

thanks in advance

maher

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

From: khaled Ragab <[EMAIL PROTECTED]>
Subject: Re: file reading from kernel again
Date: Thu, 05 Apr 2001 11:24:17 +0200

Hi,
Massimiliano Caovilla

>         Hello
> I have module that REALLY NEEDS to read/write files from within the
> kernel: I actually do that by calling directly the file operations from
> the file * I get with a filp_open. It works well, but I can't find a way
> to check its error return. Actually, I do a comparison between the
> size_t returned by read and the size_t I requested to be read> anyway,
> it seems it dosn't work if I open a file in O_CREAT and then try to read
> from the file! How should I check in another way?
>  Thanks, Massi

Please tell me how you open a file inside your module. Please tell me the
sequence of instruction you use to open a file inside your module.
Many thanks for you in anticipation.
Yours,
Khaled


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

From: "Hubert" <[EMAIL PROTECTED]>
Subject: Zombies and daemons
Date: Thu, 5 Apr 2001 11:30:22 +0200

Hi all,

I cannot remove a zombie created by a daemon from the process list.

My daemon (using pthreads) creates a child process within one of its threads
by calling vfork() and execv(). After the child process terminates, it is
converted to a zombie.
The same thread that creates the child process tries to remove the zombie by
calling waitpid(pid_t,&status,0) but always gets a return value of -1.
I also tried to call vfork() twice (found this described in some manuals) to
make the init process responsable for the zombie, but it did not work.

How can I remove a zombie created by a daemon? Should I also daemonize the
child or is there a better way?

Thank you

Hubert





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

From: Emmanuel CECCHET <[EMAIL PROTECTED]>
Subject: Re: How can I use the SCI inside linux module for DSM??
Date: Thu, 05 Apr 2001 12:10:13 +0200

This is a multi-part message in MIME format.
==============5A1E7F1F9A62A8F8A9469178
Content-Type: multipart/alternative;
 boundary="------------A16B11352FC967CF8E9C9C7A"


==============A16B11352FC967CF8E9C9C7A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit



khaled Ragab wrote:

> Hi,  Emmanuel CECCHET
> Many thanks for your interest to reply me.
>
> > Why do you try to use it as a device ? You can directly call the functions
> > that are exported in the kernel by the driver. Which driver do you use ?
>
> I used PCISCI for Dolphin  PCI-SCI adapter D310.

You can directly use all functions exported by the driver in genif.h.
If you want to access the devices, you'll have to create the devices
using the mkIRMdev script file.

> > You can get a 'struct file' by using the same code as sys_open()
> > is fs/open.c. After the call to filp_open(...) don't forget to check
> > if everything was ok with the IS_ERR(..) macro.
> > In the struct file, you have the f_op field that is a structure of
> > file system operations specific to each file system. You can use
> > the specific read/write operations by using f->f_op->read(...)
> > or f->f_op->write(...)/
> > Be careful when using buffers in the kernel, the memory is
> > really limited !
>
> I did that before, but when I called f->f_op->open I received segmentation
> fault in kernel too.
> Please tell me how can I determine the f and f->f_op pointers, where struct
> file *f.

Here is a piece of code that should help :

{
  int flags; // flags for open
  int mode;  // mode for open
  char * tmp;
  int error;

  tmp = getname(filename);
  if (!IS_ERR(tmp))
  {
    struct file *f = filp_open(tmp, flags, mode);
    error = PTR_ERR(f);
    if (!IS_ERR(f))
    {
      if ((f->f_op) && (f->f_op->read))
      {
        char    buf[100];
        loff_t  ofs = 0;
        ssize_t sz;

        if ((sz = f->f_op->read(f, buf, 100, &ofs)) == -EFAULT)
          printk("Read failed\n");
        else
          printk("%d bytes read\n", sz);
      }
      else
        printk("Missing file_operations or read operation\n");
    }
    else
      printk("open failed\n");
  }
  else
    printk("Unable to get name\n");
}

Let me know if this piece of code doesn't work.

Emmanuel

==============A16B11352FC967CF8E9C9C7A
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
&nbsp;
<p>khaled Ragab wrote:
<blockquote TYPE=CITE>Hi,&nbsp; Emmanuel CECCHET
<br>Many thanks for your interest to reply me.
<p>> Why do you try to use it as a device ? You can directly call the functions
<br>> that are exported in the kernel by the driver. Which driver do you
use ?
<p>I used PCISCI for Dolphin&nbsp; PCI-SCI adapter D310.</blockquote>
You can directly use all functions exported by the driver in genif.h.
<br>If you want to access the devices, you'll have to create the devices
<br>using the mkIRMdev script file.
<blockquote TYPE=CITE>> You can get a 'struct file' by using the same code
as sys_open()
<br>> is fs/open.c. After the call to filp_open(...) don't forget to check
<br>> if everything was ok with the IS_ERR(..) macro.
<br>> In the struct file, you have the f_op field that is a structure of
<br>> file system operations specific to each file system. You can use
<br>> the specific read/write operations by using f->f_op->read(...)
<br>> or f->f_op->write(...)/
<br>> Be careful when using buffers in the kernel, the memory is
<br>> really limited !
<p>I did that before, but when I called f->f_op->open I received segmentation
<br>fault in kernel too.
<br>Please tell me how can I determine the f and f->f_op pointers, where
struct
<br>file *f.</blockquote>
Here is a piece of code that should help :
<p><tt>{</tt>
<br><tt>&nbsp; int flags; // flags for open</tt>
<br><tt>&nbsp; int mode;&nbsp; // mode for open</tt>
<br><tt>&nbsp; char * tmp;</tt>
<br><tt>&nbsp; int error;</tt>
<br><tt>&nbsp;</tt>
<br><tt>&nbsp; tmp = getname(filename);</tt>
<br><tt>&nbsp; if (!IS_ERR(tmp))</tt>
<br><tt>&nbsp; {</tt>
<br><tt>&nbsp;&nbsp;&nbsp; struct file *f = filp_open(tmp, flags, mode);</tt>
<br><tt>&nbsp;&nbsp;&nbsp; error = PTR_ERR(f);</tt>
<br><tt>&nbsp;&nbsp;&nbsp; if (!IS_ERR(f))</tt>
<br><tt>&nbsp;&nbsp;&nbsp; {</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((f->f_op) &amp;&amp; (f->f_op->read))</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char&nbsp;&nbsp;&nbsp;
buf[100];</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; loff_t&nbsp; ofs = 0;</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ssize_t sz;</tt><tt></tt>
<p><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((sz = f->f_op->read(f,
buf, 100, &amp;ofs)) == -EFAULT)</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk("Read
failed\n");</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk("%d
bytes read\n", sz);</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk("Missing file_operations
or read operation\n");</tt>
<br><tt>&nbsp;&nbsp;&nbsp; }</tt>
<br><tt>&nbsp;&nbsp;&nbsp; else</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk("open failed\n");</tt>
<br><tt>&nbsp; }</tt>
<br><tt>&nbsp; else</tt>
<br><tt>&nbsp;&nbsp;&nbsp; printk("Unable to get name\n");</tt>
<br><tt>}</tt><tt></tt>
<p>Let me know if this piece of code doesn't work.
<p>Emmanuel</html>

==============A16B11352FC967CF8E9C9C7A==

==============5A1E7F1F9A62A8F8A9469178
Content-Type: text/x-vcard; charset=us-ascii;
 name="Emmanuel.Cecchet.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Emmanuel CECCHET
Content-Disposition: attachment;
 filename="Emmanuel.Cecchet.vcf"

begin:vcard 
n:CECCHET;Emmanuel
tel;fax:04.76.61.52.52
tel;work:04.76.61.52.63
x-mozilla-html:FALSE
url:http://sirac.inrialpes.fr/~cecchet
org:INRIA Rh�ne-Alpes;Is�re (38)
adr:;;655, Avenue de l'Europe;Montbonnot St Martin;;38330;FRANCE
version:2.1
email;internet:[EMAIL PROTECTED]
title:Ph.D Student/Doctorant
x-mozilla-cpt:;-3808
fn:Emmanuel CECCHET
end:vcard

==============5A1E7F1F9A62A8F8A9469178==


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

From: Massimiliano Caovilla <[EMAIL PROTECTED]>
Subject: Re: file reading from kernel again
Date: Thu, 05 Apr 2001 10:37:23 GMT

Massimiliano Caovilla wrote:
> 
>         Hello
> I have module that REALLY NEEDS to read/write files from within the
> kernel: I actually do that by calling directly the file operations from
> the file * I get with a filp_open. It works well, but I can't find a way
> to check its error return. Actually, I do a comparison between the
> size_t returned by read and the size_t I requested to be read> anyway,
> it seems it dosn't work if I open a file in O_CREAT and then try to read
> from the file! How should I check in another way?
>  Thanks, Massi

        Bah,
it worked already, there was a silly bug in the check AFTER the read, If
I read 0 bytes, it was not considered an error... :-(

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

From: Massimiliano Caovilla <[EMAIL PROTECTED]>
Subject: Re: file reading from kernel again
Date: Thu, 05 Apr 2001 10:39:17 GMT

Lee Ho wrote:
> Refer this code.
> 
> http://linuxkernel.to/klib/download/klib.tar.gz

 Thanks, I'll check!

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

From: Massimiliano Caovilla <[EMAIL PROTECTED]>
Subject: Re: file reading from kernel again
Date: Thu, 05 Apr 2001 10:47:34 GMT

khaled Ragab wrote:

> Please tell me how you open a file inside your module. Please tell me the
> sequence of instruction you use to open a file inside your module.
> Many thanks for you in anticipation.
> Yours,
> Khaled

 I get a file * using 

file *pr_file
pr_file = filp_open("filename",O_RDWR|O_CREAT,0600)

(I don't know what 0600 means exactly, but it works)

 I save the mm segment in a mm_segment_t

mm_segment_t oldfs;
oldfs = GET_FS();

 I turn into kernel mm

SET_FS(KERNEL_DS);

 Then I call write, read, ioctl ans so on with

pr_file->f_op->read(...) 

 and I jump back to my old mm

SET_FS(oldfs)

Hope this helps,
Massimiliano

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

From: khaled Ragab <[EMAIL PROTECTED]>
Subject: Re: How can I use the SCI inside linux module for DSM??
Date: Thu, 05 Apr 2001 12:56:42 +0200


==============98F400652C215AAC8FAC66E1
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi, Emmanuel
When I wrote your pice of code I received segmentation fault error
(Unable to heandle kerenel pointer ..)
Please found a part of my code :
char *tmp, *tmp1
struct file *f;
int e;
sprintf(tmp1,"/dev/SCI/0");
 tmp = getname(tmp1);
  if (!IS_ERR(tmp))
  {
    f = filp_open(tmp,O_RDWR , 3);
    e = PTR_ERR(f);
    if (!IS_ERR(f))
    {
      printk("File was opened successfuly..\n"); return ;
    }
  }else
    {
      printk("open failed\n");  return;
    }
have you an idea??
Thanks,
Yours, Khaled.
.........................................................................

>
>
> khaled Ragab wrote:
>
>> Hi,  Emmanuel CECCHET
>> Many thanks for your interest to reply me.
>>
>> > Why do you try to use it as a device ? You can directly call the
>> functions
>> > that are exported in the kernel by the driver. Which driver do you
>> use ?
>>
>> I used PCISCI for Dolphin  PCI-SCI adapter D310.
>
> You can directly use all functions exported by the driver in genif.h.
> If you want to access the devices, you'll have to create the devices
> using the mkIRMdev script file.
>
>> > You can get a 'struct file' by using the same code as sys_open()
>> > is fs/open.c. After the call to filp_open(...) don't forget to
>> check
>> > if everything was ok with the IS_ERR(..) macro.
>> > In the struct file, you have the f_op field that is a structure of
>>
>> > file system operations specific to each file system. You can use
>> > the specific read/write operations by using f->f_op->read(...)
>> > or f->f_op->write(...)/
>> > Be careful when using buffers in the kernel, the memory is
>> > really limited !
>>
>> I did that before, but when I called f->f_op->open I received
>> segmentation
>> fault in kernel too.
>> Please tell me how can I determine the f and f->f_op pointers, where
>> struct
>> file *f.
>
> Here is a piece of code that should help :
>
> {
>   int flags; // flags for open
>   int mode;  // mode for open
>   char * tmp;
>   int error;
>
>   tmp = getname(filename);
>   if (!IS_ERR(tmp))
>   {
>     struct file *f = filp_open(tmp, flags, mode);
>     error = PTR_ERR(f);
>     if (!IS_ERR(f))
>     {
>       if ((f->f_op) && (f->f_op->read))
>       {
>         char    buf[100];
>         loff_t  ofs = 0;
>         ssize_t sz;
>
>         if ((sz = f->f_op->read(f, buf, 100, &ofs)) == -EFAULT)
>           printk("Read failed\n");
>         else
>           printk("%d bytes read\n", sz);
>       }
>       else
>         printk("Missing file_operations or read operation\n");
>     }
>     else
>       printk("open failed\n");
>   }
>   else
>     printk("Unable to get name\n");
> }
>
> Let me know if this piece of code doesn't work.
>
> Emmanuel

==============98F400652C215AAC8FAC66E1
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi, Emmanuel
<br>When I wrote your pice of code I received segmentation fault error
(Unable to heandle kerenel pointer ..)
<br>Please found a part of my code :
<br>char *tmp, *tmp1
<br>struct file *f;
<br>int e;
<br>sprintf(tmp1,"/dev/SCI/0");
<br>&nbsp;tmp = getname(tmp1);
<br>&nbsp; if (!IS_ERR(tmp))
<br>&nbsp; {
<br>&nbsp;&nbsp;&nbsp; f = filp_open(tmp,O_RDWR , 3);
<br>&nbsp;&nbsp;&nbsp; e = PTR_ERR(f);
<br>&nbsp;&nbsp;&nbsp; if (!IS_ERR(f))
<br>&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk("File was opened successfuly..\n");
return ;
<br>&nbsp;&nbsp;&nbsp; }
<br>&nbsp; }else
<br>&nbsp;&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk("open failed\n");&nbsp; return;
<br>&nbsp;&nbsp;&nbsp; }
<br>have you an idea??
<br>Thanks,
<br>Yours, Khaled.
<br>.........................................................................
<blockquote TYPE=CITE>&nbsp;
<p>khaled Ragab wrote:
<blockquote TYPE=CITE>Hi,&nbsp; Emmanuel CECCHET
<br>Many thanks for your interest to reply me.
<p>> Why do you try to use it as a device ? You can directly call the functions
<br>> that are exported in the kernel by the driver. Which driver do you
use ?
<p>I used PCISCI for Dolphin&nbsp; PCI-SCI adapter D310.</blockquote>
You can directly use all functions exported by the driver in genif.h.
<br>If you want to access the devices, you'll have to create the devices
<br>using the mkIRMdev script file.
<blockquote TYPE=CITE>> You can get a 'struct file' by using the same code
as sys_open()
<br>> is fs/open.c. After the call to filp_open(...) don't forget to check
<br>> if everything was ok with the IS_ERR(..) macro.
<br>> In the struct file, you have the f_op field that is a structure of
<br>> file system operations specific to each file system. You can use
<br>> the specific read/write operations by using f->f_op->read(...)
<br>> or f->f_op->write(...)/
<br>> Be careful when using buffers in the kernel, the memory is
<br>> really limited !
<p>I did that before, but when I called f->f_op->open I received segmentation
<br>fault in kernel too.
<br>Please tell me how can I determine the f and f->f_op pointers, where
struct
<br>file *f.</blockquote>
Here is a piece of code that should help :
<p><tt>{</tt>
<br><tt>&nbsp; int flags; // flags for open</tt>
<br><tt>&nbsp; int mode;&nbsp; // mode for open</tt>
<br><tt>&nbsp; char * tmp;</tt>
<br><tt>&nbsp; int error;</tt>
<p><tt>&nbsp; tmp = getname(filename);</tt>
<br><tt>&nbsp; if (!IS_ERR(tmp))</tt>
<br><tt>&nbsp; {</tt>
<br><tt>&nbsp;&nbsp;&nbsp; struct file *f = filp_open(tmp, flags, mode);</tt>
<br><tt>&nbsp;&nbsp;&nbsp; error = PTR_ERR(f);</tt>
<br><tt>&nbsp;&nbsp;&nbsp; if (!IS_ERR(f))</tt>
<br><tt>&nbsp;&nbsp;&nbsp; {</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((f->f_op) &amp;&amp; (f->f_op->read))</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char&nbsp;&nbsp;&nbsp;
buf[100];</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; loff_t&nbsp; ofs = 0;</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ssize_t sz;</tt>
<p><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((sz = f->f_op->read(f,
buf, 100, &amp;ofs)) == -EFAULT)</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk("Read
failed\n");</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk("%d
bytes read\n", sz);</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk("Missing file_operations
or read operation\n");</tt>
<br><tt>&nbsp;&nbsp;&nbsp; }</tt>
<br><tt>&nbsp;&nbsp;&nbsp; else</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printk("open failed\n");</tt>
<br><tt>&nbsp; }</tt>
<br><tt>&nbsp; else</tt>
<br><tt>&nbsp;&nbsp;&nbsp; printk("Unable to get name\n");</tt>
<br><tt>}</tt>
<p>Let me know if this piece of code doesn't work.
<p>Emmanuel</blockquote>
</html>

==============98F400652C215AAC8FAC66E1==


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

From: "crg" <craig.*REMOVE.THIS*[EMAIL PROTECTED]>
Crossposted-To: 
24hoursupport.helpdesk,alt.comp.shareware.programmer,comp.editors,comp.lang.java.help,comp.lang.java.programmer,comp.lang.java.softwaretools,comp.os.linux.advocacy
Subject: Re: Need your recommendation for a full-featured text editor
Date: Thu, 5 Apr 2001 12:00:30 +0100
Reply-To: "crg" <craig.*REMOVE.THIS*[EMAIL PROTECTED]>

Windows only: www.jcreator.com

"Knowledge Seeker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Hi,
>
> I am looking for a full-featured yet easy to use text editor to
> replace Notepad.  Ideally, I would like a tool that is cross-platform
> or has versions for Win98 and Linux.  The main platform requirement
> would be Win98 and the nice-to-have platform is Linux.
>
> There seem to be a plethora of choices that might work:
> UltraEdit
> TextPad
> EditPlus
> WinEdit
> Multi-Edit
> Zeus
> CRiSP
>
> Right now I am leaning to UltraEdit but I have not done a true
> rigorous evaluation.  I would definitely like to hear from anybody
> that has done a true objective comparative evaluation of these
> products (or others that I have not listed).
>
> My actual requirements are:
>
> Must haves:
> 1. Syntax highlighting (with color and or font) for HTML and Java
> 2. Robust cut and paste including row, AND column AND block
> capabilities
> 3. Split and join functions based on margin or specified column
> 4. Ability to intelligently remove prefix characters (i.e. ">") and
> re-format text to new margins keeping paragraphs intact (i.e. fixing
> forwarded email text)
> 5. Ability to edit multiple files side-by-side
> 6. Ability to compare files and synchronize multiple similar files
> flagging differences
> 7. Robust search and replace capabilities (ideally supporting
> regular expressions)
> 8. Line numbering
> 9. Column numbering
> 10. Auto-completion (based on customizable template)of common
> programming statements
> 11. Ability to preview HTML pages (including Java applets) easily
> 12. HTML toolbar (I know I should know all the tags but I just cannot
> remember them all)
> 13. Can be used as a replacement for Notepad (so it must be
> relatively quick and have a small footprint)
> 14. Highlights URL and e-mail addresses and launches browser or email
> client in a separate window when clicked
> 15. Ability to change case for entire selected text
> 16. Auto indent based on user-defined templates for each programming
> language
> 17. Auto alignment (I.e. if I want a set of lines with the "=" sign
> or decimal point or comma aligned on multiple rows)
> 18. Undo capability
>
> Nice to haves:
> 1. Syntax highlighting for Perl, C/C++, and SQL.  Also, extensibility
> for other programming languages based on easily customized syntax
> files.
> 2. Ability to use FTP
> 3. Spell checker
> 4. Ability to compile from within the editor
> 5. Keystroke save/execute (i.e. macro capability)
>
>
> --
> eCommerce Knowledge Seeker



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


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