Util-Linux package development
 help / color / mirror / Atom feed
* [PATCH 0/6] Build with musl libc
@ 2011-06-08 22:52 Josiah Worcester
  2011-06-08 22:52 ` [PATCH 1/6] fdisk, display, hexdump.h: Use standard C types instead of u_int, u_char, u_long, etc Josiah Worcester
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Josiah Worcester @ 2011-06-08 22:52 UTC (permalink / raw)
  To: util-linux; +Cc: Josiah Worcester

I was trying to build util-linux with the musl libc (http://www.etalabs.net/musl/),
and found that a few patches were needed. These seem to just be some minor cleanups
in most cases. I'm a bit dubious of the hwclock patch, though, as it seems at least
a little bit hackish.

Josiah Worcester (6):
  fdisk, display, hexdump.h: Use standard C types instead of u_int,
    u_char, u_long, etc.
  fsck, checktty, flock: Use more portable includes.
  checktty: Use NGROUPS_MAX instead of NGROUPS
  lib/tt.c: Fix mbs_width macro for systems without WIDECHAR    
  test_sysinfo: Use CHAR_BIT*sizeof(void*) instead of __WORDSIZE.
  hwclock: Don't use asm/io.h if sys/io.h can't be found

 fdisk/fdiskbsdlabel.c        |   34 +++++++++++++++++-----------------
 fsck/fsck.c                  |    2 +-
 hwclock/cmos.c               |    7 ++++++-
 lib/tt.c                     |    2 +-
 login-utils/checktty.c       |    7 +++++--
 sys-utils/flock.c            |    2 ++
 tests/helpers/test_sysinfo.c |    2 +-
 text-utils/display.c         |   32 ++++++++++++++++----------------
 text-utils/hexdump.h         |    4 ++--
 9 files changed, 51 insertions(+), 41 deletions(-)

-- 
1.7.5.3


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/6] fdisk, display, hexdump.h: Use standard C types instead of u_int, u_char, u_long, etc.
  2011-06-08 22:52 [PATCH 0/6] Build with musl libc Josiah Worcester
@ 2011-06-08 22:52 ` Josiah Worcester
  2011-06-08 22:52 ` [PATCH 2/6] fsck, checktty, flock: Use more portable includes Josiah Worcester
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Josiah Worcester @ 2011-06-08 22:52 UTC (permalink / raw)
  To: util-linux; +Cc: Josiah Worcester

Signed-off-by: Josiah Worcester <josiahw@gmail.com>
---
 fdisk/fdiskbsdlabel.c |   34 +++++++++++++++++-----------------
 text-utils/display.c  |   32 ++++++++++++++++----------------
 text-utils/hexdump.h  |    4 ++--
 3 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/fdisk/fdiskbsdlabel.c b/fdisk/fdiskbsdlabel.c
index 0c3810d..d379b70 100644
--- a/fdisk/fdiskbsdlabel.c
+++ b/fdisk/fdiskbsdlabel.c
@@ -71,7 +71,7 @@ static void xbsd_change_fstype (void);
 static int xbsd_get_part_index (int max);
 static int xbsd_check_new_partition (int *i);
 static void xbsd_list_types (void);
-static u_short xbsd_dkcksum (struct xbsd_disklabel *lp);
+static unsigned short xbsd_dkcksum (struct xbsd_disklabel *lp);
 static int xbsd_initlabel  (struct partition *p, struct xbsd_disklabel *d,
 			    int pindex);
 static int xbsd_readlabel  (struct partition *p, struct xbsd_disklabel *d);
@@ -463,28 +463,28 @@ xbsd_edit_disklabel (void)
   d = &xbsd_dlabel;
 
 #if defined (__alpha__) || defined (__ia64__)
-  d -> d_secsize    = (u_long) edit_int ((u_long) d -> d_secsize     ,_("bytes/sector"));
-  d -> d_nsectors   = (u_long) edit_int ((u_long) d -> d_nsectors    ,_("sectors/track"));
-  d -> d_ntracks    = (u_long) edit_int ((u_long) d -> d_ntracks     ,_("tracks/cylinder"));
-  d -> d_ncylinders = (u_long) edit_int ((u_long) d -> d_ncylinders  ,_("cylinders"));
+  d -> d_secsize    = (unsigned long) edit_int ((unsigned long) d -> d_secsize     ,_("bytes/sector"));
+  d -> d_nsectors   = (unsigned long) edit_int ((unsigned long) d -> d_nsectors    ,_("sectors/track"));
+  d -> d_ntracks    = (unsigned long) edit_int ((unsigned long) d -> d_ntracks     ,_("tracks/cylinder"));
+  d -> d_ncylinders = (unsigned long) edit_int ((unsigned long) d -> d_ncylinders  ,_("cylinders"));
 #endif
 
   /* d -> d_secpercyl can be != d -> d_nsectors * d -> d_ntracks */
   while (1)
   {
-    d -> d_secpercyl = (u_long) edit_int ((u_long) d -> d_nsectors * d -> d_ntracks,
+    d -> d_secpercyl = (unsigned long) edit_int ((unsigned long) d -> d_nsectors * d -> d_ntracks,
 					  _("sectors/cylinder"));
     if (d -> d_secpercyl <= d -> d_nsectors * d -> d_ntracks)
       break;
 
     printf (_("Must be <= sectors/track * tracks/cylinder (default).\n"));
   }
-  d -> d_rpm        = (u_short) edit_int ((u_short) d -> d_rpm       ,_("rpm"));
-  d -> d_interleave = (u_short) edit_int ((u_short) d -> d_interleave,_("interleave"));
-  d -> d_trackskew  = (u_short) edit_int ((u_short) d -> d_trackskew ,_("trackskew"));
-  d -> d_cylskew    = (u_short) edit_int ((u_short) d -> d_cylskew   ,_("cylinderskew"));
-  d -> d_headswitch = (u_long) edit_int ((u_long) d -> d_headswitch  ,_("headswitch"));
-  d -> d_trkseek    = (u_long) edit_int ((u_long) d -> d_trkseek     ,_("track-to-track seek"));
+  d -> d_rpm        = (unsigned short) edit_int ((unsigned short) d -> d_rpm       ,_("rpm"));
+  d -> d_interleave = (unsigned short) edit_int ((unsigned short) d -> d_interleave,_("interleave"));
+  d -> d_trackskew  = (unsigned short) edit_int ((unsigned short) d -> d_trackskew ,_("trackskew"));
+  d -> d_cylskew    = (unsigned short) edit_int ((unsigned short) d -> d_cylskew   ,_("cylinderskew"));
+  d -> d_headswitch = (unsigned long) edit_int ((unsigned long) d -> d_headswitch  ,_("headswitch"));
+  d -> d_trkseek    = (unsigned long) edit_int ((unsigned long) d -> d_trkseek     ,_("track-to-track seek"));
 
   d -> d_secperunit = d -> d_secpercyl * d -> d_ncylinders;
 }
@@ -638,13 +638,13 @@ xbsd_list_types (void) {
 	list_types (xbsd_fstypes);
 }
 
-static u_short
+static unsigned short
 xbsd_dkcksum (struct xbsd_disklabel *lp) {
-	u_short *start, *end;
-	u_short sum = 0;
+	unsigned short *start, *end;
+	unsigned short sum = 0;
   
-	start = (u_short *) lp;
-	end = (u_short *) &lp->d_partitions[lp->d_npartitions];
+	start = (unsigned short *) lp;
+	end = (unsigned short *) &lp->d_partitions[lp->d_npartitions];
 	while (start < end)
 		sum ^= *start++;
 	return sum;
diff --git a/text-utils/display.c b/text-utils/display.c
index 01805a2..c700b02 100644
--- a/text-utils/display.c
+++ b/text-utils/display.c
@@ -55,11 +55,11 @@ static off_t address;			/* address/offset in stream */
 static off_t eaddress;			/* end address */
 
 static inline void
-print(PR *pr, u_char *bp) {
+print(PR *pr, unsigned char *bp) {
 
 	switch(pr->flags) {
 	case F_ADDRESS:
-		(void)printf(pr->fmt, (quad_t)address);
+		(void)printf(pr->fmt, (int64_t)address);
 		break;
 	case F_BPAD:
 		(void)printf(pr->fmt, "");
@@ -90,23 +90,23 @@ print(PR *pr, u_char *bp) {
 	    {
 		short sval;	/* int16_t */
 		int ival;	/* int32_t */
-		long long Lval;	/* int64_t, quad_t */
+		long long Lval;	/* int64_t, int64_t */
 
 		switch(pr->bcnt) {
 		case 1:
-			(void)printf(pr->fmt, (quad_t)*bp);
+			(void)printf(pr->fmt, (int64_t)*bp);
 			break;
 		case 2:
 			memmove(&sval, bp, sizeof(sval));
-			(void)printf(pr->fmt, (quad_t)sval);
+			(void)printf(pr->fmt, (int64_t)sval);
 			break;
 		case 4:
 			memmove(&ival, bp, sizeof(ival));
-			(void)printf(pr->fmt, (quad_t)ival);
+			(void)printf(pr->fmt, (int64_t)ival);
 			break;
 		case 8:
 			memmove(&Lval, bp, sizeof(Lval));
-			(void)printf(pr->fmt, (quad_t)Lval);
+			(void)printf(pr->fmt, (int64_t)Lval);
 			break;
 		}
 		break;
@@ -127,23 +127,23 @@ print(PR *pr, u_char *bp) {
 	    {
 		unsigned short sval;	/* u_int16_t */
 		unsigned int ival;	/* u_int32_t */
-		unsigned long long Lval;/* u_int64_t, u_quad_t */
+		unsigned long long Lval;/* u_int64_t, u_int64_t */
 
 		switch(pr->bcnt) {
 		case 1:
-			(void)printf(pr->fmt, (u_quad_t)*bp);
+			(void)printf(pr->fmt, (uint64_t)*bp);
 			break;
 		case 2:
 			memmove(&sval, bp, sizeof(sval));
-			(void)printf(pr->fmt, (u_quad_t)sval);
+			(void)printf(pr->fmt, (uint64_t)sval);
 			break;
 		case 4:
 			memmove(&ival, bp, sizeof(ival));
-			(void)printf(pr->fmt, (u_quad_t)ival);
+			(void)printf(pr->fmt, (uint64_t)ival);
 			break;
 		case 8:
 			memmove(&Lval, bp, sizeof(Lval));
-			(void)printf(pr->fmt, (u_quad_t)Lval);
+			(void)printf(pr->fmt, (uint64_t)Lval);
 			break;
 		}
 		break;
@@ -174,9 +174,9 @@ void display(void)
 	register FU *fu;
 	register PR *pr;
 	register int cnt;
-	register u_char *bp;
+	register unsigned char *bp;
 	off_t saveaddress;
-	u_char savech = 0, *savebp;
+	unsigned char savech = 0, *savebp;
 
 	while ((bp = get()) != NULL)
 	    for (fs = fshead, savebp = bp, saveaddress = address; fs;
@@ -212,7 +212,7 @@ void display(void)
 		for (pr = endfu->nextpr; pr; pr = pr->nextpr)
 			switch(pr->flags) {
 			case F_ADDRESS:
-				(void)printf(pr->fmt, (quad_t)eaddress);
+				(void)printf(pr->fmt, (int64_t)eaddress);
 				break;
 			case F_TEXT:
 				(void)printf("%s", pr->fmt);
@@ -261,7 +261,7 @@ get(void)
 			eaddress = address + nread;
 			return(curp);
 		}
-		n = fread((char *)curp + nread, sizeof(u_char),
+		n = fread((char *)curp + nread, sizeof(unsigned char),
 		    length == -1 ? need : MIN(length, need), stdin);
 		if (!n) {
 			if (ferror(stdin))
diff --git a/text-utils/hexdump.h b/text-utils/hexdump.h
index 3df8629..52a64bf 100644
--- a/text-utils/hexdump.h
+++ b/text-utils/hexdump.h
@@ -46,7 +46,7 @@ typedef struct _pr {
 #define	F_U		0x100		/* %_u */
 #define	F_UINT		0x200		/* %[ouXx] */
 #define	F_TEXT		0x400		/* no conversions */
-	u_int flags;			/* flag values */
+	unsigned int flags;		/* flag values */
 	int bcnt;			/* byte count */
 	char *cchar;			/* conversion character */
 	char *fmt;			/* printf format */
@@ -58,7 +58,7 @@ typedef struct _fu {
 	struct _pr *nextpr;		/* next print unit */
 #define	F_IGNORE	0x01		/* %_A */
 #define	F_SETREP	0x02		/* rep count set, not default */
-	u_int flags;			/* flag values */
+	unsigned int flags;		/* flag values */
 	int reps;			/* repetition count */
 	int bcnt;			/* byte count */
 	char *fmt;			/* format string */
-- 
1.7.5.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/6] fsck, checktty, flock: Use more portable includes.
  2011-06-08 22:52 [PATCH 0/6] Build with musl libc Josiah Worcester
  2011-06-08 22:52 ` [PATCH 1/6] fdisk, display, hexdump.h: Use standard C types instead of u_int, u_char, u_long, etc Josiah Worcester
