Kernel Programming Guide

Total Page:16

File Type:pdf, Size:1020Kb

Kernel Programming Guide Kernel Programming Guide 2006-10-03 registered in the United States and other Apple Computer, Inc. countries. © 2002, 2006 Apple Computer, Inc. DEC is a trademark of Digital Equipment All rights reserved. Corporation. No part of this publication may be Java and all Java-based trademarks are reproduced, stored in a retrieval system, or trademarks or registered trademarks of Sun transmitted, in any form or by any means, Microsystems, Inc. in the U.S. and other mechanical, electronic, photocopying, countries. recording, or otherwise, without prior OpenGL is a registered trademark of Silicon written permission of Apple Computer, Inc., Graphics, Inc. with the following exceptions: Any person PowerPC and and the PowerPC logo are is hereby authorized to store documentation trademarks of International Business on a single computer for personal use only Machines Corporation, used under license and to print copies of documentation for therefrom. personal use provided that the documentation contains Apple’s copyright SPEC is a registered trademark of the notice. Standard Performance Evaluation Corporation (SPEC). The Apple logo is a trademark of Apple Computer, Inc. Simultaneously published in the United States and Canada. Use of the “keyboard” Apple logo (Option-Shift-K) for commercial purposes Even though Apple has reviewed this document, APPLE MAKES NO WARRANTY OR without the prior written consent of Apple REPRESENTATION, EITHER EXPRESS OR may constitute trademark infringement and IMPLIED, WITH RESPECT TO THIS DOCUMENT, ITS QUALITY, ACCURACY, unfair competition in violation of federal MERCHANTABILITY, OR FITNESS FOR A and state laws. PARTICULAR PURPOSE. AS A RESULT, THIS DOCUMENT IS PROVIDED “AS IS,” AND No licenses, express or implied, are granted YOU, THE READER, ARE ASSUMING THE ENTIRE RISK AS TO ITS QUALITY AND with respect to any of the technology ACCURACY. described in this document. Apple retains IN NO EVENT WILL APPLE BE LIABLE FOR all intellectual property rights associated DIRECT, INDIRECT, SPECIAL, INCIDENTAL, with the technology described in this OR CONSEQUENTIAL DAMAGES RESULTING FROM ANY DEFECT OR document. This document is intended to INACCURACY IN THIS DOCUMENT, even if assist application developers to develop advised of the possibility of such damages. applications only for Apple-labeled or THE WARRANTY AND REMEDIES SET Apple-licensed computers. FORTH ABOVE ARE EXCLUSIVE AND IN LIEU OF ALL OTHERS, ORAL OR WRITTEN, Every effort has been made to ensure that EXPRESS OR IMPLIED. No Apple dealer, agent, or employee is authorized to make any the information in this document is modification, extension, or addition to this accurate. Apple is not responsible for warranty. typographical errors. Some states do not allow the exclusion or limitation of implied warranties or liability for Apple Computer, Inc. incidental or consequential damages, so the above limitation or exclusion may not apply to 1 Infinite Loop you. This warranty gives you specific legal Cupertino, CA 95014 rights, and you may also have other rights which 408-996-1010 vary from state to state. Apple, the Apple logo, AppleTalk, Carbon, Cocoa, FireWire, Keychain, Logic, Mac, Mac OS, Macintosh, Pages, Panther, Power Mac, Power Macintosh, Quartz, QuickTime, and Xcode are trademarks of Apple Computer, Inc., registered in the United States and other countries. eMac and Finder are trademarks of Apple Computer, Inc. NeXT, Objective-C, and OPENSTEP are trademarks of NeXT Software, Inc., Contents Chapter 1 About This Document 11 Who Should Read This Document 11 Road Map 11 Other Apple Publications 13 Mach API Reference 13 Information on the Web 13 Chapter 2 Keep Out 15 Why You Should Avoid Programming in the Kernel 15 Chapter 3 Kernel Architecture Overview 17 Darwin 18 Architecture 19 Mach 20 BSD 20 I/O Kit 22 Kernel Extensions 22 Chapter 4 Security Considerations 23 Security Implications of Paging 24 Buffer Overflows and Invalid Input 25 User Credentials 25 Basic User Credentials 26 Access Control Lists 27 Remote Authentication 27 One-Time Pads 27 Time-based authentication 28 Temporary Files 29 /dev/mem and /dev/kmem 29 Key-based Authentication and Encryption 29 Public Key Weaknesses 30 Using Public Keys for Message Exchange 31 Using Public Keys for Identity Verification 32 Using Public Keys for Data Integrity Checking 32 3 2006-10-03 | © 2002, 2006 Apple Computer, Inc. All Rights Reserved. CONTENTS Encryption Summary 32 Console Debugging 33 Code Passing 33 Chapter 5 Performance Considerations 35 Interrupt Latency 35 Locking Bottlenecks 36 Working With Highly Contended Locks 36 Reducing Contention by Decreasing Granularity 37 Code Profiling 37 Using Counters for Code Profiling 38 Lock Profiling 38 Chapter 6 Kernel Programming Style 41 C++ Naming Conventions 41 Basic Conventions 41 Additional Guidelines 42 Standard C Naming Conventions 43 Commonly Used Functions 44 Performance and Stability Tips 45 Performance and Stability Tips 45 Stability Tips 47 Style Summary 47 Chapter 7 Mach Overview 49 Mach Kernel Abstractions 49 Tasks and Threads 50 Ports, Port Rights, Port Sets, and Port Namespaces 51 Memory Management 52 Interprocess Communication (IPC) 53 IPC Transactions and Event Dispatching 54 Message Queues 54 Semaphores 55 Notifications 55 Locks 55 Remote Procedure Call (RPC) Objects 55 Time Management 55 Chapter 8 Memory and Virtual Memory 57 Mac OS X VM Overview 57 Memory Maps Explained 59 Named Entries 60 4 2006-10-03 | © 2002, 2006 Apple Computer, Inc. All Rights Reserved. CONTENTS Universal Page Lists (UPLs) 60 Using Mach Memory Maps 62 Other VM and VM-Related Subsystems 63 Pagers 63 Working Set Detection Subsystem 64 VM Shared Memory Server Subsystem 64 Address Spaces 65 Background Info on PCI Address Translation 65 IOMemoryDescriptor Changes 66 VM System and pmap Changes: 66 Kernel Dependency Changes 67 Summary 67 Allocating Memory in the Kernel 67 Allocating Memory Using Mach Routines 67 Allocating Memory From the I/O Kit 68 Chapter 9 Mach Scheduling and Thread Interfaces 71 Overview of Scheduling 71 Why Did My Thread Priority Change? 72 Using Mach Scheduling From User Applications 73 Using the pthreads API to Influence Scheduling 73 Using the Mach Thread API to Influence Scheduling 74 Using the Mach Task API to Influence Scheduling 76 Kernel Thread APIs 77 Creating and Destroying Kernel Threads 77 SPL and Friends 78 Wait Queues and Wait Primitives 78 Chapter 10 Bootstrap Contexts 81 How Contexts Affect Users 82 How Contexts Affect Developers 83 Chapter 11 I/O Kit Overview 85 Redesigning the I/O Model 85 I/O Kit Architecture 87 Families 87 Drivers 87 Nubs 88 Connection Example 88 For More Information 91 5 2006-10-03 | © 2002, 2006 Apple Computer, Inc. All Rights Reserved. CONTENTS Chapter 12 BSD Overview 93 BSD Facilities 94 Differences between Mac OS X and BSD 95 For Further Reading 96 Chapter 13 File Systems Overview 97 Working With the File System 97 VFS Transition 98 Chapter 14 Network Architecture 99 Chapter 15 Boundary Crossings 101 Security Considerations 102 Choosing a Boundary Crossing Method 102 Kernel Subsystems 103 Bandwidth and Latency 103 Mach Messaging and Mach Interprocess Communication (IPC) 104 Using Well-Defined Ports 104 Remote Procedure Calls (RPC) 105 Calling RPC From User Applications 107 BSD syscall API 107 BSD ioctl API 107 BSD sysctl API 108 General Information on Adding a sysctl 108 Adding a sysctl Procedure Call 109 Registering a New Top Level sysctl 111 Adding a Simple sysctl 111 Calling a sysctl From User Space 112 Memory Mapping and Block Copying 114 Summary 115 Chapter 16 Synchronization Primitives 117 Semaphores 117 Condition Variables 119 Locks 119 Spinlocks 119 Mutexes 121 Read-Write Locks 122 Spin/Sleep Locks 124 Using Lock Functions 125 6 2006-10-03 | © 2002, 2006 Apple Computer, Inc. All Rights Reserved. CONTENTS Chapter 17 Miscellaneous Kernel Services 127 Using Kernel Time Abstractions 127 Obtaining Time Information 127 Event and Timer Waits 128 Handling Version Dependencies 130 Boot Option Handling 131 Queues 132 Installing Shutdown Hooks 132 Chapter 18 Kernel Extension Overview 133 Implementation of a Kernel Extension (KEXT) 134 Kernel Extension Dependencies 134 Building and Testing Your Extension 135 Debugging Your KEXT 135 Installed KEXTs 136 Chapter 19 Building and Debugging Kernels 139 Adding New Files or Modules 139 Modifying the Configuration Files 139 Modifying the Source Code Files 141 Building Your First Kernel 141 Building an Alternate Kernel Configuration 143 When Things Go Wrong: Debugging the Kernel 143 Setting Debug Flags in Open Firmware 144 Avoiding Watchdog Timer Problems 145 Choosing a Debugger 146 Using gdb for Kernel Debugging 146 Using ddb for Kernel Debugging 149 Document Revision History 155 Bibliography Bibliography 157 Apple Mac OS X Publications 157 General UNIX and Open Source Resources 157 BSD and UNIX Internals 158 Mach 158 Networking 160 Operating Systems 160 POSIX 161 Programming 161 Websites and Online Resources 161 7 2006-10-03 | © 2002, 2006 Apple Computer, Inc. All Rights Reserved. CONTENTS Security and Cryptography 162 Glossary 163 Index 173 8 2006-10-03 | © 2002, 2006 Apple Computer, Inc. All Rights Reserved. Figures, Tables, and Listings Chapter 3 Kernel Architecture Overview 17 Figure 3-1 Mac OS X architecture 17 Figure 3-2 Darwin and Mac OS X 18 Figure 3-3 Mac OS X kernel architecture 19 Chapter 6 Kernel Programming Style 41 Table 6-1 Commonly used C functions 44 Chapter 9 Mach Scheduling and Thread Interfaces 71 Table 9-1 Thread priority bands 71 Table 9-2 Thread policies 74 Table 9-3 Task roles 76 Chapter 11 I/O Kit Overview 85 Figure 11-1 I/O Kit architecture 89 Chapter 16 Synchronization Primitives 117 Listing 16-1 Allocating lock attributes and groups (lifted liberally from kern_time.c) 125 Chapter 19 Building and Debugging Kernels 139 Table 19-1 Debugging flags 145 Table 19-2 Switch options in ddb 151 9 2006-10-03 | © 2002, 2006 Apple Computer, Inc.
Recommended publications
  • USB-C Dock User Guide
    USB-C Dock User Guide Workflow Notebook and Windows, Mac Device Charging and Chrome CONTENTS Introduction 1.1 Minimum System Requirements .............................................. 1 1.2 Package Contents ..................................................................... 2 1.3 About This Manual .................................................................... 2 1.4 OWC Dock Ejector ..................................................................... 2 1.5 Front View .................................................................................. 3 1.6 Rear View ................................................................................... 3 Support Resources 2.1 Connection ................................................................................ 4 2.2 Usage Notes .............................................................................. 4 2.3 Troubleshooting ........................................................................ 5 2.4 Contacting Techincal Support .................................................. 5 OWC USB-C Dock Contents INTRODUCTION 1.1 Minimum System Requirements Hardware Requirement - 2016–2017 MacBook or - 2016 or later MacBook Pro or - 2018 or later MacBook Air - PC with a USB-C port - Additional Compatibility1 - 2019 Mac Pro - 2019 iMacs - 2017 iMacs including iMac Pro - 2018 Mac mini Operating System - Mac OS X: 10.10–10.11.6 - macOS: 10.12 or later - PC with a USB-C port NOTES - NOTICE! Mac hosts require an Ethernet driver. It can be found here: - www.owcdigital.com/support/software-drivers.html
    [Show full text]
  • Cocoa Touch & Iphone
    Music Appreciation 243: Introduction to Rick Astley Evan Doll [email protected] Alan Cannistraro [email protected] Thursday, April 2, 2009 Thursday, April 2, 2009 Welcome to CS193P: iPhone Application Development Evan Doll [email protected] Alan Cannistraro [email protected] Thursday, April 2, 2009 Staff • Lecturers ■ Evan Doll [email protected] ■ Alan Cannistraro [email protected] • Student TAs ■ Troy Brant [email protected] ■ Paul Salzman [email protected] • “Professor Emeritus” ■ Paul Marcos [email protected] Thursday, April 2, 2009 How many of you... • Are familiar with object-oriented programming? • Have developed software with Mac OS X? • Have developed apps for the iPhone? Thursday, April 2, 2009 Lectures, Sections, Office Hours • Lectures ■ 320-105, Monday & Wednesday 3:15 – 4:30 PM • Optional Section ■ 200-205, Friday 3:15 – 4:05 PM as announced ■ Guest speakers, additional topics ■ First one will be next Friday 4/10 • Office Hours ■ Troy and Paul will be holding office hours ■ Time & location TBD, check website for details Thursday, April 2, 2009 Requirements • Prerequisite: CS 106B/X • Recommended Book: None, we’ll use Apple documentation • You must have access to an Intel-based Macintosh ■ Running Mac OS X 10.5 Leopard ■ iPhone SDK (Not available on cluster computers!) • Owning an iPhone or iPod Touch is not required ■ Assignments may be done with the iPhone Simulator ■ Loaner iPod Touches should be available, more details to come Thursday, April 2, 2009 Enrollment • Response has been phenomenal again
    [Show full text]
  • Membrane: Operating System Support for Restartable File Systems Swaminathan Sundararaman, Sriram Subramanian, Abhishek Rajimwale, Andrea C
    Membrane: Operating System Support for Restartable File Systems Swaminathan Sundararaman, Sriram Subramanian, Abhishek Rajimwale, Andrea C. Arpaci-Dusseau, Remzi H. Arpaci-Dusseau, Michael M. Swift Computer Sciences Department, University of Wisconsin, Madison Abstract and most complex code bases in the kernel. Further, We introduce Membrane, a set of changes to the oper- file systems are still under active development, and new ating system to support restartable file systems. Mem- ones are introduced quite frequently. For example, Linux brane allows an operating system to tolerate a broad has many established file systems, including ext2 [34], class of file system failures and does so while remain- ext3 [35], reiserfs [27], and still there is great interest in ing transparent to running applications; upon failure, the next-generation file systems such as Linux ext4 and btrfs. file system restarts, its state is restored, and pending ap- Thus, file systems are large, complex, and under develop- plication requests are serviced as if no failure had oc- ment, the perfect storm for numerous bugs to arise. curred. Membrane provides transparent recovery through Because of the likely presence of flaws in their imple- a lightweight logging and checkpoint infrastructure, and mentation, it is critical to consider how to recover from includes novel techniques to improve performance and file system crashes as well. Unfortunately, we cannot di- correctness of its fault-anticipation and recovery machin- rectly apply previous work from the device-driver litera- ery. We tested Membrane with ext2, ext3, and VFAT. ture to improving file-system fault recovery. File systems, Through experimentation, we show that Membrane in- unlike device drivers, are extremely stateful, as they man- duces little performance overhead and can tolerate a wide age vast amounts of both in-memory and persistent data; range of file system crashes.
    [Show full text]
  • Mac Keyboard Shortcuts Cut, Copy, Paste, and Other Common Shortcuts
    Mac keyboard shortcuts By pressing a combination of keys, you can do things that normally need a mouse, trackpad, or other input device. To use a keyboard shortcut, hold down one or more modifier keys while pressing the last key of the shortcut. For example, to use the shortcut Command-C (copy), hold down Command, press C, then release both keys. Mac menus and keyboards often use symbols for certain keys, including the modifier keys: Command ⌘ Option ⌥ Caps Lock ⇪ Shift ⇧ Control ⌃ Fn If you're using a keyboard made for Windows PCs, use the Alt key instead of Option, and the Windows logo key instead of Command. Some Mac keyboards and shortcuts use special keys in the top row, which include icons for volume, display brightness, and other functions. Press the icon key to perform that function, or combine it with the Fn key to use it as an F1, F2, F3, or other standard function key. To learn more shortcuts, check the menus of the app you're using. Every app can have its own shortcuts, and shortcuts that work in one app may not work in another. Cut, copy, paste, and other common shortcuts Shortcut Description Command-X Cut: Remove the selected item and copy it to the Clipboard. Command-C Copy the selected item to the Clipboard. This also works for files in the Finder. Command-V Paste the contents of the Clipboard into the current document or app. This also works for files in the Finder. Command-Z Undo the previous command. You can then press Command-Shift-Z to Redo, reversing the undo command.
    [Show full text]
  • Mac OS X Server Administrator's Guide
    034-9285.S4AdminPDF 6/27/02 2:07 PM Page 1 Mac OS X Server Administrator’s Guide K Apple Computer, Inc. © 2002 Apple Computer, Inc. All rights reserved. Under the copyright laws, this publication may not be copied, in whole or in part, without the written consent of Apple. The Apple logo is a trademark of Apple Computer, Inc., registered in the U.S. and other countries. Use of the “keyboard” Apple logo (Option-Shift-K) for commercial purposes without the prior written consent of Apple may constitute trademark infringement and unfair competition in violation of federal and state laws. Apple, the Apple logo, AppleScript, AppleShare, AppleTalk, ColorSync, FireWire, Keychain, Mac, Macintosh, Power Macintosh, QuickTime, Sherlock, and WebObjects are trademarks of Apple Computer, Inc., registered in the U.S. and other countries. AirPort, Extensions Manager, Finder, iMac, and Power Mac are trademarks of Apple Computer, Inc. Adobe and PostScript are trademarks of Adobe Systems Incorporated. Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. Netscape Navigator is a trademark of Netscape Communications Corporation. RealAudio is a trademark of Progressive Networks, Inc. © 1995–2001 The Apache Group. All rights reserved. UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company, Ltd. 062-9285/7-26-02 LL9285.Book Page 3 Tuesday, June 25, 2002 3:59 PM Contents Preface How to Use This Guide 39 What’s Included
    [Show full text]
  • Debugging Kernel Problems
    Debugging Kernel Problems by GregLehey Edition for AsiaBSDCon 2004 Taipei, 13 March 2004 Debugging Kernel Problems by GregLehey([email protected]) Copyright © 1995-2004 GregLehey 3Debugging Kernel Problems Preface Debugging kernel problems is a black art. Not manypeople do it, and documentation is rare, in- accurate and incomplete. This document is no exception: faced with the choice of accuracyand completeness, I chose to attempt the latter.Asusual, time was the limiting factor,and this draft is still in beta status. This is a typical situation for the whole topic of kernel debugging: building debug tools and documentation is expensive,and the people who write them are also the people who use them, so there'satendencytobuild as much of the tool as necessary to do the job at hand. If the tool is well-written, it will be reusable by the next person who looks at a particular area; if not, it might fall into disuse. Consider this book a starting point for your own develop- ment of debugging tools, and remember: more than anywhere else, this is an area with ``some as- sembly required''. Debugging Kernel Problems 4 1 Introduction Operating systems fail. All operating systems contain bugs, and theywill sometimes cause the system to behave incorrectly.The BSD kernels are no exception. Compared to most other oper- ating systems, both free and commercial, the BSD kernels offer a large number of debugging tools. This tutorial examines the options available both to the experienced end user and also to the developer. In this tutorial, we’ll look at the following topics: • Howand whykernels fail.
    [Show full text]
  • Cygwin User's Guide
    Cygwin User’s Guide Cygwin User’s Guide ii Copyright © Cygwin authors Permission is granted to make and distribute verbatim copies of this documentation provided the copyright notice and this per- mission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this documentation under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this documentation into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation. Cygwin User’s Guide iii Contents 1 Cygwin Overview 1 1.1 What is it? . .1 1.2 Quick Start Guide for those more experienced with Windows . .1 1.3 Quick Start Guide for those more experienced with UNIX . .1 1.4 Are the Cygwin tools free software? . .2 1.5 A brief history of the Cygwin project . .2 1.6 Highlights of Cygwin Functionality . .3 1.6.1 Introduction . .3 1.6.2 Permissions and Security . .3 1.6.3 File Access . .3 1.6.4 Text Mode vs. Binary Mode . .4 1.6.5 ANSI C Library . .4 1.6.6 Process Creation . .5 1.6.6.1 Problems with process creation . .5 1.6.7 Signals . .6 1.6.8 Sockets . .6 1.6.9 Select . .7 1.7 What’s new and what changed in Cygwin . .7 1.7.1 What’s new and what changed in 3.2 .
    [Show full text]
  • Programming Java for OS X
    Programming Java for OS X hat’s so different about Java on a Mac? Pure Java applica- tions run on any operating system that supports Java. W Popular Java tools run on OS X. From the developer’s point of view, Java is Java, no matter where it runs. Users do not agree. To an OS X user, pure Java applications that ignore the feel and features of OS X are less desirable, meaning the customers will take their money elsewhere. Fewer sales translates into unhappy managers and all the awkwardness that follows. In this book, I show how to build GUIs that feel and behave like OS X users expect them to behave. I explain development tools and libraries found on the Mac. I explore bundling of Java applications for deployment on OS X. I also discuss interfacing Java with other languages commonly used on the Mac. This chapter is about the background and basics of Java develop- ment on OS X. I explain the history of Java development. I show you around Apple’s developer Web site. Finally, I go over the IDEs commonly used for Java development on the Mac. In This Chapter Reviewing Apple Java History Exploring the history of Apple embraced Java technologies long before the first version of Java on Apple computers OS X graced a blue and white Mac tower. Refugees from the old Installing developer tan Macs of the 1990s may vaguely remember using what was tools on OS X called the MRJ when their PC counterparts were busy using JVMs. Looking at the MRJ stands for Mac OS Runtime for Java.
    [Show full text]
  • Introduction to GNU Octave
    Introduction to GNU Octave Hubert Selhofer, revised by Marcel Oliver updated to current Octave version by Thomas L. Scofield 2008/08/16 line 1 1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 8 6 4 2 -8 -6 0 -4 -2 -2 0 -4 2 4 -6 6 8 -8 Contents 1 Basics 2 1.1 What is Octave? ........................... 2 1.2 Help! . 2 1.3 Input conventions . 3 1.4 Variables and standard operations . 3 2 Vector and matrix operations 4 2.1 Vectors . 4 2.2 Matrices . 4 1 2.3 Basic matrix arithmetic . 5 2.4 Element-wise operations . 5 2.5 Indexing and slicing . 6 2.6 Solving linear systems of equations . 7 2.7 Inverses, decompositions, eigenvalues . 7 2.8 Testing for zero elements . 8 3 Control structures 8 3.1 Functions . 8 3.2 Global variables . 9 3.3 Loops . 9 3.4 Branching . 9 3.5 Functions of functions . 10 3.6 Efficiency considerations . 10 3.7 Input and output . 11 4 Graphics 11 4.1 2D graphics . 11 4.2 3D graphics: . 12 4.3 Commands for 2D and 3D graphics . 13 5 Exercises 13 5.1 Linear algebra . 13 5.2 Timing . 14 5.3 Stability functions of BDF-integrators . 14 5.4 3D plot . 15 5.5 Hilbert matrix . 15 5.6 Least square fit of a straight line . 16 5.7 Trapezoidal rule . 16 1 Basics 1.1 What is Octave? Octave is an interactive programming language specifically suited for vectoriz- able numerical calculations.
    [Show full text]
  • Introduction Use Runit with Traditional Init (Sysvinit)
    2021/07/26 19:10 (UTC) 1/12 Runit Runit Introduction runit is a UNIX init scheme with service supervision. It is a cross-platform Unix init scheme with service supervision, a replacement for sysvinit, and other init schemes and supervision that are used with the traditional init. runit is compatible with djb's daemontools. In Unix-based computer operating systems, init (short for initialization) is the first process started during booting of the computer system. Init is a daemon process that continues running until the system is shut down. Slackware comes with its own legacy init (/sbin/init) from the sysvinit package, that used to be included in almost all other major Linux distributions. The init daemon (or its replacement) is characterised by Process ID 1 (PID 1). To read on the benefits of runit, see here: http://smarden.org/runit/benefits.html * Unless otherwise stated, all commands in this article are to be run by root. Use runit with traditional init (sysvinit) runit is not provided by Slackware, but a SlackBuild is maintained on https://slackbuilds.org/. It does not have any dependencies. As we do not want yet to replace init with runit, run the slackbuild with CONFIG=no: CONFIG=no ./runit.SlackBuild Then install the resulting package and proceed as follows: mkdir /etc/runit/ /service/ cp -a /usr/doc/runit-*/etc/2 /etc/runit/ /sbin/runsvdir-start & Starting via rc.local For a typical Slackware-stlyle service, you can edit /etc/rc.d/rc.local file if [ -x /sbin/runsvdir-start ]; then /sbin/runsvdir-start & fi and then edit write /etc/rc.d/rc.local_shutdown #!/bin/sh SlackDocs - https://docs.slackware.com/ Last update: 2020/05/06 08:08 (UTC) howtos:slackware_admin:runit https://docs.slackware.com/howtos:slackware_admin:runit RUNIT=x$( /sbin/pidof runsvdir ) if [ "$RUNIT" != x ]; then kill $RUNIT fi Then give rc.local_shutdown executive permission: chmod +x /etc/rc.d/rc.local_shutdown and reboot Starting via inittab (supervised) Remove the entries in /etc/rc.d/rc.local and /etc/rc.d/rc.local_shutdown described above.
    [Show full text]
  • Chapter 1. Origins of Mac OS X
    1 Chapter 1. Origins of Mac OS X "Most ideas come from previous ideas." Alan Curtis Kay The Mac OS X operating system represents a rather successful coming together of paradigms, ideologies, and technologies that have often resisted each other in the past. A good example is the cordial relationship that exists between the command-line and graphical interfaces in Mac OS X. The system is a result of the trials and tribulations of Apple and NeXT, as well as their user and developer communities. Mac OS X exemplifies how a capable system can result from the direct or indirect efforts of corporations, academic and research communities, the Open Source and Free Software movements, and, of course, individuals. Apple has been around since 1976, and many accounts of its history have been told. If the story of Apple as a company is fascinating, so is the technical history of Apple's operating systems. In this chapter,[1] we will trace the history of Mac OS X, discussing several technologies whose confluence eventually led to the modern-day Apple operating system. [1] This book's accompanying web site (www.osxbook.com) provides a more detailed technical history of all of Apple's operating systems. 1 2 2 1 1.1. Apple's Quest for the[2] Operating System [2] Whereas the word "the" is used here to designate prominence and desirability, it is an interesting coincidence that "THE" was the name of a multiprogramming system described by Edsger W. Dijkstra in a 1968 paper. It was March 1988. The Macintosh had been around for four years.
    [Show full text]
  • Lecture 1: Introduction to UNIX
    The Operating System Course Overview Getting Started Lecture 1: Introduction to UNIX CS2042 - UNIX Tools September 29, 2008 Lecture 1: UNIX Intro The Operating System Description and History Course Overview UNIX Flavors Getting Started Advantages and Disadvantages Lecture Outline 1 The Operating System Description and History UNIX Flavors Advantages and Disadvantages 2 Course Overview Class Specifics 3 Getting Started Login Information Lecture 1: UNIX Intro The Operating System Description and History Course Overview UNIX Flavors Getting Started Advantages and Disadvantages What is UNIX? One of the first widely-used operating systems Basis for many modern OSes Helped set the standard for multi-tasking, multi-user systems Strictly a teaching tool (in its original form) Lecture 1: UNIX Intro The Operating System Description and History Course Overview UNIX Flavors Getting Started Advantages and Disadvantages A Brief History of UNIX Origins The first version of UNIX was created in 1969 by a group of guys working for AT&T's Bell Labs. It was one of the first big projects written in the emerging C language. It gained popularity throughout the '70s and '80s, although non-AT&T versions eventually took the lion's share of the market. Predates Microsoft's DOS by 12 years! Lecture 1: UNIX Intro The Operating System Description and History Course Overview UNIX Flavors Getting Started Advantages and Disadvantages Lecture Outline 1 The Operating System Description and History UNIX Flavors Advantages and Disadvantages 2 Course Overview Class Specifics 3
    [Show full text]