skip to main content
10.1145/1967677.1967684acmconferencesArticle/Chapter ViewAbstractPublication PagescpsweekConference Proceedingsconference-collections
research-article

An approach to improving the structure of error-handling code in the linux kernel

Published:11 April 2011Publication History

ABSTRACT

The C language does not provide any abstractions for exception handling or other forms of error handling, leaving programmers to devise their own conventions for detecting and handling errors. The Linux coding style guidelines suggest placing error handling code at the end of each function, where it can be reached by gotos whenever an error is detected. This coding style has the advantage of putting all of the error-handling code in one place, which eases understanding and maintenance, and reduces code duplication. Nevertheless, this coding style is not always applied. In this paper, we propose an automatic program transformation that transforms error-handling code into this style. We have applied our transformation to the Linux 2.6.34 kernel source code, on which it reorganizes the error handling code of over 1800 functions, in about 25 minutes.

References

  1. M. Bruntink. Reengineering idiomatic exception handling in legacy C code. In 12th European Conference on Software Maintenance and Reengineering (CSMR), pages 133--142, Athens, Greece, Apr. 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Bruntink:ICSE06M. Bruntink, A. van Deursen, and T. Tourwé. Discovering faults in idiom-based exception handling. In 28th International Conference on Software Engineering (ICSE), pages 242--251, Shanghai, China, May 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. P. A. Buhr and W. Y. R. Mok. Advanced exception handling mechanisms. IEEE Trans. Software Eng., 26 (9): 820--836, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. CDT. CDT/User/FAQ -- Eclipsepedia, 2010. \newline\fnamehttp://wiki.eclipse.org/CDT/User/FAQ.Google ScholarGoogle Scholar
  5. Ferreira, and Garcia}Filho:06F. C. Filho, C. M. F. Rubira, R. de A. Maranhão Ferreira, and A. Garcia. Aspectizing exception handling: A quantitative study. In Advanced Topics in Exception Handling Techniques, volume 4119 of Lecture Notes in Computer Science, pages 255--274. Springer, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. M. Fowler. Refactoring: Improving the Design of Existing Code. Addison Wesley, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. A. F. Garcia, C. M. F. Rubira, A. B. Romanovsky, and J. Xu. A comparative study of exception handling mechanisms for building dependable object-oriented software. Journal of Systems and Software, 59 (2): 197--222, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. J. B. Goodenough. Exception handling: Issues and a proposed notation. Commun. ACM, 18 (12): 683--696, 1975. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. B. McCloskey and E. Brewer. ASTEC: a new approach to refactoring C. In ESEC/FSE-13, pages 21--30, Lisbon, Portugal, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. Mortensen and S. Ghosh. Refactoring idiomatic exception handling in CGoogle ScholarGoogle Scholar
  11. : Throwing and catching exceptions with aspects. In Industry Track of the International Conference on Aspect-Oriented Software Development (AOSD), Vancouver, Canada, Mar. 2007.Google ScholarGoogle Scholar
  12. Y. Padioleau. Parsing C/CGoogle ScholarGoogle Scholar
  13. code without pre-processing. In Compiler Construction (CC'09), pages 109--125, York, UK, Mar. 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Y. Padioleau, J. Lawall, R. R. Hansen, and G. Muller. Documenting and automating collateral evolutions in Linux device drivers. In EuroSys 2008, pages 247--260, Glasgow, Scotland, Mar. 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. N. Palix, G. Thomas, S. Saha, C. Calvès, J. Lawall, and G. Muller. Faults in Linux: Ten years later. In Sixteenth International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), Newport Beach, CA, USA, Mar. 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. W. Weimer and G. C. Necula. Exceptional situations and program reliability. ACM Transactions on Programming Languages and Systems, 30 (2), 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. D. A. Wheeler. SLOCCount. \newline \fnamehttp://www.dwheeler.com/sloccount/.Google ScholarGoogle Scholar

Index Terms

  1. An approach to improving the structure of error-handling code in the linux kernel

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        LCTES '11: Proceedings of the 2011 SIGPLAN/SIGBED conference on Languages, compilers and tools for embedded systems
        April 2011
        182 pages
        ISBN:9781450305556
        DOI:10.1145/1967677
        • cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 46, Issue 5
          LCTES '10
          May 2011
          170 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/2016603
          Issue’s Table of Contents

        Copyright © 2011 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 11 April 2011

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        Overall Acceptance Rate116of438submissions,26%

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader