read_all: Define FNM_EXTMATCH if not already (like under musl).
PATCH 1/1 read_all: Define FNM_EXTMATCH if not already (like under musl).
With musl, FNM_EXTMATCH is not defined:
| read_all.c: In function 'read_test':
| read_all.c:201:41: error: 'FNM_EXTMATCH' undeclared (first use in this function); did you mean 'FNM_NOMATCH'?
| if (exclude && !fnmatch(exclude, path, FNM_EXTMATCH)) {
| ^~~~~~~~~~~~
| FNM_NOMATCH
| read_all.c:201:41: note: each undeclared identifier is reported only once for each function it appears in
| <builtin>: recipe for target 'read_all' failed
| make[4]: *** [read_all] Error 1--- testcases/kernel/fs/read_all/read_all.c | 4 ++++ 1 file changed, 4 insertions(+)
testcases/kernel/fs/read_all/read_all.c +4 -0
@@ -60,6 +60,10 @@#define MAX_PATH 4096#define MAX_DISPLAY 40 +#if !defined(FNM_EXTMATCH ) +#define FNM_EXTMATCH 0 +#endif +struct queue {sem_t sem;int front;
Signature · 1 line
2.7.4
PATCH 1/1 read_all: Define FNM_EXTMATCH if not already (like under musl).
Hi Daniel,
Quoted 20 lines
With musl,
FNM_EXTMATCHis not defined:| read_all.c: In function 'read_test': | read_all.c:201:41: error: 'FNM_EXTMATCH' undeclared (first use in this function); did you mean 'FNM_NOMATCH'? | if (exclude && !fnmatch(exclude, path, FNM_EXTMATCH)) { | ^~~~~~~~~~~~ | FNM_NOMATCH | read_all.c:201:41: note: each undeclared identifier is reported only once for each function it appears in | <builtin>: recipe for target 'read_all' failed | make[4]: *** [read_all] Error 1Signed-off-by Daniel DÃaz <[email protected]>--- testcases/kernel/fs/read_all/read_all.c | 4 ++++ 1 file changed, 4 insertions(+)testcases/kernel/fs/read_all/read_all.c +0
-0
testcases/kernel/fs/read_all/read_all.c line 63
Quoted 4 lines
testcases/kernel/fs/read_all/read_all.c +1
-0@@ -60,6 +60,10 @@#define MAX_PATH 4096#define MAX_DISPLAY 40 +#if !defined(FNM_EXTMATCH )
Maybe just
#ifndef FNM_EXTMATCH
And maybe it'd be good to put this definition into include/lapi/fnmatch.h (create it), so it can be reused.
FYI: LTP isn't musl ready atm.
testcases/kernel/fs/read_all/read_all.c line 69
Quoted 6 lines
testcases/kernel/fs/read_all/read_all.c +3
-0+#define FNM_EXTMATCH 0 +#endif +struct queue {sem_t sem;int front;
Kind regards,
Petr
PATCH v2 1/1 fs/read_all: define FNM_EXTMATCH if needed
FNM_EXTMATCH is not defined in musl libc:
| read_all.c: In function 'read_test':
| read_all.c:201:41: error: 'FNM_EXTMATCH' undeclared (first use in this function); did you mean 'FNM_NOMATCH'?
| if (exclude && !fnmatch(exclude, path, FNM_EXTMATCH)) {
| ^~~~~~~~~~~~
| FNM_NOMATCH
| read_all.c:201:41: note: each undeclared identifier is reported only once for each function it appears in
| <builtin>: recipe for target 'read_all' failed
| make[4]: *** [read_all] Error 1Even not being 100% musl ready at the moment, this seems a trivial fix to allow LTP to be built with musl libc.
--- include/lapi/fnmatch.h | 14 ++++++++++++++ testcases/kernel/fs/read_all/read_all.c | 1 + 2 files changed, 15 insertions(+) create mode 100644 include/lapi/fnmatch.h
include/lapi/fnmatch.h new file +14 -0
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2018 Linaro Limited. All rights reserved. +* Author: Rafael David Tinoco <[email protected]> +*/ + +#ifndef FNMATCH_H__ +#define FNMATCH_H__ + +#ifndef FNM_EXTMATCH +#define FNM_EXTMATCH 0 +#endif + +#endif
testcases/kernel/fs/read_all/read_all.c +1 -0
@@ -40,6 +40,7 @@*/ #include <sys/types.h> #include <sys/stat.h> +#include <lapi/fnmatch.h> #include <stdlib.h> #include <stdio.h> #include <dirent.h>
Signature · 1 line
2.18.0
PATCH v2 1/1 fs/read_all: define FNM_EXTMATCH if needed
Hi!
Pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]