[PATCH 9/9] telnetd: Use syslog() instead of printk()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue May 1 09:03:17 UTC 2018


----- Am 1. Mai 2018 um 0:12 schrieb joel joel at rtems.org:

> Sorry to ask this but is there a syslog service that needs to be started
> before
> telnetd? Is there some dependency?

The syslog() function uses printf() for output without extra initialization.

> 
> What's the rationale for this change?

printk() should not be used for normal output. The syslog9) is already used in other places of the telnetd and ftpd.

> 
> On Mon, Apr 30, 2018 at 4:48 AM, Sebastian Huber <
> sebastian.huber at embedded-brains.de> wrote:
> 
>> Update #3419.
>> ---
>>  cpukit/telnetd/pty.c          | 10 ++++++++--
>>  cpukit/telnetd/telnetd-init.c |  2 +-
>>  2 files changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/cpukit/telnetd/pty.c b/cpukit/telnetd/pty.c
>> index d41de97d85..14d688018f 100644
>> --- a/cpukit/telnetd/pty.c
>> +++ b/cpukit/telnetd/pty.c
>> @@ -42,6 +42,7 @@
>>  #include <stdio.h>
>>  #include <stdlib.h>
>>  #include <string.h>
>> +#include <syslog.h>
>>  #include <unistd.h>
>>  /*-----------------------------------------*/
>>  #define IAC_ESC    255
>> @@ -453,8 +454,13 @@ rtems_device_driver my_pty_initialize(
>>      chmod(telnet_ptys[ndx].devname,0660);
>>      chown(telnet_ptys[ndx].devname,2,0); /* tty,root*/
>>    };
>> -  printk("Device: /dev/pty%X../dev/pty%X (%d)pseudo-terminals
>> registered.\n",
>> -          0,rtems_telnetd_maximum_ptys-1,rtems_telnetd_maximum_ptys);
>> +  syslog(
>> +    LOG_KERN | LOG_INFO,
>> +    "/dev/pty%X../dev/pty%X (%d) pseudo-terminals registered.\n",
>> +    0,
>> +    rtems_telnetd_maximum_ptys - 1,
>> +    rtems_telnetd_maximum_ptys
>> +  );
>>
>>    return RTEMS_SUCCESSFUL;
>>  }
>> diff --git a/cpukit/telnetd/telnetd-init.c b/cpukit/telnetd/telnetd-init.c
>> index 760db41fcc..7762ad70ba 100644
>> --- a/cpukit/telnetd/telnetd-init.c
>> +++ b/cpukit/telnetd/telnetd-init.c
>> @@ -12,7 +12,7 @@
>>
>>  #include <rtems/telnetd.h>
>>
>> -int rtems_initialize_telnetd( void )
>> +rtems_status_code rtems_telnetd_initialize( void )
>>  {
>>    return rtems_telnetd_start( &rtems_telnetd_config );
>>  }
>> --
>> 2.12.3
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list