Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

posix_openpt(3c) [hpux man page]

posix_openpt(3C)														  posix_openpt(3C)

NAME
posix_openpt() - open a pseudo-terminal master device SYNOPSIS
Parameters oflag indicates the file status flags and file access modes of the open file description. Values for oflag are constructed by a bit- wise-inclusive OR of flags from the following list, defined in Open for reading and writing. If set will not cause the terminal device to become the controlling terminal for the process. DESCRIPTION
The function establishes a connection between a master device for a pseudo-terminal and a file descriptor. This file descriptor can be used to refer that device. The file status flags and file access modes of the opened file descriptor will be set according to the value of oflag. RETURN VALUE
Upon successful completion opens a master pseudo-terminal device and returns a non-negative integer representing the lowest numbered unused file descriptor. Otherwise, returns -1 and is set to indicate the error. ERRORS
On failure sets one of the following values for OPEN_MAX file descriptors are currently open in the calling process. The maximum allowable number of files are currently open on the system. The value of oflag is not valid. Out of pseudo-terminal resources. Out of STREAMS resources. AUTHOR
was developed by HP. SEE ALSO
open(2), grantpt(3C), ptsname(3C), unlockpt(3C), ptm(7), pts(7). posix_openpt(3C)

Check Out this Related Man Page

POSIX_OPENPT(2) 					      BSD System Calls Manual						   POSIX_OPENPT(2)

NAME
posix_openpt -- open a pseudo-terminal device LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> #include <fcntl.h> int posix_openpt(int oflag); DESCRIPTION
The posix_openpt() function allocates a new pseudo-terminal and establishes a connection with its master device. A slave device shall be created in /dev/pts. After the pseudo-terminal has been allocated, the slave device should have the proper permissions before it can be used (see grantpt(3)). The name of the slave device can be determined by calling ptsname(3). The file status flags and file access modes of the open file description shall be set according to the value of oflag. Values for oflag are constructed by a bitwise-inclusive OR of flags from the following list, defined in <fcntl.h>: O_RDWR Open for reading and writing. O_NOCTTY If set posix_openpt() shall not cause the terminal device to become the controlling terminal for the process. The posix_openpt() function shall fail when oflag contains other values. RETURN VALUES
Upon successful completion, the posix_openpt() function shall allocate a new pseudo-terminal device and return a non-negative integer repre- senting a file descriptor, which is connected to its master device. Otherwise, -1 shall be returned and errno set to indicate the error. ERRORS
The posix_openpt() function shall fail if: [ENFILE] The system file table is full. [EINVAL] The value of oflag is not valid. [EAGAIN] Out of pseudo-terminal resources. SEE ALSO
pts(4), ptsname(3), tty(4) STANDARDS
The posix_openpt() function conforms to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
The posix_openpt() function appeared in FreeBSD 5.0. In FreeBSD 8.0, this function was changed to a system call. NOTES
The flag O_NOCTTY is included for compatibility; in FreeBSD, opening a terminal does not cause it to become a process's controlling terminal. AUTHORS
Ed Schouten <ed@FreeBSD.org> BSD
August 20, 2008 BSD
Man Page

14 More Discussions You Might Find Interesting

1. HP-UX

Get the terminal IP-ADDRESS

HI !!! I'm working under Windows-XP and Reflexion-X against a Unix HP-UX host. From a shellscript I need to open a new terminal window, I need the IP-ADDRESS for that. It is asked the user. It want to be able to obtain it automatically. WHO CAN I GET IT? THANKS. (2 Replies)
Discussion started by: josep55
2 Replies

2. Programming

terminal device control through a C/C++ program

Hi, I want to fork a new process from a daemon that needs terminal attachment to some ttyN or pts/N device. Here is the code #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> #include <string.h> int main(int... (5 Replies)
Discussion started by: ku@ntum
5 Replies

3. Shell Programming and Scripting

see if a file is open

I need to find out if a file is currently begin written to. I have read that you can use Stat in terminal and you can compare the Access/Modify. How would I go about doing this? I want to put it in a loop so if file is open then keep looking until it is closed. If closed then continue with your... (1 Reply)
Discussion started by: mainegate
1 Replies

