anselmo-ed@cs.yale.edu (Ed Anselmo) (08/09/89)
This is being posted for one of the faculty members at Yale... ----------------------------- To: requests Subject: Share and X on maxine On maxine there seems to be a problem with the share system call and its interaction with fork and with X. If one calls share from a process, forks, and then calls share again from the parent process, as in the pr gram below, the second call to share falls. The result of the following pro ram is: (10)% a.out share 2 failed : Unable to satisfy allocation request and the program is: #include <stdio.h> main(argc, argv) int argc; char **argv; { extern char *share(); char *buf; if ((buf = share(0, (unsigned)1)) == NULL) { perror("share failed\n"); exit(1); } if (0 == fork()) return; if ((buf = share(0, (unsigned)1)) == NULL) perror("share 2 failed\n"); } This causes problems with X since the XtInitialize routine eventually c lls share, and thus, one is very limited in when this routine can be called if shared memory is also used. I believe (although I'm not certain since I don't know where the Encore sources are) that XtInitialize calls shar () from the sub-routine XOpenDisplay. If one writes an X program that cal s XtInitialize after calling share and forking of a child process, the pr gram fails at run-time with the message: X Toolkit Error: Can't Open display Is there any documentation that explains the interaction of Encore X an share? Does Encore consider this a bug? Is there any hope of it being corrected or is this something that we'll have to work around? ---------------------------- So, can you call share() again after forking? Suppose you want to share one region of memory between the parent and all children, and another segment between parent and only some of the children? -- Ed Anselmo Internet: anselmo-ed@cs.yale.edu Computer Science Department UUCP : {harvard,decvax}!yale!anselmo-ed Yale University, New Haven, CT Voice : (203) 432-1254