Hello,
I have a sample program for the same , But I am not sure how I can
upload it , as to compile that program btrieve(pervasive) library and
header files are also required.
Can I attach source code here ?
Problem is always getting recreated if I open Btrieve file in child
process after fork()
---in main process fork is called-
iStat = fork();
printf("\nCreating Clients using fork method iStat is %d...\n",iStat);
if ((iStat) == 0 )
{
printf("\n I am in child \n");
rd_proc_wr_request();
printf("\n I am in child exit \n");
exit(0);
}
/*when the process client finishes Kill the child */
else
{
/*We are the parent so free the memory*/
sleep(15);
printf("start of Main Process \n");
//wait(NULL);
errWaitPid = waitpid( iStat, &wstatus, WNOHANG | WUNTRACED | WCONTINUED );
printf( "errWaitPid = %d, errno = %d, comment = %s\n", errWaitPid,
errno, strerror( errno ) );
printf ("Parent reads <%s>\n",shm) ;
printf("Exiting Main Process\n");
exit(0);
}
this is child process code---
static void* rd_proc_wr_request()
{
/* Btrieve function parameters */
BTI_BYTE posBlock1[128];
BTI_BYTE posBlock2[128];
BTI_BYTE dataBuf[255];
BTI_WORD dataLen;
BTI_BYTE keyBuf1[255];
BTI_BYTE keyBuf2[255];
BTI_WORD keyNum = 0;
BTI_BYTE btrieveLoaded = FALSE;
BTI_LONG personID;
BTI_BYTE file1Open = FALSE;
BTI_BYTE file2Open = FALSE;
BTI_SINT status;
BTI_SINT getStatus = -1;
BTI_SINT i;
BTI_SINT posCtr;
CLIENT_ID clientID;
VERSION_STRUCT versionBuffer[3];
FILE_CREATE_BUF fileCreateBuf;
GNE_BUFFER_PTR gneBuffer;
PERSON_STRUCT personRecord;
printf("This is child process...\n");
printf("Btrieve before B_OPEN status with BTRV (sample.btr) = %d\n", status);
memset(dataBuf, 0, sizeof(dataBuf));
memset(keyBuf1, 0, sizeof(keyBuf1));
memset(keyBuf2, 0, sizeof(keyBuf2));
strcpy((BTI_CHAR *)keyBuf1, FILE1_NAME);
strcpy((BTI_CHAR *)keyBuf2, FILE2_NAME);
status = BTRV(
B_OPEN,
posBlock1,
dataBuf,
&dataLen,
keyBuf1,
keyNum);
printf("Btrieve B_OPEN status (sample.btr) = %d\n", status);
---end-
Please find cygcheck.out
Cygwin Configuration Diagnostics
Current System Time: Thu Dec 08 14:20:46 2016
Windows 2012 Server Standard Ver 6.2 Build 9200
Running under WOW64 on AMD64
Running in Terminal Service session
Path: C:\Program Files (x86)\Actian\PSQL\bin\
C:\Program Files\Actian\PSQL\bin\
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files\ibm\gsk8\lib64
C:\Program Files (x86)\ibm\gsk8\lib
C:\Program Files\Java\jre7\bin
C:\PROGRA~1\IBM\SQLLIB\BIN
C:\PROGRA~1\IBM\SQLLIB\FUNCTION
C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL
C:\Program Files\Java\jdk1.7.0_71\bin
C:\jdk1.7.0_71\bin
l:\misys\bin
Output from L:\misys\bin\id.exe
UID: 1074127(rashi)
GID: 1049089(Domain Users)
1049089(Domain Users)
545(Users)
14(REMOTE INTERACTIVE LOGON)
4(INTERACTIVE)
11(Authenticated Users)
15(This Organization)
4095(CurrentSession)
66048(LOCAL)
1073640(clearuser)
1172632(BLRCUSIFM Distribution Group)
1075982(scmbmdev)
1188451(RFS-DAT-RO-DocShare)
1212325(Token Authentication)
1188519(RFS-DAT-RO-SophisBuildDevArchive)
1076018(scmbmrlse)
1180352(BLR- DFS BMPLUS Transition Modify Access)
1172617(LANTSTNT-READ-WRITE-ACCESS)
1174051(LANTSTNT-READ-ACCESS)
1131517(Global Remote Access)
1075146(BLR - All Emp Reject)
1150696(BLR-DFS BMPlusDev RW)
1142083(All Emp - Bangalore)
1151970(SMB-Summit-Enhancements-ACL-RO)
1152002(PFM-TI-Resource-Calendar-ACL-RO)
1195039(HU1VSWFS01 Labs Read Only Access)
1151982(PFM-Opics-Enhancements-ACL-RO)
1136031(BLR-BMLAN L3 DEVELOPMENT QUEUE)
1165883(BLR-Bankmaster&BMPlus)
1160576(SMB-Opics-Enhancements-WHP-ACL-RO)
1151956(PFM-PC-Requests-ACL-RO)
1187844(TrustedSendersAndDomains)
1151972(PFM-Summit-Project-Folders-ACL-RO)
1084824(NYCOR-WWSTAFF)
1151980(PFM-SMB-Everyone)
1195050(HU1VSWFS01 Install Read Only Access)
1180378(PFM-Customer-Support-ACL-RO)
1177268(PFM-Business-Center-Support-ACL-RW)
1190917(Kulu-AllMisys-ViewerOnly)
1180374(PFM-Summit-Clients-BDB-ACL-RO)
1160651(PFM-GCC-Sydney-ACL-RO)
1122116(NY1180-Shared Modify Access)
1191425(websense-Bangalore)
1149450(BLR-DFS BMLAN RW)
1118763(AllCorestaff)
1182716(BLR-PRINTUSERS)
1118741(AllStaff)
1090058(BLR-BM LAN)
1180372(PFM-Training-Summit-Clients-ACL-RO)
1089790(Core Bangalore)
1122267(Misys Queens - Blr)
1195102(HU1VSWFS01 PD-PREF Integration Read Only Access)
1143055(ALM Tools User-All)
1180380(PFM-AP-Summit-CS-ACL-RO)
1063073(NYCOR-WWSTAFF)
70145(Authentication authority asserted identity)
401408(Medium Mandatory Level)
SysDir: C:\Windows\system32
WinDir: C:\Windows
PWD = '/cygdrive/l/bmpcunix/etc'
CYGWIN = 'server'
HOME = '/home/rashi'
USERDOMAIN_ROAMINGPROFILE = 'MISYSROOT'
HOMEPATH = '\'
DB2INSTANCE = 'DB2'
APPDATA = 'C:\Users\rashi\AppData\Roaming'
ProgramW