@ 2011-06-08 22:52 ` Josiah Worcester
  2011-06-08 22:52 ` [PATCH 3/6] checktty: Use NGROUPS_MAX instead of NGROUPS Josiah Worcester
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Josiah Worcester @ 2011-06-08 22:52 UTC (permalink / raw)
  To: util-linux; +Cc: Josiah Worcester

Signed-off-by: Josiah Worcester <josiahw@gmail.com>
---
 fsck/fsck.c            |    2 +-
 login-utils/checktty.c |    3 +++
 sys-utils/flock.c      |    2 ++
 3 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index 0d5feda..9153367 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -29,7 +29,7 @@
 
 #include <sys/types.h>
 #include <sys/wait.h>
-#include <sys/signal.h>
+#include <signal.h>
 #include <sys/stat.h>
 #include <sys/file.h>
 #include <fcntl.h>
diff --git a/login-utils/checktty.c b/login-utils/checktty.c
index f849057..518b701 100644
--- a/login-utils/checktty.c
+++ b/login-utils/checktty.c
@@ -22,7 +22,10 @@
 #include <malloc.h>
 #include <netdb.h>
 #include <sys/syslog.h>
+#include <sys/socket.h>
 #include <ctype.h>
+#include <limits.h>
+#include <netinet/in.h>
 #include "nls.h"
 
 #include <sys/sysmacros.h>
