* [PATCH] selftests: mqueue: fix all errors
@ 2022-05-04 10:17 Sebin Sebastian
2022-05-04 18:44 ` Shuah Khan
0 siblings, 1 reply; 2+ messages in thread
From: Sebin Sebastian @ 2022-05-04 10:17 UTC (permalink / raw)
Cc: mailmesebin00, Shuah Khan, linux-kselftest, linux-kernel
All errors and styling issues were fixed.
Signed-off-by: Sebin Sebastian <mailmesebin00@gmail.com>
---
.../testing/selftests/mqueue/mq_open_tests.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/mqueue/mq_open_tests.c b/tools/testing/selftests/mqueue/mq_open_tests.c
index 9403ac01ba11..c3cb40eae1e9 100644
--- a/tools/testing/selftests/mqueue/mq_open_tests.c
+++ b/tools/testing/selftests/mqueue/mq_open_tests.c
@@ -59,12 +59,12 @@ char *default_queue_path = "/test1";
mqd_t queue = -1;
static inline void __set(FILE *stream, int value, char *err_msg);
-void shutdown(int exit_val, char *err_cause, int line_no);
+ void shutdown(int exit_val, char *err_cause, int line_no);
static inline int get(FILE *stream);
static inline void set(FILE *stream, int value);
static inline void getr(int type, struct rlimit *rlim);
static inline void setr(int type, struct rlimit *rlim);
-void validate_current_settings();
+static void validate_current_settings(void);
static inline void test_queue(struct mq_attr *attr, struct mq_attr *result);
static inline int test_queue_fail(struct mq_attr *attr, struct mq_attr *result);
@@ -78,7 +78,7 @@ static inline void __set(FILE *stream, int value, char *err_msg)
void shutdown(int exit_val, char *err_cause, int line_no)
{
- static int in_shutdown = 0;
+ static int in_shutdown;
/* In case we get called recursively by a set() call below */
if (in_shutdown++)
@@ -118,6 +118,7 @@ void shutdown(int exit_val, char *err_cause, int line_no)
static inline int get(FILE *stream)
{
int value;
+
rewind(stream);
if (fscanf(stream, "%d", &value) != 1)
shutdown(4, "Error reading /proc entry", __LINE__ - 1);
@@ -150,7 +151,7 @@ static inline void setr(int type, struct rlimit *rlim)
shutdown(7, "setrlimit()", __LINE__ - 1);
}
-void validate_current_settings()
+void validate_current_settings(void)
{
int rlim_needed;
@@ -202,7 +203,9 @@ static inline void test_queue(struct mq_attr *attr, struct mq_attr *result)
int flags = O_RDWR | O_EXCL | O_CREAT;
int perms = DEFFILEMODE;
- if ((queue = mq_open(queue_path, flags, perms, attr)) == -1)
+ queue = mq_open(queue_path, flags, perms, attr);
+
+ if ((queue == -1))
shutdown(1, "mq_open()", __LINE__);
if (mq_getattr(queue, result))
shutdown(1, "mq_getattr()", __LINE__);
@@ -224,7 +227,9 @@ static inline int test_queue_fail(struct mq_attr *attr, struct mq_attr *result)
int flags = O_RDWR | O_EXCL | O_CREAT;
int perms = DEFFILEMODE;
- if ((queue = mq_open(queue_path, flags, perms, attr)) == -1)
+ queue = mq_open(queue_path, flags, perms, attr);
+
+ if (queue == -1)
return 0;
if (mq_getattr(queue, result))
shutdown(1, "mq_getattr()", __LINE__);
@@ -498,5 +503,5 @@ int main(int argc, char *argv[])
printf("Queue open with total size > 2GB when euid = 99 "
"failed:\t\t\tPASS\n");
- shutdown(0,"",0);
+ shutdown(0, "", 0);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] selftests: mqueue: fix all errors
2022-05-04 10:17 [PATCH] selftests: mqueue: fix all errors Sebin Sebastian
@ 2022-05-04 18:44 ` Shuah Khan
0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2022-05-04 18:44 UTC (permalink / raw)
To: Sebin Sebastian; +Cc: Shuah Khan, linux-kselftest, linux-kernel, Shuah Khan
On 5/4/22 4:17 AM, Sebin Sebastian wrote:
> All errors and styling issues were fixed.
>
> Signed-off-by: Sebin Sebastian <mailmesebin00@gmail.com>
Please include details on how you found the problems and the log from the tool
> ---
> .../testing/selftests/mqueue/mq_open_tests.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/tools/testing/selftests/mqueue/mq_open_tests.c b/tools/testing/selftests/mqueue/mq_open_tests.c
> index 9403ac01ba11..c3cb40eae1e9 100644
> --- a/tools/testing/selftests/mqueue/mq_open_tests.c
> +++ b/tools/testing/selftests/mqueue/mq_open_tests.c
> @@ -59,12 +59,12 @@ char *default_queue_path = "/test1";
> mqd_t queue = -1;
>
> static inline void __set(FILE *stream, int value, char *err_msg);
> -void shutdown(int exit_val, char *err_cause, int line_no);
> + void shutdown(int exit_val, char *err_cause, int line_no);
I don't see any change in this line
Including the log helps me understand why these changes are necessary.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-04 18:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-04 10:17 [PATCH] selftests: mqueue: fix all errors Sebin Sebastian
2022-05-04 18:44 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox