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.13 by root, Mon Jan 23 11:02:27 2006 UTC vs.
Revision 1.14 by root, Mon Jan 23 11:21:48 2006 UTC

371 } 371 }
372 372
373 return true; 373 return true;
374} 374}
375 375
376/////////////////////////////////////////////////////////////////////////////
377// helper/proxy support
378
376#if PTYTTY_HELPER 379#if PTYTTY_HELPER
377 380
378static int sock_fd = -1; 381static int sock_fd = -1;
379static int helper_pid, owner_pid; 382static int helper_pid, owner_pid;
380 383
609 if (uid != geteuid () 612 if (uid != geteuid ()
610 || gid != getegid ()) 613 || gid != getegid ())
611 ptytty_fatal ("unable to drop privileges, aborting.\n"); 614 ptytty_fatal ("unable to drop privileges, aborting.\n");
612} 615}
613 616
617/////////////////////////////////////////////////////////////////////////////
618// C API
619
620#define DEFINE_METHOD(retval, name, args1, args2) \
621extern "C" retval ptytty_ ## name args1 \
622{ return ((struct ptytty *)ptytty)->name args2; }
623
624DEFINE_METHOD(int,pty,(void *ptytty),)
625DEFINE_METHOD(int,tty,(void *ptytty),)
626DEFINE_METHOD(int,get,(void *ptytty),())
627DEFINE_METHOD(void,login,(void *ptytty, int cmd_pid, bool login_shell, const char *hostname),(cmd_pid,login_shell,hostname))
628
629DEFINE_METHOD(void,close_tty,(void *ptytty),())
630DEFINE_METHOD(int,make_controlling_tty,(void *ptytty),())
631DEFINE_METHOD(void,set_utf8_mode,(void *ptytty, int on),(on))
632
633#define DEFINE_STATIC(retval, name, args) \
634extern "C" retval ptytty_ ## name args \
635{ return ptytty::name args; }
636
637DEFINE_STATIC(void,init,())
638DEFINE_STATIC(void *,create,())
639
640void ptytty_delete (void *ptytty)
641{
642 delete (struct ptytty *)ptytty;
643}
644
645DEFINE_STATIC(void,drop_privileges,())
646DEFINE_STATIC(void,use_helper,())
647

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines