Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
1478a2fc
Unverified
Commit
1478a2fc
authored
Jun 19, 2020
by
Christian Brauner
Committed by
Stéphane Graber
Jun 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
openpty: adapt variable naming
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
51eccacb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
18 deletions
+20
-18
openpty.c
src/include/openpty.c
+14
-14
openpty.h
src/include/openpty.h
+6
-4
No files found.
src/include/openpty.c
View file @
1478a2fc
...
...
@@ -34,43 +34,43 @@
#define _PATH_DEVPTMX "/dev/ptmx"
int
openpty
(
int
*
a
master
,
int
*
aslave
,
char
*
name
,
struct
termios
*
termp
,
int
openpty
(
int
*
a
ptmx
,
int
*
apts
,
char
*
name
,
struct
termios
*
termp
,
struct
winsize
*
winp
)
{
char
buf
[
PATH_MAX
];
int
master
,
slave
;
int
ptmx
,
pts
;
master
=
open
(
_PATH_DEVPTMX
,
O_RDWR
);
if
(
master
==
-
1
)
ptmx
=
open
(
_PATH_DEVPTMX
,
O_RDWR
);
if
(
ptmx
==
-
1
)
return
-
1
;
if
(
grantpt
(
master
))
if
(
grantpt
(
ptmx
))
goto
fail
;
if
(
unlockpt
(
master
))
if
(
unlockpt
(
ptmx
))
goto
fail
;
if
(
ptsname_r
(
master
,
buf
,
sizeof
buf
))
if
(
ptsname_r
(
ptmx
,
buf
,
sizeof
buf
))
goto
fail
;
slave
=
open
(
buf
,
O_RDWR
|
O_NOCTTY
);
if
(
slave
==
-
1
)
pts
=
open
(
buf
,
O_RDWR
|
O_NOCTTY
);
if
(
pts
==
-
1
)
goto
fail
;
/* XXX Should we ignore errors here? */
if
(
termp
)
tcsetattr
(
slave
,
TCSAFLUSH
,
termp
);
tcsetattr
(
pts
,
TCSAFLUSH
,
termp
);
if
(
winp
)
ioctl
(
slave
,
TIOCSWINSZ
,
winp
);
ioctl
(
pts
,
TIOCSWINSZ
,
winp
);
*
a
master
=
master
;
*
a
slave
=
slave
;
*
a
ptmx
=
ptmx
;
*
a
pts
=
pts
;
if
(
name
!=
NULL
)
strcpy
(
name
,
buf
);
return
0
;
fail:
close
(
master
);
close
(
ptmx
);
return
-
1
;
}
src/include/openpty.h
View file @
1478a2fc
...
...
@@ -27,10 +27,12 @@
#include <termios.h>
#include <sys/ioctl.h>
/* Create pseudo tty master slave pair with NAME and set terminal
attributes according to TERMP and WINP and return handles for both
ends in AMASTER and ASLAVE. */
extern
int
openpty
(
int
*
__amaster
,
int
*
__aslave
,
char
*
__name
,
/*
* Create pseudo tty ptmx pts pair with @__name and set terminal
* attributes according to @__termp and @__winp and return handles for both
* ends in @__aptmx and @__apts.
*/
extern
int
openpty
(
int
*
__aptmx
,
int
*
__apts
,
char
*
__name
,
const
struct
termios
*
__termp
,
const
struct
winsize
*
__winp
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment