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
Open sidebar
emacs
emacs
Commits
f01769f9
Commit
f01769f9
authored
Apr 22, 2012
by
Leo Liu
Browse files
* src/sysdep.c (list_system_processes): Support Darwin.
Fixes: debbugs:5725
parent
5790543d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
src/ChangeLog
src/ChangeLog
+4
-0
src/sysdep.c
src/sysdep.c
+16
-2
No files found.
src/ChangeLog
View file @
f01769f9
2012-04-22 Leo Liu <sdl.web@gmail.com>
* sysdep.c (list_system_processes): Support Darwin (Bug#5725).
2012-04-22 Paul Eggert <eggert@cs.ucla.edu>
2012-04-22 Paul Eggert <eggert@cs.ucla.edu>
* sysdep.c [__FreeBSD__]: Minor cleanups.
* sysdep.c [__FreeBSD__]: Minor cleanups.
...
...
src/sysdep.c
View file @
f01769f9
...
@@ -44,6 +44,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
...
@@ -44,6 +44,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <math.h>
#include <math.h>
#endif
#endif
#ifdef DARWIN_OS
#include <sys/sysctl.h>
#endif
#ifdef WINDOWSNT
#ifdef WINDOWSNT
#define read sys_read
#define read sys_read
#define write sys_write
#define write sys_write
...
@@ -2536,12 +2540,16 @@ list_system_processes (void)
...
@@ -2536,12 +2540,16 @@ list_system_processes (void)
return
proclist
;
return
proclist
;
}
}
#elif defined
__FreeBSD__
#elif defined
BSD_SYSTEM
Lisp_Object
Lisp_Object
list_system_processes
(
void
)
list_system_processes
(
void
)
{
{
#ifdef DARWIN_OS
int
mib
[]
=
{
CTL_KERN
,
KERN_PROC
,
KERN_PROC_ALL
};
#else
int
mib
[]
=
{
CTL_KERN
,
KERN_PROC
,
KERN_PROC_PROC
};
int
mib
[]
=
{
CTL_KERN
,
KERN_PROC
,
KERN_PROC_PROC
};
#endif
size_t
len
;
size_t
len
;
struct
kinfo_proc
*
procs
;
struct
kinfo_proc
*
procs
;
size_t
i
;
size_t
i
;
...
@@ -2562,7 +2570,13 @@ list_system_processes (void)
...
@@ -2562,7 +2570,13 @@ list_system_processes (void)
GCPRO1
(
proclist
);
GCPRO1
(
proclist
);
len
/=
sizeof
(
struct
kinfo_proc
);
len
/=
sizeof
(
struct
kinfo_proc
);
for
(
i
=
0
;
i
<
len
;
i
++
)
for
(
i
=
0
;
i
<
len
;
i
++
)
proclist
=
Fcons
(
make_fixnum_or_float
(
procs
[
i
].
ki_pid
),
proclist
);
{
#ifdef DARWIN_OS
proclist
=
Fcons
(
make_fixnum_or_float
(
procs
[
i
].
kp_proc
.
p_pid
),
proclist
);
#else
proclist
=
Fcons
(
make_fixnum_or_float
(
procs
[
i
].
ki_pid
),
proclist
);
#endif
}
UNGCPRO
;
UNGCPRO
;
xfree
(
procs
);
xfree
(
procs
);
...
...
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