*** apache_base:[src.main]alloc.c;1 Mon Aug 23 11:38:21 1999 --- apache_cur:[src.main]alloc.c;3 Mon Aug 23 11:38:04 1999 *************** *** 60,66 **** * sure that nothing leaks. * * rst --- 4/95 --- 6/95 ! */ #include "httpd.h" #include "multithread.h" --- 60,79 ---- * sure that nothing leaks. * * rst --- 4/95 --- 6/95 ! * ! * Porting to OpenVMS. Added "shr=get,put" which is the default sharability ! * under UNIX. ! * PV 25/01/99 ! */ ! #ifdef VMS ! int vms_child_id; ! #define child_id vms_child_id ! #ifdef DEBUG ! #define DBG_PRINT if ( vms_child_id == -2 ) 0; else printf ! #else ! #define DBG_PRINT if ( vms_child_id != -2 ) 0; else printf ! #endif ! #endif #include "httpd.h" #include "multithread.h" *************** *** 1775,1781 **** --- 1788,1801 ---- int save_errno; ap_block_alarms(); + #ifdef VMS + /* + * Not ANSI, but makes files shareable under VMS. + */ + fd = open(name, flg, mode, "shr=get,put"); + #else fd = open(name, flg, mode); + #endif save_errno = errno; if (fd >= 0) { fd = ap_slack(fd, AP_SLACK_HIGH); *************** *** 1793,1798 **** --- 1813,1835 ---- ap_block_alarms(); res = close(fd); + #ifdef VMS + DBG_PRINT("(%d) closed fd %d, status: %d, errno: %d/%d\n", child_id, fd, res, errno, + vaxc$errno); + if ( (res < 0) && (errno==EBUSY) ) { + /* + * C RTL has been called recursively, abort. + */ + int status; + status = vms_close_busy_socket ( fd ); + DBG_PRINT("(%d) forcing close of busy socket, status: %d\n", + child_id, status ); + if ( (status&1) == 1 ) { + errno = 0; /* clear error condition */ + res = 0; + } + } + #endif save_errno = errno; ap_kill_cleanup(a, (void *) (long) fd, fd_cleanup); ap_unblock_alarms(); *************** *** 1867,1874 **** --- 1904,1916 ---- if (*mode == 'a') { /* Work around faulty implementations of fopen */ baseFlag = (*(mode + 1) == '+') ? O_RDWR : O_WRONLY; + #ifdef VMS + desc = open(name, baseFlag | O_APPEND | O_CREAT, + modeFlags, "shr=get,put"); + #else desc = open(name, baseFlag | O_APPEND | O_CREAT, modeFlags); + #endif /* ! VMS */ if (desc >= 0) { desc = ap_slack(desc, AP_SLACK_LOW); fd = ap_fdopen(desc, mode);