Linux-Development-Sys Digest #244, Volume #8 Mon, 30 Oct 00 12:13:18 EST
Contents:
Re: udp bind and sendto problem (Kasper Dupont)
Suse 6.4........................QT library ("A. Groeneveld")
Re: Linux and PXE (Kasper Dupont)
Re: Linux and PXE (Andi Kleen)
Re: rebooting linux without physikal reset (Kasper Dupont)
Re: Kernel API (Kasper Dupont)
Re: Linux and PXE (Kasper Dupont)
Re: Filesystem development (Elizabeth Clarke)
Re: recvfrom() & sendto() (Anes Lihovac)
Re: memory usage realloc() ([EMAIL PROTECTED])
Re: memory usage realloc() (Nick Maclaren)
Re: Linux and PXE (Andi Kleen)
Debugging Modules (Oliver Graebner)
USB backport broken ? (Anders =?iso-8859-1?Q?=D6stling?=)
Linux Networking Implementation (Sam Liang)
Re: memory usage realloc() (Paul Kimoto)
----------------------------------------------------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: udp bind and sendto problem
Date: Mon, 30 Oct 2000 11:09:44 +0100
[EMAIL PROTECTED] wrote:
>
> i am trying to program a little udp application on a red hat 6.2 linux
> machine. when i try to call sendto after successfully binding to an
> address and port it returns an error (-1). what am i doing wrong?
> cant i bind then call sendto?!
>
> thanks in advance.
>
> here is a code snippet: (this works if i remove the call to bind().)
>
> struct sockaddr_in saddr;
> memset(&saddr, 0, sizeof(saddr));
> saddr.sin_family = AF_INET;
> saddr.sin_port = htons(13492);
> inet_pton(AF_INET, "10.100.132.18", &saddr.sin_addr);
>
> fd = socket(AF_INET, SOCK_DGRAM, 0);
>
> success = bind(fd, (struct sockaddr *) &saddr, sizeof(saddr));
> // success returns 0
>
> success = sendto(fd, message, message_length, 0,
> &saddr, sizeof(saddr);
> // success returns -1.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
I think replacing
inet_pton(AF_INET, "10.100.132.18", &saddr.sin_addr);
with
saddr.sin_addr=0;
would work. That is the only difference
from what I would have written.
--
Kasper Dupont
------------------------------
From: "A. Groeneveld" <[EMAIL PROTECTED]>
Subject: Suse 6.4........................QT library
Date: Mon, 30 Oct 2000 10:35:28 +0100
Hello who knows how i can check if the QT library is well installed on my
suse system?
When i use Kdevelop with qt library it says it cannot find all qt
widgets..........
--
Andr� Groeneveld
Middelweg 11
3235 NM Rockanje NL
Telefoon: 0181 401544
Fax: 020 8688169
Homepagina: www.home.hccnet/a.groeneveld
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Linux and PXE
Date: Mon, 30 Oct 2000 11:31:02 +0100
[EMAIL PROTECTED] wrote:
>
> On Fri, 27 Oct 2000 23:27:09 GMT [EMAIL PROTECTED] wrote:
>
> | I have a requirement to use PXE to download linux kernel, do some work,
> | and then boot to the os on the disk.
> |
> | The problems that I am having is that I am unable to program the reboot
> | code to switch to the next boot device. The plug and play bios
> | specification says that int 18h could be sent to the bios to boot to
> | next device. I have verified this by sending the interrup in Setup.s,
> | and the next boot device gets control.
Originally int 18h was used to start the ROM BASIC.
The standard MBR code will if no boot partition exists
call int 18h and not expect it to return. Since no
PC manufactured for the last decade int 18h has been
used for all kinds of stuff since. Because the MBR and
perhaps other programs will call int 18h there has to
be something. I have seen all different kind of error
messages like No ROM BASIC please reset. Or suggesting
some BASIC for DOS. Some computers enter the BIOS setup
menu.
In most recent BIOSes the int 18h is used in the
following case: You have choosen the boot sequence to
be C, A. Since a harddisk would normally be present
the MBR will always be loaded and executed if no boot
partition exists int 18h will be called. The BIOS int
18h routine will then atempt to boot from floppy.
I wouldn't expect much from int 18h.
> |
> | However, when I program the reboot code to send interrupt 18h seems to
> | hang the machine. I am sending that interrup after the linux code
> | switches itself to the real mode (modified the process.c code). I guess
> | linux when loading destroys the bios data area, which might be causing
> | the machine to hang? Any clues? Is it possible to access bios services
> | when running under linux. If not, what kind of cleanup I need to do to
> | achieve the same functionality?
>
> I do believe the BIOS will have to be restarted from reset once Linux has
> been running in protected mode. So many things besides the CPU mode can
> be "out of whack" that the reset sequence is the only way to do this.
Some BIOS functions can be called, if you look in
apm.c you will see a call to int 15h. I think
Linux leaves the first page untouched, which should
be enough for the BIOS to work. I would suggest you
try using INT 10h to clear the display use INT 13h
to load the boot record you prefer and jump to that.
(The boot record might need some parameters, I'm
not sure.) This piece of untested code could be a
replacement for the int 18h
; Clear Segment registers and set SP
CLI
XOR AX,AX
MOV DS,AX
MOV SS,AX
MOV ES,AX
MOV SP,7C00
STI
; Clear the screen
MOV AX,0003
INT 10
; Print one char just to see what happens
MOV AX,0e21
INT 10
; Load MBR replace parameters to your needs.
MOV AX,0201
MOV BX,7C00
MOV CX,0001
MOV DX,0080
INT 13
; Print another char
MOV AX,0e21
INT 10
; Jump to the CODE
JMP 0:7C00
[...]
I'm doing some experiments with a kernel
module doing something simelair, but
currently it is a problem that
machine_real_restart cannot be called
from a module.
--
Kasper Dupont
------------------------------
From: Andi Kleen <[EMAIL PROTECTED]>
Subject: Re: Linux and PXE
Date: 30 Oct 2000 11:57:16 +0100
Kasper Dupont <[EMAIL PROTECTED]> writes:
>
> Some BIOS functions can be called, if you look in
> apm.c you will see a call to int 15h. I think
> Linux leaves the first page untouched, which should
> be enough for the BIOS to work. I would suggest you
> try using INT 10h to clear the display use INT 13h
> to load the boot record you prefer and jump to that.
> (The boot record might need some parameters, I'm
> not sure.) This piece of untested code could be a
> replacement for the int 18h
Don't try. It'll crash and burn. APM is a special case and only
works because APM is spec'ed for protected mode calls and the call
code does some careful segment switching for it.
The only way to call BIOS code is via the vm86 mode, but even that
is quite tricky and requires considerable setup.
-Andi
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: rebooting linux without physikal reset
Date: Mon, 30 Oct 2000 12:02:58 +0100
Philip Armstrong wrote:
>
> In article <[EMAIL PROTECTED]>,
> Kasper Dupont <[EMAIL PROTECTED]> wrote:
> >Daniel Goergen wrote:
> >> Is it possible to reboot linux without letting the computer make a
> >> physical reset?
> >> (I have to store data in RAM (we have no FS) before und read it after
> >> the reboot)
> >I think, what you want is something like LOADLIN runing
> >under Linux. I think it would be possible, but I don't
> >think anyone has made it yet.
>
> Its possible that the two-kernel monte available from
> http://www.scyld.com/ might do what you want...
>
I took a quick look on the source and documentation.
It is exactly what i was looking for, that saved me
the time for writing this myself. :-)
I can see that SCC like me found that some usefull
kernel symbols is not exported. Why does kernel
symbols have to explicitely be exported, wouldn't
it be possible to allow modules to use any symbols
from the kernel?
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Kernel API
Date: Mon, 30 Oct 2000 12:06:28 +0100
Nix wrote:
>
> Tux <[EMAIL PROTECTED]> writes:
>
> > try
> >
> > gcc -O -D__KERNEL__ ...
> >
> > Optimization needs to be activated because of some extra features.
>
> That's a pretty safe statement. :)
>
> You need to have optimization turned on because in all released versions
> of GCC (ignoring the `released snapshot' in RedHat 7) function inlining
> is only done when optimizing, and the kernel depends upon function
> inlining being done (for port I/O, IIRC).
>
[...]
That is not the only reason, the user space access
macros generate calls of nonexisting functions.
They are removed when optimizing because they are
in a never used path in a switch statement.
--
Kasper Dupont
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Linux and PXE
Date: Mon, 30 Oct 2000 12:15:13 +0100
Andi Kleen wrote:
>
[...]
>
> Don't try. It'll crash and burn. APM is a special case and only
> works because APM is spec'ed for protected mode calls and the call
> code does some careful segment switching for it.
>
> The only way to call BIOS code is via the vm86 mode, but even that
> is quite tricky and requires considerable setup.
>
> -Andi
That call I was mentioning is done in real
mode. If the CPU is in real mode and the
first 2KB is untouched i cannot see how
anything can go wrong. What can go wrong?
--
Kasper Dupont
------------------------------
From: Elizabeth Clarke <[EMAIL PROTECTED]>
Subject: Re: Filesystem development
Date: 30 Oct 2000 12:53:06 +0000
[EMAIL PROTECTED] writes:
> Is the filesystem mounted to allow execute? Is memory mapping implemented
> in your filesystem?
Yes, and no. I found it after quite a bit of head scratching. The answer is
that I needed to implement bmap - which is a file block number to disk number
call. And I needed to put in the file mmap entry generic_file_mmap.
Once I did that my bmap was called, then it barfed cos I was wasn''t expecting
to be called with block > filelength / blocksize. Now working and I can
execute from flash.
Thanks. And apologies for not following up that I had found the solution.
Beth
------------------------------
Date: Mon, 30 Oct 2000 14:58:12 +0100
From: Anes Lihovac <[EMAIL PROTECTED]>
Subject: Re: recvfrom() & sendto()
Maurizio Piana wrote:
>
> Hi all, I'm searching for the source code of recvfrom() and sendto()
> functions but all that I can find is the prototypes of these two
> functions. Does any of you know where to find the source code?
>
> I'm trying to understand how these functions work to produce an udp
> packet from an input [using functions in udp.c file] and reverse
> (from packet --> original data).
>
> Thanx
Hello !
This should be in the libc your system is running !
Regards
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: memory usage realloc()
Date: Mon, 30 Oct 2000 13:49:41 GMT
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:
> The behavior of ANSI library functions in user programs is not a
> c.o.l.d.system matter, but anyway ...
>
> In article <8ti06d$ni$[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote:
> > Has someone experience with ANSI library function realloc()? I have
some
> > problems with this function.
> >
> > I have something like below:
> >
> > int *p, *q;
> >
> > p=malloc(sizeof(int)*1024);
> > q=realloc(p, sizeof(int)*1024*12);
> >
> > if (q!=p) {
> > free(p);
> > }
> >
> > I have seg-fault here. Why?
>
> Harbison and Steele (3rd edition) says:
>
> : Whenever realloc returns a pointer that is different from its first
> : argument the programmer should assume that the old region of memory
was
> : deallocated and should not be used.
>
> So presumably realloc() has already free()d the memory pointed at by
p.
> In the Linux malloc() implementation, you can't free() the same memory
more
> than once; segfaults are a common result.
>
> --
> Paul Kimoto
> This message was originally posted on Usenet in plain text. Any
images,
> hyperlinks, or the like shown here have been added without my consent,
> and may be a violation of international copyright law.
>
I don't agree with you, because if the older memory is freed
automatically, why it's still possible to access it, store value in it?
Or it's because Linux will take some time to really "free" the memory,
not right after the free() call?
thanks!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
From: [EMAIL PROTECTED] (Nick Maclaren)
Subject: Re: memory usage realloc()
Date: 30 Oct 2000 14:06:51 GMT
In article <8tju9i$f2p$[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes:
|> In article <[EMAIL PROTECTED]>,
|> [EMAIL PROTECTED] wrote:
|> > The behavior of ANSI library functions in user programs is not a
|> > c.o.l.d.system matter, but anyway ...
|> >
|> > Harbison and Steele (3rd edition) says:
|> >
|> > : Whenever realloc returns a pointer that is different from its first
|> > : argument the programmer should assume that the old region of memory
|> was
|> > : deallocated and should not be used.
|> >
|> > So presumably realloc() has already free()d the memory pointed at by
|> p.
|> > In the Linux malloc() implementation, you can't free() the same memory
|> more
|> > than once; segfaults are a common result.
|>
|> I don't agree with you, because if the older memory is freed
|> automatically, why it's still possible to access it, store value in it?
|>
|> Or it's because Linux will take some time to really "free" the memory,
|> not right after the free() call?
It isn't as simple as that, and will depend on the exact details
of your allocation library. There are almost certainly several
different ones for Linux, with different properties. Paul Kimoto
is correct in all respects (including the matter being off-group),
and I don't know the details of the allocation libraries on Linux,
so I won't describe what can happen.
But remember that, just because something doesn't blow up, doesn't
mean that it has worked - still less that it will work in another
context or will continue to work.
Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email: [EMAIL PROTECTED]
Tel.: +44 1223 334761 Fax: +44 1223 334679
------------------------------
From: Andi Kleen <[EMAIL PROTECTED]>
Subject: Re: Linux and PXE
Date: 30 Oct 2000 15:00:05 +0100
Kasper Dupont <[EMAIL PROTECTED]> writes:
> Andi Kleen wrote:
> >
> [...]
> >
> > Don't try. It'll crash and burn. APM is a special case and only
> > works because APM is spec'ed for protected mode calls and the call
> > code does some careful segment switching for it.
> >
> > The only way to call BIOS code is via the vm86 mode, but even that
> > is quite tricky and requires considerable setup.
> >
> > -Andi
>
> That call I was mentioning is done in real
> mode. If the CPU is in real mode and the
> first 2KB is untouched i cannot see how
> anything can go wrong. What can go wrong?
Hardware is in a state the BIOS does not expect it to. To make the BIOS work
you need a quite good virtual machine, e.g. as in dosemu (which even has
to emulate most BIOS calls because they're hopeless)
-Andi
------------------------------
From: Oliver Graebner <[EMAIL PROTECTED]>
Subject: Debugging Modules
Date: Mon, 30 Oct 2000 15:57:42 +0100
Reply-To: [EMAIL PROTECTED]
Hi Anyone,
I tried to set up a debugging environmet for modules. I'm already able
to debug the kernel of a x86 based remote target with gdb on the host
and gdbstub on the target via a serial connection. After loading the
module (compiled with -g for debugging) I break into the debugger again
with an "int 3" instruction in the module code. The debugger shows me
the assembler code of the module but I'm not able to connect the
assembler code to the source code.
I found a command "add-symbol-file FILE ADDR" in the gdb online help but
I don't know what kind of address I have to fill into ADDR. Am I on the
right way or does anybody know how to debug modules?
Any hints and suggestions would be appreciated!
- Oliver
------------------------------
From: Anders =?iso-8859-1?Q?=D6stling?= <[EMAIL PROTECTED]>
Subject: USB backport broken ?
Date: Mon, 30 Oct 2000 15:43:07 +0100
Hi
I have tried the newest pre-release (2.2.18-pre18 and pre-17) in order
to test the backport of the usb code more thorughly. However, it seems
like it's getting less and less stable...
The backport [manually applied] on 2.2.16 works quite well. My MS
Intellimouse works fine except after an APM suspend/resume. There is no
way I can wake the mouse up except rebooting after resuming.
Using the prepatch with the "hotplug" made the usbdevfs to become
corrupt. Typing "cat /proc/bus/usb/drivers" gave about 100 lines of "usb
usb usb..." before ending. The bus/usb/devices showed nothing at all.
However, it worked [sort of] when using all modules, but a usb restart
(/etc/usb/rc.usb restart) from within an X session made the system
freeze and forced a hard reset to unlock. Restart from a VT session
worked though !!! Anyway, after trying a lot of combinations
(modules/builtin/script load/unload) I am no long able to make it work
at all with the pre-patches. Had to revert to 2.2.16 to bring my mouse
back to life...
Is this a known problem ? I'd like to hear from anyone who has managed
to make it work with hot-plugging, and maybe APM too. Or if there is no
hope until 2.4.
Thanks
Anders
PS. I'm running this on a Compaq Armada 6500 (former DEC Hinote 2000)
laptop with usb-uhci
--
+-----------------------------------------------------+
| [ The Pk7 attachment is a Digital Signature ] |
+-----------------------------------------------------+
| Anders �stling |
| Technology Specialist |
| Corporate Technology Group, IKEA IT CENTER |
| Box 803 |
| SE-251 08 Helsingborg, SWEDEN |
| Voice: +46-42-26 43 45 |
| Fax : +46-42-26 44 10 |
| Email: [EMAIL PROTECTED] |
+-----------------------------------------------------+
------------------------------
From: Sam Liang <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.networking
Subject: Linux Networking Implementation
Date: Mon, 30 Oct 2000 08:45:54 -0800
Hello,
We need to make some changes and do some experiments with Linux's TCP
implementation. Are there any good books or web pages that explain the
current Linux TCP/IP implementations (data structures and program
flow)? Such as how buffers are managed, how acknowledgement is sent
out, how processes are woken up when data come in, etc.
Thanks,
Sam
[EMAIL PROTECTED]
------------------------------
From: [EMAIL PROTECTED] (Paul Kimoto)
Subject: Re: memory usage realloc()
Date: 30 Oct 2000 12:01:33 -0500
Reply-To: [EMAIL PROTECTED]
In article <8tju9i$f2p$[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote:
> In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED] wrote:
>> The behavior of ANSI library functions in user programs is not a
>> c.o.l.d.system matter, but anyway ...
>> realloc() has already free()d the memory pointed at by p.
>> In the Linux malloc() implementation, you can't free() the same memory more
>> than once; segfaults are a common result.
> I don't agree with you, because if the older memory is freed
> automatically, why it's still possible to access it, store value in it?
>
> Or it's because Linux will take some time to really "free" the memory,
> not right after the free() call?
"free" does not (necessarily) ask to "make memory inaccessible to the
program". It means "this memory has no further use". In practice, often
the implementation makes some notation to indicate that the memory in
question can be given out in a future malloc(). In this case, it will
still be possible to find old values in the free()d region, but this would
mean that you are not following the rules for using free() (i.e., that you
will not look at the memory there again).
--
Paul Kimoto
This message was originally posted on Usenet in plain text. Any images,
hyperlinks, or the like shown here have been added without my consent,
and may be a violation of international copyright law.
------------------------------
** 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
******************************