busybox 1.6.1 miscutils/taskset problem with glibc, wrong number of params

Brian Austin brian.austin at cirrus.com
Wed Sep 12 14:32:13 UTC 2007


what version are you using?

the newer ones have 3 I believe.  But I'm not exactly sure since we use
uClibc mostly


On Wed, 2007-09-12 at 10:21 -0400, Paul Barrette wrote:
> Glibc's  sched_setaffinity only has two args
> extern int sched_setaffinity (__pid_t __pid, __const cpu_set_t *__mask)
> 
> While uclibc has 3.
> 
> 
> CC      miscutils/taskset.o
> miscutils/taskset.c: In function `taskset_main':
> miscutils/taskset.c:78: warning: passing arg 2 of `sched_getaffinity' 
> makes pointer from integer without a cast
> miscutils/taskset.c:78: error: too many arguments to function 
> `sched_getaffinity'
> miscutils/taskset.c:86: warning: passing arg 2 of `sched_setaffinity' 
> makes pointer from integer without a cast
> miscutils/taskset.c:86: error: too many arguments to function 
> `sched_setaffinity'
> make[1]: *** [miscutils/taskset.o] Error 1
> make: *** [miscutils] Error 2
> 
> Something like this should work, unless there is a more elegant way:
> --- bk.taskset.c        2007-06-30 11:06:44.000000000 -0400
> +++ taskset.c   2007-09-12 10:12:29.324150000 -0400
> @@ -75,7 +75,13 @@
> 
>        if (opt & OPT_p) {
>  print_aff:
> +               /* Pb: glibc has 2 params for this func */
> +#ifdef __GLIBC__
> +#warning "GLIBC DEFINED"
> +               if (sched_getaffinity(pid,  &mask) < 0)
> +#else
>                if (sched_getaffinity(pid, sizeof(mask), &mask) < 0)
> +#endif
>                        bb_perror_msg_and_die("failed to %cet pid %d's 
> affinity", 'g', pid);
>                printf("pid %d's %s affinity mask: "TASKSET_PRINTF_MASK"\n",
>                                pid, state, from_cpuset(mask));
> @@ -83,7 +89,12 @@
>                        return EXIT_SUCCESS;
>        }
> 
> +       /* Pb: glibc has 2 params for this func */
> +#ifdef __GLIBC__
> +       if (sched_setaffinity(pid,  &new_mask))
> +#else
>        if (sched_setaffinity(pid, sizeof(new_mask), &new_mask))
> +#endif
>                bb_perror_msg_and_die("failed to %cet pid %d's affinity", 
> 's', pid);
>        if (opt & OPT_p) {
>                state += 8;
> 





More information about the busybox mailing list