aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/process.c b/src/process.c
index 2cc2c86df39..405c06db46d 100644
--- a/src/process.c
+++ b/src/process.c
@@ -276,6 +276,10 @@ static int max_desc;
276 the file descriptor of a socket that is already bound. */ 276 the file descriptor of a socket that is already bound. */
277static int external_sock_fd; 277static int external_sock_fd;
278 278
279/* The name (path) of the socket that was passed to Emacs, when
280 `external_sock_fd' is not -1. */
281static const char *external_sock_name = NULL;
282
279/* Indexed by descriptor, gives the process (if any) for that descriptor. */ 283/* Indexed by descriptor, gives the process (if any) for that descriptor. */
280static Lisp_Object chan_process[FD_SETSIZE]; 284static Lisp_Object chan_process[FD_SETSIZE];
281static void wait_for_socket_fds (Lisp_Object, char const *); 285static void wait_for_socket_fds (Lisp_Object, char const *);
@@ -7972,10 +7976,21 @@ restore_nofile_limit (void)
7972} 7976}
7973 7977
7974 7978
7979DEFUN ("get-external-sockname", Fget_external_sockname, Sget_external_sockname, 0, 0, 0,
7980 doc: /* Return the path of an external socket passed to Emacs.
7981Otherwise return nil. */)
7982 (void)
7983{
7984 if (external_sock_name)
7985 return make_string(external_sock_name, strlen(external_sock_name));
7986 else
7987 return Qnil;
7988}
7989
7975/* This is not called "init_process" because that is the name of a 7990/* This is not called "init_process" because that is the name of a
7976 Mach system call, so it would cause problems on Darwin systems. */ 7991 Mach system call, so it would cause problems on Darwin systems. */
7977void 7992void
7978init_process_emacs (int sockfd) 7993init_process_emacs (int sockfd, char *sockname)
7979{ 7994{
7980#ifdef subprocesses 7995#ifdef subprocesses
7981 int i; 7996 int i;
@@ -8010,6 +8025,7 @@ init_process_emacs (int sockfd)
8010#endif 8025#endif
8011 8026
8012 external_sock_fd = sockfd; 8027 external_sock_fd = sockfd;
8028 external_sock_name = sockname;
8013 max_desc = -1; 8029 max_desc = -1;
8014 memset (fd_callback_info, 0, sizeof (fd_callback_info)); 8030 memset (fd_callback_info, 0, sizeof (fd_callback_info));
8015 8031
@@ -8304,4 +8320,5 @@ returns non-`nil'. */);
8304 defsubr (&Sprocess_inherit_coding_system_flag); 8320 defsubr (&Sprocess_inherit_coding_system_flag);
8305 defsubr (&Slist_system_processes); 8321 defsubr (&Slist_system_processes);
8306 defsubr (&Sprocess_attributes); 8322 defsubr (&Sprocess_attributes);
8323 defsubr (&Sget_external_sockname);
8307} 8324}