![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi everybody, I migrate some C programs from a legacy isam to mysql. I can not change the program logic, because there are over than 300.000 lines of C code ! So I'm rewriting only the legacy I/O isam calls (like open_isam, add_key, del_key, read_record, write_record, close_isam and so on..). I have a problem: these programs recall each other trough execve() system calls maintaining the connection to the ISAM files opened (and record locks also !). For example: progr1 .. open_isam(fd,name) .. recnum=....; read_record_and_lock(fd,recnum,rec); /* READ AND LOCK record rec */ .. save_var_to_shared_memory() /* save all variables on shared memory */ .. execve("prog2",....) /* execute prog2 instead of prog1 with the same PID: this call DOES NOT close any files/sockets */ return; prog2 ... load_var_from_shared_memory(); /* the files are already OPENED and the record is LOCKED */ .. rec.field1=...; /* change some value on record */ .. write_record(fd,recnum,rec); /* update record and release LOCK */ .. isam_close(fd); return; If I close and open the connection to MYSQL, i lose the record lock, the id connection and so on. How can I to pass a MYSQL structure to another process through an execve() call ? The socket remains opened through this call, but I think I must recreate the MYSQL object after reading from shared memory (there is also the MYSQL statement data structure). Probabily, I need a function that clone a MYSQL connection ... I have look into libmysql source code but it's not so simple to find the correct solution to this problem. Can you help me? Thanks Federico |
![]() |
| Thread Tools | |
| Display Modes | |
| |