home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / gnu / emacs / bug / 1494 < prev    next >
Encoding:
Text File  |  1992-11-17  |  8.2 KB  |  281 lines

  1. Newsgroups: gnu.emacs.bug
  2. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!klinzhai.rutgers.edu!root
  3. From: root@klinzhai.rutgers.edu
  4. Subject: Solaris 2.0 port for Gnu emacs
  5. Message-ID: <9211172150.AA26996@klinzhai.rutgers.edu>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Tue, 17 Nov 1992 21:50:30 GMT
  10. Approved: bug-gnu-emacs@prep.ai.mit.edu
  11. Lines: 268
  12.  
  13. The following new s- file and diffs allow Emacs to run under Sun's
  14. Solaris 2.0.  There are two possible issues:
  15.  
  16.   - note that fileio.c also includes changes to add two new Rutgers functions
  17.     and one Rutgers bug fix.  The new functions are used by our Lisp
  18.     code, which tries to make sure that new versions of files have
  19.     the same attributes as the original.  In particular, when root
  20.     edits a file, we want the original ownership to be preserved.
  21.  
  22.   - in fileio.c, we need config.h to be read before dir.h or dirent.h
  23.     so that we can select which.  Unfortunately I have no way to
  24.     know whether this is going to create side effects for other
  25.     ports.
  26.  
  27. The rest of this message is s-solaris2-0.h and then diffs for other files
  28.  
  29. ------------------------------------------------------------------------------
  30.  
  31. /* GNU Emacs site configuration template file.
  32.    Copyright (C) 1988 Free Software Foundation, Inc.
  33.  
  34. This file is part of GNU Emacs.
  35.  
  36. GNU Emacs is free software; you can redistribute it and/or modify
  37. it under the terms of the GNU General Public License as published by
  38. the Free Software Foundation; either version 1, or (at your option)
  39. any later version.
  40.  
  41. GNU Emacs is distributed in the hope that it will be useful,
  42. but WITHOUT ANY WARRANTY; without even the implied warranty of
  43. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  44. GNU General Public License for more details.
  45.  
  46. You should have received a copy of the GNU General Public License
  47. along with GNU Emacs; see the file COPYING.  If not, write to
  48. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  49.  
  50. /* Sun Solaris 2.0, using Cygnus gcc */
  51.  
  52. #include "s-usg5-4.h"
  53.  
  54. /*
  55.  * the following are probably due to using Cygnus gcc.  Note that I've
  56.  * put in symlinks to crti and crtn from /opt/cygnus/lib.  In fact
  57.  * they actually occur in a deeply nested release-specific directory.
  58.  * it's not safe to put the Cygnus .o files into the normal Sun
  59.  * locations, because we'd like gcc and Sun's compiler to coexist.
  60.  * Possibly this should be under a conditional such as __GCC__, though
  61.  * this is more Cygnus-specific than GCC-specific.
  62.  */
  63.  
  64. #undef START_FILES
  65. #define START_FILES pre-crt0.o /opt/cygnus/lib/crt1.o /opt/cygnus/lib/crti.o /usr/ccs/lib/values-Xt.o
  66. #undef LIB_STANDARD
  67. #define LIB_STANDARD -lsocket -lnsl -lelf -lc /usr/ucblib/libucb.a /opt/cygnus/lib/crtn.o
  68. #define LIB_GCC 
  69.  
  70. /* the following are probably appropriate even using Sun's compiler */
  71.  
  72. #define NEED_DIRENT
  73. #define USE_SYSCONF
  74. #define LIBS_TERMCAP /usr/ccs/lib/libtermcap.a
  75.  
  76. ------------------------------------------------------------------------------
  77.  
  78. *** m-sparc.h.ORIG    Tue Jan  8 17:55:40 1991
  79. --- m-sparc.h    Tue Nov 17 20:56:24 1992
  80. ***************
  81. *** 83,90 ****
  82. --- 83,96 ----
  83.   #include <alloca.h>
  84.   
  85.   /* Must use the system's termcap.  It does special things.  */
  86. + /*
  87. +  * With Solaris, it's in a different place.  This probably belongs in 
  88. +  * the s- file, but for now, leave it here but let s-solaris define it
  89. +  */
  90.   
  91. + #ifndef LIBS_TERMCAP
  92.   #define LIBS_TERMCAP -ltermcap
  93. + #endif
  94.   
  95.   /* Mask for address bits within a memory segment */
  96.   
  97. *** fileio.c.ORIG    Sun Feb 16 20:56:17 1992
  98. --- fileio.c    Tue Nov 17 20:47:21 1992
  99. ***************
  100. *** 34,39 ****
  101. --- 34,41 ----
  102.   
  103.   #include <ctype.h>
  104.   
  105. + #include "config.h"
  106.   #ifdef VMS
  107.   #include "dir.h"
  108.   #include <perror.h>
  109. ***************
  110. *** 40,47 ****
  111. --- 42,53 ----
  112.   #include <stddef.h>
  113.   #include <string.h>
  114.   #else
  115. + #ifdef NEED_DIRENT
  116. + #include <dirent.h>
  117. + #else
  118.   #include <sys/dir.h>
  119.   #endif
  120. + #endif
  121.   #include <errno.h>
  122.   
  123.   #ifndef vax11c
  124. ***************
  125. *** 59,65 ****
  126.   #ifdef NULL
  127.   #undef NULL
  128.   #endif
  129. - #include "config.h"
  130.   #include "lisp.h"
  131.   #include "buffer.h"
  132.   #include "window.h"
  133. --- 65,70 ----
  134. ***************
  135. *** 1563,1568 ****
  136. --- 1568,1622 ----
  137.     return (mtime1 > st.st_mtime) ? Qt : Qnil;
  138.   }
  139.   
  140. + DEFUN ("file-owner", Ffile_owner, Sfile_owner, 1, 1, 0,
  141. +   "Return ownership of FILE, as a vector (uid,gid).")
  142. +   (filename)
  143. +      Lisp_Object filename;
  144. + {
  145. +   Lisp_Object abspath,owner[2];
  146. +   struct stat st;
  147. +   abspath = Fexpand_file_name (filename, current_buffer->directory);
  148. +   /* Remove final slash, if any.
  149. +      stat behaves differently depending!  */
  150. +   if (XSTRING (abspath)->data[XSTRING (abspath)->size - 1] == '/')
  151. +     {
  152. +       if (EQ (abspath, filename))
  153. +     abspath = Fcopy_sequence (abspath);
  154. +       XSTRING (abspath)->data[XSTRING (abspath)->size - 1] = 0;
  155. +     }
  156. +   if (stat (XSTRING (abspath)->data, &st) < 0)
  157. +     return Qnil;
  158. +   XFASTINT (owner[0]) = st.st_uid;
  159. +   XFASTINT (owner[1]) = st.st_gid;
  160. +   return Flist(2,owner);
  161. + }
  162. + DEFUN ("set-file-owner", Fset_file_owner, Sset_file_owner, 2, 2, 0,
  163. +   "Set ownership of FILE, as the vector (uid,gid).")
  164. +   (filename,owner)
  165. +      Lisp_Object filename,*owner;
  166. + {
  167. +    unsigned char *fn;
  168. +    if(Flength(owner) != 2)
  169. +      return Qnil;
  170. +    filename = Fexpand_file_name (filename, current_buffer->directory);
  171. +    fn = XSTRING (filename)->data;
  172. +    if(-1 == chown(fn, XFASTINT (Fcar (owner)),
  173. +           XFASTINT (Fcar (Fcdr (owner)))))
  174. +      return Qnil;
  175. +    else
  176. +      return Qt;
  177. + }
  178.   close_file_unwind (fd)
  179.        Lisp_Object fd;
  180.   {
  181. ***************
  182. *** 2052,2057 ****
  183. --- 2106,2112 ----
  184.     Lisp_Object tail, buf;
  185.     int auto_saved = 0;
  186.     int tried = 0;
  187. +   int modes;   /* RU: save file modes; see below */
  188.     char *omessage = echo_area_contents;
  189.     /* No GCPRO needed, because (when it matters) all Lisp_Object variables
  190.        point to non-strings reached from Vbuffer_alist.  */
  191. ***************
  192. *** 2093,2098 ****
  193. --- 2148,2161 ----
  194.         if (!auto_saved && NULL (nomsg))
  195.           message1 ("Auto-saving...");
  196.         internal_condition_case (auto_save_1, Qt, auto_save_error);
  197. +           /* RU: make sure the auto-save file has same protections as file */
  198. +       if (EQ (b->filename, Qnil))
  199. +         Fset_file_modes (current_buffer->auto_save_file_name, 384); /* 600 */
  200. +       else {
  201. +         modes = Ffile_modes (current_buffer->filename);
  202. +         if (!EQ (modes, Qnil))
  203. +           Fset_file_modes (current_buffer->auto_save_file_name, modes);
  204. +       }
  205.         auto_saved++;
  206.         b->auto_save_modified = BUF_MODIFF (b);
  207.         XFASTINT (current_buffer->save_length) = Z - BEG;
  208. ***************
  209. *** 2325,2330 ****
  210. --- 2388,2395 ----
  211.     defsubr (&Sfile_directory_p);
  212.     defsubr (&Sfile_modes);
  213.     defsubr (&Sset_file_modes);
  214. +   defsubr (&Sfile_owner);
  215. +   defsubr (&Sset_file_owner);
  216.     defsubr (&Sfile_newer_than_file_p);
  217.     defsubr (&Sinsert_file_contents);
  218.     defsubr (&Swrite_region);
  219. *** getpagesize.h.ORIG    Sun Mar 31 23:12:22 1991
  220. --- getpagesize.h    Tue Nov 17 20:32:29 1992
  221. ***************
  222. *** 12,17 ****
  223. --- 12,20 ----
  224.   #include <sys/param.h>
  225.   #endif
  226.   
  227. + #ifdef USE_SYSCONF
  228. + #define getpagesize() sysconf(_SC_PAGESIZE)
  229. + #else
  230.   #ifdef EXEC_PAGESIZE
  231.   #define getpagesize() EXEC_PAGESIZE
  232.   #else
  233. ***************
  234. *** 24,29 ****
  235.   #define getpagesize() NBPC
  236.   #endif /* no NBPG */
  237.   #endif /* no EXEC_PAGESIZE */
  238.   
  239.   #endif /* not HAVE_GETPAGESIZE */
  240. --- 27,32 ----
  241.   #define getpagesize() NBPC
  242.   #endif /* no NBPG */
  243.   #endif /* no EXEC_PAGESIZE */
  244. + #endif /* no USE_SYSCONF */
  245.   
  246.   #endif /* not HAVE_GETPAGESIZE */
  247. *** process.c.ORIG    Tue Feb 18 19:00:53 1992
  248. --- process.c    Tue Nov 17 20:39:40 1992
  249. ***************
  250. *** 1747,1753 ****
  251.         else
  252.           error("select error: %s", sys_errlist[xerrno]);
  253.       }
  254. ! #if defined (sun) || defined (APOLLO)
  255.         else if (nfds > 0 && FD_ISSET (0, &Available) && interrupt_input)
  256.       /* System sometimes fails to deliver SIGIO.  */
  257.       kill (getpid (), SIGIO);
  258. --- 1747,1754 ----
  259.         else
  260.           error("select error: %s", sys_errlist[xerrno]);
  261.       }
  262. ! /* following sun conditional should be used only for SunOS, not Solaris */
  263. ! #if defined (sun) && defined (BSD) || defined (APOLLO)
  264.         else if (nfds > 0 && FD_ISSET (0, &Available) && interrupt_input)
  265.       /* System sometimes fails to deliver SIGIO.  */
  266.       kill (getpid (), SIGIO);
  267.  
  268.