Ruby  2.0.0p247(2013-06-27revision41674)
Data Structures | Defines | Functions | Variables
ext/pty/pty.c File Reference
#include "ruby/config.h"
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <fcntl.h>
#include <errno.h>
#include <pwd.h>
#include <ctype.h>
#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/util.h"
#include "internal.h"
#include <signal.h>

Go to the source code of this file.

Data Structures

struct  pty_info
struct  child_info

Defines

#define WIFSTOPPED(status)   (((status) & 0xff) == 0x7f)
#define DEVICELEN   16
#define ERROR_EXIT(str)

Functions

static VALUE echild_status (VALUE self)
static void getDevice (int *, int *, char[DEVICELEN], int)
static int chfunc (void *data, char *errbuf, size_t errbuf_len)
static void establishShell (int argc, VALUE *argv, struct pty_info *info, char SlaveName[DEVICELEN])
static int no_mesg (char *slavedevice, int nomesg)
static int get_device_once (int *master, int *slave, char SlaveName[DEVICELEN], int nomesg, int fail)
static VALUE pty_close_pty (VALUE assoc)
static VALUE pty_open (VALUE klass)
static VALUE pty_detach_process (struct pty_info *info)
static VALUE pty_getpty (int argc, VALUE *argv, VALUE self)
 NORETURN (static void raise_from_check(pid_t pid, int status))
static void raise_from_check (pid_t pid, int status)
static VALUE pty_check (int argc, VALUE *argv, VALUE self)
void Init_pty ()

Variables

static VALUE eChildExited
static VALUE cPTY

Define Documentation

#define DEVICELEN   16

Definition at line 46 of file pty.c.

Referenced by get_device_once(), pty_getpty(), and pty_open().

#define ERROR_EXIT (   str)
Value:
do { \
        strlcpy(errbuf, (str), errbuf_len); \
        return -1; \
    } while (0)

Referenced by chfunc().

#define WIFSTOPPED (   status)    (((status) & 0xff) == 0x7f)

Definition at line 28 of file pty.c.

Referenced by raise_from_check().


Function Documentation

static int chfunc ( void *  data,
char *  errbuf,
size_t  errbuf_len 
) [static]
static VALUE echild_status ( VALUE  self) [static]

Definition at line 66 of file pty.c.

References rb_intern, and rb_ivar_get().

Referenced by Init_pty().

static void establishShell ( int  argc,
VALUE argv,
struct pty_info info,
char  SlaveName[DEVICELEN] 
) [static]
static int get_device_once ( int *  master,
int *  slave,
char  SlaveName[DEVICELEN],
int  nomesg,
int  fail 
) [static]
static void getDevice ( int *  master,
int *  slave,
char  SlaveName[DEVICELEN],
int  nomesg 
) [static]

Definition at line 450 of file pty.c.

References get_device_once(), and rb_gc().

Referenced by establishShell(), and pty_open().

void Init_pty ( )
static int no_mesg ( char *  slavedevice,
int  nomesg 
) [static]

Definition at line 210 of file pty.c.

Referenced by get_device_once().

NORETURN ( static void   raise_from_checkpid_t pid, int status)
static VALUE pty_check ( int  argc,
VALUE argv,
VALUE  self 
) [static]

Definition at line 654 of file pty.c.

References NUM2PIDT, Qnil, raise_from_check(), rb_last_status_get(), rb_scan_args(), rb_waitpid(), RTEST, UNREACHABLE, and WNOHANG.

Referenced by Init_pty().

static VALUE pty_close_pty ( VALUE  assoc) [static]

Definition at line 459 of file pty.c.

References Qnil, rb_ary_entry(), rb_io_close(), RB_TYPE_P, RFILE, and T_FILE.

Referenced by pty_open().

static VALUE pty_detach_process ( struct pty_info info) [static]

Definition at line 535 of file pty.c.

References pty_info::child_pid, Qnil, and rb_detach_process().

Referenced by pty_getpty().

static VALUE pty_getpty ( int  argc,
VALUE argv,
VALUE  self 
) [static]
static VALUE pty_open ( VALUE  klass) [static]
static void raise_from_check ( pid_t  pid,
int  status 
) [static]

Definition at line 609 of file pty.c.

References buf, eChildExited, kill(), rb_exc_new2(), rb_exc_raise(), rb_iv_set(), rb_last_status_get(), snprintf, and WIFSTOPPED.

Referenced by pty_check().


Variable Documentation

VALUE cPTY [static]

Definition at line 670 of file pty.c.

VALUE eChildExited [static]

Definition at line 60 of file pty.c.

Referenced by Init_pty(), and raise_from_check().