[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [microblaze-uclinux] Modbus TCP/IP module
Hi Raul,
Raul Camaras wrote:
> Sorry, fork() doesn't seem to work! it returns -1.
> Does anyone know how to get it working?
As Alejandro pointed out, in uClinux you must use vfork() instead of
fork. There are some tricks:
1. vfork() blocks the parent until the child calls either a variant of
exec() or _exit()
2. The child shares the parent's stack frame until (1) occurs. This
means that the child can make function calls, but must not return from
the current function scope. Otherwise, it will destroy the parent stack
frame. Any local variables must also be used very carefully, since they
are allocated on the stack.
3. The child shares the parent's data space until (1) occurs. The
child must not modify any global variables, including hidden variables
in the C libraries, like errno. Use _exit() instead of exit() for this
reason.
Generally porting Linux fork apps to uClinux vfork apps is either very
easy (search/replace), or very difficult (completely refactor the code)
- there's not much in between.
Regards,
John
> thanks
> best regards,
> Raul
>
>
>
> Am Do, den 26.01.2006 schrieb Raul Camaras um 14:42:
>
>>Hi all,
>>here is our modbus TCP/IP module that we use with uClinux. It was
>>programmed of course under linux. It offers functions 3(read) and
>>16(write) for multiple holding registers, so as multiple client
>>connections. The port used is the standard for modbus, the 502.
>>
>>Hope this heps somehow. One of my problems programming TCP/IP with
>>uClinux was a big delays(of about 1 or 2 minutes) when communicating two
>>uClinux via TCP/IP, does somebody has any idea or work around for this?
>>I looked already the traffic with tcpdump, and actually, it delays.
>>
>>Best regards,
>>Raul
>>
>>
>
>
> ___________________________
> microblaze-uclinux mailing list
> microblaze-uclinux@xxxxxxxxxxxxxx
> Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
--
Dr John Williams, Research Fellow,
Embedded Systems Group / Reconfigurable Computing
School of ITEE, The University of Queensland, Brisbane, Australia
(p) +61 7 33652185 (f) +61 7 33654999 (m) +61 403969243
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/