Print this page
3772 consider raising default descriptor soft limit

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libnsl/rpc/svc.c
          +++ new/usr/src/lib/libnsl/rpc/svc.c
↓ open down ↓ 95 lines elided ↑ open up ↑
  96   96  void svc_getreq_common();
  97   97  char *strdup();
  98   98  
  99   99  extern mutex_t  svc_door_mutex;
 100  100  extern cond_t   svc_door_waitcv;
 101  101  extern int      svc_ndoorfds;
 102  102  extern SVCXPRT_LIST *_svc_xprtlist;
 103  103  extern mutex_t xprtlist_lock;
 104  104  extern void __svc_rm_from_xlist();
 105  105  
      106 +#if !defined(_LP64)
 106  107  extern fd_set _new_svc_fdset;
      108 +#endif
 107  109  
 108  110  /*
 109  111   * If the allocated array of reactor is too small, this value is used as a
 110  112   * margin. This reduces the number of allocations.
 111  113   */
 112  114  #define USER_FD_INCREMENT 5
 113  115  
 114  116  static void add_pollfd(int fd, short events);
 115  117  static void remove_pollfd(int fd);
 116  118  static void __svc_remove_input_of_fd(int fd);
↓ open down ↓ 730 lines elided ↑ open up ↑
 847  849  
 848  850  /* ********************** CALLOUT list related stuff ************* */
 849  851  
 850  852  /*
 851  853   * Add a service program to the callout list.
 852  854   * The dispatch routine will be called when a rpc request for this
 853  855   * program number comes in.
 854  856   */
 855  857  bool_t
 856  858  svc_reg(const SVCXPRT *xprt, const rpcprog_t prog, const rpcvers_t vers,
 857      -                        void (*dispatch)(), const struct netconfig *nconf)
      859 +    void (*dispatch)(), const struct netconfig *nconf)
 858  860  {
 859  861          struct svc_callout *prev;
 860  862          struct svc_callout *s, **s2;
 861  863          struct netconfig *tnconf;
 862  864          char *netid = NULL;
 863  865          int flag = 0;
 864  866  
 865  867  /* VARIABLES PROTECTED BY svc_lock: s, prev, svc_head */
 866  868  
 867  869          if (xprt->xp_netid) {
↓ open down ↓ 91 lines elided ↑ open up ↑
 959  961  
 960  962  #ifdef PORTMAP
 961  963  /*
 962  964   * Add a service program to the callout list.
 963  965   * The dispatch routine will be called when a rpc request for this
 964  966   * program number comes in.
 965  967   * For version 2 portmappers.
 966  968   */
 967  969  bool_t
 968  970  svc_register(SVCXPRT *xprt, rpcprog_t prog, rpcvers_t vers,
 969      -                                        void (*dispatch)(), int protocol)
      971 +    void (*dispatch)(), int protocol)
 970  972  {
 971  973          struct svc_callout *prev;
 972  974          struct svc_callout *s;
 973  975          struct netconfig *nconf;
 974  976          char *netid = NULL;
 975  977          int flag = 0;
 976  978  
 977  979          if (xprt->xp_netid) {
 978  980                  netid = strdup(xprt->xp_netid);
 979  981                  flag = 1;
↓ open down ↓ 105 lines elided ↑ open up ↑
1085 1087  }
1086 1088  
1087 1089  
1088 1090  /* ******************* REPLY GENERATION ROUTINES  ************ */
1089 1091  
1090 1092  /*
1091 1093   * Send a reply to an rpc request
1092 1094   */
1093 1095  bool_t
1094 1096  svc_sendreply(const SVCXPRT *xprt, const xdrproc_t xdr_results,
1095      -                                                const caddr_t xdr_location)
     1097 +    const caddr_t xdr_location)
1096 1098  {
1097 1099          struct rpc_msg rply;
1098 1100  
1099 1101          rply.rm_direction = REPLY;
1100 1102          rply.rm_reply.rp_stat = MSG_ACCEPTED;
1101 1103          rply.acpted_rply.ar_verf = xprt->xp_verf;
1102 1104          rply.acpted_rply.ar_stat = SUCCESS;
1103 1105          rply.acpted_rply.ar_results.where = xdr_location;
1104 1106          rply.acpted_rply.ar_results.proc = xdr_results;
1105 1107          return (SVC_REPLY((SVCXPRT *)xprt, &rply));
↓ open down ↓ 114 lines elided ↑ open up ↑
1220 1222          rply.acpted_rply.ar_verf = xprt->xp_verf;
1221 1223          rply.acpted_rply.ar_stat = PROG_UNAVAIL;
1222 1224          SVC_REPLY((SVCXPRT *)xprt, &rply);
1223 1225  }
1224 1226  
1225 1227  /*
1226 1228   * Program version mismatch error reply
1227 1229   */
1228 1230  void
1229 1231  svcerr_progvers(const SVCXPRT *xprt, const rpcvers_t low_vers,
1230      -                                                const rpcvers_t high_vers)
     1232 +    const rpcvers_t high_vers)