diff --git a/sys-utils/flock.c b/sys-utils/flock.c
index 20004ca..c7fb70e 100644
--- a/sys-utils/flock.c
+++ b/sys-utils/flock.c
@@ -39,6 +39,8 @@
 #include <sys/file.h>
 #include <sys/time.h>
 #include <sys/wait.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 
 #include "nls.h"
 
-- 
1.7.5.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/6] checktty: Use NGROUPS_MAX instead of NGROUPS
  2011-06-08 22:52 [PATCH 0/6] Build with musl libc Josiah Worcester
  2011-06-08 22:52 ` [PATCH 1/6] fdisk, display, hexdump.h: Use standard C types instead of u_int, u_char, u_long, etc Josiah Worcester
  2011-06-08 22:52 ` [PATCH 2/6] fsck, checktty, flock: Use more portable includes Josiah Worcester
@ 2011-06-08 22:52 ` Josiah Worcester
  2011-06-09 19:31   ` Sami Kerola
  2011-06-08 22:52 ` [PATCH 4/6] lib/tt.c: Fix mbs_width macro for systems without WIDECHAR Josiah Worcester
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Josiah Worcester @ 2011-06-08 22:52 UTC (permalink / raw)
  To: util-linux; +Cc: Josiah Worcester

Signed-off-by: Josiah Worcester <josiahw@gmail.com>
---
 login-utils/checktty.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/login-utils/checktty.c b/login-utils/checktty.c
index 518b701..a8c5247 100644
--- a/login-utils/checktty.c
+++ b/login-utils/checktty.c
@@ -42,7 +42,7 @@
 #define TTY_MAJOR 4
 #endif
 
-static gid_t mygroups[NGROUPS];
+static gid_t mygroups[NGROUPS_MAX];
 static int   num_groups;
 
 #define NAMELEN 128
@@ -83,7 +83,7 @@ am_in_group(char *group)
 static void
 find_groups(gid_t defgrp, const char *user)
 {
-	num_groups = getgroups(NGROUPS, mygroups);
+	num_groups = getgroups(NGROUPS_MAX, mygroups);
 }
 
 static struct ttyclass *
-- 
1.7.5.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/6] lib/tt.c: Fix mbs_width macro for systems without WIDECHAR
  2011-06-08 22:52 [PATCH 0/6] Build with musl libc Josiah Worcester
                   ` (2 preceding siblings ...)
  2011-06-08 22:52 ` [PATCH 3/6] checktty: Use NGROUPS_MAX instead of NGROUPS Josiah Worcester
@ 2011-06-08 22:52 ` Josiah Worcester
  2011-06-08 22:52 ` [PATCH 5/6] test_sysinfo: Use CHAR_BIT*sizeof(void*) instead of __WORDSIZE Josiah Worcester
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Josiah Worcester @ 2011-06-08 22:52 UTC (permalink / raw)
  To: util-linux; +Cc: Josiah Worcester

Signed-off-by: Josiah Worcester <josiahw@gmail.com>
---
 lib/tt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/tt.c b/lib/tt.c
index 7cbbce3..1929a48 100644
--- a/lib/tt.c
+++ b/lib/tt.c
@@ -52,7 +52,7 @@ static const struct tt_symbols utf8_tt_symbols = {
 };
 
 #else /* !HAVE_WIDECHAR */
-# define mbs_width       strlen(_s)
+# define mbs_width(_s)       strlen(_s)
 #endif /* !HAVE_WIDECHAR */
 
 #define is_last_column(_tb, _cl) \
-- 
1.7.5.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/6] test_sysinfo: Use CHAR_BIT*sizeof(void*) instead of __WORDSIZE.
  2011-06-08 22:52 [PATCH 0/6] Build with musl libc Josiah Worcester
                   ` (3 preceding siblings ...)
  2011-06-08 22:52 ` [PATCH 4/6] lib/tt.c: Fix mbs_width macro for systems without WIDECHAR Josiah Worcester
@ 2011-06-08 22:52 ` Josiah Worcester
  2011-06-08 22:52 ` [PATCH 6/6] hwclock: Don't use asm/io.h if sys/io.h can't be found Josiah Worcester
  2011-06-14 12:24 ` [PATCH 0/6] Build with musl libc Karel Zak
  6 siblings, 0 replies; 11+ messages in thread
From: Josiah Worcester @ 2011-06-08 22:52 UTC (permalink / raw)
  To: util-linux; +Cc: Josiah Worcester

Signed-off-by: Josiah Worcester <josiahw@gmail.com>
---
 tests/helpers/test_sysinfo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tests/helpers/test_sysinfo.c b/tests/helpers/test_sysinfo.c
index cb7b66b..a8d80d8 100644
--- a/tests/helpers/test_sysinfo.c
+++ b/tests/helpers/test_sysinfo.c
@@ -28,7 +28,7 @@ typedef struct {
 int
 hlp_wordsize(void)
 {
-	printf("%d\n", __WORDSIZE);
+	printf("%d\n", CHAR_BIT*sizeof(void*));
 	return 0;
 }
 
-- 
1.7.5.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 6/6] hwclock: Don't use asm/io.h if sys/io.h can't be found
  2011-06-08 22:52 [PATCH 0/6] Build with musl libc Josiah Worcester
                   ` (4 preceding siblings ...)
  2011-06-08 22:52 ` [PATCH 5/6] test_sysinfo: Use CHAR_BIT*sizeof(void*) instead of __WORDSIZE Josiah Worcester
@ 2011-06-08 22:52 ` Josiah Worcester
  2011-06-09  0:58   ` Mike Frysinger
  2011-06-14 12:24 ` [PATCH 0/6] Build with musl libc Karel Zak
  6 siblings, 1 reply; 11+ messages in thread
From: Josiah Worcester @ 2011-06-08 22:52 UTC (permalink / raw)
  To: util-linux; +Cc: Josiah Worcester

Signed-off-by: Josiah Worcester <josiahw@gmail.com>
---
 hwclock/cmos.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/hwclock/cmos.c b/hwclock/cmos.c
index 947b21b..b5169a1 100644
--- a/hwclock/cmos.c
+++ b/hwclock/cmos.c
@@ -53,7 +53,12 @@
 #ifdef HAVE_SYS_IO_H
 #include <sys/io.h>
 #else
-#include <asm/io.h>		/* for inb, outb */
+/* Disable cmos access; we can no longer use asm/io.h, since
+ * the kernel does not export that header.
+ */
+#undef __i386__
+void outb(int a, int b){}
+int inb(int c){ return 0; }
 #endif
 #elif defined(__alpha__)
 /* <asm/io.h> fails to compile, probably because of u8 etc */
-- 
1.7.5.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 6/6] hwclock: Don't use asm/io.h if sys/io.h can't be found
  2011-06-08 22:52 ` [PATCH 6/6] hwclock: Don't use asm/io.h if sys/io.h can't be found Josiah Worcester
