Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
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
zhul
criu
Commits
a7601d6a
Commit
a7601d6a
authored
Feb 18, 2015
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tty: Move tty_type() and is_pty() to tty.c
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
3a25abda
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
30 deletions
+31
-30
tty.h
include/tty.h
+1
-30
tty.c
tty.c
+30
-0
No files found.
include/tty.h
View file @
a7601d6a
...
...
@@ -27,41 +27,12 @@ enum {
extern
const
struct
fdtype_ops
tty_dump_ops
;
static
inline
int
tty_type
(
int
major
,
int
minor
)
{
switch
(
major
)
{
case
TTYAUX_MAJOR
:
if
(
minor
==
2
)
return
TTY_TYPE_PTM
;
else
if
(
minor
==
1
)
return
TTY_TYPE_CONSOLE
;
break
;
case
TTY_MAJOR
:
if
(
minor
>
MIN_NR_CONSOLES
&&
minor
<
MAX_NR_CONSOLES
)
/*
* Minors [MIN_NR_CONSOLES; MAX_NR_CONSOLES] stand
* for consoles (virtual terminals, VT in terms
* of kernel).
*/
return
TTY_TYPE_VT
;
case
UNIX98_PTY_MASTER_MAJOR
...
(
UNIX98_PTY_MASTER_MAJOR
+
UNIX98_PTY_MAJOR_COUNT
-
1
):
return
TTY_TYPE_PTM
;
case
UNIX98_PTY_SLAVE_MAJOR
:
return
TTY_TYPE_PTS
;
}
return
TTY_TYPE_UNKNOWN
;
}
int
tty_type
(
int
major
,
int
minor
);
static
inline
int
is_tty
(
int
major
,
int
minor
)
{
return
tty_type
(
major
,
minor
)
!=
TTY_TYPE_UNKNOWN
;
}
static
inline
int
is_pty
(
int
type
)
{
return
(
type
==
TTY_TYPE_PTM
||
type
==
TTY_TYPE_PTS
);
}
extern
int
dump_verify_tty_sids
(
void
);
extern
struct
collect_image_info
tty_info_cinfo
;
extern
struct
collect_image_info
tty_cinfo
;
...
...
tty.c
View file @
a7601d6a
...
...
@@ -130,6 +130,36 @@ static LIST_HEAD(all_ttys);
static
DECLARE_BITMAP
(
tty_bitmap
,
(
MAX_TTYS
<<
1
));
static
DECLARE_BITMAP
(
tty_active_pairs
,
(
MAX_TTYS
<<
1
));
int
tty_type
(
int
major
,
int
minor
)
{
switch
(
major
)
{
case
TTYAUX_MAJOR
:
if
(
minor
==
2
)
return
TTY_TYPE_PTM
;
else
if
(
minor
==
1
)
return
TTY_TYPE_CONSOLE
;
break
;
case
TTY_MAJOR
:
if
(
minor
>
MIN_NR_CONSOLES
&&
minor
<
MAX_NR_CONSOLES
)
/*
* Minors [MIN_NR_CONSOLES; MAX_NR_CONSOLES] stand
* for consoles (virtual terminals, VT in terms
* of kernel).
*/
return
TTY_TYPE_VT
;
case
UNIX98_PTY_MASTER_MAJOR
...
(
UNIX98_PTY_MASTER_MAJOR
+
UNIX98_PTY_MAJOR_COUNT
-
1
):
return
TTY_TYPE_PTM
;
case
UNIX98_PTY_SLAVE_MAJOR
:
return
TTY_TYPE_PTS
;
}
return
TTY_TYPE_UNKNOWN
;
}
static
inline
int
is_pty
(
int
type
)
{
return
(
type
==
TTY_TYPE_PTM
||
type
==
TTY_TYPE_PTS
);
}
/*
* /dev/ptmx is a shared resource between all tasks
* so we need to serialize access to it.
...
...
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