From: Richard Palethorpe <rpalethorpe@suse.de>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 1/3] Add more mqueue safe macros
Date: Tue, 01 Nov 2022 11:48:25 +0000 [thread overview]
Message-ID: <87v8ny99mi.fsf@suse.de> (raw)
In-Reply-To: <20220816113142.25638-2-andrea.cervesato@suse.com>
Hello,
Ah, I see you had two similar patches on the queue and merged the one
with less functions added.
Anyway, now merged this as well with inline added and trailing
whitespace removed.
Andrea Cervesato via ltp <ltp@lists.linux.it> writes:
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
> include/tst_safe_posix_ipc.h | 73 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 73 insertions(+)
>
> diff --git a/include/tst_safe_posix_ipc.h b/include/tst_safe_posix_ipc.h
> index b60c12c9e..78ce660b5 100644
> --- a/include/tst_safe_posix_ipc.h
> +++ b/include/tst_safe_posix_ipc.h
> @@ -1,6 +1,7 @@
> // SPDX-License-Identifier: GPL-2.0-or-later
> /*
> * Copyright (C) 2017-2019 Petr Vorel pvorel@suse.cz
> + * Copyright (C) 2022 Andrea Cervesato andrea.cervesato@suse.com
> */
>
> #ifndef TST_SAFE_POSIX_IPC_H__
> @@ -12,6 +13,18 @@
> #define SAFE_MQ_OPEN(pathname, oflags, ...) \
> safe_mq_open(__FILE__, __LINE__, (pathname), (oflags), ##__VA_ARGS__)
>
> +#define SAFE_MQ_NOTIFY(mqdes, sevp) \
> + safe_mq_notify(__FILE__, __LINE__, (mqdes), (sevp))
> +
> +#define SAFE_MQ_SEND(mqdes, msg_ptr, msg_len, msg_prio) \
> + safe_mq_send(__FILE__, __LINE__, (mqdes), (msg_ptr), (msg_len), (msg_prio))
> +
> +#define SAFE_MQ_CLOSE(mqdes) \
> + safe_mq_close(__FILE__, __LINE__, (mqdes))
> +
> +#define SAFE_MQ_UNLINK(name) \
> + safe_mq_unlink(__FILE__, __LINE__, (name))
> +
> static inline int safe_mq_open(const char *file, const int lineno,
> const char *pathname, int oflags, ...)
> {
> @@ -46,4 +59,64 @@ static inline int safe_mq_open(const char *file, const int lineno,
> return rval;
> }
>
> +static int safe_mq_notify(const char *file, const int lineno,
> + mqd_t mqdes, const struct sigevent *sevp)
> +{
> + int rval;
> +
> + rval = mq_notify(mqdes, sevp);
> +
> + if (rval == -1)
> + tst_brk_(file, lineno, TBROK | TERRNO, "mq_notify() failed");
> +
> + return rval;
> +}
> +
> +static int safe_mq_send(const char *file, const int lineno,
> + mqd_t mqdes, const char *msg_ptr,
> + size_t msg_len, unsigned int msg_prio)
> +{
> + int rval;
> +
> + rval = mq_send(mqdes, msg_ptr, msg_len, msg_prio);
> +
> + if (rval == -1) {
> + tst_brk_(file, lineno, TBROK | TERRNO,
> + "mq_send(%d,%s,%lu,%d) failed", mqdes, msg_ptr,
> + msg_len, msg_prio);
> + }
> +
> + return rval;
> +}
> +
> +static int safe_mq_close(const char *file, const int lineno,
> + mqd_t mqdes)
> +{
> + int rval;
> +
> + rval = mq_close(mqdes);
> +
> + if (rval == -1) {
> + tst_brk_(file, lineno, TBROK | TERRNO,
> + "mq_close(%d) failed", mqdes);
> + }
> +
> + return rval;
> +}
> +
> +static int safe_mq_unlink(const char *file, const int lineno,
> + const char *name)
> +{
> + int rval;
> +
> + rval = mq_unlink(name);
> +
> + if (rval == -1) {
> + tst_brk_(file, lineno, TBROK | TERRNO,
> + "mq_unlink(%s) failed", name);
> + }
> +
> + return rval;
> +}
> +
> #endif /* TST_SAFE_POSIX_IPC_H__ */
> --
> 2.35.3
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-11-01 11:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-16 11:31 [LTP] [PATCH v3 0/3] Refactor pidns30 and pidns31 using new LTP API Andrea Cervesato via ltp
2022-08-16 11:31 ` [LTP] [PATCH v3 1/3] Add more mqueue safe macros Andrea Cervesato via ltp
2022-11-01 11:48 ` Richard Palethorpe [this message]
2022-08-16 11:31 ` [LTP] [PATCH v3 2/3] Refactor pidns30 test using new LTP API Andrea Cervesato via ltp
2022-11-01 12:01 ` Richard Palethorpe
2023-02-08 9:42 ` Andrea Cervesato via ltp
2023-02-08 9:51 ` Andrea Cervesato via ltp
2022-08-16 11:31 ` [LTP] [PATCH v3 3/3] Refactor pidns31 " Andrea Cervesato via ltp
2022-11-01 12:54 ` Richard Palethorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v8ny99mi.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=andrea.cervesato@suse.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox