coda_psdev.c (50477) | coda_psdev.c (51791) |
---|---|
1/* 2 * 3 * Coda: an Experimental Distributed File System 4 * Release 3.1 5 * 6 * Copyright (c) 1987-1998 Carnegie Mellon University 7 * All Rights Reserved 8 * --- 13 unchanged lines hidden (view full) --- 22 * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF 23 * ANY DERIVATIVE WORK. 24 * 25 * Carnegie Mellon encourages users of this software to return any 26 * improvements or extensions that they make, and to grant Carnegie 27 * Mellon the rights to redistribute these changes without encumbrance. 28 * 29 * @(#) src/sys/coda/coda_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ | 1/* 2 * 3 * Coda: an Experimental Distributed File System 4 * Release 3.1 5 * 6 * Copyright (c) 1987-1998 Carnegie Mellon University 7 * All Rights Reserved 8 * --- 13 unchanged lines hidden (view full) --- 22 * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF 23 * ANY DERIVATIVE WORK. 24 * 25 * Carnegie Mellon encourages users of this software to return any 26 * improvements or extensions that they make, and to grant Carnegie 27 * Mellon the rights to redistribute these changes without encumbrance. 28 * 29 * @(#) src/sys/coda/coda_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ |
30 * $FreeBSD: head/sys/fs/coda/coda_psdev.c 50477 1999-08-28 01:08:13Z peter $ | 30 * $FreeBSD: head/sys/fs/coda/coda_psdev.c 51791 1999-09-29 15:03:48Z marcel $ |
31 * 32 */ 33 34/* 35 * Mach Operating System 36 * Copyright (c) 1989 Carnegie-Mellon University 37 * All rights reserved. The CMU software License Agreement specifies 38 * the terms and conditions for use and redistribution. --- 31 unchanged lines hidden (view full) --- 70#include <coda/coda.h> 71#include <coda/cnode.h> 72#include <coda/coda_namecache.h> 73#include <coda/coda_io.h> 74#include <coda/coda_psdev.h> 75 76#define CTL_C 77 | 31 * 32 */ 33 34/* 35 * Mach Operating System 36 * Copyright (c) 1989 Carnegie-Mellon University 37 * All rights reserved. The CMU software License Agreement specifies 38 * the terms and conditions for use and redistribution. --- 31 unchanged lines hidden (view full) --- 70#include <coda/coda.h> 71#include <coda/cnode.h> 72#include <coda/coda_namecache.h> 73#include <coda/coda_io.h> 74#include <coda/coda_psdev.h> 75 76#define CTL_C 77 |
78#ifdef CTL_C 79#include <sys/signalvar.h> 80#endif 81 |
|
78int coda_psdev_print_entry = 0; 79static 80int outstanding_upcalls = 0; 81int coda_call_sleep = PZERO - 1; 82#ifdef CTL_C 83int coda_pcatch = PCATCH; 84#else 85#endif --- 394 unchanged lines hidden (view full) --- 480coda_call(mntinfo, inSize, outSize, buffer) 481 struct coda_mntinfo *mntinfo; int inSize; int *outSize; caddr_t buffer; 482{ 483 struct vcomm *vcp; 484 struct vmsg *vmp; 485 int error; 486#ifdef CTL_C 487 struct proc *p = curproc; | 82int coda_psdev_print_entry = 0; 83static 84int outstanding_upcalls = 0; 85int coda_call_sleep = PZERO - 1; 86#ifdef CTL_C 87int coda_pcatch = PCATCH; 88#else 89#endif --- 394 unchanged lines hidden (view full) --- 484coda_call(mntinfo, inSize, outSize, buffer) 485 struct coda_mntinfo *mntinfo; int inSize; int *outSize; caddr_t buffer; 486{ 487 struct vcomm *vcp; 488 struct vmsg *vmp; 489 int error; 490#ifdef CTL_C 491 struct proc *p = curproc; |
488 unsigned int psig_omask = p->p_sigmask; | 492 sigset_t psig_omask = p->p_sigmask; 493 sigset_t tempset; |
489 int i; 490#endif 491 if (mntinfo == NULL) { 492 /* Unlikely, but could be a race condition with a dying warden */ 493 return ENODEV; 494 } 495 496 vcp = &(mntinfo->mi_vcomm); --- 39 unchanged lines hidden (view full) --- 536 on a ^c or ^z. The problem is that emacs sets certain interrupts 537 as SA_RESTART. This means that we should exit sleep handle the 538 "signal" and then go to sleep again. Mostly this is done by letting 539 the syscall complete and be restarted. We are not idempotent and 540 can not do this. A better solution is necessary. 541 */ 542 i = 0; 543 do { | 494 int i; 495#endif 496 if (mntinfo == NULL) { 497 /* Unlikely, but could be a race condition with a dying warden */ 498 return ENODEV; 499 } 500 501 vcp = &(mntinfo->mi_vcomm); --- 39 unchanged lines hidden (view full) --- 541 on a ^c or ^z. The problem is that emacs sets certain interrupts 542 as SA_RESTART. This means that we should exit sleep handle the 543 "signal" and then go to sleep again. Mostly this is done by letting 544 the syscall complete and be restarted. We are not idempotent and 545 can not do this. A better solution is necessary. 546 */ 547 i = 0; 548 do { |
544 error = tsleep(&vmp->vm_sleep, (coda_call_sleep|coda_pcatch), "coda_call", hz*2); 545 if (error == 0) 546 break; 547 else if (error == EWOULDBLOCK) { | 549 error = tsleep(&vmp->vm_sleep, 550 (coda_call_sleep|coda_pcatch), "coda_call", 551 hz*2); 552 if (error == 0) 553 break; 554 else if (error == EWOULDBLOCK) { |
548#ifdef CODA_VERBOSE | 555#ifdef CODA_VERBOSE |
549 printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i); | 556 printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i); |
550#endif | 557#endif |
551 } else if (p->p_siglist == sigmask(SIGIO)) { 552 p->p_sigmask |= p->p_siglist; | 558 } 559 else { 560 SIGEMPTYSET(tempset); 561 SIGADDSET(tempset, SIGIO); 562 if (SIGSETEQ(p->p_siglist, tempset)) { 563 SIGADDSET(p->p_sigmask, SIGIO); |
553#ifdef CODA_VERBOSE | 564#ifdef CODA_VERBOSE |
554 printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i); | 565 printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", 566 error, i); |
555#endif | 567#endif |
556 } else if (p->p_siglist == sigmask(SIGALRM)) { 557 p->p_sigmask |= p->p_siglist; | 568 } else { 569 SIGDELSET(tempset, SIGIO); 570 SIGADDSET(tempset, SIGALRM); 571 if (SIGSETEQ(p->p_siglist, tempset)) { 572 SIGADDSET(p->p_sigmask, SIGALRM); |
558#ifdef CODA_VERBOSE | 573#ifdef CODA_VERBOSE |
559 printf("coda_call: tsleep returns %d SIGALRM, cnt %d\n", error, i); | 574 printf("coda_call: tsleep returns %d SIGALRM, cnt %d\n", 575 error, i); |
560#endif | 576#endif |
561 } else { 562 printf("coda_call: tsleep returns %d, cnt %d\n", error, i); 563 printf("coda_call: siglist = %x, sigmask = %x, mask %x\n", 564 p->p_siglist, p->p_sigmask, 565 p->p_siglist & ~p->p_sigmask); 566 break; 567#ifdef notyet 568 p->p_sigmask |= p->p_siglist; 569 printf("coda_call: new mask, siglist = %x, sigmask = %x, mask %x\n", 570 p->p_siglist, p->p_sigmask, 571 p->p_siglist & ~p->p_sigmask); | 577 } 578 else { 579 printf("coda_call: tsleep returns %d, cnt %d\n", 580 error, i); 581 582#if notyet 583 tempset = p->p_siglist; 584 SIGSETNAND(tempset, p->p_sigmask); 585 printf("coda_call: siglist = %p, sigmask = %p, mask %p\n", 586 p->p_siglist, p->p_sigmask, 587 tempset); 588 break; 589 SIGSETOR(p->p_sigmask, p->p_siglist); 590 tempset = p->p_siglist; 591 SIGSETNAND(tempset, p->p_sigmask); 592 printf("coda_call: new mask, siglist = %p, sigmask = %p, mask %p\n", 593 p->p_siglist, p->p_sigmask, 594 tempset); |
572#endif | 595#endif |
573 } | 596 } 597 } 598 } |
574 } while (error && i++ < 128 && VC_OPEN(vcp)); 575 p->p_sigmask = psig_omask; 576#else 577 (void) tsleep(&vmp->vm_sleep, coda_call_sleep, "coda_call", 0); 578#endif 579 if (VC_OPEN(vcp)) { /* Venus is still alive */ 580 /* Op went through, interrupt or not... */ 581 if (vmp->vm_flags & VM_WRITE) { --- 73 unchanged lines hidden --- | 599 } while (error && i++ < 128 && VC_OPEN(vcp)); 600 p->p_sigmask = psig_omask; 601#else 602 (void) tsleep(&vmp->vm_sleep, coda_call_sleep, "coda_call", 0); 603#endif 604 if (VC_OPEN(vcp)) { /* Venus is still alive */ 605 /* Op went through, interrupt or not... */ 606 if (vmp->vm_flags & VM_WRITE) { --- 73 unchanged lines hidden --- |