Skip to contentSkip to conversation

Portability patches for GNU/Hurd

PATCH Applied Thomas Schwinge 2 participants 17 messages May 25, 2012 – May 29, 2012

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH 1/1 test_pager: Repair build for non-Linux.

---
 lib/Makefile.am |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
lib/Makefile.am +1 -1
index aed0ecd..01b59dc 100644
@@ -27,6 +27,7 @@ test_blkdev_SOURCES = blkdev.c
 test_ismounted_SOURCES = ismounted.c
 test_wholedisk_SOURCES = wholedisk.c
 test_mangle_SOURCES = mangle.c
+test_pager_SOURCES = pager.c
 
 test_at_SOURCES = at.c
 test_at_CFLAGS = -DTEST_PROGRAM_AT
@@ -38,7 +39,6 @@ test_procutils_SOURCES = procutils.c
 if LINUX
 test_cpuset_SOURCES = cpuset.c
 test_sysfs_SOURCES = sysfs.c at.c
-test_pager_SOURCES = pager.c
 test_sysfs_CFLAGS = -DTEST_PROGRAM_SYSFS
 
 test_loopdev_SOURCES = \
Signature · 1 line
1.7.9
#3 lore raw

PATCH 1/7 kill, raw, rename: Don't explicitly enable for --enable-most-builds.

In reply to Thomas Schwinge

They're already dealt with in the default configuration.

---
 configure.ac |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
configure.ac +0 -3
index eb67ada..76f73a1 100644
@@ -631,12 +631,9 @@ if test "x$enable_most_builds" = xyes; then
   enable_arch=yes
   enable_ddate=yes
   enable_elvtune=yes
-  enable_kill=yes
   enable_last=yes
   enable_line=yes
   enable_mesg=yes
-  enable_raw=yes
-  enable_rename=yes
   enable_reset=yes
   enable_login_utils=yes
   enable_write=yes
Signature · 1 line
1.7.9
#4 lore raw

PATCH 2/7 arch, eject, elvtune: Gracefully disable on non-Linux platforms.

---
 configure.ac |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
configure.ac +3 -3
index 76f73a1..cd8fa4e 100644
@@ -628,9 +628,9 @@ AC_ARG_ENABLE([most-builds],
   [], enable_most_builds=no
 )
 if test "x$enable_most_builds" = xyes; then
-  enable_arch=yes
+  enable_arch=check
   enable_ddate=yes
-  enable_elvtune=yes
+  enable_elvtune=check
   enable_last=yes
   enable_line=yes
   enable_mesg=yes
@@ -862,7 +862,7 @@ AC_SUBST([ruman1dir])
 
 AC_ARG_ENABLE([eject],
   AS_HELP_STRING([--disable-eject], [do not build eject]),
-  [], enable_eject=yes
+  [], enable_eject=check
 )
 UL_BUILD_INIT([eject])
 UL_REQUIRES_LINUX([eject])
Signature · 1 line
1.7.9
#6 lore raw

PATCH 3/7 last, login, write: Provide a fallback for MAXHOSTNAMELEN, as elsewhere.

In reply to Thomas Schwinge
---
 login-utils/last.c  |    8 ++++++++
 login-utils/login.c |    8 ++++++++
 term-utils/write.c  |    8 ++++++++
 3 files changed, 24 insertions(+), 0 deletions(-)
login-utils/last.c +8 -0
index 1b1bee1..4d09c4b 100644
@@ -62,6 +62,14 @@
 #include "xalloc.h"
 #include "c.h"
 
+#ifndef MAXHOSTNAMELEN
+# ifdef HOST_NAME_MAX
+#  define MAXHOSTNAMELEN HOST_NAME_MAX
+# else
+#  define MAXHOSTNAMELEN 64
+# endif
+#endif
+
 #define	SECDAY	(24*60*60)			/* seconds in a day */
 #define	NO	0				/* false/no */
 #define	YES	1				/* true/yes */
login-utils/login.c +8 -0
index 7b4f8b5..f459b79 100644
@@ -71,6 +71,14 @@
 
 #include "logindefs.h"
 
+#ifndef MAXHOSTNAMELEN
+# ifdef HOST_NAME_MAX
+#  define MAXHOSTNAMELEN HOST_NAME_MAX
+# else
+#  define MAXHOSTNAMELEN 64
+# endif
+#endif
+
 #define is_pam_failure(_rc)	((_rc) != PAM_SUCCESS)
 
 #define LOGIN_MAX_TRIES        3
term-utils/write.c +8 -0
index 2a94792..c8aca7e 100644
@@ -65,6 +65,14 @@
 #include "closestream.h"
 #include "nls.h"
 
+#ifndef MAXHOSTNAMELEN
+# ifdef HOST_NAME_MAX
+#  define MAXHOSTNAMELEN HOST_NAME_MAX
+# else
+#  define MAXHOSTNAMELEN 64
+# endif
+#endif
+
 static void __attribute__ ((__noreturn__)) usage(FILE * out);
 void search_utmp(char *, char *, char *, uid_t);
 void do_write(char *, char *, uid_t);
Signature · 1 line
1.7.9
#9 lore raw

PATCH 4/7 login: Include <linux/major.h> only if it exists.

In reply to Thomas Schwinge

It isn't required on non-Linux systems.

---
 login-utils/login.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
login-utils/login.c +3 -1
index f459b79..7384940 100644
@@ -49,7 +49,9 @@
 #include <stdlib.h>
 #include <sys/syslog.h>
 #include <sys/sysmacros.h>
