fcntl and record locking

Jack de Valpine <[email protected]>
Newsgroups gmane.linux.cluster.ssic.user
Message-ID <[email protected]>
Hi,

Does file record locking work on CFS with fcntl? Such as the following 
code snippet:

    fls.l_start = scanorig + 
((long)(vmult-1-ypos)*vres*hmult+xpos)*hres*sizeof(COLR);
    fls.l_len = ((long)(vres-1)*hmult+1)*hres*sizeof(COLR);
    fls.l_whence = 0;
    fls.l_type = F_WRLCK;
    /* lock the section of the file */
    if (fcntl(outfd, F_SETLKW, &fls) < 0)
        filerr("lock");
    if (lseek(outfd, (off_t)fls.l_start, SEEK_SET) < 0)
        filerr("seek");

    ....write out some stuff here...

    fls.l_type = F_UNLCK;
    /* release the lock */
    if (fcntl(outfd, F_SETLKW, &fls) < 0)
        filerr("lock");

Sorry if this is obvious. I am just getting some unexpected behavior 
with the program. Note this occurs after doing a fork().

Thanks,

-Jack

-- 
# Jack de Valpine
# president
#
# visarc incorporated
# http://www.visarc.com
#
# channeling technology for superior design and construction




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.