@ 2011-06-09  0:58   ` Mike Frysinger
  2011-06-14 12:26     ` Karel Zak
  0 siblings, 1 reply; 11+ messages in thread
From: Mike Frysinger @ 2011-06-09  0:58 UTC (permalink / raw)
  To: Josiah Worcester; +Cc: util-linux

[-- Attachment #1: Type: Text/Plain, Size: 367 bytes --]

On Wednesday, June 08, 2011 18:52:48 Josiah Worcester wrote:
> -#include <asm/io.h>		/* for inb, outb */
> +/* Disable cmos access; we can no longer use asm/io.h, since
> + * the kernel does not export that header.
> + */
> +#undef __i386__
> +void outb(int a, int b){}
> +int inb(int c){ return 0; }

probably should be turned into a header check in configure
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/6] checktty: Use NGROUPS_MAX instead of NGROUPS
  2011-06-08 22:52 ` [PATCH 3/6] checktty: Use NGROUPS_MAX instead of NGROUPS Josiah Worcester
@ 2011-06-09 19:31   ` Sami Kerola
  0 siblings, 0 replies; 11+ messages in thread
From: Sami Kerola @ 2011-06-09 19:31 UTC (permalink / raw)
  To: Josiah Worcester; +Cc: util-linux

[-- Attachment #1: Type: text/plain, Size: 344 bytes --]

On Thu, Jun 9, 2011 at 00:52, Josiah Worcester <josiahw@gmail.com> wrote:
> -static gid_t mygroups[NGROUPS];
> +static gid_t mygroups[NGROUPS_MAX];

That might fix issue with musl libc, but is that truly an enhancement?
How about using sysconf(_SC_NGROUPS_MAX), e.g. see attachment.

-- 
   Sami Kerola
   http://www.iki.fi/kerolasa/

[-- Attachment #2: 0001-checktty-NGROUP-sysconf.txt --]
[-- Type: text/plain, Size: 1383 bytes --]

From bf4382f2f49c99f8cb3db360b54d8825525c153d Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
Date: Thu, 9 Jun 2011 21:23:13 +0200
Subject: [PATCH] checktty: NGROUP -> sysconf

Use sysconf return value instead of NGROUP definition to determine size of
grouplist array.

http://pubs.opengroup.org/onlinepubs/009695399/functions/getgroups.html

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 login-utils/checktty.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/login-utils/checktty.c b/login-utils/checktty.c
index f849057..e39d1e2 100644
--- a/login-utils/checktty.c
+++ b/login-utils/checktty.c
@@ -33,13 +33,14 @@
 #include "pathnames.h"
 #include "login.h"
 #include "strutils.h"
+#include "xalloc.h"
 #include "c.h"
 
 #ifndef TTY_MAJOR
 #define TTY_MAJOR 4
 #endif
 
-static gid_t mygroups[NGROUPS];
+static gid_t *mygroups;
 static int   num_groups;
 
 #define NAMELEN 128
@@ -311,6 +312,7 @@ main(int argc, char **argv)
 		{ NULL, NULL }
 	}, *item;
 
+	mygroups = xmalloc(sizeof(gid_t) * sysconf(_SC_NGROUPS_MAX));
 	memset(&hints, 0, sizeof(hints));
 	hints.ai_family = AF_UNSPEC;
 	hints.ai_flags = AI_NUMERICHOST |  AI_PASSIVE | AI_ADDRCONFIG;
@@ -342,6 +344,7 @@ main(int argc, char **argv)
 			printf("getaddrinfo() failed\n");
 
 	}
