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 2011 Publication 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.
[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.
[3]
P. A. Buhr and W. Y. R. Mok. Advanced exception handling mechanisms. IEEE Trans. Software Eng., 26 (9): 820--836, 2000.
[4]
CDT. CDT/User/FAQ -- Eclipsepedia, 2010. \newline\fnamehttp://wiki.eclipse.org/CDT/User/FAQ.
[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.
[6]
M. Fowler. Refactoring: Improving the Design of Existing Code. Addison Wesley, 1999.
[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.
[8]
J. B. Goodenough. Exception handling: Issues and a proposed notation. Commun. ACM, 18 (12): 683--696, 1975.
[9]
B. McCloskey and E. Brewer. ASTEC: a new approach to refactoring C. In ESEC/FSE-13, pages 21--30, Lisbon, Portugal, 2005.
[10]
M. Mortensen and S. Ghosh. Refactoring idiomatic exception handling in C
[11]
: Throwing and catching exceptions with aspects. In Industry Track of the International Conference on Aspect-Oriented Software Development (AOSD), Vancouver, Canada, Mar. 2007.
[12]
Y. Padioleau. Parsing C/C
[13]
code without pre-processing. In Compiler Construction (CC'09), pages 109--125, York, UK, Mar. 2009.
[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.
[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.
[16]
W. Weimer and G. C. Necula. Exceptional situations and program reliability. ACM Transactions on Programming Languages and Systems, 30 (2), 2008.
[17]
D. A. Wheeler. SLOCCount. \newline \fnamehttp://www.dwheeler.com/sloccount/.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

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
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]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 11 April 2011

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. error handling
  2. exception handling
  3. linux

Qualifiers

  • Research-article

Conference

LCTES '11

Acceptance Rates

Overall Acceptance Rate 116 of 438 submissions, 26%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)4
  • Downloads (Last 6 weeks)1
Reflects downloads up to 01 Jan 2025

Other Metrics

Citations

Cited By

View all

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media