Kbase 15756: proserve hangs tty device
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/10/1998 |
|
proserve hangs tty device
This notebook entry deals with a c program called detach.c that was
written as a workaround for a bug.
WHAT DOES THIS PROGRAM DO?
The detach.c program is used as a wrapper around other PROGRESS
programs to detach them from the terminal and not tie up or hang the
tty.
WHAT ARE THE SYMPTOMS?
A bug was found in Version 6 that ties up the tty device if a user
starts a proserve, prowdog, proapw, probiw or proaiw session from
anywhere other than the console. This bug has been reported on DG-UX,
VMS and UNIX V.4 operating systems. After one of these processes is
started from a remote login, once the user logs off the system, the
tty is no longer available until the PROGRESS process is completed.
The terminal hangs if you attempt to log in.
WHEN SHOULD I USE THIS PROGRAM?
This program should be used only as a last choice. This program is
not documented and its use is not supported or warrantied. The only
supported workaround for this bug is to either start the proserve,
prowdog, proapw, probiw, proaiw from the console or start these
programs from cron.
--- cut here ---
/* detach.c - closes stdin, stdout, and stderr. This should detach
the caller from the terminal. It then calls exec() to start the
passed program. This program WILL NOT search your path to find
the file to exec.
To Compile: # cc -o detach detach.c
Usage: detach /usr/dlc/_mprosrv <dbname> [args]
PROGRESS SOFTWARE provides no warranties with this program as it is
an unsupported and undocumented method for starting and using the
database. base. (i.e use at your risk.)
*/
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
main(argc, argv)
int argc;
char *argv[];
{
int fd0, fd1, fd2;
int ret;
/* make sure a program was passed */
if (argc < 2)
{
printf("Usage: %s program arguments\n",argv[0]);
exit(1);
}
/* close stdin and open a file, assumming that we'll get fd 0 */
close(0);
fd0 = open("detach.out", O_RDWR | O_CREAT, S_IRWXU | S_IRWXG);
if (fd0 < 0)
{
perror("Error opening file detach.out");
exit(1);
}
/* close stdout and open a file, assumming that we'll get fd 1 */
close(1);
fd1 = open("detach.out", O_RDWR | O_CREAT);
if (fd1 < 0)
{
perror("Error opening file detach.out");
exit(1);
}
/* close stderr and open a file, assumming that we'll get fd 2 */
close(2);
fd2 = open("detach.out", O_RDWR | O_CREAT);
if (fd2 < 0)
{
perror("Error opening file detach.out");
exit(1);
}
printf(" fd0 = %d, fd1 = %d, fd2 = %d\n",fd0,fd1,fd2);
/* at this point we should be detached from the terminal. Now we
need to fork() a child and have the child exec the program
passed in by the arguments.
*/
ret = fork();
if (ret < 0)
{
/* fork failed, must be a resource problem */
printf("fork failed, errno = %d\n",errno);
exit(1);
}
if (ret == 0)
{
/* we are the child branch, exec the program and exit */
ret = execv(argv[1], &argv[1]);
}
/* we are the parent, simply exit */
exit(0);
}
--- cut here ---
15-May-96
Progress Software Technical Support Note # 15756