Linux-man Archive on lore.kernel.org
 help / color / Atom feed
* Re: Documentation error for "sched_getaffinity"
       [not found] <e5e7506b47e8442492478aadf289979b@mbx03.liveapp.local>
@ 2019-09-25 12:42 ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; only message in thread
From: Michael Kerrisk (man-pages) @ 2019-09-25 12:42 UTC (permalink / raw)
  To: unlisted-recipients:; (no To-header on input); +Cc: mtk.manpages, linux-man

Hello Marc,

On 9/25/19 11:33 AM, Marc Brandis wrote:
> Hello,
> 
> I noticed the following documentation error in the online man pages
> (man7.org) for the "sched_getaffinity(2)" system call. It incorrectly
> says that sched_getaffinity returns 0 on success; instead it returns
> the number of bits in the CPU set, which I assume is the number of


I think you mean "bytes", not "bits"

> CPUs (incl. hyperthreading) the system has.

> I am running on Linux kernel 4.15.0-62 in Ubuntu build 18.04. I came
> across it when debugging a multi-threaded program using the call, and
> that program passing a large buffer for the cpuset parameter (8
> kBytes).
> 
> It is not just a typo or grammar issue, but I still was not sure
> whether this should be reported through Bugzilla.

The explanation for what you are seeing is actually covered 
lower in the page:

   C library/kernel differences
       ...
       On  success,  the  raw sched_getaffinity() system call returns the
       number of bytes placed copied into the mask buffer; this  will  be
       the minimum of cpusetsize and the size (in bytes) of the cpumask_t
       data type that is used internally by the kernel to  represent  the
       CPU set bit mask.

But, you're not the first to miss this detail, so I've just now modified
the RETURN VALUE section to make it easier for people to find that text:

       On  success,  sched_setaffinity() and sched_getaffinity() return 0
       (but see "C library/kernel differences" below,  which  notes  that
       the  underlying  sched_getaffinity() differs in its return value).

Thanks,


Michael
-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <e5e7506b47e8442492478aadf289979b@mbx03.liveapp.local>
2019-09-25 12:42 ` Documentation error for "sched_getaffinity" Michael Kerrisk (man-pages)

Linux-man Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-man/0 linux-man/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-man linux-man/ https://lore.kernel.org/linux-man \
		linux-man@vger.kernel.org
	public-inbox-index linux-man

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-man


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git