Patchwork Fix sol-thread.c compilation on Solaris

login
register
mail settings
Submitter Rainer Orth
Date Nov. 29, 2017, 1:26 p.m.
Message ID <yddtvxdcj22.fsf@CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/24595/
State New
Headers show

Comments

Rainer Orth - Nov. 29, 2017, 1:26 p.m.
Hi Pedro,

> On 11/28/2017 01:23 PM, Rainer Orth wrote:
>> 
>> # HG changeset patch
>> # Parent  d3867b61620919242bbc9d875d355487a4e71e96
>> Fix sol-thread.c compilation on Solaris
>> 
>> diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
>> --- a/gdb/sol-thread.c
>> +++ b/gdb/sol-thread.c
>> @@ -112,7 +112,7 @@ typedef td_err_e (td_ta_get_nthreads_fty
>>  typedef td_err_e (td_ta_tsd_iter_ftype)(const td_thragent_t *ta_p,
>>  					td_key_iter_f *cb, void *cbdata_p);
>>  typedef td_err_e (td_ta_thr_iter_ftype)(const td_thragent_t *ta_p,
>> -					td_thr_iter_f *cb, void *cbdata_p,
>> +					td_thr_iter_f *cb, const void *cbdata_p,
>
> Pedantically, I'd think it better that this prototype
> continues to match the prototype declared in Solaris's
> proc_service.h (...)

indeed: <thread_db.h> has

td_err_e
td_ta_thr_iter(const td_thragent_t *, td_thr_iter_f *, void *,
	td_thr_state_e, int, sigset_t *, unsigned);

i.e. without the const.

>> @@ -1122,7 +1122,7 @@ info_cb (const td_thrhandle_t *th, void 
>>     inferior.  */
>>  
>>  static void
>> -info_solthreads (char *args, int from_tty)
>> +info_solthreads (const char *args, int from_tty)
>>  {
>>    p_td_ta_thr_iter (main_ta, info_cb, args,
>>  		    TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
>
> (...) which I guess means using '(void *) args' here.  WDYT?

Makes sense.  The resulting patch works just as well.

	Rainer
Pedro Alves - Nov. 29, 2017, 2:07 p.m.
On 11/29/2017 01:26 PM, Rainer Orth wrote:
> Hi Pedro,
> 
>> On 11/28/2017 01:23 PM, Rainer Orth wrote:
>>>
>>> # HG changeset patch
>>> # Parent  d3867b61620919242bbc9d875d355487a4e71e96
>>> Fix sol-thread.c compilation on Solaris
>>>
>>> diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
>>> --- a/gdb/sol-thread.c
>>> +++ b/gdb/sol-thread.c
>>> @@ -112,7 +112,7 @@ typedef td_err_e (td_ta_get_nthreads_fty
>>>  typedef td_err_e (td_ta_tsd_iter_ftype)(const td_thragent_t *ta_p,
>>>  					td_key_iter_f *cb, void *cbdata_p);
>>>  typedef td_err_e (td_ta_thr_iter_ftype)(const td_thragent_t *ta_p,
>>> -					td_thr_iter_f *cb, void *cbdata_p,
>>> +					td_thr_iter_f *cb, const void *cbdata_p,
>>
>> Pedantically, I'd think it better that this prototype
>> continues to match the prototype declared in Solaris's
>> proc_service.h (...)
> 
> indeed: <thread_db.h> has
> 
> td_err_e
> td_ta_thr_iter(const td_thragent_t *, td_thr_iter_f *, void *,
> 	td_thr_state_e, int, sigset_t *, unsigned);
> 
> i.e. without the const.
> 
>>> @@ -1122,7 +1122,7 @@ info_cb (const td_thrhandle_t *th, void 
>>>     inferior.  */
>>>  
>>>  static void
>>> -info_solthreads (char *args, int from_tty)
>>> +info_solthreads (const char *args, int from_tty)
>>>  {
>>>    p_td_ta_thr_iter (main_ta, info_cb, args,
>>>  		    TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
>>
>> (...) which I guess means using '(void *) args' here.  WDYT?
> 
> Makes sense.  The resulting patch works just as well.

OK.

BTW, while you're here, I believe there's nothing blocking
the "Remove ioctl-based procfs support on Solaris" patch
at this point, right?

Thanks,
Pedro Alves
Rainer Orth - Nov. 29, 2017, 2:09 p.m.
Hi Pedro,

> BTW, while you're here, I believe there's nothing blocking
> the "Remove ioctl-based procfs support on Solaris" patch
> at this point, right?

nothing except for completing the testing, which is what I'm doing as we
speak ;-)

	Rainer

Patch

# HG changeset patch
# Parent  b50d57495ca9e18f5c34b0bf201f7e7fc7509094
Fix sol-thread.c compilation on Solaris

diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -1122,9 +1122,9 @@  info_cb (const td_thrhandle_t *th, void 
    inferior.  */
 
 static void
-info_solthreads (char *args, int from_tty)
+info_solthreads (const char *args, int from_tty)
 {
-  p_td_ta_thr_iter (main_ta, info_cb, args,
+  p_td_ta_thr_iter (main_ta, info_cb, (void *) args,
 		    TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
 		    TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
 }