-#include <linux/major.h>
+#ifdef HAVE_LINUX_MAJOR_H
+# include <linux/major.h>
+#endif
 #include <netdb.h>
 #include <lastlog.h>
 #include <security/pam_appl.h>
Signature · 1 line
1.7.9
#10 lore raw

PATCH 5/7 write: Use PATH_MAX instead of MAXPATHLEN, as elsewhere.

In reply to Thomas Schwinge
---
 term-utils/write.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
term-utils/write.c +3 -3
index c8aca7e..901ddc4 100644
@@ -102,7 +102,7 @@ int main(int argc, char **argv)
 	time_t atime;
 	uid_t myuid;
 	int msgsok, myttyfd, c;
-	char tty[MAXPATHLEN], *mytty;
+	char tty[PATH_MAX], *mytty;
 
 	static const struct option longopts[] = {
 		{"version", no_argument, NULL, 'V'},
@@ -296,7 +296,7 @@ void search_utmp(char *user, char *tty, char *mytty, uid_t myuid)
 int term_chk(char *tty, int *msgsokP, time_t * atimeP, int showerror)
 {
 	struct stat s;
-	char path[MAXPATHLEN];
+	char path[PATH_MAX];
 
 	if (strlen(tty) + 6 > sizeof(path))
 		return 1;
@@ -321,7 +321,7 @@ void do_write(char *tty, char *mytty, uid_t myuid)
 	char *login, *pwuid, *nows;
 	struct passwd *pwd;
 	time_t now;
-	char path[MAXPATHLEN], host[MAXHOSTNAMELEN], line[512];
+	char path[PATH_MAX], host[MAXHOSTNAMELEN], line[512];
 
 	/* Determine our login name(s) before the we reopen() stdout */
 	if ((pwd = getpwuid(myuid)) != NULL)
Signature · 1 line
1.7.9
#12 lore raw

PATCH 6/7 write: Don't explicitly include <asm/param.h>.

In reply to Thomas Schwinge

It doesn't exist on some systems, but will come in via <sys/param.h> on the others.

---
 term-utils/write.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
term-utils/write.c +0 -1
index 901ddc4..9964e08 100644
@@ -57,7 +57,6 @@
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <paths.h>
-#include <asm/param.h>
 #include <getopt.h>
 
 #include "c.h"
Signature · 1 line
1.7.9
#14 lore raw

PATCH 7/7 setsid: Include <sys/ioctl.h> instead of <termio.h>.

In reply to Thomas Schwinge
---
 sys-utils/setsid.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sys-utils/setsid.c +1 -1
index 6d1eeda..52ad38f 100644
@@ -15,7 +15,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <termio.h>
+#include <sys/ioctl.h>
 
 #include "c.h"
 #include "nls.h"
Signature · 1 line
1.7.9
maintainer Applied
#2 lore raw

Re: [PATCH] test_pager: Repair build for non-Linux.

In reply to Thomas Schwinge
Quoted 2 lines · Thomas Schwinge
 lib/Makefile.am |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
maintainer Applied
#16 lore raw

Re: [PATCH 1/7] kill, raw, rename: Don't explicitly enable for --enable-most-builds.

In reply to Thomas Schwinge
Quoted 2 lines · Thomas Schwinge
 configure.ac |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
maintainer Applied
#5 lore raw

Re: [PATCH 2/7] arch, eject, elvtune: Gracefully disable on non-Linux platforms.

In reply to Thomas Schwinge
Quoted 2 lines · Thomas Schwinge
 configure.ac |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
maintainer
#7 lore raw

Re: [PATCH 3/7] last, login, write: Provide a fallback for MAXHOSTNAMELEN, as elsewhere.

In reply to Thomas Schwinge
Quoted 6 lines · Thomas Schwinge
---
 login-utils/last.c  |    8 ++++++++
 login-utils/login.c |    8 ++++++++
 term-utils/write.c  |    8 ++++++++
 3 files changed, 24 insertions(+), 0 deletions(-)

I have moved the fallback for MAXHOSTNAMELEN to c.h, it seems better than duplicate the code. Thanks.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
maintainer Applied
#11 lore raw

Re: [PATCH 5/7] write: Use PATH_MAX instead of MAXPATHLEN, as elsewhere.

In reply to Thomas Schwinge
Quoted 2 lines · Thomas Schwinge
 term-utils/write.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
maintainer Applied
#13 lore raw

Re: [PATCH 6/7] write: Don't explicitly include <asm/param.h>.

In reply to Thomas Schwinge
Quoted 2 lines · Thomas Schwinge
 term-utils/write.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
maintainer Applied
#15 lore raw

Re: [PATCH 7/7] setsid: Include <sys/ioctl.h> instead of <termio.h>.

In reply to Thomas Schwinge
Quoted 2 lines · Thomas Schwinge
 sys-utils/setsid.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#8 lore raw

Re: [PATCH 3/7] last, login, write: Provide a fallback for MAXHOSTNAMELEN, as elsewhere.

In reply to Karel Zak

Hi!

Quoted 10 lines · Karel Zak
Quoted 6 lines · Thomas Schwinge
---
 login-utils/last.c  |    8 ++++++++
 login-utils/login.c |    8 ++++++++
 term-utils/write.c  |    8 ++++++++
 3 files changed, 24 insertions(+), 0 deletions(-)

I have moved the fallback for MAXHOSTNAMELEN to c.h, it seems better than duplicate the code. Thanks.

Yes, of course that makes even more sense. Thanks also for applying the others.

Grüße,
Thomas