Linux-Development-Sys Digest #181, Volume #8     Fri, 29 Sep 00 12:13:11 EDT

Contents:
  Re: RS232 / Mitutoyo Counter and Basic example ("O.Petzold")
  Re: Interpreterexecutionbug (Danny Reinhold)
  Re: Interpreterexecutionbug (Basile STARYNKEVITCH)
  Re: Interpreterexecutionbug (Danny Reinhold)
  Re: RS232 / Mitutoyo Counter and Basic example (Lew Pitcher)
  Re: Help: Kernel hang/coredump analysis ([EMAIL PROTECTED])
  Re: disabling update of last-access and modification timestamps on files (Benjamin 
Rutt)
  new project for linux in idea..... ("javewolf")
  Re: Help: Kernel hang/coredump analysis (Mike McDonald)
  Re: problem with ftp (Stefaan A Eeckels)
  Re: Building a 2.0 kernel from a 2.2.14 based machine (Phil Ehrens)

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

From: "O.Petzold" <[EMAIL PROTECTED]>
Subject: Re: RS232 / Mitutoyo Counter and Basic example
Date: Fri, 29 Sep 2000 09:20:59 +0200

Thnak you Lew,

> However, here's what it does...
>
> Open /dev/ttyS0 for I/O

lamer question: ttyS0 is it com1 ?

>
> write the string "CS00" to /dev/ttyS0
> write the string "ef-11pr ? Y or N" to /dev/tty, and input a response
> loop forever
>   write the string "GA00" to /dev/ttyS0
>   wait for some input on /dev/ttyS0
>   read a line of input from /dev/ttyS0
>   if the response to the /dev/tty prompt was not 'Y'
>     read a line of input from /dev/ttyS0
>     write the input to /dev/tty
>   end-if
>   print a blank line on /dev/tty
>   idle loop for a while
> end-of-forever-loop
>
> > - How can I read/write to the serial port, what does it mean line 50 ?
> > (com:e72 and as #1 ?)
>
>   FILE *file;
>
>   file = fopen("/dev/ttyS0","r+");

How can I set the traits like 9600 baud, parity: even etc. ? I've read the
serial programming
howto (very) short. There was using a structure - is there another way ?

>
>   fprintf(file,"%s\n",data); or fwrite(data,sizeof(char),sizeof
> data,file);
>   fscanf(); or fgets(); or fread(); /* you get the picture */
>
> > - line 60: print #1, "CS00": does it mean put cs00 into stream???? #1,
> > is it hex, ascii ???
>
> It seems to be a string (i.e. "CS00" ).

I have to terminate each string with a
carriage return '\cr' (right ?) and a
line feed '\n' (right as well ?)
This I can read in the manual.

I remember, that dos is using '\cr\n' to terminate a line (very back in my
mind), but
I'm not sure.

Thanks    Olaf



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

From: Danny Reinhold <[EMAIL PROTECTED]>
Subject: Re: Interpreterexecutionbug
Date: Fri, 29 Sep 2000 11:59:54 +0200

Lew Pitcher wrote:

Hi Lew (and others),

> > While exploring linux I found an incompatibility to other unices (at
> > least SunOS, Solaris, Irix, Aix and HP-UX behave diffently from
> > linux)...
> >
> > When you start a program in the bash, the program can read it's program
> > name in argv[0]. This variable contains the _complete pathname_.
> argv[0] is not guaranteed to have anything meaningful in it, but when
> it does, it will be the name of the program. It is not guaranteed to
> be the complete pathname; sometimes this cannot even be established,
> let alone recorded. P'haps some Unices keep this information
Well, all OS's mentioned above and at least the sh on all of them put
the
complete pathname in argv[0] when a program is startet via interpreter
files
or directly in sh...

> available, or even some shells make it available, but the standards do
> not require it.
Hui... That's what I really wanted to know..
But fact is that linux is different from nearly all other UNICES in this
topic...

> > My only reference to this topic is the book 'Advanced programming in the
> > UNIX
> > environment' by W. Richard Stevens (Addison-Wesley). This book states
> > that
> > the complete pathname should be in argv[0].
> Where in APUE? I've got my copy out, and I can't find any statement of
> that sort. In fact, the example in section 7.4 demonstrates an argv[0]
> that _does not_ carry a complete path.
That example shows that it is not guaranteed to get the complete
pathname
if the program is startet via an arbitrary shell or directly by another
program or so what is really clear.
But section 8.11 (page 218 in my copy) says that the complete pathname
is given when a program is startet via interpreter files.

> > This incompatibility of linux to an obviously existing standard is very
> > ugly.
> > Is there any standard definition (ie POSIX) ?
> Yes, and Linux adheres to it.
Hmm, ok.
Maybe it's not an official standard to give the complete pathname; but
it's
kind of an inofficial standard since all other important UNICES behave
in the same way...

> > Is there a workaround, so that myproggy will get the complete pathname
> > in argv[0] ???
> No.
Well, I've got another mail from a decent fellow reader. He had the idea
to use readlink on the file /proc/self/exe which seems to be a symbolic
link
to the current executable...
(But this requires that the proc-pseudofs is used by users of
'myproggy'...)

> > It's not very helpful to know that the complete pathname of the script
> > containing
> > the interpreter-line is passed in argv[1], because I need to know the
> > place myproggy is installed at...
> You'll have to find other ways to locate the installation point of
> 'myproggy'. Anyway, your purpose may be suspect here; I believe that
> you are trying to fix the wrong problem, and should be addressing the
> reason you need to know the exact location your program is installed
> at.
Yes, it really seems awkward to use such assumptions.
We've just implemented another way to solve the critical problem (in
the way: If argv[0] is not an absolute pathname, assume that the program
is installed in a special relation to a given environment variable).
But anyway: I don't like such subtle incompatibilities between OSs...

