Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emacs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
emacs
emacs
Commits
16782258
Commit
16782258
authored
Feb 21, 2003
by
Jan Djärv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed subtty, workaround for when TIOCSIGSEND fails.
parent
2d772f45
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
29 deletions
+55
-29
src/ChangeLog
src/ChangeLog
+10
-0
src/process.c
src/process.c
+45
-26
src/process.h
src/process.h
+0
-3
No files found.
src/ChangeLog
View file @
16782258
2003-02-21 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
* process.h: Removed subtty field from struct Lisp_Process.
* process.c (create_process): Remove setting of subtty.
(emacs_get_tty_pgrp): New function.
(Fprocess_running_child_p, process_send_signal): Call
emacs_get_tty_pgrp instead of ioctl.
(process_send_signal): Call EMACS_KILLPG if ioctl TIOCSIGSEND fails.
2003-02-21 Kai Gro,A_(Bjohann <kai.grossjohann@uni-duisburg.de>
* keymap.c (Fdefine_key): Doc fix.
...
...
src/process.c
View file @
16782258
...
...
@@ -1782,11 +1782,12 @@ create_process (process, new_argv, current_dir)
chan_process
[
inchannel
]
=
process
;
XSETINT
(
XPROCESS
(
process
)
->
infd
,
inchannel
);
XSETINT
(
XPROCESS
(
process
)
->
outfd
,
outchannel
);
/* Record the tty descriptor used in the subprocess. */
if (forkin < 0)
XPROCESS (process)->subtty = Qnil;
else
XSETFASTINT (XPROCESS (process)->subtty, forkin);
/* Previously we recorded the tty descriptor used in the subprocess.
It was only used for getting the foreground tty process, so now
we just reopen the device (see emacs_get_tty_pgrp) as this is
more portable (see USG_SUBTTY_WORKS above). */
XPROCESS
(
process
)
->
pty_flag
=
(
pty_flag
?
Qt
:
Qnil
);
XPROCESS
(
process
)
->
status
=
Qrun
;
setup_process_coding_systems
(
process
);
...
...
@@ -2044,7 +2045,6 @@ create_process (process, new_argv, current_dir)
EMACS_SET_SECS_USECS
(
offset
,
1
,
0
);
timer
=
start_atimer
(
ATIMER_RELATIVE
,
offset
,
create_process_1
,
0
);
XPROCESS (process)->subtty = Qnil;
if
(
forkin
>=
0
)
emacs_close
(
forkin
);
...
...
@@ -5107,6 +5107,33 @@ Output from processes can arrive in between bunches. */)
return
Qnil
;
}
/* Return the foreground process group for the tty/pty that
the process P uses. */
static
int
emacs_get_tty_pgrp
(
p
)
struct
Lisp_Process
*
p
;
{
int
gid
=
-
1
;
#ifdef TIOCGPGRP
if
(
ioctl
(
XINT
(
p
->
infd
),
TIOCGPGRP
,
&
gid
)
==
-
1
&&
!
NILP
(
p
->
tty_name
))
{
int
fd
;
/* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the
master side. Try the slave side. */
fd
=
emacs_open
(
XSTRING
(
p
->
tty_name
)
->
data
,
O_RDONLY
,
0
);
if
(
fd
!=
-
1
)
{
ioctl
(
fd
,
TIOCGPGRP
,
&
gid
);
emacs_close
(
fd
);
}
}
#endif
/* defined (TIOCGPGRP ) */
return
gid
;
}
DEFUN
(
"process-running-child-p"
,
Fprocess_running_child_p
,
Sprocess_running_child_p
,
0
,
1
,
0
,
doc
:
/* Return t if PROCESS has given the terminal to a child.
...
...
@@ -5117,7 +5144,7 @@ return t unconditionally. */)
{
/* Initialize in case ioctl doesn't exist or gives an error,
in a way that will cause returning t. */
int gid
= 0
;
int
gid
;
Lisp_Object
proc
;
struct
Lisp_Process
*
p
;
...
...
@@ -5131,12 +5158,7 @@ return t unconditionally. */)
error
(
"Process %s is not active"
,
SDATA
(
p
->
name
));
#ifdef TIOCGPGRP
if (!NILP (p->subtty))
ioctl (XFASTINT (p->subtty), TIOCGPGRP, &gid);
else
ioctl (XINT (p->infd), TIOCGPGRP, &gid);
#endif /* defined (TIOCGPGRP ) */
gid
=
emacs_get_tty_pgrp
(
p
);
if
(
gid
==
XFASTINT
(
p
->
pid
))
return
Qnil
;
...
...
@@ -5288,19 +5310,13 @@ process_send_signal (process, signo, current_group, nomsg)
But, TIOCGPGRP does not work on E50 ;-P works fine on E60"
His patch indicates that if TIOCGPGRP returns an error, then
we should just assume that p->pid is also the process group id. */
{
int err;
if (!NILP (p->subtty))
err = ioctl (XFASTINT (p->subtty), TIOCGPGRP, &gid);
else
err = ioctl (XINT (p->infd), TIOCGPGRP, &gid);
if (err == -1)
/* If we can't get the information, assume
the shell owns the tty. */
gid = XFASTINT (p->pid);
}
gid
=
emacs_get_tty_pgrp
(
p
);
if
(
gid
==
-
1
)
/* If we can't get the information, assume
the shell owns the tty. */
gid
=
XFASTINT
(
p
->
pid
);
/* It is not clear whether anything really can set GID to -1.
Perhaps on some system one of those ioctls can or could do so.
...
...
@@ -5362,7 +5378,10 @@ process_send_signal (process, signo, current_group, nomsg)
/* gid may be a pid, or minus a pgrp's number */
#ifdef TIOCSIGSEND
if
(
!
NILP
(
current_group
))
ioctl (XINT (p->infd), TIOCSIGSEND, signo);
{
if
(
ioctl
(
XINT
(
p
->
infd
),
TIOCSIGSEND
,
signo
)
==
-
1
)
EMACS_KILLPG
(
gid
,
signo
);
}
else
{
gid
=
-
XFASTINT
(
p
->
pid
);
...
...
src/process.h
View file @
16782258
...
...
@@ -33,9 +33,6 @@ struct Lisp_Process
Lisp_Object
infd
;
/* Descriptor by which we write to this process */
Lisp_Object
outfd
;
/* Descriptor for the tty which this process is using.
nil if we didn't record it (on some systems, there's no need). */
Lisp_Object
subtty
;
/* Name of subprocess terminal. */
Lisp_Object
tty_name
;
/* Name of this process */
...
...
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