Hello hpa, please pull from my debian klibc tree to kernel.org for minor fixes, that piled up after kernel.org shutdown, inluding a build fix against current linux 3.1. git pull git://anonscm.debian.org/users/maks/klibc.git scripts/basic/fixdep.c | 27 +++++++++++++-------------- usr/include/limits.h | 2 ++ usr/include/sys/file.h | 9 +++++++++ usr/include/sys/types.h | 4 ++++ usr/include/unistd.h | 1 - usr/kinit/ipconfig/main.c | 2 +- usr/klibc/vsscanf.c | 7 ------- 7 files changed, 29 insertions(+), 23 deletions(-) create mode 100644 usr/include/sys/file.h Greg Thelen (2): [klibc] ipconfig: check poll() return value [klibc] vsscanf: remove unused variables Maciej ?enczykowski (1): [klibc] include: [sys/types.h] -> linux/types.h and __aligned_u64 maximilian attems (3): [klibc] include: [sys/file.h] define flock(2) there [klibc] include: [limits.h] define OPEN_MAX [klibc] kbuild: add static to prototypes Nothing really exciting there yet. I should get my key signed next week, so soon can commit again. We should talk about new release procedure with kdup? Thank you -- maks P.S. patches follow below: commit acf09ea80536ac49a0001249956fef999b8d35af Author: Greg Thelen <gthelen at google.com> Date: Wed Nov 30 15:55:57 2011 -0800 [klibc] vsscanf: remove unused variables Removed unused local variable from vsscanf(). Signed-off-by: Greg Thelen <gthelen at google.com> "POSIX is quite explicit that the unsigned formats still accept signed input, and since klibc requires that signed and unsigned integer types are the same the only reason to track it would be to handle numeric overflow." -hpa Acked-by: "H. Peter Anvin" <hpa at zytor.com> Signed-off-by: maximilian attems <max at stro.at> diff --git a/usr/klibc/vsscanf.c b/usr/klibc/vsscanf.c index 51e50f7..b8f068c 100644 --- a/usr/klibc/vsscanf.c +++ b/usr/klibc/vsscanf.c @@ -88,7 +88,6 @@ int vsscanf(const char *buffer, const char *format, va_list ap) } state = st_normal; char *sarg = NULL; /* %s %c or %[ string argument */ enum bail bail = bail_none; - int sign; int converted = 0; /* Successful conversions */ unsigned long matchmap[((1 << CHAR_BIT) + (LONG_BIT - 1)) / LONG_BIT]; int matchinv = 0; /* Is match map inverted? */ @@ -177,33 +176,27 @@ int vsscanf(const char *buffer, const char *format, va_list ap) case 'p': /* Pointer */ rank = rank_ptr; base = 0; - sign = 0; goto scan_int; case 'i': /* Base-independent integer */ base = 0; - sign = 1; goto scan_int; case 'd': /* Decimal integer */ base = 10; - sign = 1; goto scan_int; case 'o': /* Octal integer */ base = 8; - sign = 0; goto scan_int; case 'u': /* Unsigned decimal integer */ base = 10; - sign = 0; goto scan_int; case 'x': /* Hexadecimal integer */ case 'X': base = 16; - sign = 0; goto scan_int; case 'n': /* # of characters consumed */ commit 1c3e2f3c152ef2a55d47b7149c85f167fabd8f2f Author: Greg Thelen <gthelen at google.com> Date: Wed Nov 30 15:53:23 2011 -0800 [klibc] ipconfig: check poll() return value Check the poll() return value for error before inspecting its output. Signed-off-by: Greg Thelen <gthelen at google.com> Signed-off-by: maximilian attems <max at stro.at> diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c index 8782ae7..37ca573 100644 --- a/usr/kinit/ipconfig/main.c +++ b/usr/kinit/ipconfig/main.c @@ -408,7 +408,7 @@ static int loop(void) prev = now; gettimeofday(&now, NULL); - if ((fds[0].revents & POLLRDNORM)) { + if ((nr > 0) && (fds[0].revents & POLLRDNORM)) { if (do_pkt_recv(pkt_fd, now.tv_sec) == 1) break; } commit 7f47891c1678874cccca66cd25e6a13486c86d78 Author: Maciej ?enczykowski <zenczykowski at gmail.com> Date: Sun Nov 6 14:33:40 2011 -0800 [klibc] include: [sys/types.h] -> linux/types.h and __aligned_u64 When building klibc 1.5.25 against linux/master (ie. post 3.1) I'm seeing: klibc/generated/include/linux/if_packet.h:176: error: expected specifier-qualifier-list before '__aligned_u64' which seems to come from upstream commits: 0d4691ce112be025019999df5f2a5e00c03f03c2 remotes/linux/master~90^2~408 (origin) 96c131842aab45b5d139d0bcb417796819f5ee92 remotes/linux/master~90^2~169 (change from aligned_u64 to __aligned_u64) and collides with klibc/usr/include/sys/types.h /* Keeps linux/types.h from getting included elsewhere */ #define _LINUX_TYPES_H not defining __aligned_u64 like the kernel's include/linux/types.h does. Signed-off-by: maximilian attems <max at stro.at> diff --git a/usr/include/sys/types.h b/usr/include/sys/types.h index 6780ed1..3a4c738 100644 --- a/usr/include/sys/types.h +++ b/usr/include/sys/types.h @@ -100,6 +100,10 @@ typedef uint16_t __sum16; typedef uint32_t __sum32; typedef uint64_t __sum64; +#define __aligned_u64 __u64 __attribute__((aligned(8))) +#define __aligned_be64 __be64 __attribute__((aligned(8))) +#define __aligned_le64 __le64 __attribute__((aligned(8))) + /* * Some headers seem to require this... */ commit 731d82caecbc309eea5e719ca0c6dfb03afd34c3 Author: maximilian attems <max at stro.at> Date: Wed Sep 7 12:26:19 2011 +0200 [klibc] kbuild: add static to prototypes Warnings found via gcc -Wmissing-prototypes. Signed-off-by: Trevor Keith <tsrk at tsrk.net> Acked-by: WANG Cong <xiyou.wangcong at gmail.com> Signed-off-by: Andrew Morton <akpm at linux-foundation.org> Signed-off-by: Sam Ravnborg <sam at ravnborg.org> [ ported 4356f4890792a678936c93c9196e8f7742e04535 to klibc + minor whitespaces ] Signed-off-by: maximilian attems <max at stro.at> diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 5b68980..fed4c7f 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -123,14 +123,13 @@ char *target; char *depfile; char *cmdline; -void usage(void) - +static void usage(void) { fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n"); exit(1); } -void print_cmdline(void) +static void print_cmdline(void) { printf("cmd_%s := %s\n\n", target, cmdline); } @@ -143,7 +142,7 @@ int len_config = 0; * Grow the configuration string to a desired length. * Usually the first growth is plenty. */ -void grow_config(int len) +static void grow_config(int len) { while (len_config + len > size_config) { if (size_config == 0) @@ -159,7 +158,7 @@ void grow_config(int len) /* * Lookup a value in the configuration string. */ -int is_defined_config(const char * name, int len) +static int is_defined_config(const char *name, int len) { const char * pconfig; const char * plast = str_config + len_config - len; @@ -175,7 +174,7 @@ int is_defined_config(const char * name, int len) /* * Add a new value to the configuration string. */ -void define_config(const char * name, int len) +static void define_config(const char *name, int len) { grow_config(len + 1); @@ -187,7 +186,7 @@ void define_config(const char * name, int len) /* * Clear the set of configuration strings. */ -void clear_config(void) +static void clear_config(void) { len_config = 0; define_config("", 0); @@ -196,7 +195,7 @@ void clear_config(void) /* * Record the use of a CONFIG_* word. */ -void use_config(char *m, int slen) +static void use_config(char *m, int slen) { char s[PATH_MAX]; char *p; @@ -217,7 +216,7 @@ void use_config(char *m, int slen) printf(" $(wildcard include/config/%s.h) \\\n", s); } -void parse_config_file(char *map, size_t len) +static void parse_config_file(char *map, size_t len) { int *end = (int *) (map + len); /* start at +1, so that p can never be < map */ @@ -247,7 +246,7 @@ void parse_config_file(char *map, size_t len) } /* test is s ends in sub */ -int strrcmp(char *s, char *sub) +static int strrcmp(char *s, char *sub) { int slen = strlen(s); int sublen = strlen(sub); @@ -258,7 +257,7 @@ int strrcmp(char *s, char *sub) return memcmp(s + slen - sublen, sub, sublen); } -void do_config_file(char *filename) +static void do_config_file(char *filename) { struct stat st; int fd; @@ -289,7 +288,7 @@ void do_config_file(char *filename) close(fd); } -void parse_dep_file(void *map, size_t len) +static void parse_dep_file(void *map, size_t len) { char *m = map; char *end = m + len; @@ -329,7 +328,7 @@ void parse_dep_file(void *map, size_t len) printf("$(deps_%s):\n", target); } -void print_deps(void) +static void print_deps(void) { struct stat st; int fd; @@ -361,7 +360,7 @@ void print_deps(void) close(fd); } -void traps(void) +static void traps(void) { static char test[] __attribute__((aligned(sizeof(int)))) = "CONF"; int *p = (int *)test; commit 80b4ed3a639ffce0a7ea0bfeee524ccedb9cc348 Author: maximilian attems <max at stro.at> Date: Wed Sep 7 00:43:38 2011 +0200 [klibc] include: [limits.h] define OPEN_MAX Usage seen in util-linux. Defined according to POSIX:2001 min. Signed-off-by: maximilian attems <max at stro.at> diff --git a/usr/include/limits.h b/usr/include/limits.h index 0d1069b..8a2c6c0 100644 --- a/usr/include/limits.h +++ b/usr/include/limits.h @@ -5,6 +5,8 @@ #ifndef _LIMITS_H #define _LIMITS_H +#define OPEN_MAX 20 + #define CHAR_BIT 8 #define SHRT_BIT 16 #define INT_BIT 32 commit 6c82efff8561f0abdaea3054a7170f0aa4605fd6 Author: maximilian attems <max at stro.at> Date: Mon Sep 5 10:56:35 2011 +0200 [klibc] include: [sys/file.h] define flock(2) there SUSv3 is silent on that definition, but seen several userspace software that expects flock to be defined in that file and complain that it is missing in klibc. Current declaration is in unistd.h. Signed-off-by: maximilian attems <max at stro.at> diff --git a/usr/include/sys/file.h b/usr/include/sys/file.h new file mode 100644 index 0000000..7b580f3 --- /dev/null +++ b/usr/include/sys/file.h @@ -0,0 +1,9 @@ +#ifndef _SYS_FILE_H +#define _SYS_FILE_H + +/* LOCK_ definitions */ +#include <fcntl.h> + +__extern int flock(int, int); + +#endif /* _SYS_FILE_H */ diff --git a/usr/include/unistd.h b/usr/include/unistd.h index f286c33..3eaeaee 100644 --- a/usr/include/unistd.h +++ b/usr/include/unistd.h @@ -105,7 +105,6 @@ __extern int dup(int); __extern int dup2(int, int); __extern int fcntl(int, int, ...); __extern int ioctl(int, int, void *); -__extern int flock(int, int); __extern int ftruncate(int, off_t); /*