version 1.3, 2012/03/29 01:31:34
|
version 1.4, 2012/05/14 12:49:21
|
Line 47 SUCH DAMAGE.
|
Line 47 SUCH DAMAGE.
|
|
|
|
|
/* |
/* |
* ioAllocPTY() Allocate new PTY and TTY | * ioAllocPTY() - Allocate new PTY and TTY |
* |
* |
* @ptyfd = master fd, pty |
* @ptyfd = master fd, pty |
* @ttyfd = slave fd, tty |
* @ttyfd = slave fd, tty |
Line 63 ioAllocPTY(int *ptyfd, int *ttyfd, char * __restrict n
|
Line 63 ioAllocPTY(int *ptyfd, int *ttyfd, char * __restrict n
|
{ |
{ |
assert(ptyfd && ttyfd); |
assert(ptyfd && ttyfd); |
if (!ptyfd || !ttyfd || (name && namesiz < 64)) { |
if (!ptyfd || !ttyfd || (name && namesiz < 64)) { |
io_SetErr(EINVAL, "Error:: invalid arguments ..."); | io_SetErr(EINVAL, "Invalid arguments"); |
return -1; |
return -1; |
} |
} |
|
|
Line 77 ioAllocPTY(int *ptyfd, int *ttyfd, char * __restrict n
|
Line 77 ioAllocPTY(int *ptyfd, int *ttyfd, char * __restrict n
|
} |
} |
|
|
/* |
/* |
* ioFreePTY() Release PTY and TTY device | * ioFreePTY() - Release PTY and TTY device |
* |
* |
* @ptyfd = master fd, pty (==-1 skip closing pty) |
* @ptyfd = master fd, pty (==-1 skip closing pty) |
* @ttyname = tty filename |
* @ttyname = tty filename |
Line 99 ioFreePTY(int ptyfd, const char *ttyname)
|
Line 99 ioFreePTY(int ptyfd, const char *ttyname)
|
} |
} |
|
|
/* |
/* |
* ioChgWinPTY() Change window size of PTY | * ioChgWinPTY() - Change window size of PTY |
* |
* |
* @ptyfd = master fd, pty |
* @ptyfd = master fd, pty |
* @row = row |
* @row = row |
Line 127 ioChgWinPTY(int ptyfd, u_short row, u_short col, u_sho
|
Line 127 ioChgWinPTY(int ptyfd, u_short row, u_short col, u_sho
|
} |
} |
|
|
/* |
/* |
* ioSetOwnerTTY() Set owner to TTY | * ioSetOwnerTTY() - Set owner to TTY |
* |
* |
* @ttyname = tty filename |
* @ttyname = tty filename |
* @UID = uid |
* @UID = uid |
Line 144 ioSetOwnerTTY(const char *ttyname, uid_t UID, gid_t GI
|
Line 144 ioSetOwnerTTY(const char *ttyname, uid_t UID, gid_t GI
|
|
|
assert(ttyname); |
assert(ttyname); |
if (!ttyname) { |
if (!ttyname) { |
io_SetErr(EINVAL, "Error:: invalid arguments ..."); | io_SetErr(EINVAL, "Invalid arguments"); |
return -1; |
return -1; |
} |
} |
|
|
Line 177 ioSetOwnerTTY(const char *ttyname, uid_t UID, gid_t GI
|
Line 177 ioSetOwnerTTY(const char *ttyname, uid_t UID, gid_t GI
|
} |
} |
|
|
/* |
/* |
* ioSetSidTTY() Makes the process's controlling TTY and sets it to sane modes. | * ioSetSidTTY() - Makes the process's controlling TTY and sets it to sane modes. |
* |
* |
* @ttyfd = slave fd, tty |
* @ttyfd = slave fd, tty |
* @ttyname = tty filename |
* @ttyname = tty filename |
Line 201 ioSetSidTTY(int *ttyfd, const char *ttyname)
|
Line 201 ioSetSidTTY(int *ttyfd, const char *ttyname)
|
/* Verify that we are successfully disconnected from the controlling tty. */ |
/* Verify that we are successfully disconnected from the controlling tty. */ |
fd = open(_PATH_TTY, O_RDWR | O_NOCTTY); |
fd = open(_PATH_TTY, O_RDWR | O_NOCTTY); |
if (fd >= 0) { |
if (fd >= 0) { |
io_SetErr(ENXIO, "Error:: Failed to disconnect from controlling tty."); | io_SetErr(ENXIO, "Failed to disconnect from controlling tty"); |
close(fd); |
close(fd); |
return -1; |
return -1; |
} |
} |
Line 239 ioSetSidTTY(int *ttyfd, const char *ttyname)
|
Line 239 ioSetSidTTY(int *ttyfd, const char *ttyname)
|
} |
} |
|
|
/* |
/* |
* ioSetRAWMode() Enter into RAW mode | * ioSetRAWMode() - Enter into RAW mode |
* |
* |
* @fd = tty fd |
* @fd = tty fd |
* @otio = saved old termios for later restore if !=NULL |
* @otio = saved old termios for later restore if !=NULL |
Line 279 ioSetRAWMode(int fd, struct termios *otio)
|
Line 279 ioSetRAWMode(int fd, struct termios *otio)
|
} |
} |
|
|
/* |
/* |
* ioRestoreMode() Restore termios to tty fd | * ioRestoreMode() - Restore termios to tty fd |
* |
* |
* @fd = tty fd |
* @fd = tty fd |
* @tio = termios structure for restore |
* @tio = termios structure for restore |
Line 297 ioRestoreMode(int fd, struct termios tio)
|
Line 297 ioRestoreMode(int fd, struct termios tio)
|
} |
} |
|
|
/* |
/* |
* ioForkPTY() Fork new process with session leader and new TTY | * ioForkPTY() - Fork new process with session leader and new TTY |
* |
* |
* @ptyfd = master fd, pty |
* @ptyfd = master fd, pty |
* @name = tty device name if not null |
* @name = tty device name if not null |