相关疑难解决方法(0)

增加FD_SETSIZE的限制并选择

我想为我的系统增加FD_SETSIZE宏值.有没有办法增加FD_SETSIZE所以选择不会失败

c linux file-descriptor

17
推荐指数
4
解决办法
4万
查看次数

我可以在Perl中打开的文件句柄数量是否有限制?

我正在设置包含文件句柄的哈希引用.

我的输入文件的第四列包含一个标识符字段,我用它来命名文件句柄的目标:

col1    col2    col3    id-0008    col5
col1    col2    col3    id-0002    col5
col1    col2    col3    id-0001    col5
col1    col2    col3    id-0001    col5
col1    col2    col3    id-0007    col5
...
col1    col2    col3    id-0003    col5
Run Code Online (Sandbox Code Playgroud)

我使用GNU核心实用程序来获取标识符列表:

$ cut -f4 myFile | sort | uniq
id-0001
id-0002
...
Run Code Online (Sandbox Code Playgroud)

此列中可以有超过1024个唯一标识符,我需要为每个标识符打开一个文件句柄,并将该句柄放入哈希引用中.

my $fhsRef;
my $fileOfInterest = "/foo/bar/fileOfInterest.txt";

openFileHandles($fileOfInterest);
closeFileHandles();

sub openFileHandles {                                                                                                                                                                                                              
    my ($fn) = @_;                                                                                                                                                                                                              

    print STDERR "getting set names... (this may take a few moments)\n";                                                                                                                                                           
    my $resultStr = `cut -f4 $fn | sort …
Run Code Online (Sandbox Code Playgroud)

io perl file-io

2
推荐指数
2
解决办法
2300
查看次数

标签 统计

c ×1

file-descriptor ×1

file-io ×1

io ×1

linux ×1

perl ×1