rpms/man-pages/devel man-pages-3.22-sched_setaffinity.patch, NONE, 1.1 man-pages.spec, 1.124, 1.125
Ivana Varekova
varekova at fedoraproject.org
Wed Dec 2 14:42:05 UTC 2009
- Previous message (by thread): rpms/kdetoys/devel .cvsignore, 1.45, 1.46 kdetoys.spec, 1.62, 1.63 sources, 1.41, 1.42
- Next message (by thread): rpms/kdebase-workspace/F-11 kdebase-workspace-4.3.3-kdm_plymouth.patch, 1.1, 1.2 kdebase-workspace.spec, 1.249, 1.250
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: varekova
Update of /cvs/pkgs/rpms/man-pages/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv21813
Modified Files:
man-pages.spec
Added Files:
man-pages-3.22-sched_setaffinity.patch
Log Message:
- fix sched_setaffinity(2) page - add an EXAMPLE and new NOTES
man-pages-3.22-sched_setaffinity.patch:
sched_setaffinity.2 | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
--- NEW FILE man-pages-3.22-sched_setaffinity.patch ---
diff -up man-pages-3.22/man2/sched_setaffinity.2.orig man-pages-3.22/man2/sched_setaffinity.2
--- man-pages-3.22/man2/sched_setaffinity.2.orig 2009-07-25 08:53:26.000000000 +0200
+++ man-pages-3.22/man2/sched_setaffinity.2 2009-12-02 15:29:17.000000000 +0100
@@ -212,6 +212,60 @@ system call returns the size (in bytes)
.I cpumask_t
data type that is used internally by the kernel to
represent the CPU set bit mask.
+
+The \fBcpu_set_t\fR affinity mask size provided by glibc only allows for upto
+1024 CPUs. It is possible to build Linux kernels with greater than 1024
+CPUs. Any application using the statically sized \fBcpu_set_t\fR will fail
+with \fBEINVAL\fR on such kernels. It is thus recommended that applications
+avoid using the statically sized \fBcpu_set_t\fR type, and instead dynamically
+allocate a mask using the CPU_*_S macros described in the \fBCPU_SET(3)\fR man
+page. Since it is not possible to determine ahead of time what \fBNR_CPUS\fR
+value the kernel was built with, applications must be prepared to catch
+\fBEINVAL\fR, and retry the command with a larger dynamically allocated mask.
+The example that follows illustrates portable usage.
+
+.SH EXAMPLE
+.nf
+ #define _GNU_SOURCE
+
+ #include <sched.h>
+ #include <stdio.h>
+ #include <errno.h>
+
+ int main(void)
+ {
+ cpu_set_t *mask;
+ size_t size;
+ int i;
+ int nrcpus = 1024;
+
+realloc:
+ mask = CPU_ALLOC(nrcpus);
+ size = CPU_ALLOC_SIZE(nrcpus);
+ CPU_ZERO_S(size, mask);
+ if ( sched_getaffinity(0, size, mask) == -1 ) {
+ CPU_FREE(mask);
+ if (errno == EINVAL &&
+ nrcpus < (1024 << 8)) {
+ nrcpus = nrcpus << 2;
+ goto realloc;
+ }
+ perror("sched_getaffinity");
+ return -1;
+ }
+
+ for ( i = 0; i < nrcpus; i++ ) {
+ if ( CPU_ISSET_S(i, size, mask) ) {
+ printf("CPU %d is set\n", (i+1));
+ }
+ }
+
+ CPU_FREE(mask);
+
+ return 0;
+ }
+.fi
+
.SH "SEE ALSO"
.BR clone (2),
.BR getcpu (2),
Index: man-pages.spec
===================================================================
RCS file: /cvs/pkgs/rpms/man-pages/devel/man-pages.spec,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -p -r1.124 -r1.125
--- man-pages.spec 18 Nov 2009 12:25:03 -0000 1.124
+++ man-pages.spec 2 Dec 2009 14:42:05 -0000 1.125
@@ -4,7 +4,7 @@
Summary: Man (manual) pages from the Linux Documentation Project
Name: man-pages
Version: 3.23
-Release: 2%{?dist}
+Release: 3%{?dist}
License: GPLv2+ and GPL+ and BSD and MIT and Copyright only and IEEE
Group: Documentation
URL: http://www.kernel.org/pub/linux/docs/manpages/
@@ -33,6 +33,7 @@ Patch56: man-pages-3.22-strcpy.patch
Patch57: man-pages-3.22-nsswitch.conf.patch
Patch58: man-pages-3.23-proc.patch
Patch59: man-pages-3.23-ld.so.patch
+Patch60: man-pages-3.22-sched_setaffinity.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Autoreq: false
@@ -64,6 +65,7 @@ rmdir man-pages-posix-%{posix_version}-%
%patch57 -p1
%patch58 -p1
%patch59 -p1
+%patch60 -p1
### And now remove those we are not going to use:
@@ -134,6 +136,9 @@ rm -rf $RPM_BUILD_ROOT
%lang(en) %{_mandir}/en/man*
%changelog
+* Wed Dec 2 2009 Ivana Hutarova Varekova <varekova at redhat.com> - 3.22-7
+- fix sched_setaffinity(2) page - add an EXAMPLE and new NOTES
+
* Wed Nov 18 2009 Ivana Varekova <varekova at redhat.com> - 3.23-2
- fix ld.so man-page (#532629)
- Previous message (by thread): rpms/kdetoys/devel .cvsignore, 1.45, 1.46 kdetoys.spec, 1.62, 1.63 sources, 1.41, 1.42
- Next message (by thread): rpms/kdebase-workspace/F-11 kdebase-workspace-4.3.3-kdm_plymouth.patch, 1.1, 1.2 kdebase-workspace.spec, 1.249, 1.250
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list