tst_device: use raw syscall in the tst_device.h
PATCH 1/1 tst_device: use raw syscall in the tst_device.h
To follow up commit 447c223dba538efc7be23edc.
--- include/tst_device.h | 6 ++++-- testcases/kernel/syscalls/fadvise/posix_fadvise01.c | 1 + testcases/kernel/syscalls/fadvise/posix_fadvise02.c | 1 + testcases/kernel/syscalls/fadvise/posix_fadvise03.c | 1 + testcases/kernel/syscalls/fadvise/posix_fadvise04.c | 1 + testcases/kernel/syscalls/fstat/fstat03.c | 1 + testcases/kernel/syscalls/pwrite/pwrite02.c | 1 + 7 files changed, 10 insertions(+), 2 deletions(-)
include/tst_device.h +4 -2
@@ -18,7 +18,9 @@ #ifndef TST_DEVICE_H__ #define TST_DEVICE_H__ +#define _GNU_SOURCE #include <unistd.h> +#include <sys/syscall.h> struct tst_device { const char *dev;
@@ -75,9 +77,9 @@ int tst_detach_device(const char *dev_path);* simply before the tst_dev_bytes_written invocation. For easy to use, * we create this inline function tst_dev_sync. */ -static inline void tst_dev_sync (int fd) +static inline int tst_dev_sync (int fd) { -syncfs (fd); +return syscall (__NR_syncfs, fd); }/*
testcases/kernel/syscalls/fadvise/posix_fadvise01.c +1 -0
@@ -20,6 +20,7 @@* None */ +#define _GNU_SOURCE#define _XOPEN_SOURCE 600#include <fcntl.h>
testcases/kernel/syscalls/fadvise/posix_fadvise02.c +1 -0
@@ -20,6 +20,7 @@* None */ +#define _GNU_SOURCE#define _XOPEN_SOURCE 600#include <fcntl.h> #include <unistd.h>
testcases/kernel/syscalls/fadvise/posix_fadvise03.c +1 -0
@@ -20,6 +20,7 @@* None */ +#define _GNU_SOURCE#define _XOPEN_SOURCE 600#include <fcntl.h> #include <unistd.h>
testcases/kernel/syscalls/fadvise/posix_fadvise04.c +1 -0
@@ -20,6 +20,7 @@* None */ +#define _GNU_SOURCE#define _XOPEN_SOURCE 600#include <fcntl.h> #include <unistd.h>
testcases/kernel/syscalls/fstat/fstat03.c +1 -0
@@ -13,6 +13,7 @@* -> EFAULT (or receive signal SIGSEGV) */ +#define _GNU_SOURCE#include <errno.h> #include <stdlib.h> #include <unistd.h>
testcases/kernel/syscalls/pwrite/pwrite02.c +1 -0
@@ -18,6 +18,7 @@* accessible address space, returns EFAULT. */ +#define _GNU_SOURCE#define _XOPEN_SOURCE 500#include <errno.h>
Signature · 1 line
2.20.1
PATCH 1/1 tst_device: use raw syscall in the tst_device.h
Hi Li,
Quoted 5 lines
To follow up commit
447c223dba538efc7be23edc.Signed-off-by Li Wang <[email protected]>Tested-by Li Wang <[email protected]>Cc Petr Vorel <[email protected]>
BTW I wonder if my sieve filter is bad, because I didn't get this mail or git send-email didn't sent it.
Quoted 1 line
Cc Cyril Hrubis <[email protected]>
Nice, thanks for a fix. + Note about _XOPEN_SOURCE below.
https://travis-ci.org/pevik/ltp/builds/634613112
NOTE: it works, failures to Debian testing are caused by bug in libtirpc 1.2.5, fixed in a86b4ff Add authdes_seccreate() stub [1].
...
Quoted 15 lines
include/tst_device.h +2
-0@@ -18,7 +18,9 @@ #ifndef TST_DEVICE_H__ #define TST_DEVICE_H__ +#define _GNU_SOURCE #include <unistd.h> +#include <sys/syscall.h> struct tst_device { const char *dev;
include/tst_device.h int tst_detach_device(const char *dev_path); · line 82
Quoted 8 lines
include/tst_device.h +2
-2@@ -75,9 +77,9 @@ int tst_detach_device(const char *dev_path);* simply before the tst_dev_bytes_written invocation. For easy to use, * we create this inline function tst_dev_sync. */ -static inline void tst_dev_sync (int fd) +static inline int tst_dev_sync (int fd) { -syncfs (fd); +return syscall (__NR_syncfs, fd);
+1 for returning result.
testcases/kernel/syscalls/fadvise/posix_fadvise01.c line 24
Quoted 13 lines
include/tst_device.h +0
-0}/* testcases/kernel/syscalls/fadvise/posix_fadvise01.c +1
-0@@ -20,6 +20,7 @@* None */ +#define _GNU_SOURCE#define _XOPEN_SOURCE 600
If we define _GNU_SOURCE we probably don't need _XOPEN_SOURCE 600, do we?
testcases/kernel/syscalls/fadvise/posix_fadvise02.c line 24
Quoted 12 lines
testcases/kernel/syscalls/fadvise/posix_fadvise01.c +0
-0#include <fcntl.h> testcases/kernel/syscalls/fadvise/posix_fadvise02.c +1
-0@@ -20,6 +20,7 @@* None */ +#define _GNU_SOURCE#define _XOPEN_SOURCE 600
Same here.
testcases/kernel/syscalls/fadvise/posix_fadvise03.c line 24
Quoted 12 lines
testcases/kernel/syscalls/fadvise/posix_fadvise02.c +0
-0#include <fcntl.h> #include <unistd.h> testcases/kernel/syscalls/fadvise/posix_fadvise03.c +1
-0@@ -20,6 +20,7 @@* None */ +#define _GNU_SOURCE#define _XOPEN_SOURCE 600
Same here.
...
testcases/kernel/syscalls/fadvise/posix_fadvise04.c line 24
Quoted 10 lines
testcases/kernel/syscalls/fadvise/posix_fadvise04.c +1
-0@@ -20,6 +20,7 @@* None */ +#define _GNU_SOURCE#define _XOPEN_SOURCE 600
Same here.
Quoted 2 lines
testcases/kernel/syscalls/fadvise/posix_fadvise04.c +0
-0#include <fcntl.h> #include <unistd.h>
...
testcases/kernel/syscalls/pwrite/pwrite02.c line 22
Quoted 10 lines
testcases/kernel/syscalls/pwrite/pwrite02.c +1
-0@@ -18,6 +18,7 @@* accessible address space, returns EFAULT. */ +#define _GNU_SOURCE#define _XOPEN_SOURCE 500
Same here.
Kind regards,
Petr
[1] http://git.linux-nfs.org/?p=steved/libtirpc.git;a=commit;h=a86b4ff0c4b4e53df436f83c21a5fbf01568a301
PATCH 1/1 tst_device: use raw syscall in the tst_device.h
Hi Petr,
Quoted 6 lines · Petr Vorel
...
Quoted 1 line
Cc Petr Vorel <[email protected]>BTW I wonder if my sieve filter is bad, because I didn't get this mail or git
send-email didn't sent it.
I guess that might because of your email filter configuration, the Cc'ed name will be kicked out if he/she has subscribed to the mailing list, especially for my Gmail-client always do that.
This is git-send-email log FYI:
----------------------------
$ git send-email 0001-tst_device-use-raw-syscall-in-the-tst_device.h.patch --to [email protected] 0001-tst_device-use-raw-syscall-in-the-tst_device.h.patch (body) Adding cc: Petr Vorel <[email protected]> from line 'Cc: Petr Vorel < [email protected]>' (body) Adding cc: Cyril Hrubis <[email protected]> from line 'Cc: Cyril Hrubis <[email protected]>' OK. Log says: Server: smtp.corp.redhat.com MAIL FROM:<[email protected]> RCPT TO:<[email protected]> RCPT TO:<[email protected]> RCPT TO:<[email protected]> From: Li Wang <[email protected]> To: [email protected] Cc: Petr Vorel <[email protected]>, Cyril Hrubis <[email protected]> Subject: [PATCH] tst_device: use raw syscall in the tst_device.h Date: Thu, 9 Jan 2020 15:15:10 +0800 Message-Id: <[email protected]> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit
Result: 250
Quoted 5 lines
Quoted 1 line
Cc Cyril Hrubis <[email protected]>Reviewed-by Petr Vorel <[email protected]>Nice, thanks for a fix. + Note about
_XOPEN_SOURCEbelow.
Thanks for the quick reply.
Quoted 7 lines
Tested-by Petr Vorel <[email protected]>https://travis-ci.org/pevik/ltp/builds/634613112
NOTE: it works, failures to Debian testing are caused by bug in libtirpc 1.2.5,
fixed in a86b4ff Addauthdes_seccreate()stub [1].
Quoted 6 lines
...
+#define
_GNU_SOURCEQuoted 1 line
#define
_XOPEN_SOURCE600If we define
_GNU_SOURCEwe probably don't need_XOPEN_SOURCE600, do we?
Ah, right. I will remove it in patch merging.
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20200109/d54007f0/attachment.htm>
PATCH 1/1 tst_device: use raw syscall in the tst_device.h
Hi Li,
Quoted 36 lines
Quoted 4 lines
Quoted 1 line
Cc Petr Vorel <[email protected]>BTW I wonder if my sieve filter is bad, because I didn't get this mail or git
send-email didn't sent it.I guess that might because of your email filter configuration, the Cc'ed name will be kicked out if he/she has subscribed to the mailing list, especially for my Gmail-client always do that.
This is git-send-email log FYI:
----------------------------$ git send-email 0001-tst_device-use-raw-syscall-in-the-tst_device.h.patch --to [email protected] 0001-tst_device-use-raw-syscall-in-the-tst_device.h.patch (body) Adding cc: Petr Vorel <[email protected]> from line 'Cc: Petr Vorel < [email protected]>' (body) Adding cc: Cyril Hrubis <[email protected]> from line 'Cc: Cyril Hrubis <[email protected]>' OK. Log says: Server: smtp.corp.redhat.com MAIL FROM:<[email protected]> RCPT TO:<[email protected]> RCPT TO:<[email protected]> RCPT TO:<[email protected]> From: Li Wang <[email protected]> To: [email protected] Cc: Petr Vorel <[email protected]>, Cyril Hrubis <[email protected]> Subject: [PATCH] tst_device: use raw syscall in the tst_device.h Date: Thu, 9 Jan 2020 15:15:10 +0800 Message-Id: <[email protected]> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit
Quoted 1 line
Result: 250
Thank you for info. Sorry, my fault (I had filter to List-Id: and *also* to To:
(normally I use just List-Id:, which is what I want).
Quoted 6 lines
Quoted 3 lines
+#define
_GNU_SOURCEQuoted 1 line
#define
_XOPEN_SOURCE600If we define
_GNU_SOURCEwe probably don't need_XOPEN_SOURCE600, do we?Ah, right. I will remove it in patch merging.
Thanks!
Kind regards,
Petr
PATCH 1/1 tst_device: use raw syscall in the tst_device.h
In reply to Li WangHi!
include/tst_device.h line 23
Quoted 3 lines
include/tst_device.h +2
-0+#define _GNU_SOURCE#include <unistd.h> +#include <sys/syscall.h>
Defining _GNU_SOURCE anywhere but at the top of the test source is meaningless. It has to be defined before we include any libc headers otherwise it's ignored.
Quoted 19 lines
struct
tst_device{include/tst_device.h +2
-2const char *dev;@@ -75,9 +77,9 @@ int tst_detach_device(const char *dev_path);* simply before the tst_dev_bytes_written invocation. For easy to use, * we create this inline function tst_dev_sync. */ -static inline void tst_dev_sync (int fd) +static inline int tst_dev_sync (int fd) { -syncfs (fd); +return syscall (__NR_syncfs, fd); }/* testcases/kernel/syscalls/fadvise/posix_fadvise01.c +0
-0
testcases/kernel/syscalls/fadvise/posix_fadvise01.c line 25
Quoted 6 lines
testcases/kernel/syscalls/fadvise/posix_fadvise01.c +1
-0@@ -20,6 +20,7 @@* None */ +#define _GNU_SOURCE#define _XOPEN_SOURCE 600#include <fcntl.h>
Why do we need the _GNU_SOURCE here? We switched to a syscall() in the header, hence we do not need the syncfs() prototype anymore.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 tst_device: use raw syscall in the tst_device.h
Hi Cyril, Li,
Quoted 22 lines
Hi!
include/tst_device.h line 23
Quoted 3 lines
include/tst_device.h +2
-0+#define _GNU_SOURCE#include <unistd.h> +#include <sys/syscall.h> Defining
_GNU_SOURCEanywhere but at the top of the test source is meaningless. It has to be defined before we include any libc headers otherwise it's ignored.Quoted 12 lines
struct
tst_device{include/tst_device.h +2
-2const char *dev;@@ -75,9 +77,9 @@ int tst_detach_device(const char *dev_path);* simply before the tst_dev_bytes_written invocation. For easy to use, * we create this inline function tst_dev_sync. */ -static inline void tst_dev_sync (int fd) +static inline int tst_dev_sync (int fd) { -syncfs (fd); +return syscall (__NR_syncfs, fd); }
Quoted 8 lines
testcases/kernel/syscalls/fadvise/posix_fadvise01.c line 25
Quoted 5 lines
testcases/kernel/syscalls/fadvise/posix_fadvise01.c +1
-0+#define _GNU_SOURCE#define _XOPEN_SOURCE 600#include <fcntl.h> Why do we need the
_GNU_SOURCEhere? We switched to asyscall()in the header, hence we do not need thesyncfs()prototype anymore.
Correct, both. Sorry for a complete wrong review.
Kind regards,
Petr
PATCH 1/1 tst_device: use raw syscall in the tst_device.h
In reply to Cyril HrubisQuoted 9 lines · Cyril Hrubis
Hi!
include/tst_device.h line 23
Quoted 3 lines
include/tst_device.h +2
-0+#define _GNU_SOURCE#include <unistd.h> +#include <sys/syscall.h> Defining
_GNU_SOURCEanywhere but at the top of the test source is meaningless. It has to be defined before we include any libc headers otherwise it's ignored.
I got the point. And yes, that means the definition should be removed from the tst_device.h header file.
Quoted 10 lines
Review
Quoted 2 lines
/*
(quoted diff) +0
-0
b/testcases/kernel/syscalls/fadvise/posix_fadvise01.cQuoted 7 lines
index
2af040840..f5d7ca8ac100644testcases/kernel/syscalls/fadvise/posix_fadvise01.c +0
-0@@ -20,6 +20,7 @@* None */
Quoted 8 lines
testcases/kernel/syscalls/fadvise/posix_fadvise01.c line 25
Quoted 3 lines
testcases/kernel/syscalls/fadvise/posix_fadvise01.c +1
-0+#define _GNU_SOURCE#define _XOPEN_SOURCE 600#include <fcntl.h> Why do we need the
_GNU_SOURCEhere? We switched to asyscall()in the header, hence we do not need thesyncfs()prototype anymore.
But shouldn't we define the _GNU_SOURCE for syscall()? Otherwise, the _XOPEN_SOURCE 600 definitions will take effect and makes the compiler print new errors[1].
Here I fee a little confused, or do we need to delete the _XOPEN_SOURCE definition directly for the test posix_fadvise01.c?
[1]:
gcc -Werror=implicit-function-declaration -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition
-I/root/ltp2/testcases/kernel/syscalls/fadvise
-I/root/ltp2/testcases/kernel/syscalls/fadvise/../utils -I../../../../include -I../../../../include -I../../../../include/old/
-L../../../../lib posix_fadvise01.c -lltp -o posix_fadvise01
In file included from ../../../../include/tst_test.h:22,
from posix_fadvise01.c:31:
../../../../include/tst_device.h: In function ?tst_dev_sync?:../../../../include/tst_device.h:82:9: error: implicit declaration of function ?syscall?; did you mean ?strcoll?? [-Werror=implicit-function-declaration]
return syscall(__NR_syncfs, fd);
^~~~~~~
strcollSignature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20200109/c446e9d2/attachment.htm>
PATCH 1/1 tst_device: use raw syscall in the tst_device.h
Hi!
Quoted 17 lines
Quoted 9 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/testcases/kernel/syscalls/fadvise/posix_fadvise01.cQuoted 7 lines
index
2af040840..f5d7ca8ac100644testcases/kernel/syscalls/fadvise/posix_fadvise01.c +0
-0@@ -20,6 +20,7 @@* None */ Quoted 8 lines
testcases/kernel/syscalls/fadvise/posix_fadvise01.c line 25
Quoted 3 lines
testcases/kernel/syscalls/fadvise/posix_fadvise01.c +1
-0+#define _GNU_SOURCE#define _XOPEN_SOURCE 600#include <fcntl.h> Why do we need the
_GNU_SOURCEhere? We switched to asyscall()in the header, hence we do not need thesyncfs()prototype anymore.
Quoted 6 lines
But shouldn't we define the
_GNU_SOURCEforsyscall()? Otherwise, the_XOPEN_SOURCE600 definitions will take effect and makes the compiler print new errors[1].Here I fee a little confused, or do we need to delete the
_XOPEN_SOURCEdefinition directly for the testposix_fadvise01.c?
Sigh, looks like the _XOPEN_SOURCE 600 disables syscall() definition from being exposed, which is otherwise exposed by default.
Also it looks like things works fine for me when I remove the _XOPEN_SOURCE 600.
So I guess that we should try to remove the _XOPEN_SOURCE from the posix_fadvise() tests and try to compile the code on old enough distribution. If that works we should do it that way.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 tst_device: use raw syscall in the tst_device.h
Quoted 28 lines · Cyril Hrubis
Hi!
Quoted 17 lines
Quoted 9 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/testcases/kernel/syscalls/fadvise/posix_fadvise01.cQuoted 7 lines
index
2af040840..f5d7ca8ac100644testcases/kernel/syscalls/fadvise/posix_fadvise01.c +0
-0@@ -20,6 +20,7 @@* None */ Quoted 8 lines
testcases/kernel/syscalls/fadvise/posix_fadvise01.c line 25
Quoted 3 lines
testcases/kernel/syscalls/fadvise/posix_fadvise01.c +1
-0+#define _GNU_SOURCE#define _XOPEN_SOURCE 600#include <fcntl.h> Why do we need the
_GNU_SOURCEhere? We switched to asyscall()in the header, hence we do not need thesyncfs()prototype anymore.Quoted 6 lines
But shouldn't we define the
_GNU_SOURCEforsyscall()? Otherwise, the_XOPEN_SOURCE600 definitions will take effect and makes the compiler print new errors[1].Here I fee a little confused, or do we need to delete the
_XOPEN_SOURCEdefinition directly for the testposix_fadvise01.c?Sigh, looks like the
_XOPEN_SOURCE600 disablessyscall()definition from being exposed, which is otherwise exposed by default.
Quoted 7 lines
Also it looks like things works fine for me when I remove the
_XOPEN_SOURCE600.So I guess that we should try to remove the
_XOPEN_SOURCEfrom theposix_fadvise()tests and try to compile the code on old enough distribution. If that works we should do it that way.
Ok, I will have a try (remove the _XOPEN_SOURCE) to build it on more distros. If works fine will send patch v2.
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20200109/9e1d1ba2/attachment-0001.htm>
PATCH 1/1 tst_device: use raw syscall in the tst_device.h
In reply to Li WangHi,
Quoted 14 lines
Quoted 7 lines
include/tst_device.h line 23
Quoted 3 lines
include/tst_device.h +2
-0+#define _GNU_SOURCE#include <unistd.h> +#include <sys/syscall.h> Defining
_GNU_SOURCEanywhere but at the top of the test source is meaningless. It has to be defined before we include any libc headers otherwise it's ignored.I got the point. And yes, that means the definition should be removed from the
tst_device.hheader file.Quoted 1 line
Quoted 1 line
(quoted diff) +0
-0
...
Quoted 11 lines
Quoted 6 lines
Quoted 3 lines
+#define
_GNU_SOURCE
#define_XOPEN_SOURCE600
#include <fcntl.h>Why do we need the
_GNU_SOURCEhere? We switched to asyscall()in the header, hence we do not need thesyncfs()prototype anymore.But shouldn't we define the
_GNU_SOURCEforsyscall()? Otherwise, the_XOPEN_SOURCE600 definitions will take effect and makes the compiler print new errors[1].
Correct, syscall() requires _GNU_SOURCE and <unistd.h>.
+ Not sure if <sys/syscall.h> should be used (as it's in your patch or lapi/syscalls.h.
Quoted 11 lines
Here I feel a little confused, or do we need to delete the
_XOPEN_SOURCEdefinition directly for the testposix_fadvise01.c?[1]:
gcc -Werror=implicit-function-declaration -g -O2 -fno-strict-aliasing -pipe(quoted diff) +0
-4-Wall -W -Wold-style-definition -I/root/ltp2/testcases/kernel/syscalls/fadvise -I/root/ltp2/testcases/kernel/syscalls/fadvise/../utils -I../../../../include -I../../../../include -I../../../../include/old/ -L../../../../lib posix_fadvise01.c -lltp -o posix_fadvise01In file included from
../../../../include/tst_test.h:22,
Quoted 8 lines
from posix_fadvise01.c:31:
../../../../include/tst_device.h: In function ?tst_dev_sync?:../../../../include/tst_device.h:82:9: error: implicit declaration of function ?syscall?; did you mean ?strcoll?? [-Werror=implicit-function-declaration]return syscall(__NR_syncfs, fd); ^~~~~~~ strcoll
+ Our syscall numbers in include/lapi/syscalls/ are outdated (syncfs is not at least in include/lapi/syscalls/sparc{64,}.in and include/lapi/syscalls/x86_64.in).
Kind regards,
Petr
PATCH 1/1 tst_device: use raw syscall in the tst_device.h
Hi!
Quoted 4 lines
Quoted 3 lines
But shouldn't we define the
_GNU_SOURCEforsyscall()? Otherwise, the_XOPEN_SOURCE600 definitions will take effect and makes the compiler print new errors[1].Correct,
syscall()requires_GNU_SOURCEand <unistd.h>.
Not really, it's guarded by _USE_MISC which is enabled by default and disabled by _XOPEN_SOURCE.
Looks like the manual page is outdated at least.
Quoted 2 lines
+ Not sure if <
sys/syscall.h> should be used (as it's in your patch orlapi/syscalls.h.
Well, given that syncfs is old enough (2.6.39) either should work.
Quoted 15 lines
Quoted 15 lines
Here I feel a little confused, or do we need to delete the
_XOPEN_SOURCEdefinition directly for the testposix_fadvise01.c?[1]:
gcc -Werror=implicit-function-declaration -g -O2 -fno-strict-aliasing -pipe(quoted diff) +0
-4-Wall -W -Wold-style-definition -I/root/ltp2/testcases/kernel/syscalls/fadvise -I/root/ltp2/testcases/kernel/syscalls/fadvise/../utils -I../../../../include -I../../../../include -I../../../../include/old/ -L../../../../lib posix_fadvise01.c -lltp -o posix_fadvise01In file included from
../../../../include/tst_test.h:22,from posix_fadvise01.c:31:
../../../../include/tst_device.h: In function ???tst_dev_sync???:../../../../include/tst_device.h:82:9: error: implicit declaration of function ???syscall???; did you mean ???strcoll????
Quoted 8 lines
Quoted 4 lines
[-Werror=implicit-function-declaration]
return syscall(__NR_syncfs, fd); ^~~~~~~ strcoll+ Our syscall numbers in
include/lapi/syscalls/are outdated (syncfs is not at least ininclude/lapi/syscalls/sparc{64,}.inandinclude/lapi/syscalls/x86_64.in).
The lapi/syscall.h includes sys/syscall.h so it's probably not a problem, since there are no distribution that are missing syncfs in the system headers. Note that we are only adding fallback definitions there and if present the system values take precedence.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 tst_device: use raw syscall in the tst_device.h
Hi,
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
But shouldn't we define the
_GNU_SOURCEforsyscall()? Otherwise, the_XOPEN_SOURCE600 definitions will take effect and makes the compiler print new errors[1].Correct,
syscall()requires_GNU_SOURCEand <unistd.h>.Not really, it's guarded by
_USE_MISCwhich is enabled by default and disabled by_XOPEN_SOURCE.
Yep, looking into features.h __USE_MISC is defined by _DEFAULT_SOURCE, which is enabled if nothing or only _GNU_SOURCE is defined.
Quoted 1 line
Looks like the manual page is outdated at least.
Yes, that's what I checked this time (I usually look into sources).
Quoted 29 lines
Quoted 2 lines
+ Not sure if <
sys/syscall.h> should be used (as it's in your patch orlapi/syscalls.h.Well, given that syncfs is old enough (2.6.39) either should work.
Quoted 15 lines
Quoted 15 lines
Here I feel a little confused, or do we need to delete the
_XOPEN_SOURCEdefinition directly for the testposix_fadvise01.c?[1]:
gcc -Werror=implicit-function-declaration -g -O2 -fno-strict-aliasing -pipe(quoted diff) +0
-4-Wall -W -Wold-style-definition -I/root/ltp2/testcases/kernel/syscalls/fadvise -I/root/ltp2/testcases/kernel/syscalls/fadvise/../utils -I../../../../include -I../../../../include -I../../../../include/old/ -L../../../../lib posix_fadvise01.c -lltp -o posix_fadvise01In file included from
../../../../include/tst_test.h:22,from posix_fadvise01.c:31:
../../../../include/tst_device.h: In function ???tst_dev_sync???:../../../../include/tst_device.h:82:9: error: implicit declaration of function ???syscall???; did you mean ???strcoll????Quoted 8 lines
Quoted 4 lines
[-Werror=implicit-function-declaration]
return syscall(__NR_syncfs, fd); ^~~~~~~ strcoll+ Our syscall numbers in
include/lapi/syscalls/are outdated (syncfs is not at least ininclude/lapi/syscalls/sparc{64,}.inandinclude/lapi/syscalls/x86_64.in).
Quoted 4 lines
The
lapi/syscall.hincludessys/syscall.hso it's probably not a problem, since there are no distribution that are missing syncfs in the system headers. Note that we are only adding fallback definitions there and if present the system values take precedence.
Good. Sorry for wrong report (haven't notice <sys/syscall.h> inclusion).
Kind regards,
Petr