Summary: osaf: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]
Review request for Trac Ticket(s): 452
Peer Reviewer(s): Mathi, Ramesh
Pull request to:
Affected branch(es): default(4.4)
Development branch: default

--------------------------------
Impacted area       Impact y/n
--------------------------------
 Docs                    n
 Build system            n
 RPM/packaging           n
 Configuration files     n
 Startup scripts         n
 SAF services            y
 OpenSAF services        y
 Core libraries          y
 Samples                 n
 Tests                   y
 Other                   n


Comments (indicate scope for each "y" above):
---------------------------------------------
This set of patches replace usages of select() with the new osaf_poll() API
introduced in ticket [#580]. Stricly speaking, not all of them have to be
replaced in order to solve the problem described in ticket [#452], but to
ensure that no select() that should have been replaced is forgotten, we
replace all occurrences of select(). This way, it is easy to check that
select() is not used, e.g. by running the grep command on the source tree.

Note that the java bindings have not yet been fixed. They will be fixed in
a patch that will be sent out later.

changeset 8bd7a81783f17268607be9ad703bc7978e1df7ff
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        amf: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().

changeset 7a3af5d1b0464b7cb2b2c1b749f6e0a8530f8f34
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        base: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().

        The following APIs were based on select() and have been removed from 
BASE:

        m_SET_FD_IN_SEL_OBJ() m_GET_HIGHER_SEL_OBJ() ncs_sel_obj_select()
        m_NCS_SEL_OBJ_SELECT() ncs_sel_obj_poll_single_obj()
        m_NCS_SEL_OBJ_POLL_SINGLE_OBJ() m_NCS_SEL_OBJ_ZERO() m_NCS_SEL_OBJ_SET()
        m_NCS_SEL_OBJ_ISSET() m_NCS_SEL_OBJ_CLR() NCS_SEL_OBJ_SET

changeset 7738c5ed214580b07dabf9519e87b3e78b8f9745
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        ckpt: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().

changeset 68977bc498106e797d31c530e944641741911ac8
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        clm: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().

changeset 6fdf5ea8d207c1ca7e26952fa4432504c305a244
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        dtm: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().

changeset fecc4ff2bab5c0fc232dd93b1d80c15014423719
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        evt: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().

changeset 74935cb76deeba539d1dc4b0f9136014b1f5bf94
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        imm: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().

changeset 28b843a756325cc0f04de0015fc4e30887e8b2dc
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        lck: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().

changeset e90ead796c0c3ea134c764c188cafcecc925a07f
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        log: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().

changeset 0159610ba8d939cc6917a0dc0d693a524ead5538
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        mds: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().

changeset 618bf27b7a6f9908f7397471c461cc7c5de45bea
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        msg: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().

changeset 3e51c97673889d0be76e31ad6d5c0bcd1e781b5b
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        nid: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().

changeset f597e3c93f9d5a0145e8848d407fe65041dd2348
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        ntf: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().

changeset 15e6df4c4d6b2d80072b729236e66ba752464548
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        plm: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().

changeset 1fe792d6fe63301d0e0dffd53f2936a4dc464448
Author: Anders Widell <[email protected]>
Date:   Thu, 31 Oct 2013 14:13:50 +0100

        rde: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]

        The select() function cannot handle file descriptors larger than 1023. 
To
        avoid this limitation, we replace all usages of select() with poll().


Complete diffstat:
------------------
 contrib/plmc/plmcd/plmcd.c                       |   18 ++++-----
 osaf/libs/agents/infrastructure/rda/rda_papi.c   |   36 ++++-----------------
 osaf/libs/agents/saf/amfa/ava_init.c             |    8 +--
 osaf/libs/agents/saf/clma/clma_util.c            |    7 +--
 osaf/libs/agents/saf/cpa/cpa_init.c              |    8 +---
 osaf/libs/agents/saf/cpa/cpa_proc.c              |    9 +---
 osaf/libs/agents/saf/eda/eda_mds.c               |   10 +----
 osaf/libs/agents/saf/eda/eda_saf_api.c           |    2 +-
 osaf/libs/agents/saf/gla/gla_init.c              |    9 +---
 osaf/libs/agents/saf/imma/imma_init.c            |    7 +--
 osaf/libs/agents/saf/lga/lga_api.c               |    2 +-
 osaf/libs/agents/saf/lga/lga_util.c              |    7 +--
 osaf/libs/agents/saf/mqa/mqa_init.c              |   13 +-----
 osaf/libs/agents/saf/ntfa/ntfa_api.c             |    2 +-
 osaf/libs/agents/saf/ntfa/ntfa_util.c            |    8 +--
 osaf/libs/agents/saf/plma/plma_mds.c             |    7 +--
 osaf/libs/core/include/ncs_osprm.h               |  142 
+------------------------------------------------------------------------------------
 osaf/libs/core/include/os_defs.h                 |    1 -
 osaf/libs/core/leap/os_defs.c                    |  203 
++++--------------------------------------------------------------------------------------------------------------------
 osaf/libs/core/leap/sysf_ipc.c                   |    9 +---
 osaf/libs/core/leap/sysf_tmr.c                   |   68 
+++++++---------------------------------
 osaf/libs/core/mds/mds_c_sndrcv.c                |    9 +---
 osaf/libs/core/mds/mds_main.c                    |    7 +--
 osaf/services/infrastructure/dtms/dtm/dtm_main.c |   12 +-----
 osaf/services/infrastructure/nid/nodeinit.c      |   42 
+++++-------------------
 osaf/services/saf/cpsv/cpnd/cpnd_init.c          |   46 
++++++++++++++++-----------
 osaf/services/saf/glsv/glnd/glnd_api.c           |   41 +++++++++++++----------
 osaf/services/saf/plmsv/plms/hpi_intf/plms_hrb.c |   28 +++++-----------
 osaf/tools/safimm/immfind/imm_find.c             |    1 -
 osaf/tools/safimm/immlist/imm_list.c             |    1 -
 osaf/tools/saflog/saflogger/saf_logger.c         |    1 -
 osaf/tools/safntf/ntfread/ntfread.c              |    1 -
 osaf/tools/safntf/ntfsend/ntfsend.c              |    1 -
 osaf/tools/safntf/ntfsubscribe/ntfsubscribe.c    |    1 -
 tests/clmsv/Makefile.am                          |    3 +-
 tests/logsv/Makefile.am                          |    6 ++-
 tests/mds/mdstipc_conf.c                         |   78 
+++++++++++++++++-----------------------------
 tests/ntfsv/Makefile.am                          |    3 +-
 38 files changed, 183 insertions(+), 674 deletions(-)


Testing Commands:
-----------------
Apply patches, compile and start OpenSAF. Then run the program shown below:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <saLog.h>

int main(void) {
  // Change limit for number of open files to 2048
  struct rlimit rlim;
  if (getrlimit(RLIMIT_NOFILE, &rlim) != 0) {
    perror("getrlimit");
    exit(EXIT_FAILURE);
  }
  rlim.rlim_cur = 2048;
  if (setrlimit(RLIMIT_NOFILE, &rlim) != 0) {
    perror("setrlimit");
    exit(EXIT_FAILURE);
  }

  // Create 1024 file descriptors
  int fds[2];
  for (int i = 0; i != 512; ++i) {
    if (pipe(fds) != 0) {
      perror("pipe");
      exit(EXIT_FAILURE);
    }
  }

  // Initialise LOG. Process will be aborted due to too large fd.
  // An error message will be logged to syslog.
  SaLogHandleT logHandle;
  SaVersionT version = {'A', 2, 1};
  saLogInitialize(&logHandle, NULL, &version);

  printf("Program exiting sucessfully.\n");
  return EXIT_SUCCESS;
}


Testing, Expected Results:
--------------------------
The program above should exit successfully.


Conditions of Submission:
-------------------------
Ack from reviewers.


Arch      Built     Started    Linux distro
-------------------------------------------
mips        n          n
mips64      n          n
x86         n          n
x86_64      y          y
powerpc     n          n
powerpc64   n          n


Reviewer Checklist:
-------------------
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
    that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
    (i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
    Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
    like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
    cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
    too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
    Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
    commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
    of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
    comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have a badly configured date and time; confusing the
    the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
    for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
    do not contain the patch that updates the Doxygen manual.


------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to