函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:fs\devpts\inode.c Create Date:2022-07-29 11:11:00
首页 Copyright©Brick

524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
/*
 * The normal naming convention is simply /dev/pts/<number>; this conforms
 * to the System V naming convention
 */
 
int devpts_new_index(struct pts_fs_info *fsi)
{
    int index = -ENOSPC;
 
    if (atomic_inc_return(&pty_count) >= (pty_limit -
              (fsi->mount_opts.reserve ? 0 : pty_reserve)))
        goto out;
 
    index = ida_alloc_max(&fsi->allocated_ptys, fsi->mount_opts.max - 1,
            GFP_KERNEL);
 
out:
    if (index < 0)
        atomic_dec(&pty_count);
    return index;
}