PTY: Fix a few errors from early testing

This commit is contained in:
Gregory Nutt 2016-07-15 14:09:02 -06:00
parent e7f0a56498
commit 4b5149b244
2 changed files with 12 additions and 6 deletions

View File

@ -226,7 +226,13 @@ static int ptmx_open(FAR struct file *filep)
goto errout_with_sem;
}
/* Create the master slave pair */
/* Create the master slave pair. This should create:
*
* Slave device: /dev/pts/N
* Master device: /dev/ptyN
*
* Where N=minor
*/
ret = pty_register(minor);
if (ret < 0)
@ -234,9 +240,9 @@ static int ptmx_open(FAR struct file *filep)
goto errout_with_minor;
}
/* Open the master side */
/* Open the master device: /dev/ptyN, where N=minor */
snprintf(devname, 16, "/dev/ttyp%d", minor);
snprintf(devname, 16, "/dev/pty%d", minor);
fd = open(devname, O_RDWR);
DEBUGASSERT(fd >= 0); /* open() should never fail */

View File

@ -111,7 +111,7 @@ struct pty_devpair_s
* Private Data
****************************************************************************/
static const struct file_operations pty_fops =
static const struct file_operations g_pty_fops =
{
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
pty_open, /* open */
@ -691,7 +691,7 @@ int pty_register(int minor)
snprintf(devname, 16, "/dev/pts/%d", minor);
#endif
ret = register_driver(devname, &pty_fops, 0666, &devpair->pp_slave);
ret = register_driver(devname, &g_pty_fops, 0666, &devpair->pp_slave);
if (ret < 0)
{
goto errout_with_pipeb;
@ -707,7 +707,7 @@ int pty_register(int minor)
snprintf(devname, 16, "/dev/pty%d", minor);
ret = register_driver(devname, &pty_fops, 0666, &devpair->pp_master);
ret = register_driver(devname, &g_pty_fops, 0666, &devpair->pp_master);
if (ret < 0)
{
goto errout_with_slave;