4. UNIX for Dummies Questions & Answers

how to access files via their descriptors?

hello, I'm new here, and new to Linux. I was wondering how to get hold of a certain file's descriptor, and how to use that number so that I access the contents of the file. please give me a full example, that is (1) how to determine the descriptor and (2) what magic symbols to use so that... (4 Replies)
Discussion started by: ialoq
4 Replies

5. UNIX for Dummies Questions & Answers

Can not access internet?

Hi everybody. I've setup SunSolaris 10 on VirtualBox, but when I start Sun, I can connect to the Internet, when I open terminal and type command for list device ethernet: #ifconfig -a just only see loopback lo0 Can help me solve this problem? Thank you very much, ken (0 Replies)
Discussion started by: kenjingo
0 Replies

6. UNIX for Dummies Questions & Answers

How to open a file in TextEdit

I have found out how to create a file in Terminal from a script result: sudo diskutil repairPermissions / > ~/Library/Logs/Permissions.log I want to now open this file in TextEdit, however when I use the standard open command it opens in the default editor. How do I open the above file in... (1 Reply)
Discussion started by: TereNovo
1 Replies

7. Solaris

How to open and arrange terminal windows automatically under CDE?

Hi, Is there a way to open and arrange terminal windows automatically under CDE? For example, I want to open and arrange terminal windows like this: |------------| | TW TW TW | | TW TW TW | | TW TW TW | |------------| Thank you in advanced! (5 Replies)
Discussion started by: aixlover
5 Replies

8. UNIX for Dummies Questions & Answers

Opening a terminal with bash

Hi, The computer that I use is on a network and has the exact same installation as other computers on the network (Ubuntu 10.04 LTS). When I open a new terminal window by default it opens a tcsh shell. I don't have the root privilege to modify it. Is it possible to open a terminal window that... (8 Replies)
Discussion started by: gaurab
8 Replies

9. Red Hat

full access to redhat

Hello, Hello, I just installed my RedHat Enterprise Linux 5 on vmwork to learn exploit it. my first problem (for now) is that i cant received response from some command typed on (open terminal) ex: code : 1 2 # /etc/redhat-releasebash: /etc/redhat-release: Permission denied... (4 Replies)
Discussion started by: debutant1990
4 Replies

10. UNIX for Dummies Questions & Answers

Does DOS has a terminal or pseudo terminal?

I am wondering if the DOS console works like the unix terminal? (1 Reply)
Discussion started by: vistastar
1 Replies

11. Fedora

How to use terminal while keeping a program open?

hi all, I open Matlab program from terminal. However, when I go back to terminal I can't do anything in it , only until Matlab is closed. Can someone please advise me on how I can oversome this problem ? thanks peter (2 Replies)
Discussion started by: peter_071
2 Replies

12. Red Hat

Data recovery from lost+found in centos6.2

Respective sir, I have Centos-6.2 on my system(P-4,1GB RAM, 80GB hdd).While working on my system I just face one problem my all folder get symbol of lock so I go for open terminal but my terminal is also not opened.So I shut down my pc without proper way.After restart my system I... (1 Reply)
Discussion started by: Kiran ursal
1 Replies

13. IP Networking

Ssh port forwarding through a pseudo terminal

Here's a situation: I do all my work on a Mac. I have mysql installed on my mac. 1. There's a certain linux server 'server01' that provides access to another linux server 'server02' via a pseudo terminal So, to ssh into 'server02', I do this from my mac: ssh -t server01... (1 Reply)
Discussion started by: imperialguy
1 Replies

14. UNIX for Beginners Questions & Answers

Pssh open terminal?

Hi folks. I'm using pssh to run commands on a cluster, (pis/Raspian/Jessie) but I'm opening a app that runs and runs and runs. It's quite helpful to vnc to a machine to make sure it's still running ok now and then, but they're basically left alone. Of course when pssh runs a command it... (2 Replies)
Discussion started by: MuntyScrunt
2 Replies