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
How to build 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.
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.
댓글
댓글 쓰기