All of lore.kernel.org
 help / color / mirror / Atom feed
From: apawar.linux@gmail.com (Abhijit Pawar)
To: kernelnewbies@lists.kernelnewbies.org
Subject: no files can be opened in a C program
Date: Tue, 26 Jul 2011 10:35:06 +0530	[thread overview]
Message-ID: <4E2E4B02.8000906@gmail.com> (raw)
In-Reply-To: <CAE0An6fiC5saxqT+fFgCzeWGkO4Xp+4Z7F6OnX2mrtquYxBjyg@mail.gmail.com>

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

      reply	other threads:[~2011-07-26  5:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E2E4B02.8000906@gmail.com \
    --to=apawar.linux@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.