+	free(mygroups);
 	return EXIT_SUCCESS;
 }
 #endif /* MAIN_TEST_CHECKTTY */
-- 
1.7.5.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/6] Build with musl libc
  2011-06-08 22:52 [PATCH 0/6] Build with musl libc Josiah Worcester
                   ` (5 preceding siblings ...)
  2011-06-08 22:52 ` [PATCH 6/6] hwclock: Don't use asm/io.h if sys/io.h can't be found Josiah Worcester
@ 2011-06-14 12:24 ` Karel Zak
  6 siblings, 0 replies; 11+ messages in thread
From: Karel Zak @ 2011-06-14 12:24 UTC (permalink / raw)
  To: Josiah Worcester; +Cc: util-linux

On Wed, Jun 08, 2011 at 04:52:42PM -0600, Josiah Worcester wrote:
>  fdisk/fdiskbsdlabel.c        |   34 +++++++++++++++++-----------------
>  fsck/fsck.c                  |    2 +-
>  hwclock/cmos.c               |    7 ++++++-
>  lib/tt.c                     |    2 +-
>  login-utils/checktty.c       |    7 +++++--
>  sys-utils/flock.c            |    2 ++
>  tests/helpers/test_sysinfo.c |    2 +-
>  text-utils/display.c         |   32 ++++++++++++++++----------------
>  text-utils/hexdump.h         |    4 ++--
>  9 files changed, 51 insertions(+), 41 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 6/6] hwclock: Don't use asm/io.h if sys/io.h can't be found
  2011-06-09  0:58   ` Mike Frysinger
