diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-05-22 03:00:08 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-05-22 03:00:08 +0000 |
commit | d7fba4ec70714ccdf7fb29ce85584a71898b7626 (patch) | |
tree | 94d56571cfade12aedab53a01e77d3498f6de7f4 /examples/OS/Process | |
parent | 89479b1202f3656b2eab09efe64b1e9e8fd4ced9 (diff) | |
download | ATCD-TAO-0_1_23.tar.gz |
This commit was manufactured by cvs2svn to create tag 'TAO-0_1_23'.TAO-0_1_23
Diffstat (limited to 'examples/OS/Process')
-rw-r--r-- | examples/OS/Process/Makefile | 46 | ||||
-rw-r--r-- | examples/OS/Process/Process.dsp | 101 | ||||
-rw-r--r-- | examples/OS/Process/Process.dsw | 29 | ||||
-rw-r--r-- | examples/OS/Process/Process.mak | 256 | ||||
-rw-r--r-- | examples/OS/Process/Process.mdp | bin | 40448 -> 0 bytes | |||
-rw-r--r-- | examples/OS/Process/README | 55 | ||||
-rw-r--r-- | examples/OS/Process/imore.cpp | 246 | ||||
-rw-r--r-- | examples/OS/Process/process.cpp | 417 |
8 files changed, 0 insertions, 1150 deletions
diff --git a/examples/OS/Process/Makefile b/examples/OS/Process/Makefile deleted file mode 100644 index de80638368f..00000000000 --- a/examples/OS/Process/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -#---------------------------------------------------------------------------- -# $Id: Makefile 1.1 10/18/96 -# -# Makefile for repeating token client application -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -BIN = process imore - -FILES = process imore - -LSRC = $(addsuffix .cpp,$(FILES)) -LOBJ = $(LSRC:%.cpp=$(VDIR)%.o) -SHOBJ = $(addsuffix .so,$(FILES)) - -BUILD = $(VBIN) - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - - - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/examples/OS/Process/Process.dsp b/examples/OS/Process/Process.dsp deleted file mode 100644 index 12a6737bafc..00000000000 --- a/examples/OS/Process/Process.dsp +++ /dev/null @@ -1,101 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Process" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Process - Win32 Release
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Process.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Process.mak" CFG="Process - Win32 Release"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Process - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "Process - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "Process - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir ".\Release"
-# PROP BASE Intermediate_Dir ".\Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir ".\Release"
-# PROP Intermediate_Dir ".\Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 aced.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\ace"
-
-!ELSEIF "$(CFG)" == "Process - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ".\Debug"
-# PROP BASE Intermediate_Dir ".\Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir ".\Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386
-# ADD LINK32 ace.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\..\..\ace"
-
-!ENDIF
-
-# Begin Target
-
-# Name "Process - Win32 Release"
-# Name "Process - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
-# Begin Source File
-
-SOURCE=.\process.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/examples/OS/Process/Process.dsw b/examples/OS/Process/Process.dsw deleted file mode 100644 index a2474e84a86..00000000000 --- a/examples/OS/Process/Process.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 5.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "Process"=.\Process.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/examples/OS/Process/Process.mak b/examples/OS/Process/Process.mak deleted file mode 100644 index d787ff51cf2..00000000000 --- a/examples/OS/Process/Process.mak +++ /dev/null @@ -1,256 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-!IF "$(CFG)" == ""
-CFG=Process - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to Process - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "Process - Win32 Release" && "$(CFG)" !=\
- "Process - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE on this makefile
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Process.mak" CFG="Process - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Process - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "Process - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-################################################################################
-# Begin Project
-# PROP Target_Last_Scanned "Process - Win32 Debug"
-RSC=rc.exe
-CPP=cl.exe
-
-!IF "$(CFG)" == "Process - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-OUTDIR=.\Release
-INTDIR=.\Release
-
-ALL : "$(OUTDIR)\Process.exe"
-
-CLEAN :
- -@erase "$(INTDIR)\process.obj"
- -@erase "$(OUTDIR)\Process.exe"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
-CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\
- /Fp"$(INTDIR)/Process.pch" /YX /Fo"$(INTDIR)/" /c
-CPP_OBJS=.\Release/
-CPP_SBRS=.\.
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-BSC32_FLAGS=/nologo /o"$(OUTDIR)/Process.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib ace.lib /nologo /subsystem:console /machine:I386
-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
- advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib ace.lib /nologo\
- /subsystem:console /incremental:no /pdb:"$(OUTDIR)/Process.pdb" /machine:I386\
- /out:"$(OUTDIR)/Process.exe"
-LINK32_OBJS= \
- "$(INTDIR)\process.obj"
-
-"$(OUTDIR)\Process.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "Process - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ""
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-OUTDIR=.
-INTDIR=.\Debug
-
-ALL : "$(OUTDIR)\Process.exe"
-
-CLEAN :
- -@erase "$(INTDIR)\process.obj"
- -@erase "$(INTDIR)\vc40.idb"
- -@erase "$(INTDIR)\vc40.pdb"
- -@erase "$(OUTDIR)\Process.exe"
- -@erase "$(OUTDIR)\Process.ilk"
- -@erase "$(OUTDIR)\Process.pdb"
-
-"$(INTDIR)" :
- if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
-
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE"\
- /Fp"$(INTDIR)/Process.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
-CPP_OBJS=.\Debug/
-CPP_SBRS=.\.
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-BSC32_FLAGS=/nologo /o"$(OUTDIR)/Process.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib aced.lib /nologo /subsystem:console /debug /machine:I386
-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
- advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib aced.lib /nologo\
- /subsystem:console /incremental:yes /pdb:"$(OUTDIR)/Process.pdb" /debug\
- /machine:I386 /out:"$(OUTDIR)/Process.exe"
-LINK32_OBJS= \
- "$(INTDIR)\process.obj"
-
-"$(OUTDIR)\Process.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-.c{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
-
-.cpp{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
-
-.cxx{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
-
-.c{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
-
-.cpp{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
-
-.cxx{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
-
-################################################################################
-# Begin Target
-
-# Name "Process - Win32 Release"
-# Name "Process - Win32 Debug"
-
-!IF "$(CFG)" == "Process - Win32 Release"
-
-!ELSEIF "$(CFG)" == "Process - Win32 Debug"
-
-!ENDIF
-
-################################################################################
-# Begin Source File
-
-SOURCE=.\process.cpp
-
-!IF "$(CFG)" == "Process - Win32 Release"
-
-DEP_CPP_PROCE=\
- "..\..\..\ace\config-win32.h"\
- {$(INCLUDE)}"\ace\ACE.h"\
- {$(INCLUDE)}"\ace\ACE.i"\
- {$(INCLUDE)}"\ace\Auto_Ptr.cpp"\
- {$(INCLUDE)}"\ace\Auto_Ptr.h"\
- {$(INCLUDE)}"\ace\Auto_Ptr.i"\
- {$(INCLUDE)}"\ace\config-win32-common.h"\
- {$(INCLUDE)}"\ace\config.h"\
- {$(INCLUDE)}"\ace\Get_Opt.h"\
- {$(INCLUDE)}"\ace\Get_Opt.i"\
- {$(INCLUDE)}"\ace\Log_Msg.h"\
- {$(INCLUDE)}"\ace\Log_Priority.h"\
- {$(INCLUDE)}"\ace\Log_Record.h"\
- {$(INCLUDE)}"\ace\Log_Record.i"\
- {$(INCLUDE)}"\ace\Object_Manager.h"\
- {$(INCLUDE)}"\ace\Object_Manager.i"\
- {$(INCLUDE)}"\ace\OS.h"\
- {$(INCLUDE)}"\ace\OS.i"\
- {$(INCLUDE)}"\ace\Process.h"\
- {$(INCLUDE)}"\ace\Process.i"\
- {$(INCLUDE)}"\ace\SString.h"\
- {$(INCLUDE)}"\ace\SString.i"\
- {$(INCLUDE)}"\ace\stdcpp.h"\
- {$(INCLUDE)}"\ace\Trace.h"\
- {$(INCLUDE)}"\ace\ws2tcpip.h"\
-
-
-"$(INTDIR)\process.obj" : $(SOURCE) $(DEP_CPP_PROCE) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "Process - Win32 Debug"
-
-DEP_CPP_PROCE=\
- "..\..\..\ace\config-win32.h"\
- {$(INCLUDE)}"\ace\ACE.h"\
- {$(INCLUDE)}"\ace\ACE.i"\
- {$(INCLUDE)}"\ace\Auto_Ptr.cpp"\
- {$(INCLUDE)}"\ace\Auto_Ptr.h"\
- {$(INCLUDE)}"\ace\Auto_Ptr.i"\
- {$(INCLUDE)}"\ace\config-win32-common.h"\
- {$(INCLUDE)}"\ace\config.h"\
- {$(INCLUDE)}"\ace\Get_Opt.h"\
- {$(INCLUDE)}"\ace\Get_Opt.i"\
- {$(INCLUDE)}"\ace\Log_Msg.h"\
- {$(INCLUDE)}"\ace\Log_Priority.h"\
- {$(INCLUDE)}"\ace\Log_Record.h"\
- {$(INCLUDE)}"\ace\Log_Record.i"\
- {$(INCLUDE)}"\ace\Object_Manager.h"\
- {$(INCLUDE)}"\ace\Object_Manager.i"\
- {$(INCLUDE)}"\ace\OS.h"\
- {$(INCLUDE)}"\ace\OS.i"\
- {$(INCLUDE)}"\ace\Process.h"\
- {$(INCLUDE)}"\ace\Process.i"\
- {$(INCLUDE)}"\ace\SString.h"\
- {$(INCLUDE)}"\ace\SString.i"\
- {$(INCLUDE)}"\ace\stdcpp.h"\
- {$(INCLUDE)}"\ace\Trace.h"\
- {$(INCLUDE)}"\ace\ws2tcpip.h"\
-
-
-"$(INTDIR)\process.obj" : $(SOURCE) $(DEP_CPP_PROCE) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-# End Target
-# End Project
-################################################################################
diff --git a/examples/OS/Process/Process.mdp b/examples/OS/Process/Process.mdp Binary files differdeleted file mode 100644 index f42ecb286ce..00000000000 --- a/examples/OS/Process/Process.mdp +++ /dev/null diff --git a/examples/OS/Process/README b/examples/OS/Process/README deleted file mode 100644 index 3c751c506b0..00000000000 --- a/examples/OS/Process/README +++ /dev/null @@ -1,55 +0,0 @@ -This directory contains two examples: <imore> and <process>. They -show how you can play with various features of ACE_Process to create -new processes. - -imore: ------ -This example shows how to redirect the output of one process (in our -case, the parent process) to another process (child process.) This is -very similiar what a UNIX shell does when we "pipe" command together. -You can select whether you want to use named pipes or a unnamed pipe. - - -process: --------- - -This example shows how to use ACE_Process to "portably" create new -processes. The ACE_Process_Options class allows applications to -portably specify path, command-line arguments, environment variable -values. It also allows applications to set the new process' standard -handles (stdin, stdout, and stderr). ACE_Process is created with the -ACE_Process_Options and can be used to perform operations on the -running process. - -Notice that this example uses NT version's UNIX utilities like -"DATE.EXE," and "ls.exe." You can find where to get them from -Microsoft's NT page on the Web. - -Run the application as ./process -u to get all the command-line -options. - -Here's an example output: - -lambada:OS/Process> ./process -a -starting... -starting... -Sun May 11 15:06:51 CDT 1997 -date succeeded. -starting... -checking ACE_PROCESS_TEST -ACE_PROCESS_TEST = here's a large number 4294967295. -ACE_PROCESS_TEST2 = ophilli. -total 600 -drwxr-xr-x 5 harrison doc 512 May 11 15:06 . --rw-r--r-- 1 harrison doc 9330 May 7 23:54 .#process.cpp.4.3 -drwxr-xr-x 4 harrison doc 512 Apr 21 15:32 .. -drwx------ 2 harrison doc 512 May 8 22:33 .obj -drwx------ 2 harrison doc 512 May 8 22:33 .shobj -drwxr-xr-x 2 harrison doc 512 May 11 15:05 CVS --rw-r--r-- 1 harrison doc 1717 Oct 21 1996 Makefile --rw-r--r-- 1 harrison doc 10048 Oct 21 1996 Process.mak --rw-r--r-- 1 harrison doc 44032 Oct 21 1996 Process.mdp --rw-r--r-- 1 harrison doc 1452 May 11 15:05 README --rwx--x--x 1 harrison doc 212992 May 11 15:06 process --rw-r--r-- 1 harrison doc 10172 May 10 19:38 process.cpp --rw------- 1 harrison doc 1380 May 10 19:19 process.wst diff --git a/examples/OS/Process/imore.cpp b/examples/OS/Process/imore.cpp deleted file mode 100644 index 09c841e2569..00000000000 --- a/examples/OS/Process/imore.cpp +++ /dev/null @@ -1,246 +0,0 @@ -// ============================================================================ -// $Id$ -// -// = LIBRARY -// examples -// -// = FILENAME -// imore.cpp (imore stands for indirect more.) -// -// = DESCRIPTION -// This program demonstrates how to redirect stdout of a parent -// process to the stdin of its child process using either unnamed pipe -// or named pipes to relay data to subprocess which runs "more" to -// display data on the screen. Run imore to see how to use this -// program. -// -// Unfortunately, on Win32, this program doesn't use any pipe at all because -// using pipes confuses MORE.COM on Win32 and it just acts like "cat" on Unix. -// -// = AUTHOR -// Nanbor Wang <nw1@cs.wustl.edu> -// -// ============================================================================ - -#include "ace/OS.h" -#include "ace/FIFO_Recv.h" -#include "ace/FIFO_Send.h" -#include "ace/Pipe.h" -#include "ace/Get_Opt.h" -#include "ace/Process.h" -#include "ace/Signal.h" - -#if defined (ACE_WIN32) -static const char * executable = "MORE.COM"; -#else -static const char * executable = "more"; // I like less better. -static char *rendezvous_dir = "/tmp"; -static char *rendezvous_pfx = "imore"; -#endif /* ACE_WIN32 */ - -static char *fname = 0; // File you want to view. -static int use_named_pipe = 0; // Do we want to use named pipe? - -static void -usage (void) -{ - ACE_ERROR ((LM_ERROR, "Usage: imore [-n|-u] <filename>\n" - "\t-n Use named pipe.\n" - "\t-u Use unnamed pipe.\n")); -} - -static int -parse_args (int argc, char **argv) -{ - ACE_Get_Opt get_opt (argc, argv, "un"); - int c; - - while ((c = get_opt ()) != -1) - { - switch (c) - { - case 'n': // We want to use named pipe. -#if !defined (ACE_WIN32) - use_named_pipe = 1; -#else - ACE_ERROR_RETURN ((LM_ERROR, "Named pipes not supported on Win32\n"), -1); -#endif /* !ACE_WIN32 */ - break; - case 'u': // Use unnamed pipe. - use_named_pipe = 0; - break; - default: // What are you talking about? - usage (); - return -1; - } - } - - if (get_opt.optind >= argc) // Do you forget to give me a filename to "more?" - { - usage (); - return -1; - } - else - fname = argv[get_opt.optind]; // Alright. - - return 0; -} - -static int -setup_named_pipes (ACE_Process_Options &opt) -{ - // Create a unique temporary name for named pipe. - char *rendezvous = ACE_OS::tempnam (rendezvous_dir, - rendezvous_pfx); - - // Out of memory? - if (rendezvous == NULL) - return -1; - - // Alright, this is indeed strange. Named pipes are meant to be - // used for unrelated processes. Because of the constraints in - // ACE_Process, I have to pre-open the named pipes here. - ACE_FIFO_Recv rfifo; // read end fifo. - ACE_FIFO_Send wfifo; // write end fifo. - - // Check if the pipes are created successfully. - if (rfifo.open (rendezvous) == -1 || wfifo.open (rendezvous) == -1) - { - ACE_OS::free (rendezvous); - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "fifo.open"), -1); - } - - // Remove (rm, del) the file after no one uses it any more. - ACE_OS::unlink (rendezvous); - ACE_OS::free (rendezvous); - - // Setting up pipe between parent and child process. Use the read - // end of the named pipe as child process'es ACE_STDIN. - // ACE_Process_Options will keep copies (by dup) of fd's that we - // pass in. Notice that we have to specify child process to use - // ACE_STDOUT for output explicitly because we'll close it down in - // the line after. Child process will use whatever we use to dup2 - // ACE_STDOUT as its stdout. - opt.set_handles (rfifo.get_handle (), ACE_STDOUT); - - // The previous keep a copy of original ACE_STDOUT fd, now we - // can replace ACE_STDOUT of parent process to the write end - // of the named pipe. - ACE_OS::dup2 (wfifo.get_handle (), ACE_STDOUT); - - // Close unused fd's. Notice ACE_FIFO doesn't close the fd - // when it goes out of scope. - rfifo.close (); - wfifo.close (); -} - -static int -setup_unnamed_pipe (ACE_Process_Options &opt) -{ - // Create an unnamed pipe instance. - ACE_Pipe pipe; - - // Check if the pipe is created successfully. - if (pipe.open () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "pipe.open"), -1); - - // Setting up pipe between parent and child process. Use the pipe - // as child process'es ACE_STDIN. ACE_Process_Options will keep - // copies (by dup) of fd's that we pass in. Notice that we have to - // specify child process to use ACE_STDOUT for output explicitly - // because we'll close it down in the line after. Child process - // will use whatever we use to dup2 ACE_STDOUT as its stdout. - opt.set_handles (pipe.read_handle (), ACE_STDOUT); - - // The previous keep a copy of original ACE_STDOUT fd, now we - // can replace ACE_STDOUT of parent process to the pipe. - ACE_OS::dup2 (pipe.write_handle (), ACE_STDOUT); - - // Don't forget to close the unused fd. - pipe.close (); -} - -static int -print_file (ACE_HANDLE infd) -{ - char buffer[BUFSIZ]; - ssize_t len; - - while ((len = ACE_OS::read (infd, buffer, BUFSIZ)) > 0) - { - if ((ACE_OS::write (ACE_STDOUT, buffer, len) != len)) - if (errno == EPIPE) - { - // I tried to "produce" EPIPE warning to test - // the program but never seen one. (odd.) - // ACE_ERROR ((LM_ERROR, "\n\nEPIPE\n")); - break; - } - else - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "write"), -1); - } - return 0; -} - -int -main (int argc, char *argv[]) -{ - // Ignore SIGPIPE signal on Unix platforms in case - // child process (more) terminates before we finish - // writing to stdout. -#if !defined (ACE_WIN32) - ACE_Sig_Action sig_act (SIG_IGN); - if (sig_act.register_action (SIGPIPE) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Sig_Action::register_action"), -1); -#endif /* ACE_WIN32 */ - - // Alright, what you want me to do now? - if (::parse_args (argc, argv) == -1) - return -1; - - // Can I find the file you want? - ACE_HANDLE infile = ACE_OS::open (fname, O_RDONLY); - if (infile == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", fname), -1); - - ACE_Process new_process; - - // Notice that we must enclose ACE_Process_Options in the block - // so the file handlers it keeps can be close elegantly. -#if !defined (ACE_WIN32) - { - ACE_Process_Options options; - - if ((use_named_pipe ? ::setup_named_pipes : - ::setup_unnamed_pipe) (options) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "Error, bailing out!\n"), -1); - - options.command_line (executable); - new_process.spawn (options); - } - - // write file to ACE_STDOUT. - if (::print_file (infile) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "Error, bailing out!\n"), -1); - - // Close the STDOUT to inform child eof. - ACE_OS::close (ACE_STDOUT); -#else - // We can only pass a file handler directly to child process - // otherwise "more" doesn't act quite the way we want. What do you - // expect? It's just Billy boy's toy. Nonetheless, if your child - // processes don't need to interact with the terminal, we can use - // the exact code for Unixes on NT. - ACE_Process_Options options; - options.command_line (executable); - options.set_handles (infile); - new_process.spawn (options); -#endif /* ! ACE_WIN32 */ - - // Wait till we are done. - new_process.wait (); - - ACE_OS::close (infile); - - return 0; -} diff --git a/examples/OS/Process/process.cpp b/examples/OS/Process/process.cpp deleted file mode 100644 index e5342f320b7..00000000000 --- a/examples/OS/Process/process.cpp +++ /dev/null @@ -1,417 +0,0 @@ -// ============================================================================ -// $Id$ - -// -// = LIBRARY -// examples -// -// = FILENAME -// process.cpp -// -// = DESCRIPTION -// This example tests the ACE_Process. For more info, check the -// README file in this directory. -// -// = AUTHOR -// Tim Harrison. -// -// ============================================================================ - -#include "ace/OS.h" -#include "ace/Get_Opt.h" -#include "ace/Process.h" - -#if defined (ACE_WIN32) -#define EXEC_NAME "MORE.COM" -const char *DATE_PATH = "date.exe"; -const char *LS_PATH = "ls.exe"; -#else -#define EXEC_NAME "less" -const char *DATE_PATH = "date"; -const char *LS_PATH = "ls"; -#endif /* ACE_WIN32 */ - -static char *executable = EXEC_NAME; -static char *print_file = 0; -static char *environment_string = 0; -static int get_env = 0; -static int run_date = 0; -static int run_ls = 0; -static int run_all = 0; -static int run_setenv = 0; -static int run_tokenizer = 0; - -// Parse the command-line arguments and set options. -static int -parse_args (int argc, char **argv) -{ - ACE_Get_Opt get_opt (argc, argv, "dlx:p:e:gastu"); - int c; - - while ((c = get_opt ()) != -1) - { - switch (c) - { - case 't': - run_tokenizer = 1; - break; - case 's': - run_setenv = 1; - break; - case 'a': - run_all = 1; - break; - case 'd': - run_date = 1; - break; - case 'l': - run_ls = 1; - break; - case 'x': - executable = get_opt.optarg; - break; - case 'p': - print_file = get_opt.optarg; - break; - case 'e': - environment_string = get_opt.optarg; - break; - case 'g': - get_env = 1; - break; - case 'u': - default: - ACE_ERROR_RETURN ((LM_ERROR, "Usage:\n" - "-d print date\n" - "-l run ls\n" - "-x <executable=more.com>\n" - "-p print <file_name>\n" - "-e <env variable message>\n" - "-s setenv ACE_PROCESS_ENV and spawn -g\n" - "-g get_env ACE_PROCESS_ENV\n" - "-t test tokenizer\n" - "-a run all (d,l,e \"running\")\n"), -1); - break; - } - } - - return 0; -} - -// This shows how to set handles. -static void -test_more (void) -{ - ACE_HANDLE infile = ACE_OS::open (print_file, O_RDONLY); - - if (infile == ACE_INVALID_HANDLE) - { - ACE_ERROR ((LM_DEBUG, "%p\n", print_file)); - return; - } - - ACE_Process new_process; - ACE_Process_Options options; - options.command_line (executable); - options.set_handles (infile); - - if (new_process.spawn (options) == -1) - { - int error = ACE_OS::last_error (); - ACE_ERROR ((LM_ERROR, "%p errno = %d.\n", - "test_more", error)); - } - - new_process.wait (); - ACE_OS::close (infile); - - ACE_DEBUG ((LM_DEBUG, "More succeeded.\n")); -} - -// This is a simple usage of ACE_Process. -static void -test_date (void) -{ - ACE_Process_Options options; - options.command_line (DATE_PATH); - - // Try to create a new process running date. - ACE_Process new_process; - if (new_process.spawn (options) == -1) - { - int error = ACE_OS::last_error (); - ACE_ERROR ((LM_ERROR, "%p errno = %d.\n", - "test_date", error)); - return; - } - - new_process.wait (); - ACE_DEBUG ((LM_DEBUG, "date succeeded.\n")); -} - -static void -test_ls (void) -{ - ACE_Process_Options options; - options.command_line ("%s -al", LS_PATH); - - ACE_Process new_process; - if (new_process.spawn (options) == -1) - { - int error = ACE_OS::last_error (); - ACE_ERROR ((LM_ERROR, "%p errno = %d.\n", - "test_ls", error)); - } - - new_process.wait (); -} - -#if defined (ACE_WIN32) -// This is just to test the direct usage of CreateProcess. I use this -// occasionally as a sanity check when ACE_Process breaks. -static void -win32_test_ls (void) -{ - PROCESS_INFORMATION process_info; - STARTUPINFO startup_info; - ACE_OS::memset ((void *) &startup_info, - 0, sizeof startup_info); - ACE_OS::memset ((void *) &process_info, - 0, sizeof process_info); - startup_info.cb = sizeof (startup_info); - startup_info.dwFlags = STARTF_USESTDHANDLES; - - ACE_HANDLE std_out = ACE_STDOUT; - - if (!::DuplicateHandle (::GetCurrentProcess(), - std_out, - ::GetCurrentProcess(), - &startup_info.hStdOutput, - NULL, - TRUE, - DUPLICATE_SAME_ACCESS)) - { - ACE_ERROR ((LM_ERROR, "%p duplicate failed.\n", "test_ls")); - return; - } - - BOOL fork_result = - ::CreateProcess ("c:\\Utils\\bin\\ls.exe", - "-a", - NULL, // No process attributes. - NULL, // No thread attributes. - TRUE, // Allow handle inheritance. - NULL, // CREATE_NEW_CONSOLE, // Create a new console window. - NULL, - 0, // Current directory to start in. - &startup_info, - &process_info); - - ::CloseHandle (startup_info.hStdOutput); - - if (fork_result == 0) - ACE_ERROR ((LM_ERROR, "%p CreateProcess failed.\n", "test_ls")); - else - { - ::WaitForSingleObject (process_info.hProcess, INFINITE); - ACE_DEBUG ((LM_ERROR, "ls succeeded.\n")); - } -} - -// This code spawns a new process. The new process inherits our -// existing environment, plus one more. This has to be done by hand -// since CreateProcess does not allow us to inherit AND add -// environment variables. -static void -win32_spawn_environment_process (void) -{ - PROCESS_INFORMATION process_info; - STARTUPINFO startup_info; - ACE_OS::memset ((void *) &startup_info, - 0, sizeof startup_info); - ACE_OS::memset ((void *) &process_info, - 0, sizeof process_info); - startup_info.cb = sizeof (startup_info); - startup_info.dwFlags = STARTF_USESTDHANDLES; - - ACE_HANDLE std_in = ACE_STDIN; - ACE_HANDLE std_out = ACE_STDOUT; - ACE_HANDLE std_err = ACE_STDERR; - - if (!::DuplicateHandle (::GetCurrentProcess(), - std_out, - ::GetCurrentProcess(), - &startup_info.hStdOutput, - NULL, - TRUE, - DUPLICATE_SAME_ACCESS)) - { - ACE_ERROR ((LM_ERROR, "%p duplicate failed.\n", "spawn_environment_process")); - return; - } - - if (!::DuplicateHandle (::GetCurrentProcess(), - std_err, - ::GetCurrentProcess(), - &startup_info.hStdError, - NULL, - TRUE, - DUPLICATE_SAME_ACCESS)) - { - ACE_ERROR ((LM_ERROR, "%p duplicate failed.\n", "spawn_environment_process")); - return; - } - - if (!::DuplicateHandle (::GetCurrentProcess(), - std_in, - ::GetCurrentProcess(), - &startup_info.hStdInput, - NULL, - TRUE, - DUPLICATE_SAME_ACCESS)) - { - ACE_ERROR ((LM_ERROR, "%p duplicate failed.\n", "spawn_environment_process")); - return; - } - - char *existing_environment = ::GetEnvironmentStrings (); - char environment[10240]; - ACE_OS::sprintf (environment, "ACE_PROCESS_TEST=%s", - environment_string); - - int size = 0; - while (existing_environment[size] != '\0') - size += ACE_OS::strlen (existing_environment + size) + 1; - - ACE_OS::memcpy (environment + (ACE_OS::strlen (environment) + 1), - existing_environment, - size); - - ::FreeEnvironmentStrings (existing_environment); - - BOOL fork_result = - ::CreateProcess ("d:\\harrison\\ACE_wrappers\\examples\\OS\\Process\\process.exe", - "process -g", - NULL, // No process attributes. - NULL, // No thread attributes. - TRUE, // Allow handle inheritance. - NULL, // CREATE_NEW_CONSOLE, // Create a new console window. - environment, // Environment. - //"d:\\harrison\\ACE_wrappers\\examples\\OS\\Process\\", - 0, - &startup_info, - &process_info); - - ::CloseHandle (startup_info.hStdOutput); - ::CloseHandle (startup_info.hStdError); - - if (fork_result == 0) - ACE_ERROR ((LM_ERROR, "%p.\n", "spawn_environment_process")); - else - { - ::WaitForSingleObject (process_info.hProcess, INFINITE); - ACE_DEBUG ((LM_ERROR, "spawn_environment_process succeeded.\n")); - } -} -#endif - -static void -test_setenv (const char *argv0) -{ - ACE_Process_Options options; - // options.setenv ("ACE_PROCESS_TEST", "here's a really large number: %u", 0 - 1); - options.setenv ("ACE_PROCESS_TEST= here's a large number %u", 0 - 1); - options.setenv ("ACE_PROCESS_TEST2", "ophilli"); - options.command_line ("%s -g", argv0); - ACE_Process process; - if (process.spawn (options) == -1) - { - ACE_ERROR ((LM_ERROR, "%p.\n", "test_setenv")); - return; - } - - process.wait (); -} - -// Tests the ACE_Tokenizer. -static void -tokenize (char *buffer) -{ - // This tokenizer will replace all spaces with end-of-string - // characters and will preserve text between "" and '' pairs. - ACE_Tokenizer parser (buffer); - parser.delimiter_replace (' ', '\0'); - parser.preserve_designators ('\"', '\"'); // " This quote is for emacs - parser.preserve_designators ('\'', '\''); - - const char *temp; - - while (1) - { - temp = parser.next (); - if (temp == 0) - break; - ACE_DEBUG ((LM_DEBUG, temp)); - ACE_DEBUG ((LM_DEBUG, "\n")); - } -} - -int -main (int argc, char *argv[]) -{ - if (ACE_LOG_MSG->open (argv[0]) == -1) - ACE_ERROR ((LM_ERROR, "cannot open logger!!!\n")); - - ACE_DEBUG ((LM_DEBUG, "starting...\n")); - - if (::parse_args (argc, argv) == -1) - return -1; - - if (run_all) - { - ACE_Process_Options options; - options.command_line ("%s -d -l -s", argv[0]); - ACE_Process process; - if (process.spawn (options) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1); - process.wait (); - } - - if (run_date) - ::test_date (); - - if (run_setenv) - ::test_setenv (argv[0]); - - if (get_env) - { - ACE_DEBUG ((LM_DEBUG, "checking ACE_PROCESS_TEST\n")); - char *value = ACE_OS::getenv ("ACE_PROCESS_TEST"); - char *value2 = ACE_OS::getenv ("ACE_PROCESS_TEST2"); - ACE_DEBUG ((LM_DEBUG, "ACE_PROCESS_TEST = %s.\n" - "ACE_PROCESS_TEST2 = %s.\n", - value == 0 ? "no value" : value, - value2 == 0 ? "no value" : value2)); - } - - if (run_ls) - ::test_ls (); - -#if defined (ACE_WIN32) - if (environment_string != 0) - win32_spawn_environment_process (); -#endif /* ACE_WIN32 */ - - if (print_file != 0) - test_more (); - - if (run_tokenizer) - { - tokenize (" -f hi honey -g \"I\'m home\""); - tokenize ("\"token 1\"\'token 2\'\"token 3\" "); - } - - return 0; -} - - |