ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libptytty/src/ptytty.C
(Generate patch)

Comparing libptytty/src/ptytty.C (file contents):
Revision 1.20 by root, Mon Jan 23 11:45:44 2006 UTC vs.
Revision 1.21 by root, Mon Jan 23 11:53:27 2006 UTC

544} 544}
545 545
546void 546void
547ptytty::use_helper () 547ptytty::use_helper ()
548{ 548{
549#ifndef PTYTTY_NO_PID_CHECK
549 int pid = getpid (); 550 int pid = getpid ();
551#endif
550 552
551 if (sock_fd >= 0 && pid == owner_pid) 553 if (sock_fd >= 0
554#ifndef PTYTTY_NO_PID_CHECK
555 && pid == owner_pid
556#endif
557 )
552 return; 558 return;
553 559
560#ifndef PTYTTY_NO_PID_CHECK
554 owner_pid = pid; 561 owner_pid = pid;
562#endif
555 563
556 int sv[2]; 564 int sv[2];
557 565
558 if (socketpair (AF_UNIX, SOCK_STREAM, 0, sv)) 566 if (socketpair (AF_UNIX, SOCK_STREAM, 0, sv))
559 ptytty_fatal ("could not create socket to communicate with pty/sessiondb helper, aborting.\n"); 567 ptytty_fatal ("could not create socket to communicate with pty/sessiondb helper, aborting.\n");
610 618
611ptytty * 619ptytty *
612ptytty::create () 620ptytty::create ()
613{ 621{
614#if PTYTTY_HELPER 622#if PTYTTY_HELPER
623 if (helper_pid
624# ifndef PTYTTY_NO_PID_CHECK
615 if (helper_pid && getpid () == owner_pid) 625 && getpid () == owner_pid
626# endif
627 )
616 // use helper process 628 // use helper process
617 return new ptytty_proxy; 629 return new ptytty_proxy;
618 else 630 else
619#endif 631#endif
620 return new ptytty_unix; 632 return new ptytty_unix;
665} 677}
666 678
667///////////////////////////////////////////////////////////////////////////// 679/////////////////////////////////////////////////////////////////////////////
668// C API 680// C API
669 681
670#ifndef NO_C_API 682#ifndef PTYTTY_NO_C_API
671 683
672#define DEFINE_METHOD(retval, name, args1, args2) \ 684#define DEFINE_METHOD(retval, name, args1, args2) \
673extern "C" retval ptytty_ ## name args1 \ 685extern "C" retval ptytty_ ## name args1 \
674{ return ((struct ptytty *)ptytty)->name args2; } 686{ return ((struct ptytty *)ptytty)->name args2; }
675 687

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines