Porting to OS/2: Case #17 spawn...()

Many Unix programs seem not to care about command line length. So sometimes they pass a very long command line to a child program. However, OS/2 has a limitation for a command line length. It's 32KB. If a length is longer than 32KB, then OS/2 cannot execute a child program.

If so, there is no way to workaround this ? Fortunately, there is a way in case of kLIBC. kLIBC supports a response file as an argument. Instead of passing arguments to a child program directly, passing arguments via a response file is the way.

Here is spwanvpe() to pass a very long command line as a response file.


And a test program.


How to build spawnvpe-1.exe

  • gcc spwanvpe-1.c spawnvpe.c

How to build spawnvpe-1-child.c

  • gcc spawnvpe-1-child.c

Other spawnl...() and spawnv...() can be implemented similarly. Or it's possible to implement all spawn..() functions by refactoring common parts.

댓글

이 블로그의 인기 게시물

토렌트: < 왕좌의 게임 > 시즌 1 ~ 시즌 8 완결편 마그넷

토렌트: NGC < 코스모스 > 우리말 더빙 전편(1편~13편) 마그넷

토렌트: < 스타워즈 > Ep.1 ~ Ep.6 마그넷