home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.emacs.bug
- Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!klinzhai.rutgers.edu!root
- From: root@klinzhai.rutgers.edu
- Subject: Solaris 2.0 port for Gnu emacs
- Message-ID: <9211172150.AA26996@klinzhai.rutgers.edu>
- Sender: gnulists@ai.mit.edu
- Organization: GNUs Not Usenet
- Distribution: gnu
- Date: Tue, 17 Nov 1992 21:50:30 GMT
- Approved: bug-gnu-emacs@prep.ai.mit.edu
- Lines: 268
-
- The following new s- file and diffs allow Emacs to run under Sun's
- Solaris 2.0. There are two possible issues:
-
- - note that fileio.c also includes changes to add two new Rutgers functions
- and one Rutgers bug fix. The new functions are used by our Lisp
- code, which tries to make sure that new versions of files have
- the same attributes as the original. In particular, when root
- edits a file, we want the original ownership to be preserved.
-
- - in fileio.c, we need config.h to be read before dir.h or dirent.h
- so that we can select which. Unfortunately I have no way to
- know whether this is going to create side effects for other
- ports.
-
- The rest of this message is s-solaris2-0.h and then diffs for other files
-
- ------------------------------------------------------------------------------
-
- /* GNU Emacs site configuration template file.
- Copyright (C) 1988 Free Software Foundation, Inc.
-
- This file is part of GNU Emacs.
-
- GNU Emacs is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- GNU Emacs is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Emacs; see the file COPYING. If not, write to
- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
- /* Sun Solaris 2.0, using Cygnus gcc */
-
- #include "s-usg5-4.h"
-
- /*
- * the following are probably due to using Cygnus gcc. Note that I've
- * put in symlinks to crti and crtn from /opt/cygnus/lib. In fact
- * they actually occur in a deeply nested release-specific directory.
- * it's not safe to put the Cygnus .o files into the normal Sun
- * locations, because we'd like gcc and Sun's compiler to coexist.
- * Possibly this should be under a conditional such as __GCC__, though
- * this is more Cygnus-specific than GCC-specific.
- */
-
- #undef START_FILES
- #define START_FILES pre-crt0.o /opt/cygnus/lib/crt1.o /opt/cygnus/lib/crti.o /usr/ccs/lib/values-Xt.o
- #undef LIB_STANDARD
- #define LIB_STANDARD -lsocket -lnsl -lelf -lc /usr/ucblib/libucb.a /opt/cygnus/lib/crtn.o
- #define LIB_GCC
-
- /* the following are probably appropriate even using Sun's compiler */
-
- #define NEED_DIRENT
- #define USE_SYSCONF
- #define LIBS_TERMCAP /usr/ccs/lib/libtermcap.a
-
- ------------------------------------------------------------------------------
-
- *** m-sparc.h.ORIG Tue Jan 8 17:55:40 1991
- --- m-sparc.h Tue Nov 17 20:56:24 1992
- ***************
- *** 83,90 ****
- --- 83,96 ----
- #include <alloca.h>
-
- /* Must use the system's termcap. It does special things. */
- + /*
- + * With Solaris, it's in a different place. This probably belongs in
- + * the s- file, but for now, leave it here but let s-solaris define it
- + */
-
- + #ifndef LIBS_TERMCAP
- #define LIBS_TERMCAP -ltermcap
- + #endif
-
- /* Mask for address bits within a memory segment */
-
- *** fileio.c.ORIG Sun Feb 16 20:56:17 1992
- --- fileio.c Tue Nov 17 20:47:21 1992
- ***************
- *** 34,39 ****
- --- 34,41 ----
-
- #include <ctype.h>
-
- + #include "config.h"
- +
- #ifdef VMS
- #include "dir.h"
- #include <perror.h>
- ***************
- *** 40,47 ****
- --- 42,53 ----
- #include <stddef.h>
- #include <string.h>
- #else
- + #ifdef NEED_DIRENT
- + #include <dirent.h>
- + #else
- #include <sys/dir.h>
- #endif
- + #endif
- #include <errno.h>
-
- #ifndef vax11c
- ***************
- *** 59,65 ****
- #ifdef NULL
- #undef NULL
- #endif
- - #include "config.h"
- #include "lisp.h"
- #include "buffer.h"
- #include "window.h"
- --- 65,70 ----
- ***************
- *** 1563,1568 ****
- --- 1568,1622 ----
- return (mtime1 > st.st_mtime) ? Qt : Qnil;
- }
-
- + DEFUN ("file-owner", Ffile_owner, Sfile_owner, 1, 1, 0,
- + "Return ownership of FILE, as a vector (uid,gid).")
- + (filename)
- + Lisp_Object filename;
- + {
- + Lisp_Object abspath,owner[2];
- + struct stat st;
- +
- + abspath = Fexpand_file_name (filename, current_buffer->directory);
- +
- + /* Remove final slash, if any.
- + stat behaves differently depending! */
- + if (XSTRING (abspath)->data[XSTRING (abspath)->size - 1] == '/')
- + {
- + if (EQ (abspath, filename))
- + abspath = Fcopy_sequence (abspath);
- + XSTRING (abspath)->data[XSTRING (abspath)->size - 1] = 0;
- + }
- +
- + if (stat (XSTRING (abspath)->data, &st) < 0)
- + return Qnil;
- +
- + XFASTINT (owner[0]) = st.st_uid;
- + XFASTINT (owner[1]) = st.st_gid;
- +
- + return Flist(2,owner);
- + }
- +
- + DEFUN ("set-file-owner", Fset_file_owner, Sset_file_owner, 2, 2, 0,
- + "Set ownership of FILE, as the vector (uid,gid).")
- + (filename,owner)
- + Lisp_Object filename,*owner;
- + {
- + unsigned char *fn;
- +
- + if(Flength(owner) != 2)
- + return Qnil;
- +
- + filename = Fexpand_file_name (filename, current_buffer->directory);
- + fn = XSTRING (filename)->data;
- +
- + if(-1 == chown(fn, XFASTINT (Fcar (owner)),
- + XFASTINT (Fcar (Fcdr (owner)))))
- + return Qnil;
- + else
- + return Qt;
- + }
- +
- +
- close_file_unwind (fd)
- Lisp_Object fd;
- {
- ***************
- *** 2052,2057 ****
- --- 2106,2112 ----
- Lisp_Object tail, buf;
- int auto_saved = 0;
- int tried = 0;
- + int modes; /* RU: save file modes; see below */
- char *omessage = echo_area_contents;
- /* No GCPRO needed, because (when it matters) all Lisp_Object variables
- point to non-strings reached from Vbuffer_alist. */
- ***************
- *** 2093,2098 ****
- --- 2148,2161 ----
- if (!auto_saved && NULL (nomsg))
- message1 ("Auto-saving...");
- internal_condition_case (auto_save_1, Qt, auto_save_error);
- + /* RU: make sure the auto-save file has same protections as file */
- + if (EQ (b->filename, Qnil))
- + Fset_file_modes (current_buffer->auto_save_file_name, 384); /* 600 */
- + else {
- + modes = Ffile_modes (current_buffer->filename);
- + if (!EQ (modes, Qnil))
- + Fset_file_modes (current_buffer->auto_save_file_name, modes);
- + }
- auto_saved++;
- b->auto_save_modified = BUF_MODIFF (b);
- XFASTINT (current_buffer->save_length) = Z - BEG;
- ***************
- *** 2325,2330 ****
- --- 2388,2395 ----
- defsubr (&Sfile_directory_p);
- defsubr (&Sfile_modes);
- defsubr (&Sset_file_modes);
- + defsubr (&Sfile_owner);
- + defsubr (&Sset_file_owner);
- defsubr (&Sfile_newer_than_file_p);
- defsubr (&Sinsert_file_contents);
- defsubr (&Swrite_region);
- *** getpagesize.h.ORIG Sun Mar 31 23:12:22 1991
- --- getpagesize.h Tue Nov 17 20:32:29 1992
- ***************
- *** 12,17 ****
- --- 12,20 ----
- #include <sys/param.h>
- #endif
-
- + #ifdef USE_SYSCONF
- + #define getpagesize() sysconf(_SC_PAGESIZE)
- + #else
- #ifdef EXEC_PAGESIZE
- #define getpagesize() EXEC_PAGESIZE
- #else
- ***************
- *** 24,29 ****
- #define getpagesize() NBPC
- #endif /* no NBPG */
- #endif /* no EXEC_PAGESIZE */
-
- #endif /* not HAVE_GETPAGESIZE */
- -
- --- 27,32 ----
- #define getpagesize() NBPC
- #endif /* no NBPG */
- #endif /* no EXEC_PAGESIZE */
- + #endif /* no USE_SYSCONF */
-
- #endif /* not HAVE_GETPAGESIZE */
- *** process.c.ORIG Tue Feb 18 19:00:53 1992
- --- process.c Tue Nov 17 20:39:40 1992
- ***************
- *** 1747,1753 ****
- else
- error("select error: %s", sys_errlist[xerrno]);
- }
- ! #if defined (sun) || defined (APOLLO)
- else if (nfds > 0 && FD_ISSET (0, &Available) && interrupt_input)
- /* System sometimes fails to deliver SIGIO. */
- kill (getpid (), SIGIO);
- --- 1747,1754 ----
- else
- error("select error: %s", sys_errlist[xerrno]);
- }
- ! /* following sun conditional should be used only for SunOS, not Solaris */
- ! #if defined (sun) && defined (BSD) || defined (APOLLO)
- else if (nfds > 0 && FD_ISSET (0, &Available) && interrupt_input)
- /* System sometimes fails to deliver SIGIO. */
- kill (getpid (), SIGIO);
-
-