From: Maxime Devos <maximedevos@telenet.be>
To: Christopher Baines <mail@cbaines.net>, guile-devel@gnu.org
Subject: Re: [PATCH] Define SO_RCVTIMEO and SO_SNDTIMEO.
Date: Sat, 17 Sep 2022 11:40:36 +0200 [thread overview]
Message-ID: <a0571903-1089-e99c-bcc5-fcf002a925d7@telenet.be> (raw)
In-Reply-To: <20220917080512.17824-1-mail@cbaines.net>
[-- Attachment #1.1.1: Type: text/plain, Size: 1450 bytes --]
On 17-09-2022 10:05, Christopher Baines wrote:
> + if (ioptname == SO_RCVTIMEO || ioptname == SO_SNDTIMEO)
> + {
> + SCM_ASSERT (scm_is_pair (value), value, SCM_ARG4, FUNC_NAME);
How about using SCM_ASSERT_TYPE instead to improve the error message a
little?
> + opt_time.tv_sec = scm_to_ulong (SCM_CAR (value));
> + opt_time.tv_usec = scm_to_ulong (SCM_CDR (value));
I think it needs to be documented how to actually use SO_RCVTIMEO /
SO_SNDTIMEO (more specifically, the types). For example, the user might
expect to enter flonums 1.567 as time durations (in seconds) instead, or
a duration from SRFI 19. How is the user supposed to know the
appropriate type, aside from experimenting and reading the source code?
Also, it is not documented there is a maximum on the number of seconds,
I recommend to document that there is some limit, or alternatively clip
numbers to the maximum.
> + optlen = sizeof (opt_time);
> + optval = &opt_time;
> + }
> +
I think this needs a #if defined(SO_RCVTIMEO) && defined(SO_SNDTIMEO),
for systems that don't have those. Alternatively, if all systems have
those, it seems to me that the #ifdef in
> +#ifdef SO_RCVTIMEO
> + scm_c_define ("SO_RCVTIMEO", scm_from_int (SO_RCVTIMEO));
> +#endif
> +#ifdef SO_SNDTIMEO
> + scm_c_define ("SO_SNDTIMEO", scm_from_int (SO_SNDTIMEO));
> +#endif
can be removed.
Greetings,
Maxime.
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
next prev parent reply other threads:[~2022-09-17 9:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-17 8:05 [PATCH] Define SO_RCVTIMEO and SO_SNDTIMEO Christopher Baines
2022-09-17 9:40 ` Maxime Devos [this message]
2022-09-18 14:11 ` Christopher Baines
2022-09-18 13:56 ` [PATCH v2] " Christopher Baines
2022-09-18 14:17 ` [PATCH v3] " Christopher Baines
2022-10-12 20:28 ` Ludovic Courtès
2022-10-13 10:28 ` Christopher Baines
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a0571903-1089-e99c-bcc5-fcf002a925d7@telenet.be \
--to=maximedevos@telenet.be \
--cc=guile-devel@gnu.org \
--cc=mail@cbaines.net \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).