All of lore.kernel.org
 help / color / mirror / Atom feed
* no files can be opened in a C program
@ 2011-07-25 11:31 Venkateswarlu P
  2011-07-25 11:48 ` Anuz Pratap Singh Tomar
  0 siblings, 1 reply; 9+ messages in thread
From: Venkateswarlu P @ 2011-07-25 11:31 UTC (permalink / raw)
  To: kernelnewbies

What is the Max no of files that can be opened simultaneously within a
Single C program.

i want this information for kenel compilation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110725/8f3a6aa5/attachment.html 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* no files can be opened in a C program
  2011-07-25 11:31 no files can be opened in a C program Venkateswarlu P
@ 2011-07-25 11:48 ` Anuz Pratap Singh Tomar
  2011-07-25 11:59   ` Naveen Kumar
  0 siblings, 1 reply; 9+ messages in thread
From: Anuz Pratap Singh Tomar @ 2011-07-25 11:48 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Jul 25, 2011 at 12:31 PM, Venkateswarlu P
<p.venkatesh551@gmail.com>wrote:

>
> What is the Max no of files that can be opened simultaneously within a
> Single C program.
>
> i want this information for kenel compilation
>
>
> See man 3 setrlimit
Total number of files that can be opened should depend on file system.
And what this has to do with kernel compilation?

>
>
>
>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110725/8a3e8926/attachment.html 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* no files can be opened in a C program
  2011-07-25 11:48 ` Anuz Pratap Singh Tomar
@ 2011-07-25 11:59   ` Naveen Kumar
  2011-07-25 12:35     ` Abhijit Pawar
  0 siblings, 1 reply; 9+ messages in thread
From: Naveen Kumar @ 2011-07-25 11:59 UTC (permalink / raw)
  To: kernelnewbies

You can use command ulimit -a, there you can check the limit for a process.

Thanks,
Naveen

On Mon, Jul 25, 2011 at 5:18 PM, Anuz Pratap Singh Tomar <
chambilkethakur@gmail.com> wrote:

>
>
> On Mon, Jul 25, 2011 at 12:31 PM, Venkateswarlu P <
> p.venkatesh551 at gmail.com> wrote:
>
>>
>> What is the Max no of files that can be opened simultaneously within a
>> Single C program.
>>
>> i want this information for kenel compilation
>>
>>
>> See man 3 setrlimit
> Total number of files that can be opened should depend on file system.
> And what this has to do with kernel compilation?
>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110725/5588ad6d/attachment.html 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* no files can be opened in a C program
  2011-07-25 11:59   ` Naveen Kumar
@ 2011-07-25 12:35     ` Abhijit Pawar
  2011-07-25 15:50       ` Dave Hylands
  0 siblings, 1 reply; 9+ messages in thread
From: Abhijit Pawar @ 2011-07-25 12:35 UTC (permalink / raw)
  To: kernelnewbies

On 07/25/2011 05:29 PM, Naveen Kumar wrote:
> You can use command ulimit -a, there you can check the limit for a 
> process.
>
> Thanks,
> Naveen
Ulimit gives 1024 as open file limit. In struct task_struct it has a 
member called struct files_struct *files;

I tried checking for this member and the limit however I am  not able to 
decide correctly why the limit is 1024.
  Also, is there any distinction between 32 bit and 64 bit systems for 
this limit?


> On Mon, Jul 25, 2011 at 5:18 PM, Anuz Pratap Singh Tomar 
> <chambilkethakur at gmail.com <mailto:chambilkethakur@gmail.com>> wrote:
>
>
>
>     On Mon, Jul 25, 2011 at 12:31 PM, Venkateswarlu P
>     <p.venkatesh551 at gmail.com <mailto:p.venkatesh551@gmail.com>> wrote:
>
>
>         What is the Max no of files that can be opened simultaneously
>         within a Single C program.
>
>         i want this information for kenel compilation
>
>
>     See man 3 setrlimit
>     Total number of files that can be opened should depend on file system.
>     And what this has to do with kernel compilation?
>
>
>
>
>
>
>
>         _______________________________________________
>         Kernelnewbies mailing list
>         Kernelnewbies at kernelnewbies.org
>         <mailto:Kernelnewbies@kernelnewbies.org>
>         http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
>     _______________________________________________
>     Kernelnewbies mailing list
>     Kernelnewbies at kernelnewbies.org
>     <mailto:Kernelnewbies@kernelnewbies.org>
>     http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Regards,
Abhijit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110725/f1f0846a/attachment-0001.html 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* no files can be opened in a C program
  2011-07-25 12:35     ` Abhijit Pawar
@ 2011-07-25 15:50       ` Dave Hylands
  2011-07-26  4:29         ` Abhijit Pawar
  0 siblings, 1 reply; 9+ messages in thread
From: Dave Hylands @ 2011-07-25 15:50 UTC (permalink / raw)
  To: kernelnewbies

Hi Abhijit,

On Mon, Jul 25, 2011 at 6:35 AM, Abhijit Pawar <apawar.linux@gmail.com> wrote:
> On 07/25/2011 05:29 PM, Naveen Kumar wrote:
>
> You can use command ulimit -a, there you can check the limit for a process.
>
> Thanks,
> Naveen
>
> Ulimit gives 1024 as open file limit. In struct task_struct it has a member
> called struct files_struct *files;
>
> I tried checking for this member and the limit however I am? not able to
> decide correctly why the limit is 1024.
> ?Also, is there any distinction between 32 bit and 64 bit systems for this
> limit?

My 64-bit system reports 1024 as well.

I have no troubles compiling kernels.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* no files can be opened in a C program
  2011-07-25 15:50       ` Dave Hylands
@ 2011-07-26  4:29         ` Abhijit Pawar
  2011-07-26  4:41           ` Manish Katiyar
  0 siblings, 1 reply; 9+ messages in thread
From: Abhijit Pawar @ 2011-07-26  4:29 UTC (permalink / raw)
  To: kernelnewbies

Hi Dave,
On 07/25/2011 09:20 PM, Dave Hylands wrote:
> Hi Abhijit,
>
> On Mon, Jul 25, 2011 at 6:35 AM, Abhijit Pawar<apawar.linux@gmail.com>  wrote:
>> On 07/25/2011 05:29 PM, Naveen Kumar wrote:
>>
>> You can use command ulimit -a, there you can check the limit for a process.
>>
>> Thanks,
>> Naveen
>>
>> Ulimit gives 1024 as open file limit. In struct task_struct it has a member
>> called struct files_struct *files;
>>
>> I tried checking for this member and the limit however I am  not able to
>> decide correctly why the limit is 1024.
>>   Also, is there any distinction between 32 bit and 64 bit systems for this
>> limit?
> My 64-bit system reports 1024 as well.
>
> I have no troubles compiling kernels.
>
Thanks. Yes, on my 64 bit Fedora 15 I get same value as yours.

What I am interested in is knowing why the limit is on 1024 File 
Descriptors? That means 1024 Inodes. AFAIK there isnt anything written 
in filesystem code which will put this limit of 1024 inodes for a process.
This means its very specific to the process.
Unfortunately I am know having details on the process front. Is there 
anything which you or anyone aware in process area because of which this 
limit is there?

Thanks again.

Regards,
Abhijit Pawar.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* no files can be opened in a C program
  2011-07-26  4:29         ` Abhijit Pawar
@ 2011-07-26  4:41           ` Manish Katiyar
  2011-07-26  4:52             ` Manish Katiyar
  0 siblings, 1 reply; 9+ messages in thread
From: Manish Katiyar @ 2011-07-26  4:41 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Jul 25, 2011 at 9:29 PM, Abhijit Pawar <apawar.linux@gmail.com> wrote:
> Hi Dave,
> On 07/25/2011 09:20 PM, Dave Hylands wrote:
>> Hi Abhijit,
>>
>> On Mon, Jul 25, 2011 at 6:35 AM, Abhijit Pawar<apawar.linux@gmail.com> ?wrote:
>>> On 07/25/2011 05:29 PM, Naveen Kumar wrote:
>>>
>>> You can use command ulimit -a, there you can check the limit for a process.
>>>
>>> Thanks,
>>> Naveen
>>>
>>> Ulimit gives 1024 as open file limit. In struct task_struct it has a member
>>> called struct files_struct *files;
>>>
>>> I tried checking for this member and the limit however I am ?not able to
>>> decide correctly why the limit is 1024.
>>> ? Also, is there any distinction between 32 bit and 64 bit systems for this
>>> limit?
>> My 64-bit system reports 1024 as well.
>>
>> I have no troubles compiling kernels.
>>
> Thanks. Yes, on my 64 bit Fedora 15 I get same value as yours.
>
> What I am interested in is knowing why the limit is on 1024 File
> Descriptors? That means 1024 Inodes. AFAIK there isnt anything written
> in filesystem code which will put this limit of 1024 inodes for a process.
> This means its very specific to the process.
> Unfortunately I am know having details on the process front. Is there
> anything which you or anyone aware in process area because of which this
> limit is there?

man getdtablesize

-- 
Thanks -
Manish

^ permalink raw reply	[flat|nested] 9+ messages in thread

* no files can be opened in a C program
  2011-07-26  4:41           ` Manish Katiyar
@ 2011-07-26  4:52             ` Manish Katiyar
  2011-07-26  5:05               ` Abhijit Pawar
  0 siblings, 1 reply; 9+ messages in thread
From: Manish Katiyar @ 2011-07-26  4:52 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Jul 25, 2011 at 9:41 PM, Manish Katiyar <mkatiyar@gmail.com> wrote:
> On Mon, Jul 25, 2011 at 9:29 PM, Abhijit Pawar <apawar.linux@gmail.com> wrote:
>> Hi Dave,
>> On 07/25/2011 09:20 PM, Dave Hylands wrote:
>>> Hi Abhijit,
>>>
>>> On Mon, Jul 25, 2011 at 6:35 AM, Abhijit Pawar<apawar.linux@gmail.com> ?wrote:
>>>> On 07/25/2011 05:29 PM, Naveen Kumar wrote:
>>>>
>>>> You can use command ulimit -a, there you can check the limit for a process.
>>>>
>>>> Thanks,
>>>> Naveen
>>>>
>>>> Ulimit gives 1024 as open file limit. In struct task_struct it has a member
>>>> called struct files_struct *files;
>>>>
>>>> I tried checking for this member and the limit however I am ?not able to
>>>> decide correctly why the limit is 1024.
>>>> ? Also, is there any distinction between 32 bit and 64 bit systems for this
>>>> limit?
>>> My 64-bit system reports 1024 as well.
>>>
>>> I have no troubles compiling kernels.
>>>
>> Thanks. Yes, on my 64 bit Fedora 15 I get same value as yours.
>>
>> What I am interested in is knowing why the limit is on 1024 File
>> Descriptors? That means 1024 Inodes. AFAIK there isnt anything written
>> in filesystem code which will put this limit of 1024 inodes for a process.
>> This means its very specific to the process.
>> Unfortunately I am know having details on the process front. Is there
>> anything which you or anyone aware in process area because of which this
>> limit is there?
>
> man getdtablesize

and if you trace the kernel code, it comes from the limits of the init
task, which is hard coded during creation. You can get/set these
values using getrlimit/setrlimit.


include/linux/init_task.h
33 #define INIT_SIGNALS(sig) {                                             \
.................
.................
 41         .rlim           = INIT_RLIMITS,
..............

include/asm-generic/resource.h
 72 #define INIT_RLIMITS                                                    \
 73 {                                                                       \
 74         [RLIMIT_CPU]            = {  RLIM_INFINITY,  RLIM_INFINITY },   \
 75         [RLIMIT_FSIZE]          = {  RLIM_INFINITY,  RLIM_INFINITY },   \
 76         [RLIMIT_DATA]           = {  RLIM_INFINITY,  RLIM_INFINITY },   \
 77         [RLIMIT_STACK]          = {       _STK_LIM,   _STK_LIM_MAX },   \
 78         [RLIMIT_CORE]           = {              0,  RLIM_INFINITY },   \
 79         [RLIMIT_RSS]            = {  RLIM_INFINITY,  RLIM_INFINITY },   \
 80         [RLIMIT_NPROC]          = {              0,              0 },   \
 81         [RLIMIT_NOFILE]         = {   INR_OPEN_CUR,   INR_OPEN_MAX },   \
...............
..............

include/linux/fs.h
25 #undef NR_OPEN
 26 #define INR_OPEN_CUR 1024       /* Initial setting for nfile rlimits */
 27 #define INR_OPEN_MAX 4096       /* Hard limit for nfile rlimits */


HTH
-- 
Thanks -
Manish

^ permalink raw reply	[flat|nested] 9+ messages in thread

* no files can be opened in a C program
  2011-07-26  4:52             ` Manish Katiyar