@ 2011-06-14 12:26     ` Karel Zak
  0 siblings, 0 replies; 11+ messages in thread
From: Karel Zak @ 2011-06-14 12:26 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: Josiah Worcester, util-linux

On Wed, Jun 08, 2011 at 08:58:25PM -0400, Mike Frysinger wrote:
> On Wednesday, June 08, 2011 18:52:48 Josiah Worcester wrote:
> > -#include <asm/io.h>		/* for inb, outb */
> > +/* Disable cmos access; we can no longer use asm/io.h, since
> > + * the kernel does not export that header.
> > + */
> > +#undef __i386__
> > +void outb(int a, int b){}
> > +int inb(int c){ return 0; }
> 
> probably should be turned into a header check in configure

 I have added asm/io.h check to configure.ac to keep it backwardly
 compatible...

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-06-14 12:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-08 22:52 [PATCH 0/6] Build with musl libc Josiah Worcester
2011-06-08 22:52 ` [PATCH 1/6] fdisk, display, hexdump.h: Use standard C types instead of u_int, u_char, u_long, etc Josiah Worcester
2011-06-08 22:52 ` [PATCH 2/6] fsck, checktty, flock: Use more portable includes Josiah Worcester
2011-06-08 22:52 ` [PATCH 3/6] checktty: Use NGROUPS_MAX instead of NGROUPS Josiah Worcester
2011-06-09 19:31   ` Sami Kerola
2011-06-08 22:52 ` [PATCH 4/6] lib/tt.c: Fix mbs_width macro for systems without WIDECHAR Josiah Worcester
2011-06-08 22:52 ` [PATCH 5/6] test_sysinfo: Use CHAR_BIT*sizeof(void*) instead of __WORDSIZE Josiah Worcester
2011-06-08 22:52 ` [PATCH 6/6] hwclock: Don't use asm/io.h if sys/io.h can't be found Josiah Worcester
2011-06-09  0:58   ` Mike Frysinger
2011-06-14 12:26     ` Karel Zak
2011-06-14 12:24 ` [PATCH 0/6] Build with musl libc Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox