error.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include <u.h>
  10. #include <libc.h>
  11. #include <thread.h>
  12. #include <sunrpc.h>
  13. static struct {
  14. SunStatus status;
  15. char *msg;
  16. } tab[] = {
  17. SunProgUnavail, "program unavailable",
  18. SunProgMismatch, "program mismatch",
  19. SunProcUnavail, "procedure unavailable",
  20. SunGarbageArgs, "garbage args",
  21. SunSystemErr, "system error",
  22. SunRpcMismatch, "rpc mismatch",
  23. SunAuthBadCred, "bad auth cred",
  24. SunAuthRejectedCred, "rejected auth cred",
  25. SunAuthBadVerf, "bad auth verf",
  26. SunAuthRejectedVerf, "rejected auth verf",
  27. SunAuthTooWeak, "auth too weak",
  28. SunAuthInvalidResp, "invalid auth response",
  29. SunAuthFailed, "auth failed",
  30. };
  31. void
  32. sunErrstr(SunStatus status)
  33. {
  34. int i;
  35. for(i=0; i<nelem(tab); i++){
  36. if(tab[i].status == status){
  37. werrstr(tab[i].msg);
  38. return;
  39. }
  40. }
  41. werrstr("unknown sun error %d", (int)status);
  42. }