> BTW: have you considered the effects of links (especially hard links)?
> If you installed /usr/local/bin/myproggy, then hardlinked
> /usr/bin/hisproggy to it, which name should be presented in argv[0]
> when hisproggy (which is myproggy) is run?
Hmmm, good point !!!

> > Is this considered a bug in the linux-kernel or is it an acceptable
> > incompatibility ???
> At best, you're complaining about the behaviour of a particular shell
> or runtime library (which _could_ load argv[0] with a better guess as
> to the program's path, based on where it found it in the $PATH). This
> has _nothing_ to do with the kernel.
Correct, what I'm complaining is not the call via an arbitrary user
space
program (like a shell).
I am compaining the call via interpreter files.
This is a 'hack' in the kernel (in the exec function).
So this is a kernel and standardisation issue...

> As for 'acceptable incompatability', do you accept AIX's
> incompatability with POSIX and Linux here? You _could_ take action and
> fix this 'incompatability' rather than whining that it exists.
Well, the problem is not that there is a difference between AIX and
Linux.
The problem is that Linux is different from all other important
UNICes...
Before changing kernel behaviour ('fixing the incompatibility') I want
to
know, what POSIX says and what other Linuxers think about this topic.
Most probably this incompatibility is not important enough to take
action (you said it: Assuming such things is most probably a failure
itself)...

Greets,
 Danny

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

From: Basile STARYNKEVITCH <[EMAIL PROTECTED]>
Subject: Re: Interpreterexecutionbug
Date: 29 Sep 2000 12:30:39 +0200

>>>>> "Danny" == Danny Reinhold <[EMAIL PROTECTED]> writes:

    Danny> Lew Pitcher wrote: Hi Lew (and others),

    >> > While exploring linux I found an incompatibility to other
    >> unices [...]

    Danny> Well, all OS's mentioned above and at least the sh on all
    Danny> of them put the complete pathname in argv[0] when a program
    Danny> is startet via interpreter files or directly in sh...


This is not what I observe on Solaris 2.6.

/* file ech.c */
#include <stdio.h>
int main(int argc, char**argv)
{
  int i;
  printf("argc=%d argv=", argc);
  for (i=0; i<argc; i++) printf(" %s", argv[i]);
  putchar('\n');
  fflush(stdout);
  return 0;
}

I compiled (in ~/tmp) 
gcc ech.c -o ~/bin/ech

~/bin is in my $PATH. I rehash-ed the shell after compilation

my shell is zsh:

 % ech ??
argc=3 argv= ech aa bb

% bin/ech ??
argc=3 argv= bin/ech aa bb

(same result with /bin/sh - ie Solaris bourne shell)


So it seems that argv[0] is the command name as typed in the shell,
not the full executable file path given as first argument to execve

Perhaps I misunderstood Danny and other messages. But I think that
argv[0] is *not* the full executable path. This path can be retrieved
under Linux by readlink(2) /proc/self/exe and under Solaris 2.6 by the
getexecname(3c) library function. (On some pathological cases, this
path might not exist or be false).

P.S. Beware of my antispam invalid return address. Please correct it
before replying.

N.B. Any opinions expressed here are only mine, and not of my organization.
N.B. Les opinions exprimees ici me sont personnelles et n engagent pas le CEA.

=====================================================================
Basile STARYNKEVITCH   ----  Commissariat � l Energie Atomique 
DTA/LETI/DEIN/SLA * CEA/Saclay b.528 (p111f) * 91191 GIF/YVETTE CEDEX * France
phone: 1,69.08.60.55; fax: 1.69.08.83.95 home: 1,46.65.45.53
email: Basile point Starynkevitch at cea point fr 


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

From: Danny Reinhold <[EMAIL PROTECTED]>
Subject: Re: Interpreterexecutionbug
Date: Fri, 29 Sep 2000 14:09:04 +0200

Basile STARYNKEVITCH wrote:
> 
> >>>>> "Danny" == Danny Reinhold <[EMAIL PROTECTED]> writes:
> 
>     Danny> Lew Pitcher wrote: Hi Lew (and others),
> 
>     >> > While exploring linux I found an incompatibility to other
>     >> unices [...]
> 
>     Danny> Well, all OS's mentioned above and at least the sh on all
>     Danny> of them put the complete pathname in argv[0] when a program
>     Danny> is startet via interpreter files or directly in sh...
> 
> This is not what I observe on Solaris 2.6.

Hi Lew, Basile and everybody !

You are right !
I did not test the behaviour on AIX...

I used your ech-Program and the following sh-script to test the
interpreter-
file-mechanism which is the topic I am interested in:

testech.sh:
[---snip---]
#!/mytmp/testargv0/ech
[---snap---]

The result shows, that 'sh' allways passes the programname typed into
the
shell in argv[0] - ok.
But I expected to see the absolute pathname in argv[0] when starting the
script on several platforms - as statet in the book I just referred to -
but look yourself:

---
Linux
---
$ ./testech.sh
argc=2 argv= ech ./testech.sh

---
HP-UX
---
$ ./testech.sh
argc=2 argv= /devel/dr/tmp/testargv0/ech ./testech.sh

---
AIX
---
$ ./testech.sh
argc=2 argv= ech ./testech.sh

---
Solaris
---
$ ./testech.sh
argc=2 argv= /devel/dr/tmp/testargv0/ech ./testech.sh

---
IRIX
---
$ ./testech.sh
argc=2 argv= /devel/dr/tmp/testargv0/ech ./testech.sh


This means that not only Linux but also AIX behave not as I expected...

Now I agree that this is no bug in Linux!

Thank you both for helping and for giving interesting statements
(especially the readlink-idea and the hardlink-problem) !

Greets,
  Danny

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

From: [EMAIL PROTECTED] (Lew Pitcher)
Subject: Re: RS232 / Mitutoyo Counter and Basic example
Reply-To: [EMAIL PROTECTED]
Date: Fri, 29 Sep 2000 12:11:59 GMT

On Fri, 29 Sep 2000 09:20:59 +0200, "O.Petzold"
<[EMAIL PROTECTED]> wrote:

>Thnak you Lew,
>
>> However, here's what it does...
>>
>> Open /dev/ttyS0 for I/O
>
>lamer question: ttyS0 is it com1 ?

Yes, on an Intel x86 ('PC') platform, /dev/ttyS0 is the Linux
equivalent of MSDOS/MSWindows COM1:

>>
>> write the string "CS00" to /dev/ttyS0
>> write the string "ef-11pr ? Y or N" to /dev/tty, and input a response
>> loop forever
>>   write the string "GA00" to /dev/ttyS0
>>   wait for some input on /dev/ttyS0
>>   read a line of input from /dev/ttyS0
>>   if the response to the /dev/tty prompt was not 'Y'
>>     read a line of input from /dev/ttyS0
>>     write the input to /dev/tty
>>   end-if
>>   print a blank line on /dev/tty
>>   idle loop for a while
>> end-of-forever-loop
>>
>> > - How can I read/write to the serial port, what does it mean line 50 ?
>> > (com:e72 and as #1 ?)
>>
>>   FILE *file;
>>
>>   file = fopen("/dev/ttyS0","r+");
>
>How can I set the traits like 9600 baud, parity: even etc. ? I've read the
>serial programming
>howto (very) short. There was using a structure - is there another way ?

The termios functions (man termios), curses functions (man ncurses) or
ioctl() function (man ioctl) will permit you to manipulate the device
traits. Your best bet would probably be the termios functions here.

>>
>>   fprintf(file,"%s\n",data); or fwrite(data,sizeof(char),sizeof
>> data,file);
>>   fscanf(); or fgets(); or fread(); /* you get the picture */
>>
>> > - line 60: print #1, "CS00": does it mean put cs00 into stream???? #1,
>> > is it hex, ascii ???
>>
>> It seems to be a string (i.e. "CS00" ).
>
>I have to terminate each string with a
>carriage return '\cr' (right ?) and a
>line feed '\n' (right as well ?)
>This I can read in the manual.

To send a carriage return, followed by a linefeed, you'd
printf("CS00\r\n"); The '\r' sequence will generate a carriage return,
and the '\n' will generate a linefeed. However, depending on how your
/dev/ttyS0 is configured (i.e, through the termios ONLCR option), the
'\r' in your printf format string may be redundant.

>I remember, that dos is using '\cr\n' to terminate a line (very back in my
>mind), but
>I'm not sure.
>
>Thanks    Olaf
>
>


Lew Pitcher
Information Technology Consultant
Toronto Dominion Bank Financial Group

([EMAIL PROTECTED])


(Opinions expressed are my own, not my employer's.)

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

From: [EMAIL PROTECTED]
Crossposted-To: comp.os.linux.misc,comp.os.linux.development.apps
Subject: Re: Help: Kernel hang/coredump analysis
Date: Fri, 29 Sep 2000 15:19:55 +0100


On Fri, 29 Sep 2000, Liaw Yong Shyang wrote:

> 
> On Thu, 21 Sep 2000, WATM wrote:
> 
> > Liaw Yong Shyang wrote:
> > > 
> > > Hi,
> > > 
> > > I have midified and recompiled the Linux kernel for my project. I can
> > > reboot from my new kernel image successfully, and it works happily.
> > > However, the system will hang from time to time. How can I debug, as I
> > > could not repeat the bug at my will?? Is it any tool that I can use to
> > > analyse coredump? Any book or article I can read more about coredump
> > > analysis?
> > > 
> > > I really appreciate if you can help. Thank in advance.
> > 
> > 
> > If it is an Oops, it can be analyzed with ksymoops.
> > The oops data is sent to the kernel ring buffer (read with dmesg).
> 
> What is an Oops? Is there any book/article where I can find out more about
> ksymoops?
> Actually, I modified the networking code (i.e. net/ipv4). How can I debug
> my code when the kernel hang? Or is there any tools for debuging kernel
> code? Thanks.
> 
> 
> > 
> > --Bruno
> > 
> > 
> 

You can read information about oops in the linux source:
Documentation/oops-tracing.txt

About your specific problem, I don't know anything about the networking
code, but I think you should compile your modified code with debugging
messages.

In the kernel makefile replace the line
CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
with the line
CFLAGS = -Wall -Wstrict-prototypes -O2 -g

Recompile only the relevant part, or your you'll have a huge kernel.
When the kernel hangs you can debug it with

gdb /somewhere/vmlinux /proc/kcore

Note however that the /proc/kcore can only be read! It's not possible to
change anything! But it still might be useful in catching the offending
code.

I don't know if this can be much of a help, but its worth trying. If
anybody as a better idea, please speak up...

If it does't work you can always stick to the best module debugger there
is: printk. :-)


--Bruno
____________________________________________________________________________
WATM2000:
ATM sem fios em placas DSSS 802.11

E-mail: [EMAIL PROTECTED]
URL:    http://feldspato.ist.utl.pt/~watm2000

Autores:
Bruno Ascenso: [EMAIL PROTECTED]
Bruno Santos : [EMAIL PROTECTED]   







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

From: Benjamin Rutt <[EMAIL PROTECTED]>
Subject: Re: disabling update of last-access and modification timestamps on files
Date: 29 Sep 2000 08:54:41 -0600

[EMAIL PROTECTED] (Bob Hauck) writes:

> >I was wondering whether there is a way on a linux, or unix system in
> >general, to disable updates of the last-access and modification
> >timestamps on a few select files that we are updating frequently.
> 
> The "noatime" option to mount can do this on a per-filesystem basis.  I
> don't know of any finer-grained method.

OK, that looks like exactly what I wanted, thanks!

Benjamin

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

From: "javewolf" <[EMAIL PROTECTED]>
Subject: new project for linux in idea.....
Date: Fri, 29 Sep 2000 15:43:57 GMT

Hello everybody.

I just came back home from work and suddenly an idea came up in my mind.
Well an idea is not bad but i know that my idea can't be realized without
knowledge and help.

Well my idea is to develop a brand new program for linux that will be free
to download.so no cost to get it when it's finished.

My idea is a sort of program (called "Laovs"=Linux Audio Or Video Share)
like napster for linux. BUT!!!! Not only to share Audio like Mp3 or Wav
files but much more like: DivX and Mpeg and avi and MPG and so on.
so finaly it must be a program so that everybody who has linux and want to
download an Mp3 or a movie that we finally all use "Laovs"

my question to you all is
1:-Were to start??
2:-Is it possible to share also video over the Napster server?( If not can
we as linux users setting up a server like napster?)
3:-Are there any peoples in the world who would like to develop this program
in C C++ Perl?
4:- are there peoples who are interested in this project????


Please send a reply or whatever if somebody finds this a good idea and would
like to help develop this "Laovs"

Greets
Javewolf




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

Reply-To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED] (Mike McDonald)
Subject: Re: Help: Kernel hang/coredump analysis
Crossposted-To: comp.os.linux.misc,comp.os.linux.development.apps
Date: Fri, 29 Sep 2000 15:54:21 GMT

In article <[EMAIL PROTECTED]>,
        [EMAIL PROTECTED] writes:

> Recompile only the relevant part, or your you'll have a huge kernel.
> When the kernel hangs you can debug it with
> 
> gdb /somewhere/vmlinux /proc/kcore

  Uh, if the kernel is hung, how are you going to type "gdb ..."?

  Mike McDonald
  [EMAIL PROTECTED]

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

From: [EMAIL PROTECTED] (Stefaan A Eeckels)
Subject: Re: problem with ftp
Crossposted-To: alt.linux,comp.os.linux.setup,linux.redhat.install,linux.redhat.misc
Date: Fri, 29 Sep 2000 17:42:14 +0200

In article <8r0jft$8g1$[EMAIL PROTECTED]>,
        "jhuman" <[EMAIL PROTECTED]> writes:
> I get this error when trying to ftp to one of my linux boxes on private
> lan....
> 
> 421 Service not available, remote server has closed connection
> 
> What does this mean and how do I fix it....

Usually, it's because of badly configured tcpwrappers.

-- 
Stefaan
-- 
Ninety-Ninety Rule of Project Schedules:
        The first ninety percent of the task takes ninety percent of
the time, and the last ten percent takes the other ninety percent.

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

From: [EMAIL PROTECTED] (Phil Ehrens)
Subject: Re: Building a 2.0 kernel from a 2.2.14 based machine
Date: 29 Sep 2000 16:07:50 GMT
Reply-To: -@-

bill davidsen wrote:
>In article <[EMAIL PROTECTED]>,
>Ed Hudson <[EMAIL PROTECTED]> wrote:
>| I am trying to build a 2.0.33 kernel on a 2.2.14 machine.  When I try to compile, I 
>get a lot of 
>| errors as follows:
>| 
>| /usr/src/linux2.0/linux/include/asm/string.h:118 invalid 'asm' statement
>| /usr/src/linux2.0/linux/include/asm/string.h:118 fixed or forbidden register 4(si) 
>was spilled for 
>| SIREG
>| 
>| There are a bunch some spilling SIREG, others spilling CREG.  What am I doing 
>wrong?  I do a 
>| make config, make dep, make clean, make bzImage and it fails on the make bzImage.
>
>  You may be using the wrong compiler. If you are on Slackware, try the
>other one (gcc/egcs) and see if that helps. There's a note in the kernel
>docs somewhere about using egca on older kernels, you can look for that.

I just want to second Bill.  Use this compiler:

ftp://ftp.gnu.org/gnu/gcc/gcc-2.7.2.3.tar.gz

And see if it helps.

-- 
Phil Ehrens <[EMAIL PROTECTED]>| Fun stuff:
The LIGO Laboratory, MS 18-34         | http://www.ralphmag.org
California Institute of Technology    | http://www.yellow5.com
1200 East California Blvd.            | ftp://ftp.no.pgpi.com/pub/pgp
Pasadena, CA 91125 USA                | http://slashdot.org
Phone:(626)395-8518 Fax:(626)793-9744 | http://kame56.homepage.com

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


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