1231 1233  {
1232 1234          struct rpc_msg rply;
1233 1235  
1234 1236          rply.rm_direction = REPLY;
1235 1237          rply.rm_reply.rp_stat = MSG_ACCEPTED;
1236 1238          rply.acpted_rply.ar_verf = xprt->xp_verf;
1237 1239          rply.acpted_rply.ar_stat = PROG_MISMATCH;
1238 1240          rply.acpted_rply.ar_vers.low = low_vers;
1239 1241          rply.acpted_rply.ar_vers.high = high_vers;
1240 1242          SVC_REPLY((SVCXPRT *)xprt, &rply);
↓ open down ↓ 516 lines elided ↑ open up ↑
1757 1759   * __svc_dup(struct svc_req *req, caddr_t *resp_buf, uint_t *resp_bufsz,
1758 1760   *      char *xprt_cache)
1759 1761   * searches the request cache. Creates an entry and returns DUP_NEW if
1760 1762   * the request is not found in the cache.  If it is found, then it
1761 1763   * returns the state of the request (in progress, drop, or done) and
1762 1764   * also allocates, and passes back results to the user (if any) in
1763 1765   * resp_buf, and its length in resp_bufsz. DUP_ERROR is returned on error.
1764 1766   */
1765 1767  int
1766 1768  __svc_dup(struct svc_req *req, caddr_t *resp_buf, uint_t *resp_bufsz,
1767      -        char *xprt_cache)
     1769 +    char *xprt_cache)
1768 1770  {
1769 1771          uint32_t drxid, drhash;
1770 1772          int rc;
1771 1773          struct dupreq *dr = NULL;
1772 1774          time_t timenow = time(NULL);
1773 1775  
1774 1776          /* LINTED pointer alignment */
1775 1777          struct dupcache *dc = (struct dupcache *)xprt_cache;
1776 1778  
1777 1779          if (dc == NULL) {
↓ open down ↓ 27 lines elided ↑ open up ↑
1805 1807  /*
1806 1808   * __svc_dupcache_check(struct svc_req *req, caddr_t *resp_buf,
1807 1809   *              uint_t *resp_bufsz,truct dupcache *dc, uint32_t drxid,
1808 1810   *              uint32_t drhash)
1809 1811   * Checks to see whether an entry already exists in the cache. If it does
1810 1812   * copy back into the resp_buf, if appropriate. Return the status of
1811 1813   * the request, or DUP_NEW if the entry is not in the cache
1812 1814   */
1813 1815  static int
1814 1816  __svc_dupcache_check(struct svc_req *req, caddr_t *resp_buf, uint_t *resp_bufsz,
1815      -                struct dupcache *dc, uint32_t drxid, uint32_t drhash)
     1817 +    struct dupcache *dc, uint32_t drxid, uint32_t drhash)
1816 1818  {
1817 1819          struct dupreq *dr = NULL;
1818 1820  
1819 1821          (void) rw_rdlock(&(dc->dc_lock));
1820 1822          dr = dc->dc_hashtbl[drhash];
1821 1823          while (dr != NULL) {
1822 1824                  if (dr->dr_xid == drxid &&
1823 1825                      dr->dr_proc == req->rq_proc &&
1824 1826                      dr->dr_prog == req->rq_prog &&
1825 1827                      dr->dr_vers == req->rq_vers &&
↓ open down ↓ 138 lines elided ↑ open up ↑
1964 1966          }
1965 1967  }
1966 1968  
1967 1969  /*
1968 1970   * __svc_dupcache_enter(struct svc_req *req, struct dupreq *dr,
1969 1971   *      struct dupcache *dc, uint32_t drxid, uint32_t drhash, time_t timenow)
1970 1972   * build new duprequest entry and then insert into the cache
1971 1973   */
1972 1974  static int
1973 1975  __svc_dupcache_enter(struct svc_req *req, struct dupreq *dr,
1974      -        struct dupcache *dc, uint32_t drxid, uint32_t drhash, time_t timenow)
     1976 +    struct dupcache *dc, uint32_t drxid, uint32_t drhash, time_t timenow)
1975 1977  {
1976 1978          dr->dr_xid = drxid;
1977 1979          dr->dr_prog = req->rq_prog;
1978 1980          dr->dr_vers = req->rq_vers;
1979 1981          dr->dr_proc = req->rq_proc;
1980 1982          dr->dr_addr.maxlen = req->rq_xprt->xp_rtaddr.len;
1981 1983          dr->dr_addr.len = dr->dr_addr.maxlen;
1982 1984          if ((dr->dr_addr.buf = malloc(dr->dr_addr.maxlen)) == NULL) {
1983 1985                  syslog(LOG_ERR, "__svc_dupcache_enter: malloc failed");
1984 1986                  free(dr);
↓ open down ↓ 22 lines elided ↑ open up ↑
2007 2009  
2008 2010  /*
2009 2011   * __svc_dupdone(struct svc_req *req, caddr_t resp_buf, uint_t resp_bufsz,
2010 2012   *              int status, char *xprt_cache)
2011 2013   * Marks the request done (DUP_DONE or DUP_DROP) and stores the response.
2012 2014   * Only DONE and DROP requests can be marked as done. Sets the lru pointers
2013 2015   * to make the entry the most recently used. Returns DUP_ERROR or status.
2014 2016   */
2015 2017  int
2016 2018  __svc_dupdone(struct svc_req *req, caddr_t resp_buf, uint_t resp_bufsz,
2017      -                int status, char *xprt_cache)
     2019 +    int status, char *xprt_cache)
2018 2020  {
2019 2021          uint32_t drxid, drhash;
2020 2022          int rc;
2021 2023  
2022 2024          /* LINTED pointer alignment */
2023 2025          struct dupcache *dc = (struct dupcache *)xprt_cache;
2024 2026  
2025 2027          if (dc == NULL) {
2026 2028                  syslog(LOG_ERR, "__svc_dupdone: undefined cache");
2027 2029                  return (DUP_ERROR);
↓ open down ↓ 25 lines elided ↑ open up ↑
2053 2055  /*
2054 2056   * __svc_dupcache_update(struct svc_req *req, caddr_t resp_buf,
2055 2057   *      uint_t resp_bufsz, int status, struct dupcache *dc, uint32_t drxid,
2056 2058   *      uint32_t drhash)
2057 2059   * Check if entry exists in the dupcacache. If it does, update its status
2058 2060   * and time and also its buffer, if appropriate. Its possible, but unlikely
2059 2061   * for DONE requests to not exist in the cache. Return DUP_ERROR or status.
2060 2062   */
2061 2063  static int
2062 2064  __svc_dupcache_update(struct svc_req *req, caddr_t resp_buf, uint_t resp_bufsz,
2063      -        int status, struct dupcache *dc, uint32_t drxid, uint32_t drhash)
     2065 +    int status, struct dupcache *dc, uint32_t drxid, uint32_t drhash)
2064 2066  {
2065 2067          struct dupreq *dr = NULL;
2066 2068          time_t timenow = time(NULL);
2067 2069  
2068 2070          (void) rw_wrlock(&(dc->dc_lock));
2069 2071          dr = dc->dc_hashtbl[drhash];
2070 2072          while (dr != NULL) {
2071 2073                  if (dr->dr_xid == drxid &&
2072 2074                      dr->dr_proc == req->rq_proc &&
2073 2075                      dr->dr_prog == req->rq_prog &&
↓ open down ↓ 102 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX