2016-07-15 17:39:33 +02:00
|
|
|
/****************************************************************************
|
2018-05-29 21:21:26 +02:00
|
|
|
* libs/libc/stdlib/lib_unlockpt.c
|
2016-07-15 17:39:33 +02:00
|
|
|
*
|
2021-03-02 15:54:21 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2016-07-15 17:39:33 +02:00
|
|
|
*
|
2021-03-02 15:54:21 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2016-07-15 17:39:33 +02:00
|
|
|
*
|
2021-03-02 15:54:21 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2016-07-15 17:39:33 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#ifdef CONFIG_PSEUDOTERM
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: unlockpt
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* The unlockpt() function unlocks the slave pseudoterminal device
|
2017-06-28 18:39:54 +02:00
|
|
|
* corresponding to the master pseudoterminal referred to by fd.
|
2016-07-15 17:39:33 +02:00
|
|
|
* unlockpt() must be called before opening the slave side of a
|
2017-06-28 18:39:54 +02:00
|
|
|
* pseudoterminal.
|
2016-07-15 17:39:33 +02:00
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2016-07-15 17:39:33 +02:00
|
|
|
* When successful, unlockpt() returns 0. Otherwise, it returns -1 and
|
|
|
|
* sets errno appropriately.
|
|
|
|
*
|
2017-06-28 18:39:54 +02:00
|
|
|
* EBADF - The fd argument is not a file descriptor open for writing.
|
2016-07-15 17:39:33 +02:00
|
|
|
* EINVAL - The fd argument is not associated with a master
|
|
|
|
* pseudoterminal
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int unlockpt(int fd)
|
|
|
|
{
|
|
|
|
return ioctl(fd, TIOCSPTLCK, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_PSEUDOTERM */
|