lkml.org 
[lkml]   [1999]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: FD_CLFORK or equivalent?
    From
    Date
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    >>>>> "Richard" == Richard B Johnson <root@chaos.analogic.com> writes:

    Richard> But... The 'standard' way is:

    Richard> fd = open("/", O_RDONLY);
    Richard> while (fd >= 0) (void)close(fd--);

    Would this not be more accurate:

    struct rlimit *rlim;
    if (getrlimit(RLIMIT_NOFILE, rlim)) { /* error */ }
    fd = rlim->rlim_cur;
    while (fd >=0 ) (void)close(fd--);

    Hmmm. Should calling setrlimit(RLIMIT_NOFILE, (struct rlimit *)NULL)
    close all open files? It of course doesn't, but should it?

    - -JimC
    - --
    James H. Cloos, Jr. <http://www.jhcloos.com/cloos/public_key> 1024D/ED7DAEA6
    <cloos@jhcloos.com> E9E9 F828 61A4 6EA9 0F2B 63E7 997A 9F17 ED7D AEA6
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v0.9.5 (GNU/Linux)
    Comment: For info see http://www.gnupg.org

    iD8DBQE3MKWumXqfF+19rqYRAvZbAJ9J7099fas8+3TpnQs/sPolhFtg+QCgmiYX
    VaP/sndR0KOS6grv3eHB5dA=
    =aCmo
    -----END PGP SIGNATURE-----

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:51    [W:3.288 / U:0.036 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site