@@ -20,6 +20,7 @@
|
|||||||
#define F_GETLK 0x0020 /* get locking information */
|
#define F_GETLK 0x0020 /* get locking information */
|
||||||
#define F_SETLK 0x0080 /* set locking information */
|
#define F_SETLK 0x0080 /* set locking information */
|
||||||
#define F_SETLKW 0x0100 /* as above, but waits if blocked */
|
#define F_SETLKW 0x0100 /* as above, but waits if blocked */
|
||||||
|
#define F_DUPFD_CLOEXEC 0x0200 /* duplicate fd with close on exec set */
|
||||||
|
|
||||||
/* advisory locking types */
|
/* advisory locking types */
|
||||||
#define F_RDLCK 0x0040 /* read or shared lock */
|
#define F_RDLCK 0x0040 /* read or shared lock */
|
||||||
|
|||||||
@@ -6147,13 +6147,14 @@ common_fcntl(int fd, int op, size_t argument, bool kernel)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case F_DUPFD:
|
case F_DUPFD:
|
||||||
|
case F_DUPFD_CLOEXEC:
|
||||||
{
|
{
|
||||||
struct io_context* context = get_current_io_context(kernel);
|
struct io_context* context = get_current_io_context(kernel);
|
||||||
|
|
||||||
status = new_fd_etc(context, descriptor, (int)argument);
|
status = new_fd_etc(context, descriptor, (int)argument);
|
||||||
if (status >= 0) {
|
if (status >= 0) {
|
||||||
mutex_lock(&context->io_mutex);
|
mutex_lock(&context->io_mutex);
|
||||||
fd_set_close_on_exec(context, fd, false);
|
fd_set_close_on_exec(context, fd, op == F_DUPFD_CLOEXEC);
|
||||||
mutex_unlock(&context->io_mutex);
|
mutex_unlock(&context->io_mutex);
|
||||||
|
|
||||||
atomic_add(&descriptor->ref_count, 1);
|
atomic_add(&descriptor->ref_count, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user