util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	util-linux@vger.kernel.org
Subject: Re: [PATCH] Fix non-Linux build
Date: Mon, 13 Aug 2012 15:25:46 +0200	[thread overview]
Message-ID: <20120813132546.GB21956@x2.net.home> (raw)
In-Reply-To: <20120808151943.GR10080@type.famille.thibault.fr>

On Wed, Aug 08, 2012 at 05:19:43PM +0200, Samuel Thibault wrote:
> --- a/lib/cpuset.c
> +++ b/lib/cpuset.c
> @@ -54,6 +54,7 @@ static const char *nexttoken(const char *q,  int sep)
>  	return q;
>  }
>  
> +#ifdef __linux__
>  /*
>   * Number of bits in a CPU bitmask on current system
>   */
> @@ -85,6 +86,7 @@ int get_max_number_of_cpus(void)
>  	}
>  	return -1;
>  }
> +#endif

 Hmm... this not too elegant for the internal API. I have modified the
 patch:

--- a/lib/cpuset.c
+++ b/lib/cpuset.c
@@ -59,6 +59,7 @@ static const char *nexttoken(const char *q,  int sep)
  */
 int get_max_number_of_cpus(void)
 {
+#ifdef SYS_sched_getaffinity
        int n, cpus = 2048;
        size_t setsize;
        cpu_set_t *set = cpuset_alloc(cpus, &setsize, NULL);
@@ -83,6 +84,7 @@ int get_max_number_of_cpus(void)
                cpuset_free(set);
                return n * 8;
        }
+#endif
        return -1;
 }


... so the function always exist. I guess the syscall is Linux
specific.

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  reply	other threads:[~2012-08-13 13:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-08 15:19 [PATCH] Fix non-Linux build Samuel Thibault
2012-08-13 13:25 ` Karel Zak [this message]
2012-08-15 12:23   ` Samuel Thibault
  -- strict thread matches above, loose matches on Subject: below --
2025-01-12 15:39 Samuel Thibault
2025-01-14  9:32 ` Karel Zak

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=20120813132546.GB21956@x2.net.home \
    --to=kzak@redhat.com \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=util-linux@vger.kernel.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 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 NNTP newsgroup(s).