2010-06-19 05:10:23 Alternatives to forkpty() ?
Stephen Lombard (AUSTRALIA)
Message: 90448
Hi Folks,
I can understand and appreciate that non-mmu systems don't have fork() and anything else such as forkpty().
I am trying to port an Amateur Radio application and I have replaced several fork() calls with vfork() safely but the one remaining forkpty() call has me going in circles.
Could anyone please suggest a way to tackle the problem or an alternate solution to implement?
Thanks heaps for all the fantastic work on blackfin's uClinux port.
Regards,
Stephen Lombard, VK4ISP
QuoteReplyEditDelete
2010-06-19 10:23:19 Re: Alternatives to forkpty() ?
Robin Getz (UNITED STATES)
Message: 90455
Stephen:
The "proper" thing to do is to fix uClibc's forkpty up, so it can be used on nommu machines. It's current make logic has:
ifneq ($(ARCH_USE_MMU),y)
libutil_SRC := $(filter-out $(libutil_DIR)/forkpty.c,$(libutil_SRC))
endif
Mike could comment more.
-Robin
QuoteReplyEditDelete
2010-06-19 13:00:51 Re: Alternatives to forkpty() ?
Mike Frysinger (UNITED STATES)
Message: 90457
forkpty isnt fixable. like the documentation says, it is like fork, which means you end up with two identical processes running where one is the master pty and one is the slave. that cant be faked on nommu anymore than fork can be.
QuoteReplyEditDelete
2010-06-19 13:02:55 Re: Alternatives to forkpty() ?
Mike Frysinger (UNITED STATES)
Message: 90458
you'd have to simulate it yourself in your own application:
- openpty()
- vfork()
- close all fd's but leave #4 as the slave pty
- execl() same program with special flag
- have the program use that special flag to know it needs to resume after the openpty() step with the slave pty in fd #4
- ...
QuoteReplyEditDelete
2010-06-20 06:11:26 Re: Alternatives to forkpty() ?
Stephen Lombard (AUSTRALIA)
Message: 90482
Thank you Robin and Mike!
With your words of advise I wrote a replacement forkpty.c, which, from what I can tell so far seems to be working.
Regards,
Stephen Lombard