Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1463734 > unrolled thread
| Started by | Ajay Garg <ajaygargnsit@gmail.com> |
|---|---|
| First post | 2016-08-16 14:00 +0200 |
| Last post | 2016-08-16 16:50 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
Is kernel-FD-auto-close exactly equal to explicit-FD-close? Ajay Garg <ajaygargnsit@gmail.com> - 2016-08-16 14:00 +0200
Re: Is kernel-FD-auto-close exactly equal to explicit-FD-close? Ajay Garg <ajaygargnsit@gmail.com> - 2016-08-16 16:50 +0200
| From | Ajay Garg <ajaygargnsit@gmail.com> |
|---|---|
| Date | 2016-08-16 14:00 +0200 |
| Subject | Is kernel-FD-auto-close exactly equal to explicit-FD-close? |
| Message-ID | <s6Lcd-2BC-11@gated-at.bofh.it> |
Hi All. We have deployed a simple C-application on an embedded-platform running Linux, and we spuriously observe file-corruption. In particular, there is an all-important "config" file, and some of its lines are lost spuriously. Now, our application opens quite a few files on the file-systems, and one serial-port. During the course, if an error occurs, we simply "exit(1)" the binary, without any special code for closing any opened-file-descriptors. I tested with "lsof", and confirmed that after binary exit, any open-file-descriptors are closed (automatically by kernel). With this as the background, I revisit my question :: Is kernel-file-descriptor-auto-close exactly equal to explicit-file-descriptor-close? Will be grateful for pointers; as of now, nightmares have begun striking me. Thanks and Regards, Ajay
[toc] | [next] | [standalone]
| From | Ajay Garg <ajaygargnsit@gmail.com> |
|---|---|
| Date | 2016-08-16 16:50 +0200 |
| Message-ID | <s6NQK-4jo-7@gated-at.bofh.it> |
| In reply to | #1463734 |
Just discovered that calling "exit(1)" calls "fcloseall()". But as I notice, the opened-serial-port (via "open()" call) is also closed at binary exit. So, is the serial-port closed by hidden "fcloseall()" call, or by the kernel? Moreover, is this equivalent to calling explicit "close()" call on the serial-port-FD? Thanks and Regards, Ajay On Tue, Aug 16, 2016 at 5:29 PM, Ajay Garg <ajaygargnsit@gmail.com> wrote: > Hi All. > > We have deployed a simple C-application on an embedded-platform > running Linux, and we spuriously observe file-corruption. In > particular, there is an all-important "config" file, and some of its > lines are lost spuriously. > > Now, our application opens quite a few files on the file-systems, and > one serial-port. > During the course, if an error occurs, we simply "exit(1)" the binary, > without any special code for closing any opened-file-descriptors. > > I tested with "lsof", and confirmed that after binary exit, any > open-file-descriptors are closed (automatically by kernel). > > > With this as the background, I revisit my question :: Is > kernel-file-descriptor-auto-close exactly equal to > explicit-file-descriptor-close? > > Will be grateful for pointers; as of now, nightmares have begun striking me. > > > Thanks and Regards, > Ajay -- Regards, Ajay
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web