Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dosunopen(3) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

DOS services library

dosclose

dosexecve

dosinit

dosopen

exec: execl, execv, execle, execve, execlp, execvp

fork

getenv, NLgetenv

wait

dosunopen, dosreopen

Purpose

     Passes the DOS Services environment from a parent process
     to a child process.

Library

     DOS Services Library (libdos.a)

Syntax

     #include <dos.h>

     int dosunopen ( )                         int dosreopen ( )
     Description

     The dosunopen  and dosreopen subroutines provide  a means
     to pass  the current DOS Services environment  to a child
     process.  The following sequence accomplishes this task:

     1.  The parent process calls  the dosunopen subroutine to
         construct a file that  describes the current state of
         the  DOS Services environment.   dosunopen also  sets
         the DOSENVT variable (in  the AIX environment) to the
         name of this file.

     2.  The parent process then issues  a fork system call to
         start a  child process.   The child  process automat-
         ically inherits copies of  its parent's AIX open file
         descriptors, but not the DOS file descriptors.

     3.  The child process calls  the dosexecve subroutine (or
         one of the  exec system calls) to run  a new program.
         This program calls the dosinit subroutine, which ini-
         tializes  the child's  DOS Services environment  from
         the file  named by  the DOSENVT variable.   The child
         process now has access to the DOS files opened by its
         parent.

     4.  The parent  process invokes  the wait system  call to
         wait for the child to finish running its program.

     5.  When the child has finished, the parent process calls
         the  dosreopen  subroutine  to  reopen  the  original
         DOS Services environment  and to delete  the environ-
         ment file created by dosunopen.

     If a  program attempts  to reopen a  file on  a removable
     diskette  and  that diskette  is  not  inserted into  the
     machine,  then the  dosreopen subroutine  prompts you  to
     reinsert the correct diskette.

     The dosunopen  and dosreopen subroutines also  inform the
     DOS Services  environment that  a removable  diskette may
     have been removed  and replaced.  For a  program to allow
     changing of a diskette, the following steps are taken:

     1.  The program  calls the  dosclose subroutine  to close
         all files that are currently open on the diskette.

     2.  the program calls the  dosunopen subroutine to inform
         the DOS Services of the current state of the DOS Ser-
         vices environment.

     3.  The program prompts the user to change the diskette.

     4.  The program  calls the  dosreopen subroutine  so that
         the files open on other DOS Services file systems are
         reopened.

     Warning:

     Failure to use the dosunopen and dosreopen subroutines in
     the  circumstances previously  mentioned means  attempted
     operations on a newly-inserted diskette will return erro-
     neous results.

     Return Value

     Upon successful completion, a value of 0 is returned.  If
     the  dosunopen or  dosreopen  subroutine  fails, then  it
     returns a value  of -1 and sets doserrno  to indicate the
     error.

     Related Information

     In  this  book:    "DOS  services  library,"  "dosclose,"
     "dosexecve," "dosinit," "dosopen,"  "exec:  execl, execv,
     execle,  execve,   execlp,  execvp,"    "fork,"  "getenv,
     NLgetenv," and "wait."

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026