All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard PALO <richard at netbsd.org>
To: devel@acpica.org
Subject: Re: [Devel] PATCH proposal removing use of strtoul in events/evgpeinit.c
Date: Sat, 05 Sep 2015 08:01:53 +0200	[thread overview]
Message-ID: <55EA8551.2090207@netbsd.org> (raw)
In-Reply-To: 94F2FBAB4432B54E8AACC7DFDE6C92E37D343333@ORSMSX112.amr.corp.intel.com

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

Le 04/09/15 15:58, Moore, Robert a écrit :
> Sure, but the original code is much simpler.
> 
 
The reason for the error was that, by default, the extern declaration was forcluded by
_DDI_STRICT being defined.. 
which is to say that strtoul, strictly speaking is unavailable in the Solaris kernel (excepting kmdb).

So I kludged and added to acsolaris.h #ifdef _KERNEL section :
> static __GNU_INLINE unsigned long
> strtoul(const char *str, char **nptr, int base)
> {
> 	unsigned long ret;
> 	int status;
> 
> 	if ((status = ddi_strtoul(str, nptr, base, &ret)) != 0) {
> 		if (status == ERANGE)
> 			return (ULONG_MAX);
> 		return (0);
> 	}
> 	return (ret);
> }

Still seems for one call in the kernel to convert a single HEX byte from ascii to unsigned long, that 
the portable solution is to avoid using 'strtoul' in paths operating in kernel space.
(also considering the Linux discussion also around strtoul in the kernel)

cheers,
-- 
Richard PALO


             reply	other threads:[~2015-09-05  6:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-05  6:01 Richard PALO [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-09-11 15:49 [Devel] PATCH proposal removing use of strtoul in events/evgpeinit.c Moore, Robert
2015-09-11 15:36 Richard PALO
2015-09-11 14:57 Moore, Robert
2015-09-11 14:53 Moore, Robert
2015-09-11 10:56 Richard PALO
2015-09-09 18:01 Moore, Robert
2015-09-09 18:00 Moore, Robert
2015-09-04 13:58 Moore, Robert
2015-09-04 11:12 Richard PALO

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=55EA8551.2090207@netbsd.org \
    --to=devel@acpica.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.