dupuy@CS.COLUMBIA.EDU (Alexander Dupuy) (08/31/89)
A few minor fixes for GNU Make 3.55; relevant RCS log messages follow:
An extra comment line in Makefile was deleted
The default rule for building dvi from texinfo used mv on the auxiliary files;
as a result, crossreferences were never right; changed to use cp instead.
Some BSD variants (4.3BSD+NFS, 4.2?) don't have <fcntl.h>, so always use
<sys/file.h> instead, which is what is really wanted.
Improve error checking for /dev/kmem, /vmunix files in load.c
Allow use of vfork on USG machines which have it (HP-UX).
Fix bug in dup2() emulation code which caused it always to fail (it's only used
in the shell function, so I guess nobody else uses that on USG systems :-).
Eliminate a redundant #include of <errno.h> in dup2 code.
@alex
RCS file: RCS/Makefile,v; Working file: Makefile
----------------------------
revision 3.55.1.1
date: 89/08/30 13:43:30; author: dupuy; state: Exp; lines added/del: 0/1
delete extra line in comment
=============================================================================
RCS file: RCS/default.c,v; Working file: default.c
----------------------------
revision 3.55.1.1
date: 89/08/30 15:21:46; author: dupuy; state: Exp; lines added/del: 1/1
better rule for %.dvi: %.texinfo
=============================================================================
RCS file: RCS/load.c,v; Working file: load.c
----------------------------
revision 3.55.1.1
date: 89/08/30 15:41:58; author: dupuy; state: Exp; lines added/del: 31/7
add error messages, some BSD variants have no <fcntl.h>
=============================================================================
RCS file: RCS/job.c,v; Working file: job.c
----------------------------
revision 3.55.1.1
date: 89/08/30 16:39:12; author: dupuy; state: Exp; lines added/del: 2/5
add conditionalization for vfork (HP-UX)
eliminate extra inclusion of <errno.h>
fix dup2 implementation
=============================================================================
RCS file: RCS/remake.c,v; Working file: remake.c
----------------------------
revision 3.55.1.1
date: 89/08/30 15:53:04; author: dupuy; state: Exp; lines added/del: 2/2
some BSD variants have no <fcntl.h>
=============================================================================
*** /tmp/,RCSt1a10936 Wed Aug 30 13:43:12 1989
--- Makefile Wed Aug 30 13:42:26 1989
***************
*** 36,42 ****
# "/vmunix", LDAV_SYMBOL if not "_avenrun", LDAV_TYPE if not `long int',
# and LDAV_CVT to convert the LDAV_TYPE value from LDAV_SYMBOL (in `load')
# to a double if this is not "(double) load". If the `n_name' member of a
- # If no load average determination can be done, define NO_LDAV.
# `struct nlist' is an array that must be copied into, define NLIST_NAME_ARRAY.
# Otherwise, define NO_LDAV.
LOAD_AVG =
--- 36,41 ----
*** /tmp/,RCSt1a14678 Wed Aug 30 15:38:23 1989
--- default.c Wed Aug 30 15:22:18 1989
***************
*** 150,156 ****
"$(TEXINDEX) $(wildcard $(foreach _s_,cp fn ky pg tp vr,\
$*.$(_s_)))\n\
-$(foreach _f_,$(wildcard $(foreach _s_,aux cp fn ky pg tp vr,\
! $*.$(_s_))),mv $(_f_) $(_f_)O;)\n\
-$(TEX) $< \n\
$(foreach _f_,$(wildcard $(foreach _s_,aux cp fn ky pg tp vr,\
$*.$(_s_))),cmp -s $(_f_)O $(_f_) ||) \\\n\
--- 150,156 ----
"$(TEXINDEX) $(wildcard $(foreach _s_,cp fn ky pg tp vr,\
$*.$(_s_)))\n\
-$(foreach _f_,$(wildcard $(foreach _s_,aux cp fn ky pg tp vr,\
! $*.$(_s_))),cp $(_f_) $(_f_)O;)\n\
-$(TEX) $< \n\
$(foreach _f_,$(wildcard $(foreach _s_,aux cp fn ky pg tp vr,\
$*.$(_s_))),cmp -s $(_f_)O $(_f_) ||) \\\n\
*** /tmp/,RCSt1a16807 Wed Aug 30 16:38:52 1989
--- job.c Wed Aug 30 16:33:15 1989
***************
*** 27,33 ****
extern char **construct_command_argv ();
! #ifdef USG
#define vfork fork
#define VFORK_NAME "fork"
#else /* Not USG. */
--- 27,33 ----
extern char **construct_command_argv ();
! #ifdef USG && !defined(HAVE_VFORK)
#define vfork fork
#define VFORK_NAME "fork"
#else /* Not USG. */
***************
*** 989,997 ****
#if defined(USG) && !defined(USGr3) && !defined(HAVE_DUP2)
- #include <errno.h>
- extern int errno;
-
int
dup2 (old, new)
int old, new;
--- 989,994 ----
***************
*** 1000,1006 ****
(void) close (new);
fd = dup (old);
! if (fd != old)
{
(void) close (fd);
errno = EMFILE;
--- 997,1003 ----
(void) close (new);
fd = dup (old);
! if (fd != new)
{
(void) close (fd);
errno = EMFILE;
*** /tmp/,RCSt1a14764 Wed Aug 30 15:41:32 1989
--- load.c Wed Aug 30 15:40:16 1989
***************
*** 128,134 ****
--- 128,138 ----
#endif
#include <nlist.h>
+ #ifdef USG
#include <fcntl.h>
+ #else
+ #include <sys/file.h>
+ #endif
/* Return the current load average as a double. */
***************
*** 137,142 ****
--- 141,147 ----
{
LDAV_TYPE load;
static int kmem = -1;
+ static int warned = 0;
static unsigned long int offset = 0;
if (kmem < 0)
***************
*** 143,149 ****
{
kmem = open ("/dev/kmem", O_RDONLY);
if (kmem < 0)
! return 0.0;
}
if (offset == 0)
--- 148,161 ----
{
kmem = open ("/dev/kmem", O_RDONLY);
if (kmem < 0)
! {
! if (warned == 0)
! {
! perror_with_name ("open: ", "/dev/kmem");
! warned = 1;
! }
! return 0.0;
! }
}
if (offset == 0)
***************
*** 155,172 ****
strcpy (nl[1].n_name, "");
#else /* Not NLIST_NAME_ARRAY. */
nl[0].n_name = LDAV_SYMBOL;
! nl[1].n_name = 0;
#endif /* NLIST_NAME_ARRAY. */
if (nlist (KERNEL_FILE, nl) < 0 || nl[0].n_type == 0)
! return 0.0;
offset = nl[0].n_value;
}
! if (lseek (kmem, offset, 0) < 0L)
! return 0.0;
! if (read (kmem, &load, sizeof load) < 0)
! return 0.0;
return LDAV_CVT;
}
--- 167,196 ----
strcpy (nl[1].n_name, "");
#else /* Not NLIST_NAME_ARRAY. */
nl[0].n_name = LDAV_SYMBOL;
! nl[1].n_name = "";
#endif /* NLIST_NAME_ARRAY. */
if (nlist (KERNEL_FILE, nl) < 0 || nl[0].n_type == 0)
! {
! if (warned == 0)
! {
! perror_with_name ("nlist: ", KERNEL_FILE);
! warned = 1;
! }
! return 0.0;
! }
offset = nl[0].n_value;
}
! if (lseek (kmem, offset, 0) == -1L || read (kmem, &load, sizeof load) < 0)
! {
! if (warned == 0)
! {
! perror_with_name ("read: ", "/dev/kmem");
! warned = 1;
! }
! return 0.0;
! }
return LDAV_CVT;
}
*** /tmp/,RCSt1a15196 Wed Aug 30 16:02:28 1989
--- remake.c Wed Aug 30 15:55:36 1989
***************
*** 19,27 ****
#include "commands.h"
#include "dep.h"
#include "file.h"
#include <fcntl.h>
!
! #ifndef USG
#include <sys/file.h>
#endif
--- 19,27 ----
#include "commands.h"
#include "dep.h"
#include "file.h"
+ #ifdef USG
#include <fcntl.h>
! #else
#include <sys/file.h>
#endif
--