[8536] in Athena Bugs
emacsclient on rs6000
daemon@ATHENA.MIT.EDU (Calvin Clark)
Tue Nov 5 15:29:23 1991
Date: Tue, 5 Nov 91 15:29:14 -0500
From: Calvin Clark <ckclark@Athena.MIT.EDU>
To: tarquin@Athena.MIT.EDU
Cc: bugs@Athena.MIT.EDU, rs6000-comments@Athena.MIT.EDU
Reply-To: ckclark@mit.edu
>It appears that emacsclient is running sort of spottily. Sometimes, it works
>fine on the RS6000. Other times, I'll go to compose a letter, and I'll get
>the "waiting for Emacs..." message in the xterm window, but emacsclient will
>not get the idea that it's supposed to pick up the work in an existing emacs
>window.
>I am not sure if this is a problem with the emacs port or with something else.
I am not sure what is causing the problem you report, since I have not
run into this bug myself, but there's a good chance it's because emacs
is using a file in your homedir for the server/client connection. On the
RS/6000, the emacs server was creating the server file in the user's
homedir, rather than in /tmp/esrv<uid> like on the other architectures.
The SYSV IPC code does not use a Unix-domain socket for the server file,
so this worked fine. However, the emacs server file should be in /tmp
anyway, since it should not be common to all machines, as it is if kept
in the user's homedir. The following changes to emacsclient.c and
server.c should make the behavior consistent across the platforms, and
may solve some of the problems you report. Another possible fix is to
to use the BSD IPC code on the RS/6000, which will also work. I have
tested both methods.
-Calvin
--
Calvin Clark <ckclark@mit.edu>
MIT Distributed Computing and Network Services
Systems Development and Quality Assurance
*** /tmp/,RCSt1003104 Tue Nov 5 15:17:53 1991
--- server.c Tue Nov 5 15:16:54 1991
***************
*** 234,243 ****
(struct msgbuf *) malloc (sizeof *msgp + BUFSIZ);
struct msqid_ds msg_st;
int p;
! char *homedir, *getenv ();
char string[BUFSIZ];
FILE *infile;
/*
* Create a message queue using ~/.emacs_server as the path for ftok
*/
--- 234,247 ----
(struct msgbuf *) malloc (sizeof *msgp + BUFSIZ);
struct msqid_ds msg_st;
int p;
! #ifdef SERVER_HOME_DIR
! char *homedir;
! #endif /* SERVER_HOME_DIR */
! char *getenv ();
char string[BUFSIZ];
FILE *infile;
+ #ifdef SERVER_HOME_DIR
/*
* Create a message queue using ~/.emacs_server as the path for ftok
*/
***************
*** 248,253 ****
--- 252,260 ----
}
strcpy (string, homedir);
strcat (string, "/.emacs_server");
+ #else /* ! SERVER_HOME_DIR */
+ sprintf(string, "/tmp/esrv%s", geteuid());
+ #endif /* SERVER_HOME_DIR */
creat (string, 0600);
key = ftok (string, 1); /* unlikely to be anyone else using it */
s = msgget (key, 0600 | IPC_CREAT);
***************
*** 288,293 ****
--- 295,301 ----
if ((fromlen = msgrcv (s, msgp, BUFSIZ - 1, 1, 0)) < 0)
{
perror ("msgrcv");
+ exit(1);
}
else
{
*** /tmp/,RCSt1003124 Tue Nov 5 15:22:36 1991
--- emacsclient.c Tue Nov 5 14:46:37 1991
***************
*** 183,189 ****
struct msgbuf * msgp =
(struct msgbuf *) malloc (sizeof *msgp + BUFSIZ);
struct msqid_ds * msg_st;
! char *homedir, buf[BUFSIZ];
char gwdirb[BUFSIZ];
char *cwd;
char *temp;
--- 183,192 ----
struct msgbuf * msgp =
(struct msgbuf *) malloc (sizeof *msgp + BUFSIZ);
struct msqid_ds * msg_st;
! #ifdef SERVER_HOME_DIR
! char *homedir;
! #endif /* SERVER_HOME_DIR */
! char buf[BUFSIZ];
char gwdirb[BUFSIZ];
char *cwd;
char *temp;
***************
*** 195,200 ****
--- 198,204 ----
exit (1);
}
+ #ifdef SERVER_HOME_DIR
/*
* Create a message queue using ~/.emacs_server as the path for ftok
*/
***************
*** 205,210 ****
--- 209,217 ----
}
strcpy (buf, homedir);
strcat (buf, "/.emacs_server");
+ #else /* ! SERVER_HOME_DIR */
+ sprintf (buf, "/tmp/esrv%s", geteuid());
+ #endif /* SERVER_HOME_DIR */
creat (buf, 0600);
key = ftok (buf, 1); /* unlikely to be anyone else using it */
s = msgget (key, 0600);