@ 2011-07-26  5:05               ` Abhijit Pawar
  0 siblings, 0 replies; 9+ messages in thread
From: Abhijit Pawar @ 2011-07-26  5:05 UTC (permalink / raw)
  To: kernelnewbies

Hi Manish,
On 07/26/2011 10:22 AM, Manish Katiyar wrote:
> On Mon, Jul 25, 2011 at 9:41 PM, Manish Katiyar<mkatiyar@gmail.com>  wrote:
>> On Mon, Jul 25, 2011 at 9:29 PM, Abhijit Pawar<apawar.linux@gmail.com>  wrote:
>>> Hi Dave,
>>> On 07/25/2011 09:20 PM, Dave Hylands wrote:
>>>> Hi Abhijit,
>>>>
>>>> On Mon, Jul 25, 2011 at 6:35 AM, Abhijit Pawar<apawar.linux@gmail.com>    wrote:
>>>>> On 07/25/2011 05:29 PM, Naveen Kumar wrote:
>>>>>
>>>>> You can use command ulimit -a, there you can check the limit for a process.
>>>>>
>>>>> Thanks,
>>>>> Naveen
>>>>>
>>>>> Ulimit gives 1024 as open file limit. In struct task_struct it has a member
>>>>> called struct files_struct *files;
>>>>>
>>>>> I tried checking for this member and the limit however I am  not able to
>>>>> decide correctly why the limit is 1024.
>>>>>    Also, is there any distinction between 32 bit and 64 bit systems for this
>>>>> limit?
>>>> My 64-bit system reports 1024 as well.
>>>>
>>>> I have no troubles compiling kernels.
>>>>
>>> Thanks. Yes, on my 64 bit Fedora 15 I get same value as yours.
>>>
>>> What I am interested in is knowing why the limit is on 1024 File
>>> Descriptors? That means 1024 Inodes. AFAIK there isnt anything written
>>> in filesystem code which will put this limit of 1024 inodes for a process.
>>> This means its very specific to the process.
>>> Unfortunately I am know having details on the process front. Is there
>>> anything which you or anyone aware in process area because of which this
>>> limit is there?
>> man getdtablesize
> and if you trace the kernel code, it comes from the limits of the init
> task, which is hard coded during creation. You can get/set these
> values using getrlimit/setrlimit.
>
>
> include/linux/init_task.h
> 33 #define INIT_SIGNALS(sig) {                                             \
> .................
> .................
>   41         .rlim           = INIT_RLIMITS,
> ..............
>
> include/asm-generic/resource.h
>   72 #define INIT_RLIMITS                                                    \
>   73 {                                                                       \
>   74         [RLIMIT_CPU]            = {  RLIM_INFINITY,  RLIM_INFINITY },   \
>   75         [RLIMIT_FSIZE]          = {  RLIM_INFINITY,  RLIM_INFINITY },   \
>   76         [RLIMIT_DATA]           = {  RLIM_INFINITY,  RLIM_INFINITY },   \
>   77         [RLIMIT_STACK]          = {       _STK_LIM,   _STK_LIM_MAX },   \
>   78         [RLIMIT_CORE]           = {              0,  RLIM_INFINITY },   \
>   79         [RLIMIT_RSS]            = {  RLIM_INFINITY,  RLIM_INFINITY },   \
>   80         [RLIMIT_NPROC]          = {              0,              0 },   \
>   81         [RLIMIT_NOFILE]         = {   INR_OPEN_CUR,   INR_OPEN_MAX },   \
> ...............
> ..............
>
> include/linux/fs.h
> 25 #undef NR_OPEN
>   26 #define INR_OPEN_CUR 1024       /* Initial setting for nfile rlimits */
>   27 #define INR_OPEN_MAX 4096       /* Hard limit for nfile rlimits */
>
>
> HTH
This is really helpful. Thanks.

Regards,
Abhijit Pawar

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-07-26  5:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-25 11:31 no files can be opened in a C program Venkateswarlu P
2011-07-25 11:48 ` Anuz Pratap Singh Tomar
2011-07-25 11:59   ` Naveen Kumar
2011-07-25 12:35     ` Abhijit Pawar
2011-07-25 15:50       ` Dave Hylands
2011-07-26  4:29         ` Abhijit Pawar
2011-07-26  4:41           ` Manish Katiyar
2011-07-26  4:52             ` Manish Katiyar
2011-07-26  5:05               ` Abhijit Pawar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.