- It must provide a stable programming interfaces that applications can be built upon.

Size: px
Start display at page:

Download "- It must provide a stable programming interfaces that applications can be built upon."

Transcription

1 System Utilities sysfs Library - libsysfs ========================================= Version: September 13, 2004 Contents Introduction 2. Requirements 3. Definitions 4. Overview 5. Data Structures 5.1 Directory and Attribute Data Structures Attribute Structure Link Structure Directory Structure 5.2 Bus Data Structure 5.3 Class Data Structures 5.4 Root Device Data Structure 5.5 Device Data Structure 5.6 Driver Data Structure 6. Functions 6.1 Calling Conventions in Libsysfs 6.2 Utility Functions 6.3 Filesystem Functions Attribute Functions Directory Link Functions Directory Functions 6.4 Bus Functions 6.5 Class Functions 6.6 Device Functions 6.7 Driver Functions 7. Dlists 7.1 Navigating a dlist 7.2 Custom sorting using dlist_sort_custom() 8. Usage 9. Testsuite 10. Conclusion 1. Introduction Libsysfs purpose is to provide a consistent and stable interface for querying system device information exposed through the sysfs filesystem. The library implements functions for querying filesystem information, such as reading directories and files. It also contains routines for working with buses, classes, and the device tree. 2. Requirements The library must satisfy the following requirements: - It must provide a stable programming interfaces that applications can be built upon.

2 - It must provide functions to retrieve device Vital Product Data (VPD) information for Error Log Analysis (ELA) support. ELA will provide device driver and device bus address information. - It must provide access to all system devices and information exposed by sysfs. - It must provide a function to find sysfs current mount point. - It must provide a function for udev to retrieve a device s major and minor numbers. 3. Definitions sysfs: Sysfs is a virtual filesystem in 2.5+ Linux kernels that presents a hierarchical representation of all system physical and virtual devices. It presents system devices by bus, by class, and by topology. Callbacks to device drivers are exposed as files in device directories. Sysfs, for all purposes, is our tree of system devices. For more information, please see: - udev: Udev is Greg Kroah-Hartman s User Space implementation of devfs. Udev creates /dev nodes for devices upon Hotplug events. The Hotplug event provides udev with a sysfs directory location of the device. Udev must use that directory to grab device s major and minor number, which it will use to create the /dev node. For more information, please see: Udev provides persistent device naming based on a set of user specified rules. The rules a device name is based on could one or a combination of a number of parameters such as the bus the device is on, the serial number of the device (in case of USB), the vendor name (in case of SCSI) and so on. Udev uses Libsysfs to retrieve relevent information to appropriately name devices. 4. Overview Libsysfs grew from a common need. There are several applications under development that need access to sysfs and system devices. Udev, on a hotplug event, must take a sysfs device path and create a /dev node. Our diagnostic client needs to list all system devices. Finally, our Error Log Analysis piece is required to retrieve VPD information for a failing device. We divided to create a single library interface rather than having these separate applications create their own accesses to sysfs involving reading directories and files. Libsysfs will also provide stability for applications to be built upon. Sysfs currently doesn t enforce any standards for callback or file names. File names change depending on bus or class. Sysfs is also changing, it is currently being developed. Libsysfs will provide a stable interface to applications while allowing sysfs to change underneath it. Like sysfs, the library will provide devices to applications by bus, by

3 class, and by topology. The library will function similar to directories and files that lie underneath it. To query a device on a PCI bus, one would "open" the bus to scan or read devices and "close" the bus when completed. Besides supplying functions to retrieve devices, the library will also provide some utility functions like getting sysfs mount point. A paper on Libsysfs was presented at Linux.Conf.Au 2004 (Adelaide, January 2004). The paper is available online at: 5. Data Structures Libsysfs will classify system devices following sysfs example, dividing them by bus, class, and devices. The library presents this information generically. It doesn t, for example, differentiate between PCI and USB buses. Device attributes are presented with values as they are exposed by sysfs, the values are not formatted. The library will provide standard definitions for working with sysfs and devices, here s some examples: #define SYSFS_FSTYPE_NAME #define SYSFS_PROC_MNTS #define SYSFS_BUS_NAME #define SYSFS_CLASS_NAME #define SYSFS_BLOCK_NAME #define SYSFS_DEVICES_NAME #define SYSFS_DRIVERS_NAME #define SYSFS_NAME_ATTRIBUTE "sysfs" "/proc/mounts" "bus" "class" "block" "devices" "drivers" "name" The library uses some definitions to mark maximum size of a sysfs name or path length: #define SYSFS_PATH_MAX 255 #define SYSFS_NAME_LEN 50 #define SYSFS_BUS_ID_SIZE 20 NOTE: a. As of release of sysfsutils, a number of changes have been made so that the dlists and "directory" references in all libsysfs s structures are not populated until such time that it is absolutely necessary. Hence, these elements may not contain valid data at all times (as was the case before). b. As of release of sysfsutils, all dlists in the library are sorted in alphabetical order. It is now a requirement that the "name" and "path" be the first two elements of all libsysfs structures. 5.1 Directory and Attribute Data Structures The library implements structures to represent sysfs directories, links, and files.

4 5.1.1 Attribute Structure A file in sysfs represents a device or driver attribute. Attributes can be read only, write only, or read and write. File data can be ASCII and binary. The library has the following structure to represent files: struct sysfs_attribute { char name[sysfs_name_len]; char path[sysfs_path_max]; char *value; unsigned short len; /* value length */ unsigned short method; /* show and store */ }; Path represents the file/attribute s full path. Value is used when reading from or writing to an attribute. "len" is the length of data in "value". Method is a bitmask for defining if the attribute supports show(read) and/or store(write) Link Structure Symbolic links are used in sysfs to link bus or class views with particular devices. struct sysfs_link { char name[sysfs_name_len]; char path[sysfs_path_max]; char target[sysfs_path_max]; }; Link s name is stored in "name and it s target stored in "target". Absolute path to the link is stored in "path" Directory Structure The directory structure represents a sysfs directory: struct sysfs_directory { char name[sysfs_name_len]; char path[sysfs_path_max]; }; /* Private: for internal use only */ struct dlist *subdirs; struct dlist *links; struct dlist *attributes; The sysfs_directory structure includes the list of subdirectories, links and attributes. The "name" and absolute "path" are also stored in the structure. The sysfs_directory structure is intended for use internal to the library. Applications needing access to attributes and links from the directory will need to make appropriate calls (described below) to get the same. 5.2 Bus Data Structure

5 All buses look similar in sysfs including lists of devices and drivers, therefore we use the following structure to represent all sysfs buses: struct sysfs_bus { char name[sysfs_name_len]; char path[sysfs_path_max]; }; /* Private: for internal use only */ struct dlist *drivers; struct dlist *devices; struct sysfs_directory *directory; The sysfs_bus structure contains the bus "name", while the "path" to bus directory is also stored. It also contains lists of devices on the bus and drivers that are registered on it. The bus directory is represented by the sysfs_directory structure and it contains references to all the subdirectories, links, and attributes. The sysfs_directory structure is for internal use only. The following functions may be used by applications to retrieve data from the sysfs_directory structure: struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, char *attrname) 5.3 Class Data Structures The library uses two data structures to represent classes in sysfs. Sysfs classes contains a class directory like "net" or "scsi_host" and then class devices like "eth0", "lo", or "eth1" for the "net" class. struct sysfs_class { char name[sysfs_name_len]; char path[sysfs_path_max]; }; /* Private: for internal use only */ struct dlist *devices; struct sysfs_directory *directory; The sysfs_class represents device classes in sysfs like "net". It contains the class "name", "path" to the class, a list of class devices and the directory representation (for internal use only). struct sysfs_class_device { char name[sysfs_name_len]; char path[sysfs_path_max]; char classname[sysfs_name_len]; }; /* Private: for internal use only */ struct sysfs_class_device *parent; struct sysfs_device *sysdevice; /* NULL if virtual */ struct sysfs_driver *driver; /* NULL if not implemented */ struct sysfs_directory *directory;

6 A class device isn t the same as a sysfs_device, it s specific to the class in which it belongs. The class device structure contains the name of the class the class device belongs to, its sysfs_device reference and that device s driver reference (if any). It also contains the name of the class device - like "eth0", its parent point (if present) and its sysfs directory information including links and attributes (for internal use only). The following function may be used by applications to retrieve data from the sysfs_directory structure: struct dlist *sysfs_get_classdev_attributes(struct sysfs_class_device *cdev); 5.4 Root Device Data Structure Device hierarchies in sysfs are represented under the /sys/devices directory structure. Sysfs devices typically spawn off from base devices which are represented by a sysfs_root_device. struct sysfs_root_device { char name[sysfs_name_len]; char path[sysfs_path_max]; }; /* Private: for internal use only */ struct dlist *devices; struct sysfs_directory *directory; The sysfs_root_device structure contains a list of "devices" that spawn off it. The name of the root device as represented under /sys/devices is read into "name" and the absolute path into "path" and its sysfs_directory information intended to be used internal to the library. 5.5 Device Data Structure The sysfs_device structure represents a system device that s exposed in sysfs under the /sys/devices directory structure. struct sysfs_device { char name[sysfs_name_len]; char path[sysfs_path_max]; char bus_id[sysfs_name_len]; char bus[sysfs_name_len]; char driver_name[sysfs_name_len]; }; /* Private: for internal use only */ struct sysfs_device *parent; struct dlist *children; struct sysfs_directory *directory; The sysfs_device structure contains a "parent" pointer, a list of child devices, if any, device s directory, its bus id - which is the name of device s directory, the bus name on which this device is registered and its driver name. The device structure also contains the absolute path to the device and a directory structure, which contains a list of the device s attributes (for internal use only). The following functions may be used to obtain information from sysfs_directory structure:

7 struct sysfs_attribute *sysfs_get_device_attribute(struct sysfs_device *dev, const char *name) struct dlist *sysfs_get_device_attributes(struct sysfs_device *device) 5.6 Driver Data Structure The sysfs_driver structure represents a device driver. struct sysfs_driver { char name[sysfs_name_len]; char path[sysfs_path_max]; }; /* Private: for internal use only */ struct dlist *devices; struct sysfs_directory *directory; The sysfs_driver structure contains a list of devices that use this driver, the name of the driver, its path, and its directory information, which includes the driver s attributes (for internal use only). The following function may be used to retrieve driver attribute information from the sysfs_directory structure: struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver) 6. Functions Libsysfs will provide functions to access system devices by bus, by class, and by device. Functions will act like accessing directories and files, using "open" and "close". Open returns a structure and close is used to clean that structure up. 6.1 Calling Conventions in Libsysfs Libsysfs uses a simple API calling convention. APIs are classified to be one of "open", "get", "close" types. The convention is as follows: a. All "open" APIs have a corresponding "close" API. b. References obtained using "get" calls should not be closed explicitly. c. All "opened" references have to be closed with a call to their corresponding "close" call. This takes care of freeing structure references obtained with "get" calls. 6.2 Utility Functions The library will provide a few utility functions for working with sysfs. sysfs_get_mnt_path

8 Function finds the mount path for filesystem type "sysfs". Arguments: char *mnt_path Mount path buffer size_t len Size of mount path buffer Zero with success. -1 with error. Errno will be set with error: - EINVAL for invalid argument, if buffer is NULL or if len is zero Prototype: sysfs_get_mnt_path(char *mnt_path, size_t len); sysfs_get_name_from_path Function returns the last directory or file name from the included path. Arguments: const char *path Path to parse name from char *name Buffer to put parsed name into size_t *len Size of name buffer 0 with success. -1 on Error. Errno will be set with error, returning Prototype: int sysfs_get_name_from_path(const char *path, char *name, size_t *len) sysfs_get_link Sysfs readlink function, reads the link at supplied path and returns its target path. Arguments: const char *path Link s path char *target Buffer to place link s target size_t len Size of target buffer 0 with success -1 with error. Errno will be set with error, returning Prototype: int sysfs_get_link(const char *path, char *target, size_t len) sysfs_open_subsystem_list Function returns the list of entries for the given subsystem. If the argument is "bus", this function will return a list of buses ("pci", "scsi", etc) supported on the system. sysfs_close_list() has to be called to free the list obtained from this call. Arguments: char *name Subsystem to open, like "bus"..

9 dlist of entries for the subsystem on success NULL with error indicating the "name" subsystem is invalid. Prototype: struct dlist *sysfs_open_subsystem_list(char *name) sysfs_open_bus_devices_list Function returns the list of devices on the given bus. sysfs_close_list() has to be called to free the list obtained from this call. Arguments: char *name Bus name to open "pci"/"scsi"/"usb".. dlist of device names for the given bus on success NULL with error indicating the bus is not supported. Prototype: struct dlist *sysfs_open_bus_devices_list(char *name) sysfs_close_list Closes a given dlist. This can be used as a generic list close routine. Arguments: struct dlist *list List to be closed Prototype: void sysfs_close_list(struct dlist *list) sysfs_path_is_dir Utility function to verify if a given path is to a directory. Arguments: const char *path Path to verify 0 on success, 1 on error Prototype: int sysfs_path_is_dir(const char *path) sysfs_path_is_file Utility function to verify if a given path is to a file. Arguments: const char *path Path to verify 0 on success, 1 on error Prototype: int sysfs_path_is_file(const char *path)

10 sysfs_path_is_link Utility function to verify if a given path is to a link. Arguments: const char *path Path to verify 0 on success, 1 on error Prototype: int sysfs_path_is_link(const char *path) 6.3 Filesystem Functions Libsysfs provides a set of functions to open, read, and close directories and attributes/files in sysfs. These functions mirror their filesystem function counterparts Attribute Functions Along with the usual open, read, and close functions, libsysfs provides a couple other functions for accessing attribute values. sysfs_open_attribute Opens up a file in sysfs and creates a sysfs_attribute structure. File isn t read with this function. Arguments: const char *path File/Attribute s path struct sysfs_attribute * with success. Prototype: struct sysfs_attribute *sysfs_open_attribute(const char *path) sysfs_close_attribute Arguments: Cleans up and closes sysfs_attribute structure. struct sysfs_attribute *sysattr Attribute to close Prototype: void sysfs_close_attribute(struct sysfs_attribute *sysattr) sysfs_read_dir_attributes Arguments: Reads the given sysfs_directory to create a list of attributes. struct sysfs_directory *sysdir sysfs_directory whose attributes to read

11 struct dlist * of attributes on success NULL with error. Errno will be set on error, returning EINVAL for invalid arguments Prototype: struct dlist *sysfs_read_dir_attributes (struct sysfs_directory *sysdir) sysfs_refresh_dir_attributes Arguments: Given a list sysfs_directory, this function refreshes the list of attributes for the given directory. struct sysfs_directory *sysdir sysfs_ directory whose attributes list to refresh 0 with success. 1 with error. Errno will be set on error, returning EINVAL for invalid arguments Prototype: int sysfs_refresh_dir_attributes(struct sysfs_directory *sysdir) sysfs_get_dir_attributes Arguments: Returns a list of attributes for the given sysfs_directory. struct sysfs_directory *sysdir sysfs_directory whose attributes list to return struct dlist * of attributes with success NULL with error. Errno will be set on error, returning EINVAL for invalid arguments Prototype: struct dlist *sysfs_read_dir_attributes (struct sysfs_directory *sysdir) sysfs_read_attribute Reads the supplied attribute. Since the maximum transfer from a sysfs attribute is a pagesize, function reads in up to a page from the file and stores it in the "value" field in the attribute. Arguments: struct sysfs_attribute *sysattr Attribute to read 0 with success. -1 with error. Errno will be set with error, returning Prototype: int sysfs_read_attribute(struct sysfs_attribute *sysattr) sysfs_write_attribute

12 Writes to the supplied attribute. Function validates if the given attribute is writable, and writes the new value to the attribute. Value to write as well as its length is user supplied. In case the length written is not equal to the length requested to be written, the original value is restored and an error is returned. Arguments: struct sysfs_attribute *sysattr Attribute to write to const char *new_value sysattr s new value size_t len Length of "new_value" 0 with success. -1 with error. Errno will be set with error, returning Prototype: int sysfs_write_attribute(struct sysfs_attribute *sysattr, const char *new_value, size_t len) sysfs_read_attribute_value Given a path to a specific attribute, function reads and returns its value to the supplied value buffer. Arguments: const char *attrpath Attribute path to read char *value Buffer to read in attribute s value size_t vsize Size of buffer 0 with success. -1 with error. Errno will be set with error, returning Prototype: int sysfs_read_attribute_value(const char *attrpath, char *value, size_t vsize) sysfs_get_value_from_attributes Function takes a single or linked list of sysfs attribute structures and returns the value of the specified attribute name. Arguments: struct dlist *attr Attribute list to search through const char *name Name of attribute whose value to retrieve char * attribute value with success. Prototype: char *sysfs_get_value_from_attributes (struct sysfs_attribute *attr, const char *name) sysfs_get_directory_attribute Function walks the list of attributes for the given sysfs

13 directory and returns the sysfs_attribute structure for the specified attribute name. Arguments: struct sysfs_directory *dir Directory in which to search char *attrname Attribute name to look for struct sysfs_attribute on success. Prototype: struct sysfs_attribute *sysfs_get_directory_attribute (struct sysfs_directory *dir, char *attrname) Link Functions Sysfs contains many symbolic links, like bus links to bus devices. Libsysfs treats links differently than directories due to processing differences. A link in the /sys/bus/"busname"/devices/ directory indicates a device in the /sys/devices directory. Through links we give the functionality to know what is and what isn t a link and the ability to query the links target. sysfs_open_link Opens a directory link. Arguments: const char *linkpath Path to link struct sysfs_link * with success. Prototype: struct sysfs_link *sysfs_open_link(const char *linkpath) sysfs_close_link Closes a directory link structure. Arguments: struct sysfs_link *ln Link to close Prototype: void sysfs_close_link(struct sysfs_link *ln) sysfs_read_dir_links Arguments: Reads the given sysfs_directory to create a list of links. struct sysfs_directory *sysdir sysfs_directory whose links to read struct dlist * of links with success NULL with error. Errno will be set on error, returning EINVAL for invalid arguments

14 Prototype: struct dlist *sysfs_read_dir_links (struct sysfs_directory *sysdir) sysfs_get_dir_links Arguments: Returns a list of links for the given sysfs_directory. struct sysfs_directory *sysdir sysfs_directory whose list of links to return struct dlist * of links with success NULL with error. Errno will be set on error, returning EINVAL for invalid arguments Prototype: struct dlist *sysfs_read_dir_links (struct sysfs_directory *sysdir) sysfs_get_directory_link Function walks the list of links for the given sysfs directory and returns the sysfs_link structure for the specified link name. Arguments: struct sysfs_directory *dir Directory in which to search char *linkname Link name to look for struct sysfs_link * with success. Prototype: struct sysfs_link *sysfs_get_directory_link (struct sysfs_directory *dir, char *linkname) sysfs_get_subdirectory_link Function walks the list of links for the given sysfs directory and its subdirectories returns the sysfs_link structure for the specified link name. Arguments: struct sysfs_directory *dir Directory in which to search char *linkname Link name to look for struct sysfs_link * with success. Prototype: struct sysfs_link *sysfs_get_subdirectory_link (struct sysfs_directory *dir, char *linkname) sysfs_refresh_dir_links Given a list sysfs_directory, this function refreshes the list

15 of links under the given directory. Arguments: struct sysfs_directory *sysdir sysfs_ directory whose links list to refresh 0 with success. 1 with error. Errno will be set on error, returning EINVAL for invalid arguments Prototype: int sysfs_refresh_dir_links(struct sysfs_directory *sysdir) Directory Functions Sysfs directories can represent every directory under sysfs. The structures keep track of subdirectories, links, and files. Like opendir, readdir, and closedir, libsysfs provides open, read, and close functions for working with sysfs directories. Open creates the sysfs_directory structure. Read reads in its contents - like subdirectories, links, and files. Close cleans it all up. sysfs_open_directory Opens a sysfs directory at a specific path Arguments: const char *path Directory path to open struct sysfs_directory * with success. Prototype: struct sysfs_directory *sysfs_open_directory(const char *path) sysfs_close_directory Arguments: Closes specific directory, its subdirectories, links, and files. struct sysfs_directory *sysdir Directory to close Prototype: void sysfs_close_directory(struct sysfs_directory *sysdir) sysfs_read_dir_subdirs Arguments: Reads the given sysfs_directory to create a list of subdirs. struct sysfs_directory *sysdir sysfs_directory whose subdirs have to be read struct dlist * of links with success NULL with error. Errno will be set on error, returning EINVAL for invalid arguments

16 Prototype: struct dlist *sysfs_read_dir_subdirs (struct sysfs_directory *sysdir) sysfs_read_directory Arguments: Read the supplied directory. Reading fills in the directory s contents like subdirectories, links, and attributes. struct sysfs_directory *sysdir Directory to read 0 with success. -1 with error. Errno will be set with error, returning Prototype: int sysfs_read_directory(struct sysfs_directory *sysdir) sysfs_read_all_subdirs Arguments: Reads all subdirs under a given supplied directory. struct sysfs_directory *sysdir Directory to read 0 with success. -1 with error. Errno will be set with error, returning Prototype: int sysfs_read_all_subdirs(struct sysfs_directory *sysdir) sysfs_get_subdirectory Function walks the directory tree for the given directory and returns a sysfs_directory structure for the specified directory name. Arguments: struct sysfs_directory *dir Directory in which to search char *subname Name of directory to look for struct sysfs_directory with success. Prototype: struct sysfs_directory *sysfs_get_subdirectory (struct sysfs_directory *dir, char *subname) sysfs_get_dir_subdirs Arguments: Returns a list of subdirs for the given sysfs_directory. struct sysfs_directory *sysdir sysfs_directory whose subdirectories list to return struct dlist * of directories with success

17 NULL with error. Errno will be set on error, returning EINVAL for invalid arguments Prototype: struct dlist *sysfs_read_dir_subdirs (struct sysfs_directory *sysdir) sysfs_refresh_dir_subdirs Arguments: Given a list sysfs_directory, this function refreshes the list of subdirectories under the given directory. struct sysfs_directory *sysdir sysfs_ directory whose subdirs list to refresh 0 with success. 1 with error. Errno will be set on error, returning EINVAL for invalid arguments Prototype: int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir) 6.4 Bus Functions The library provides a functions for viewing buses represented in sysfs. The sysfs_open_bus opens a bus in the /sys/bus directory, such as "pci", "usb", or "scsi". The open command returns a sysfs_bus structure that contains a list of the bus devices. The sysfs_close_bus function is used to clean up the bus structure. Given a device or a driver, functions are provided to determine what bus they are on. sysfs_open_bus Function opens up one of the buses represented in sysfs in the /sys/bus directory. It returns a sysfs_bus structure that includes a list of bus devices and drivers. Arguments: const char *name Bus name to open, like "pci"... struct sysfs_bus * with success Prototype: struct sysfs_bus *sysfs_open_bus(const char *name) sysfs_close_bus Function closes up the sysfs_bus structure including its devices, drivers, and directory. Arguments: sysfs_bus *bus Bus structure to close Prototype: void sysfs_close_bus(struct sysfs_bus *bus)

18 sysfs_get_bus_devices Function returns a list of devices that are registered with this bus. Arguments: struct sysfs_bus *bus Bus whose devices list to return struct dlist * of sysfs_devices on success NULL with error. Errno will be sent with error, returning Prototype: struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus) sysfs_get_bus_drivers Function returns a list of drivers that are registered with this bus. Arguments: struct sysfs_bus *bus Bus whose drivers list to return struct dlist * of sysfs_drivers on success NULL with error. Errno will be sent with error, returning Prototype: struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) sysfs_get_bus_device Function takes a sysfs_bus structure(obtained on a successful return from a sysfs_open_bus() call) and looks for the given device on this bus. On success, it returns a sysfs_device structure corresponding to the device. Arguments: struct sysfs_bus *bus Bus structure on which to search char *id Device to look for struct sysfs_device * with success Prototype: struct sysfs_device *sysfs_get_bus_device (struct sysfs_bus *bus, char *id) sysfs_get_bus_driver Function takes a sysfs_bus structure (obtained on a successful return from a sysfs_open_bus() call) and looks for the given driver on this bus. On success, it returns a sysfs_driver structure corresponding to the driver. Arguments: struct sysfs_bus *bus Bus structure on which to search char *drvname Driver to look for

19 struct sysfs_driver * with success Prototype: struct sysfs_device *sysfs_get_bus_driver (struct sysfs_bus *bus, char *drvname) sysfs_get_bus_attributes Function takes a sysfs_bus structure and returns a list of attributes for the bus. Arguments: struct sysfs_bus *bus Bus for which attributes are required struct dlist * of attributes with success Prototype: struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) sysfs_get_bus_attribute Function takes a sysfs_bus structure and looks for the required attribute on the bus. On success, it returns a sysfs_attribute structure corresponding to the given attribute. Arguments: struct sysfs_bus *bus Bus structure on which to search char *attrname Attribute to look for struct sysfs_attribute * with success Prototype: struct sysfs_attribute *sysfs_get_bus_attribute (struct sysfs_bus *bus, char *attrname) sysfs_refresh_bus_attributes Function refreshes the list of attributes for a given sysfs_bus Arguments: struct sysfs_bus *bus Bus whose attributes list to refresh struct dlist * of attributes with success Prototype: struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) sysfs_find_driver_bus Given the name of a driver, this function finds the name of the

20 bus the driver is on Arguments: const char *driver Name of the driver to look for char *busname Buffer to return the bus name size_t bsize Size of the "busname" buffer 0 with success. -1 with error. Errno will be set with error, returning Prototype: int sysfs_find_driver_bus(const char *driver, char *busname, size_t bsize) 6.5 Class Functions Libsysfs provides functions to open sysfs classes and their class devices. These functions too operate with open and close, close must be called to clean up the class structures. Given a class device name, functions are provided to determine what class they belong to. Once a class device name and the class it belongs to is known, a function to open the class device is provided. This method can be used when details of a single class device is required. sysfs_open_class Function opens up one of the classes represented in sysfs in the /sys/class directory. It returns a sysfs_class structure that includes a list of class devices. Arguments: const char *name Class name to open, like "net".. struct sysfs_class * with success Prototype: struct sysfs_class *sysfs_open_class(const char *name) sysfs_close_class Function closes up the sysfs_class structure including its class devices. Arguments: sysfs_class *cls Class structure to close Prototype: void sysfs_close_class(struct sysfs_class *cls); sysfs_open_class_device_path Function opens up one of the class devices represented in sysfs in sysfs/class/"class"/ directory. It returns a sysfs_class_device structure.

21 Arguments: const char *path Path to class device struct sysfs_class_device * with success Prototype: struct sysfs_class_device *sysfs_open_class_device_path (const char *path) sysfs_close_class_device Arguments: Function closes up the sysfs_class_device structure. sysfs_class_device *dev Class device structure to close Prototype: void sysfs_close_class_device(struct sysfs_class_device *dev) sysfs_get_class_device Function takes a sysfs_class structure(obtained on a successful return from a sysfs_open_class() call) and looks for the given device in this class. On success, it returns a sysfs_class_device structure corresponding to the class device. Arguments: struct sysfs_class *cls Class on which to search char *name Class device "name" to look for struct sysfs_class_device * with success Prototype: struct sysfs_class_device *sysfs_get_class_device (struct sysfs_class *cls, char *name) sysfs_get_class_devices Function returns a list of class devices for the given class. Arguments: struct sysfs_class *cls Class whose class device list is required struct dlist * of sysfs_class_devices on success Prototype: struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) sysfs_open_class_device Given the name of the class on which to look for, this function locates a given class device and returns a sysfs_class_device structure corresponding to the requested class device.

22 NOTE: 1. The sysfs_class_device structure obtained upon successful return from this function has to be closed by calling sysfs_close_class_device(). 2. Class this device belongs to must be known prior to calling this function. Arguments: const char *classname Class on which to search char *name Class device "name" to open struct sysfs_class_device * with success Prototype: struct sysfs_class_device *sysfs_open_class_device (const char *classname, char *name) sysfs_get_classdev_device Function returns the sysfs_device reference (if present) for the given class device. Arguments: struct sysfs_class_device *clsdev Class device whose sysfs_device reference is required struct sysfs_device * on success Prototype: struct sysfs_device *sysfs_get_classdev_device (struct sysfs_class_device *clsdev) sysfs_get_classdev_driver Function returns the sysfs_driver reference (if present) for the given class device. Arguments: struct sysfs_class_device *clsdev Class device whose sysfs_driver reference is required struct sysfs_driver * on success Prototype: struct sysfs_driver *sysfs_get_classdev_driver (struct sysfs_class_device *clsdev) sysfs_get_classdev_parent Function returns the sysfs_class_device reference for the parent (if present) of the given class device.

23 Arguments: struct sysfs_class_device *clsdev Class device whose parent reference is required struct sysfs_class_device * on success Prototype: struct sysfs_class_device *sysfs_get_classdev_parent (struct sysfs_class_device *clsdev) sysfs_get_classdev_attributes Function takes a sysfs_class_device structure and returns a list of attributes for the class device. Arguments: struct sysfs_class_device *cdev Class device for which attributes are required struct dlist * of attributes with success Prototype: struct dlist *sysfs_get_classdev_attributes (struct sysfs_class_device *cdev) sysfs_get_classdev_attr Searches supplied class device s attributes by name and returns the attribute. Arguments: struct sysfs_class_device *clsdev Device to search const char *name Attribute name to find struct sysfs_attribute * with success Prototype: struct sysfs_attribute *sysfs_get_classdev_attr (struct sysfs_class_device *clsdev, const char *name) sysfs_refresh_classdev_attributes Arguments: Function refreshes the list of attributes for a given sysfs_class_device. struct sysfs_class_device *cdev Class device whose attributes list to refresh struct dlist * of attributes with success

24 Prototype: struct dlist *sysfs_get_classdev_attributes (struct sysfs_class_device *cdev) sysfs_open_classdev_attr NOTE: Function takes as arguments, a the name of the class, the class device name and the name of the required attribute. 1. The struct sysfs_attribute * obtained upon successful return from this function has to be closed by making a call to sysfs_close_attribute() Arguments: char *classname Class name on which to search char *dev Name of the class device char *attrib Attribute to open struct sysfs_attribute * with success. Prototype: struct sysfs_attribute *sysfs_write_classdev_attr (const char *classname, const char *dev, const char *attrib) 6.6 Device Functions Devices represent everything in sysfs under /sys/devices, which is a hierarchical view of system devices. Besides the expected open and close functions, libsysfs provides open and close functions for root devices. These functions recursively open or close a device and all of its children. sysfs_open_device_path Opens up a device at a specific path. It opens the device s directory, reads the directory, and returns a sysfs_device structure. Arguments: const char *path Path to device struct sysfs_device * with success Prototype: struct sysfs_device *sysfs_open_device_path(const char *path) sysfs_close_device Function closes up the sysfs_device structure. Arguments: sysfs_device *dev Device structure to close

25 Prototype: void sysfs_close_device(struct sysfs_device *dev) sysfs_open_root_device Function opens up one of the root devices represented in sysfs in the /sys/devices directory. It returns a sysfs_root_device structure that includes a list of devices in the tree. Arguments: const char *name Name of the root device to open struct sysfs_root_device * with success Prototype: struct sysfs_device *sysfs_open_root_device(const char *name) sysfs_close_root_device Function closes up the sysfs_root_device structure including the devices in the root device tree. Arguments: sysfs_device *root Root device structure to close Prototype: void sysfs_close_root_device(struct sysfs_root_device *root) sysfs_open_device_tree Function opens up the device tree at the specified path. Arguments: const char *path Path at which to open the device tree struct sysfs_device * with success NULL with error, Errno will be set with error, returning Prototype: struct sysfs_device *sysfs_open_device_tree(const char *path) sysfs_close_device_tree Function closes the device tree originating at the given sysfs_device. Arguments: struct sysfs_device *devroot Device from which the device tree has to be closed Prototype: void sysfs_close_device_tree(struct sysfs_device *devroot) sysfs_get_device_parent

26 Function returns the sysfs_device reference for the parent (if present) of the given sysfs_device. Arguments: struct sysfs_device *dev sysfs_device whose parent reference is required struct sysfs_device * on success Prototype: struct sysfs_device *sysfs_get_device_parent (struct sysfs_device *dev) sysfs_get_root_devices Arguments: Function returns a list of devices under the given root device. struct sysfs_root_device *root sysfs_root_device whose devices list is required struct dlist * of sysfs_devices on success Prototype: struct dlist *sysfs_get_root_devices (struct sysfs_root_device *root) sysfs_get_device_attr Searches supplied device s attributes by name and returns the attribute. Arguments: struct sysfs_device *dev Device to search const char *name Attribute name to find struct sysfs_attribute * with success Prototype: struct sysfs_attribute *sysfs_get_device_attr (struct sysfs_device *dev, const char *name) sysfs_get_device_attributes Function takes a sysfs_device structure and returns a list of attributes for the device. Arguments: struct sysfs_device *device Device for which attributes are required struct dlist * of attributes with success

27 Prototype: struct dlist *sysfs_get_device_attributes (struct sysfs_device *device) sysfs_refresh_device_attributes Function refreshes the list of attributes for a given sysfs_device. Arguments: struct sysfs_device *device Device whose attributes list to refresh struct dlist * of attributes with success Prototype: struct dlist *sysfs_refresh_device_attributes (struct sysfs_device *device) sysfs_open_device Given the name of the bus on which to look for, this function locates a given device and returns a sysfs_device structure corresponding to the requested device. Arguments: const char *bus Bus on which to search const char *bus_id Device to look for struct sysfs_device * with success Prototype: struct sysfs_device *sysfs_open_device (const char *bus, const char *bus_id) sysfs_get_device_bus Given a sysfs_device, this function fills in the bus this device is on in the sysfs_device->bus field. Arguments: struct sysfs_device *dev Device whose bus name to find 0 with success. -1 with error. Errno will be set with error, returning Prototype: int sysfs_get_device_bus(struct sysfs_device *dev) sysfs_open_device_attr Function takes as arguments, the bus on which to search for a device, and an attribute of the device to open.

28 NOTE: 1. The struct sysfs_attribute * obtained upon successful return from this function has to be closed by making a call to sysfs_close_attribute() Arguments: char *bus Bus on which to search char *bus_id Device to look for char *attrib Name of the attribute to open struct sysfs_attribute * with success. Prototype: struct sysfs_attribute *sysfs_open_device_attr (const char *bus, const char *bus_id, const char *attrib) 6.7 Driver Functions Drivers are represented in sysfs under the /sys/bus/xxx/drivers (xxx being the bus type, such as "pci", "usb, and so on). Functions are provided to open and close drivers. sysfs_open_driver_path Opens driver at specific path. Arguments: const char *path Path to driver struct sysfs_driver * with success Prototype: struct sysfs_driver *sysfs_open_driver_path(const char *path) sysfs_close_driver Closes and cleans up sysfs_driver structure. Arguments: sysfs_driver *driver Driver structure to close Prototype: void sysfs_close_driver(struct sysfs_driver *driver) sysfs_get_driver_devices Function returns a list of devices that use this driver. Arguments: struct sysfs_driver *driver Driver whose devices list is required struct dlist * of sysfs_devices on success

29 Prototype: struct dlist *sysfs_get_driver_devices (struct sysfs_driver *driver) sysfs_refresh_driver_devices Function refreshes the list of devices that use this driver. Arguments: struct sysfs_driver *driver Driver whose devices list is required to be refreshed struct dlist * of sysfs_devices on success Prototype: struct dlist *sysfs_refresh_driver_devices (struct sysfs_driver *driver) sysfs_get_driver_device Function returns a sysfs_device reference for the device with "name" that uses this driver Arguments: struct sysfs_driver *driver Driver on which to search const char *name Name of the device to look for struct sysfs_device * corresponding to "name" on success Prototype: struct dlist *sysfs_get_driver_device (struct sysfs_driver *driver, const char *name) sysfs_get_driver_attr Searches supplied driver s attributes by name and returns the attribute. Arguments: struct sysfs_driver *drv Driver to search const char *name Attribute name to find struct sysfs_attribute * with success Prototype: struct sysfs_attribute *sysfs_get_driver_attr (struct sysfs_driver *drv, const char *name) sysfs_get_driver_attributes Function takes a sysfs_driver structure and returns a list of attributes for the driver.

30 Arguments: struct sysfs_driver *driver Driver for which attributes are required struct dlist * of attributes with success Prototype: struct dlist *sysfs_get_driver_attributes (struct sysfs_driver *driver) sysfs_refresh_driver_attributes Function refreshes the list of attributes for a given sysfs_driver. Arguments: struct sysfs_driver *driver Driver whose attributes list to refresh struct dlist * of attributes with success Prototype: struct dlist *sysfs_refresh_driver_attributes (struct sysfs_driver *driver) sysfs_open_driver NOTE: Given the name of the bus on which to look for, this function locates a given driver and returns a sysfs_driver structure corresponding to the requested device. 1. The sysfs_driver structure obtained upon successful return from this function has to be closed by calling sysfs_close_driver_by_name(). 2. Bus on which to look for this driver should be known prior to calling this function. Use sysfs_find_driver_bus() to determine this. Arguments: const char *bus_name Bus on which to search const char *drv_name Driver name to look for struct sysfs_driver * with success Prototype: struct sysfs_driver *sysfs_open_driver(const char *bus_name, const char *drv_name) sysfs_get_driver_links Function returns a list of links for a given driver

31 Arguments: struct sysfs_driver *driver Driver to get links from struct dlist * of links on success NULL with error Prototype: struct dlist *sysfs_get_driver_links (struct sysfs_driver *driver) sysfs_open_driver_attr NOTE: Function takes as arguments, the bus the driver is registered on, the driver name and the name of the attribute to open. 1. The struct sysfs_attribute * obtained upon successful return from this function has to be closed by making a call to sysfs_close_attribute() Arguments: char *bus Bus on which driver is present char *drv Driver to look for char *attrib Name of the attribute to open struct sysfs_attribute * with success. Prototype: struct sysfs_attribute *sysfs_open_driver_attr (const char *bus, const char *drv, const char *attrib) 7 Dlists Libsysfs uses (yet another) list implementation thanks to Eric J Bohm. 7.1 Navigating a dlist Some library functions return a dlist of devices/drivers/attributes, etc. To navigate the list returned the macro "dlist_for_each_data" is to be used Function/Macro name: dlist_for_each_data Walk the given list, returning a known data type/ structure in each iteration. Arguments: struct dlist *list List pointer data_iterator Data type/structure variable contained in the list datatype Data type/structure contained in the list On each iteration, "data_iterator" will contain a list element of "datatype"

32 Usage example: The function sysfs_get_classdev_attributes() returns a dlist of attributes. To navigate the list: struct sysfs_attribute *attr = NULL; struct dlist *attrlist = NULL;... attrlist = sysfs_get_classdev_attributes (struct sysfs_class_device *cdev) if (attrlist!= NULL) { dlist_for_each_data(attrlist, attr, struct sysfs_attribute) {... } } 7.2 Custom sorting using dlist_sort_custom() As of release 1.2.0, libsysfs provides a new interface for custom sorting of dlists. The API dlist_sort_custom() has been added for this purpose. Applications that would like to define their own sorter function can now make use of this API. The sorter function must conform to the following prototype: int compare(void *a, void*b) dlist_sort_custom() expects that the compare function will: return >0 for a before b return <0 for b before a return 0 for a == b 8. Usage Accessing devices through libsysfs is supposed to mirror accessing devices in the filesystem it represents. Here s a typical order of operation: - get sysfs mount point - "open" sysfs category, ie. bus, class, or device - work with category - "close" sysfs category 9. Testsuite Version of sysfsutils ships with a comprehensive testsuite. The testsuite shipped as part of the "test" directory of the sysfsutils source package, results in an executable "testlibsysfs" which will be installed in the /usr/local/bin directory. Some of the salient features of the testsuite are: a. Tests _every_ API exported by the library.

33 b. Tests are performed for all possible combinations of input parameters. c. Detailed output is provided for the correct case. d. Facility to redirect output of the tests to a normal file. e. Number of iterations of tests can be specified. The testsuite comes with its own configuration file "libsysfs.conf" in the "test" directory. This file is used to generate a header file at the time the tests are built. To use the testsuite: a. Modify the variables libsysfs.conf file to appropriate values for your system. (The libsysfs.conf file contains comments describing what each variable stands for and, in some cases, how to determine an appropriate value for the system under test). b. Build and install the testsuite. c. Run the testsuite: testlibsysfs <number of iterations> <logfile> The default logfile is stdout. NOTE: If the libsysfs.conf file is changed, make sure to run "make clean" in the test directory and then a "make" for the changes to take effect. 10. Conclusion Libsysfs is meant to provide a stable application programming interface to sysfs. Applications can depend upon the library to access system devices and functions exposed through sysfs. This is a demo version of txt2pdf v.10.1 Developed by SANFACE Software Available at

Driving Me Nuts Device Classes

Driving Me Nuts Device Classes Driving Me Nuts Device Classes More necessary insructions for making your new device driver play nice in the 2.6 kernel. by Greg Kroah-Hartman In the last Driving Me Nuts column [see LJ, June 2003], we

More information

Armide Documentation. Release Kyle Mayes

Armide Documentation. Release Kyle Mayes Armide Documentation Release 0.3.1 Kyle Mayes December 19, 2014 Contents 1 Introduction 1 1.1 Features.................................................. 1 1.2 License..................................................

More information

Embedded Driving Me Nuts: Writing a Real Driver In User Space

Embedded Driving Me Nuts: Writing a Real Driver In User Space Embedded Driving Me Nuts: Writing a Real Driver In User Space Now you can control USB hardware without touching the kernel and even make your driver run on BSD-based OSes with no code changes. by Greg

More information

The Embedded I/O Company TIP700-SW-82 Linux Device Driver User Manual TEWS TECHNOLOGIES GmbH TEWS TECHNOLOGIES LLC

The Embedded I/O Company TIP700-SW-82 Linux Device Driver User Manual TEWS TECHNOLOGIES GmbH TEWS TECHNOLOGIES LLC The Embedded I/O Company TIP700-SW-82 Linux Device Driver Digital Output 24V DC Version 1.2.x User Manual Issue 1.2.1 February 2009 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 Phone: +49 (0) 4101 4058 0 25469

More information

TIP675-SW-82. Linux Device Driver. 48 TTL I/O Lines with Interrupts Version 1.2.x. User Manual. Issue November 2013

TIP675-SW-82. Linux Device Driver. 48 TTL I/O Lines with Interrupts Version 1.2.x. User Manual. Issue November 2013 The Embedded I/O Company TIP675-SW-82 Linux Device Driver 48 TTL I/O Lines with Interrupts Version 1.2.x User Manual Issue 1.2.5 November 2013 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek, Germany

More information

RCU. ò Walk through two system calls in some detail. ò Open and read. ò Too much code to cover all FS system calls. ò 3 Cases for a dentry:

RCU. ò Walk through two system calls in some detail. ò Open and read. ò Too much code to cover all FS system calls. ò 3 Cases for a dentry: Logical Diagram VFS, Continued Don Porter CSE 506 Binary Formats RCU Memory Management File System Memory Allocators System Calls Device Drivers Networking Threads User Today s Lecture Kernel Sync CPU

More information

VFS, Continued. Don Porter CSE 506

VFS, Continued. Don Porter CSE 506 VFS, Continued Don Porter CSE 506 Logical Diagram Binary Formats Memory Allocators System Calls Threads User Today s Lecture Kernel RCU File System Networking Sync Memory Management Device Drivers CPU

More information

CSE 333 SECTION 3. POSIX I/O Functions

CSE 333 SECTION 3. POSIX I/O Functions CSE 333 SECTION 3 POSIX I/O Functions Administrivia Questions (?) HW1 Due Tonight Exercise 7 due Monday (out later today) POSIX Portable Operating System Interface Family of standards specified by the

More information

The Linux Kernel Driver Model

The Linux Kernel Driver Model The Linux Kernel Driver Model Patrick Mochel Open Source Development Lab mochel@osdl.org Abstract A new device driver model has been designed and developed for the 2.5 version of the Linux Kernel. The

More information

Kernel Korner udev--persistent Device Naming in User Space

Kernel Korner udev--persistent Device Naming in User Space Kernel Korner udev--persistent Device Naming in User Space Whether you're plugging a camera and scanner in to your laptop or adding another SCSI drive to your company server, it's time to end the current

More information

Storage Systems. NPTEL Course Jan K. Gopinath Indian Institute of Science

Storage Systems. NPTEL Course Jan K. Gopinath Indian Institute of Science Storage Systems NPTEL Course Jan 2013 (Lecture 11) K. Gopinath Indian Institute of Science USB Mass Storage Device A USB has a microcontroller that handles USB protocol a media controller that handles

More information

UNIX File System. UNIX File System. The UNIX file system has a hierarchical tree structure with the top in root.

UNIX File System. UNIX File System. The UNIX file system has a hierarchical tree structure with the top in root. UNIX File System UNIX File System The UNIX file system has a hierarchical tree structure with the top in root. Files are located with the aid of directories. Directories can contain both file and directory

More information

CARRIER-SW-82. Linux Device Driver. IPAC Carrier Version 2.2.x. User Manual. Issue November 2017

CARRIER-SW-82. Linux Device Driver. IPAC Carrier Version 2.2.x. User Manual. Issue November 2017 The Embedded I/O Company CARRIER-SW-82 Linux Device Driver IPAC Carrier Version 2.2.x User Manual Issue 2.2.0 November 2017 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek, Germany Phone: +49 (0)

More information

Using the Kernel Security Module Interface

Using the Kernel Security Module Interface Using the Kernel Security Module Interface Greg shows how to create a simple kernel module that uses the LSM framework. by Greg Kroah-Hartman At the 2001 Linux Kernel Summit, NSA developers presented their

More information

The UNIX File System

The UNIX File System The UNIX File System Magnus Johansson (May 2007) 1 UNIX file system A file system is created with mkfs. It defines a number of parameters for the system as depicted in figure 1. These paremeters include

More information

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories Chapter Two Exploring the UNIX File System and File Security Lesson A Understanding Files and Directories 2 Objectives Discuss and explain the UNIX file system Define a UNIX file system partition Use the

More information

CS , Spring Sample Exam 3

CS , Spring Sample Exam 3 Andrew login ID: Full Name: CS 15-123, Spring 2010 Sample Exam 3 Mon. April 6, 2009 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the

More information

CS5460/6460: Operating Systems. Lecture 24: Device drivers. Anton Burtsev April, 2014

CS5460/6460: Operating Systems. Lecture 24: Device drivers. Anton Burtsev April, 2014 CS5460/6460: Operating Systems Lecture 24: Device drivers Anton Burtsev April, 2014 Device drivers Conceptually Implement interface to hardware Expose some high-level interface to the kernel or applications

More information

Chp1 Introduction. Introduction. Objective. Logging In. Shell. Briefly describe services provided by various versions of the UNIX operating system.

Chp1 Introduction. Introduction. Objective. Logging In. Shell. Briefly describe services provided by various versions of the UNIX operating system. Chp1 Objective Briefly describe services provided by various versions of the UNIX operating system. Logging In /etc/passwd local machine or NIS DB root:x:0:1:super-user:/root:/bin/tcsh Login-name, encrypted

More information

TIP570-SW-95 QNX-Neutrino Device Driver TIP570 16/8 Channel 12 Bit ADC and 8 Channel 12 Bit DAC on SBS PCI40 Carrier

TIP570-SW-95 QNX-Neutrino Device Driver TIP570 16/8 Channel 12 Bit ADC and 8 Channel 12 Bit DAC on SBS PCI40 Carrier TIP570-SW-95 QNX-Neutrino Device Driver TIP570 16/8 Channel 12 Bit ADC and 8 Channel 12 Bit DAC on SBS PCI40 Carrier Version 1.0.x Reference Manual Issue 1.0 January 2002 TEWS TECHNOLOGIES GmbH Am Bahnhof

More information

Driving Me Nuts Writing a Simple USB Driver

Driving Me Nuts Writing a Simple USB Driver Driving Me Nuts Writing a Simple USB Driver Give your Linux box a multicolored light you can see from across the room, and learn how to write a simple driver for the next piece of hardware you want to

More information

PCIe Hot-Swap Device Driver

PCIe Hot-Swap Device Driver PCIe Hot-Swap Device Driver Application Note AN-546 Introduction By Craig Hackney In typical PCIe based systems, PCIe buses are enumerated and resources allocated to each PCIe endpoint device during system

More information

Virtual File System. Don Porter CSE 306

Virtual File System. Don Porter CSE 306 Virtual File System Don Porter CSE 306 History Early OSes provided a single file system In general, system was pretty tailored to target hardware In the early 80s, people became interested in supporting

More information

TPMC500-SW-42. VxWorks Device Driver. User Manual. The Embedded I/O Company. 32 Channel 12 Bit ADC. Version 2.0.x. Issue 2.0.

TPMC500-SW-42. VxWorks Device Driver. User Manual. The Embedded I/O Company. 32 Channel 12 Bit ADC. Version 2.0.x. Issue 2.0. The Embedded I/O Company TPMC500-SW-42 VxWorks Device Driver 32 Channel 12 Bit ADC Version 2.0.x User Manual Issue 2.0.0 October 2004 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 e-mail: info@tews.com 25469 Halstenbek

More information

The UNIX File System

The UNIX File System The UNIX File System Magnus Johansson May 9, 2007 1 UNIX file system A file system is created with mkfs. It defines a number of parameters for the system, such as: bootblock - contains a primary boot program

More information

Operating Systems Coursework Task 3

Operating Systems Coursework Task 3 Operating Systems Coursework Task 3 TAR File System Driver DUE: Thursday 30th March @ 4PM GMT File Systems Used for the organised storage of data. Typically hierarchical/tree-based, consisting of directories

More information

Open Source support for OSD

Open Source support for OSD Open Source support for OSD IBM Haifa Research Lab IBM Labs in Haifa 2006 IBM Corporation Outline IBM Labs in Haifa Object Based Storage (OSD) OSD Initiator Past Going forward OSD Simulator on AlphaWorks

More information

Introduction PCI Interface Booting PCI driver registration Other buses. Linux Device Drivers PCI Drivers

Introduction PCI Interface Booting PCI driver registration Other buses. Linux Device Drivers PCI Drivers Overview 1 2 PCI addressing 3 4 5 bus, The most common is the PCI (in the PC world), PCI - Peripheral Component Interconnect, bus consists of two components: electrical interface programming interface,

More information

Outline. File Systems. File System Structure. CSCI 4061 Introduction to Operating Systems

Outline. File Systems. File System Structure. CSCI 4061 Introduction to Operating Systems Outline CSCI 4061 Introduction to Operating Systems Instructor: Abhishek Chandra File Systems Directories File and directory operations Inodes and metadata Links 2 File Systems An organized collection

More information

Operating Systems II BS degree in Computer Engineering Sapienza University of Rome Lecturer: Francesco Quaglia. Topics: 1.

Operating Systems II BS degree in Computer Engineering Sapienza University of Rome Lecturer: Francesco Quaglia. Topics: 1. Operating Systems II BS degree in Computer Engineering Sapienza University of Rome Lecturer: Francesco Quaglia Topics: 1. LINUX modules Modules basics A LINUX module is a software component which can be

More information

ECE 2400 Computer Systems Programming, Fall 2017 Prelim 2 Prep

ECE 2400 Computer Systems Programming, Fall 2017 Prelim 2 Prep revision: 2017-11-04-22-45 These problems are not meant to be exactly like the problems that will be on the prelim. These problems are instead meant to represent the kind of understanding you should be

More information

In object-oriented terms, kobjects can be seen as a top-level, abstract class from which other classes are derived.

In object-oriented terms, kobjects can be seen as a top-level, abstract class from which other classes are derived. KOBJECTS Why kobjects? kobjects are used to control access to a larger, domain-specific object. In object-oriented terms, kobjects can be seen as a top-level, abstract class from which other classes are

More information

CSE 333 SECTION 3. POSIX I/O Functions

CSE 333 SECTION 3. POSIX I/O Functions CSE 333 SECTION 3 POSIX I/O Functions Administrivia Questions (?) HW1 Due Tonight HW2 Due Thursday, July 19 th Midterm on Monday, July 23 th 10:50-11:50 in TBD (And regular exercises in between) POSIX

More information

NAME attr extended attributes on XFS filesystem objects. SYNOPSIS attr [ LRq ] s attrname [ V attrvalue ] pathname

NAME attr extended attributes on XFS filesystem objects. SYNOPSIS attr [ LRq ] s attrname [ V attrvalue ] pathname ATTR(1) XFS Compatibility API ATTR(1) attr extended attributes on XFS filesystem objects SYNOPSIS attr [ LRq ] s attrname [ V attrvalue ] pathname attr [ LRq ] g attrname pathname attr [ LRq ] r attrname

More information

Virtual File System (VFS) Implementation in Linux. Tushar B. Kute,

Virtual File System (VFS) Implementation in Linux. Tushar B. Kute, Virtual File System (VFS) Implementation in Linux Tushar B. Kute, http://tusharkute.com Virtual File System The Linux kernel implements the concept of Virtual File System (VFS, originally Virtual Filesystem

More information

File Management 1/34

File Management 1/34 1/34 Learning Objectives system organization and recursive traversal buffering and memory mapping for performance Low-level data structures for implementing filesystems Disk space management for sample

More information

ECE 449 OOP and Computer Simulation Lecture 11 Design Patterns

ECE 449 OOP and Computer Simulation Lecture 11 Design Patterns ECE 449 Object-Oriented Programming and Computer Simulation, Fall 2017, Dept. of ECE, IIT 1/60 ECE 449 OOP and Computer Simulation Lecture 11 Design Patterns Professor Jia Wang Department of Electrical

More information

Files and the Filesystems. Linux Files

Files and the Filesystems. Linux Files Files and the Filesystems Linux Files The file is the most basic and fundamental abstraction in Linux. Linux follows the everything-is-a-file philosophy. Consequently, much interaction occurs via reading

More information

Section 3: File I/O, JSON, Generics. Meghan Cowan

Section 3: File I/O, JSON, Generics. Meghan Cowan Section 3: File I/O, JSON, Generics Meghan Cowan POSIX Family of standards specified by the IEEE Maintains compatibility across variants of Unix-like OS Defines API and standards for basic I/O: file, terminal

More information

Last Week: ! Efficiency read/write. ! The File. ! File pointer. ! File control/access. This Week: ! How to program with directories

Last Week: ! Efficiency read/write. ! The File. ! File pointer. ! File control/access. This Week: ! How to program with directories Overview Unix System Programming Directories and File System Last Week:! Efficiency read/write! The File! File pointer! File control/access This Week:! How to program with directories! Brief introduction

More information

Exploring the file system. Johan Montelius HT2016

Exploring the file system. Johan Montelius HT2016 1 Introduction Exploring the file system Johan Montelius HT2016 This is a quite easy exercise but you will learn a lot about how files are represented. We will not look to the actual content of the files

More information

Virtual File System. Don Porter CSE 506

Virtual File System. Don Porter CSE 506 Virtual File System Don Porter CSE 506 History ò Early OSes provided a single file system ò In general, system was pretty tailored to target hardware ò In the early 80s, people became interested in supporting

More information

An abstract tree stores data that is hierarchically ordered. Operations that may be performed on an abstract tree include:

An abstract tree stores data that is hierarchically ordered. Operations that may be performed on an abstract tree include: 4.2 Abstract Trees Having introduced the tree data structure, we will step back and consider an Abstract Tree that stores a hierarchical ordering. 4.2.1 Description An abstract tree stores data that is

More information

Systems Programming. 09. Filesystem in USErspace (FUSE) Alexander Holupirek

Systems Programming. 09. Filesystem in USErspace (FUSE) Alexander Holupirek Systems Programming 09. Filesystem in USErspace (FUSE) Alexander Holupirek Database and Information Systems Group Department of Computer & Information Science University of Konstanz Summer Term 2008 Schedule

More information

TPMC860-SW-82. Linux Device Driver. 4 Channel Isolated Serial Interface RS232 Version 1.4.x. User Manual. Issue 1.4.

TPMC860-SW-82. Linux Device Driver. 4 Channel Isolated Serial Interface RS232 Version 1.4.x. User Manual. Issue 1.4. The Embedded I/O Company TPMC860-SW-82 Linux Device Driver 4 Channel Isolated Serial Interface RS232 Version 1.4.x User Manual Issue 1.4.4 December 2011 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek,

More information

DlisReader Library. Figure 1

DlisReader Library. Figure 1 DlisReader Library DlisReader is a library for reading information from files written in DLIS (RP66) format version 1. The library exposes extern functions by which user application gets DLIS file records.

More information

The sysfs Filesystem

The sysfs Filesystem The sysfs Filesystem Patrick Mochel mochel@digitalimplant.org Abstract sysfs is a feature of the Linux 2.6 kernel that allows kernel code to export information to user processes via an in-memory filesystem.

More information

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files ... and systems programming C basic syntax functions arrays structs

More information

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs.

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs. CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files... and systems programming C basic syntax functions arrays structs

More information

Operating Systems 2015 Assignment 4: File Systems

Operating Systems 2015 Assignment 4: File Systems Operating Systems 2015 Assignment 4: File Systems Deadline: Tuesday, May 26 before 23:59 hours. 1 Introduction A disk can be accessed as an array of disk blocks, often each block is 512 bytes in length.

More information

bytes per disk block (a block is usually called sector in the disk drive literature), sectors in each track, read/write heads, and cylinders (tracks).

bytes per disk block (a block is usually called sector in the disk drive literature), sectors in each track, read/write heads, and cylinders (tracks). Understanding FAT 12 You need to address many details to solve this problem. The exercise is broken down into parts to reduce the overall complexity of the problem: Part A: Construct the command to list

More information

Spiffy: Enabling File-System Aware Storage Applications

Spiffy: Enabling File-System Aware Storage Applications Spiffy: Enabling File-System Aware Storage Applications Kuei (Jack) Sun, Daniel Fryer, Joseph Chu, Matthew Lakier, Angela Demke Brown, and Ashvin Goel University of Toronto Introduction File-system aware

More information

Supporting Cloud Native with DPDK and containers KEITH INTEL CORPORATION

Supporting Cloud Native with DPDK and containers KEITH INTEL CORPORATION x Supporting Cloud Native with DPDK and containers KEITH WILES @ INTEL CORPORATION Making Applications Cloud Native Friendly How can we make DPDK Cloud Native Friendly? Reduce startup resources for quicker

More information

TDRV006-SW-42. VxWorks Device Driver. 64 Digital Inputs/Outputs (Bit I/O) Version 4.0.x. User Manual. Issue December 2017

TDRV006-SW-42. VxWorks Device Driver. 64 Digital Inputs/Outputs (Bit I/O) Version 4.0.x. User Manual. Issue December 2017 The Embedded I/O Company TDRV006-SW-42 VxWorks Device Driver 64 Digital Inputs/Outputs (Bit I/O) Version 4.0.x User Manual Issue 4.0.0 December 2017 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek,

More information

Operating Systems 2014 Assignment 4: File Systems

Operating Systems 2014 Assignment 4: File Systems Operating Systems 2014 Assignment 4: File Systems Deadline: Sunday, May 25 before 23:59 hours. 1 Introduction A disk can be accessed as an array of disk blocks, often each block is 512 bytes in length.

More information

pthreads CS449 Fall 2017

pthreads CS449 Fall 2017 pthreads CS449 Fall 2017 POSIX Portable Operating System Interface Standard interface between OS and program UNIX-derived OSes mostly follow POSIX Linux, macos, Android, etc. Windows requires separate

More information

What is a Linux Device Driver? Kevin Dankwardt, Ph.D. VP Technology Open Source Careers

What is a Linux Device Driver? Kevin Dankwardt, Ph.D. VP Technology Open Source Careers What is a Linux Device Driver? Kevin Dankwardt, Ph.D. VP Technology Open Source Careers kdankwardt@oscareers.com What does a driver do? Provides a more convenient interface to user-space for the hardware.

More information

Operating System Concepts Ch. 11: File System Implementation

Operating System Concepts Ch. 11: File System Implementation Operating System Concepts Ch. 11: File System Implementation Silberschatz, Galvin & Gagne Introduction When thinking about file system implementation in Operating Systems, it is important to realize the

More information

libxcpc(3) Exception and resource handling in C libxcpc(3)

libxcpc(3) Exception and resource handling in C libxcpc(3) NAME xcpc_set_exitproc, xcpc_push_tryctx, xcpc_pop_tryctx, xcpc_do_throw, xcpc_do_rethrow, xcpc_context_create, xcpc_context_reparent, xcpc_context_free, xcpc_context_parent, xcpc_context_root, xcpc_context_exhandler,

More information

ECE 2400 Computer Systems Programming, Fall 2017 Prelim 2 Prep

ECE 2400 Computer Systems Programming, Fall 2017 Prelim 2 Prep revision: 2017-11-04-22-42 These problems are not meant to be exactly like the problems that will be on the prelim. These problems are instead meant to represent the kind of understanding you should be

More information

Heaps / Priority Queues

Heaps / Priority Queues Heaps / Priority Queues Data and File Structures Laboratory http://wwwisicalacin/~dfslab/2017/indexhtml DFS Lab (ISI) Heaps / Priority Queues 1 / 17 Definitions Complete binary tree All non-leaf nodes

More information

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc.

Appendix A GLOSSARY. SYS-ED/ Computer Education Techniques, Inc. Appendix A GLOSSARY SYS-ED/ Computer Education Techniques, Inc. $# Number of arguments passed to a script. $@ Holds the arguments; unlike $* it has the capability for separating the arguments. $* Holds

More information

Classes ATTRIB_HH Aa thru Dz

Classes ATTRIB_HH Aa thru Dz Chapter 4. Classes ATTRIB_HH Aa thru Dz Topic: Ignore The class interface is a set of C++ classes, including their public and protected data and methods (member functions), that an application can use

More information

by Pearson Education, Inc. All Rights Reserved.

by Pearson Education, Inc. All Rights Reserved. Let s improve the bubble sort program of Fig. 6.15 to use two functions bubblesort and swap. Function bubblesort sorts the array. It calls function swap (line 51) to exchange the array elements array[j]

More information

RCU. ò Dozens of supported file systems. ò Independent layer from backing storage. ò And, of course, networked file system support

RCU. ò Dozens of supported file systems. ò Independent layer from backing storage. ò And, of course, networked file system support Logical Diagram Virtual File System Don Porter CSE 506 Binary Formats RCU Memory Management File System Memory Allocators System Calls Device Drivers Networking Threads User Today s Lecture Kernel Sync

More information

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C.

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C. Structure Unix architecture users Functions of the System tools (shell, editors, compilers, ) standard library System call Standard library (printf, fork, ) OS kernel: processes, memory management, file

More information

TPMC680-SW-82. Linux Device Driver. 64 Digital Input/Output Version 1.1.x. User Manual. Issue April 2010

TPMC680-SW-82. Linux Device Driver. 64 Digital Input/Output Version 1.1.x. User Manual. Issue April 2010 The Embedded I/O Company TPMC680-SW-82 Linux Device Driver 64 Digital Input/Output Version 1.1.x User Manual Issue 1.1.3 April 2010 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek, Germany Phone:

More information

Chapter. Basic Administration. Secrets in This Chapter. Monitoring the System Viewing Log Files Managing Services and Programs Monitoring Disk Usage

Chapter. Basic Administration. Secrets in This Chapter. Monitoring the System Viewing Log Files Managing Services and Programs Monitoring Disk Usage Basic Administration Chapter 18 Secrets in This Chapter Monitoring the System Viewing Log Files Managing Services and Programs Monitoring Disk Usage 95080c18.indd 425 2/17/09 1:24:15 AM 426 Part 3: Managing

More information

Chapter 20: Binary Trees

Chapter 20: Binary Trees Chapter 20: Binary Trees 20.1 Definition and Application of Binary Trees Definition and Application of Binary Trees Binary tree: a nonlinear linked list in which each node may point to 0, 1, or two other

More information

TPMC821-SW-42. VxWorks Device Driver. User Manual. The Embedded I/O Company. INTERBUS Master G4 PMC. Version 1.4. Issue 1.

TPMC821-SW-42. VxWorks Device Driver. User Manual. The Embedded I/O Company. INTERBUS Master G4 PMC. Version 1.4. Issue 1. The Embedded I/O Company TPMC821-SW-42 VxWorks Device Driver INTERBUS Master G4 PMC Version 1.4 User Manual Issue 1.2 January 2004 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek / Germany Phone:

More information

CMSC 341 Leftist Heaps

CMSC 341 Leftist Heaps CMSC 341 Leftist Heaps Based on slides from previous iterations of this course Today s Topics Review of Min Heaps Introduction of Left-ist Heaps Merge Operation Heap Operations Review of Heaps Min Binary

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

Final assignment: Hash map

Final assignment: Hash map Final assignment: Hash map 1 Introduction In this final assignment you will implement a hash map 1. A hash map is a data structure that associates a key with a value (a chunk of data). Most hash maps are

More information

The EXT2FS Library. The EXT2FS Library Version 1.37 January by Theodore Ts o

The EXT2FS Library. The EXT2FS Library Version 1.37 January by Theodore Ts o The EXT2FS Library The EXT2FS Library Version 1.37 January 2005 by Theodore Ts o Copyright c 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Theodore Ts o Permission is granted to make and distribute

More information

Homework 4 Answers. Due Date: Monday, May 27, 2002, at 11:59PM Points: 100. /* * macros */ #define SZBUFFER 1024 /* max length of input buffer */

Homework 4 Answers. Due Date: Monday, May 27, 2002, at 11:59PM Points: 100. /* * macros */ #define SZBUFFER 1024 /* max length of input buffer */ Homework 4 Answers Due Date: Monday, May 27, 2002, at 11:59PM Points: 100 UNIX System 1. (10 points) How do I delete the file i? Answer: Either rm./-i or rm -- -i will work. 2. (15 points) Please list

More information

CSC209 Review. Yeah! We made it!

CSC209 Review. Yeah! We made it! CSC209 Review Yeah! We made it! 1 CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files 2 ... and C programming... C basic syntax functions

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Unix Filesystem. January 26 th, 2004 Class Meeting 2 Unix Filesystem January 26 th, 2004 Class Meeting 2 * Notes adapted by Christian Allgood from previous work by other members of the CS faculty at Virginia Tech Unix Filesystem! The filesystem is your interface

More information

BRIEF CONTENTS. About the Author and the Technical Reviewer...xvii. Foreword by John Baldwin...xix. Acknowledgments...xxi. Introduction...

BRIEF CONTENTS. About the Author and the Technical Reviewer...xvii. Foreword by John Baldwin...xix. Acknowledgments...xxi. Introduction... BRIEF CONTENTS About the Author and the Technical Reviewer...xvii Foreword by John Baldwin...xix Acknowledgments...xxi Introduction...xxiii Chapter 1: Building and Running Modules...1 Chapter 2: Allocating

More information

Outline. Cgroup hierarchies

Outline. Cgroup hierarchies Outline 15 Cgroups 15-1 15.1 Introduction to cgroups v1 and v2 15-3 15.2 Cgroups v1: hierarchies and controllers 15-17 15.3 Cgroups v1: populating a cgroup 15-24 15.4 Cgroups v1: a survey of the controllers

More information

Windows Device Driver and API Reference Manual

Windows Device Driver and API Reference Manual Windows Device Driver and API Reference Manual 797 North Grove Rd, Suite 101 Richardson, TX 75081 Phone: (972) 671-9570 www.redrapids.com Red Rapids Red Rapids reserves the right to alter product specifications

More information

Design Overview of the FreeBSD Kernel CIS 657

Design Overview of the FreeBSD Kernel CIS 657 Design Overview of the FreeBSD Kernel CIS 657 Organization of the Kernel Machine-independent 86% of the kernel (80% in 4.4BSD) C code Machine-dependent 14% of kernel Only 0.6% of kernel in assembler (2%

More information

ACIS Deformable Modeling

ACIS Deformable Modeling Chapter 2. ACIS Deformable Modeling The basic use of deformable modeling is to construct a curve or surface, apply constraints and loads, and then update the shape s control point set to satisfy the constraints,

More information

Tandem Software Flow

Tandem Software Flow Xilinx Answer 51950 Tandem PCIe Second Stage Bitstream Loading across the PCI Express Link Important Note: This downloadable PDF of an Answer Record is provided to enhance its usability and readability.

More information

The android vulnerability discovery in SoC. Yu Pan and Yang Dai

The android vulnerability discovery in SoC. Yu Pan and Yang Dai The android vulnerability discovery in SoC Yu Pan and Yang Dai About us Security researcher of Vulpecker Team@360 Android Vulnerabilities research Focus on kernel & driver Numerous vulnerabilities,including

More information

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent?

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent? Design Overview of the FreeBSD Kernel CIS 657 Organization of the Kernel Machine-independent 86% of the kernel (80% in 4.4BSD) C C code Machine-dependent 14% of kernel Only 0.6% of kernel in assembler

More information

Crit-bit Trees. Adam Langley (Version )

Crit-bit Trees. Adam Langley (Version ) CRITBIT CWEB OUTPUT 1 Crit-bit Trees Adam Langley (agl@imperialviolet.org) (Version 20080926) 1. Introduction This code is taken from Dan Bernstein s qhasm and implements a binary crit-bit (alsa known

More information

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst Operating Systems CMPSCI 377 Spring 2017 Mark Corner University of Massachusetts Amherst Clicker Question #1 For a sequential workload, the limiting factor for a disk system is likely: (A) The speed of

More information

OpenVL User Manual. Sarang Lakare 1. Jan 15, 2003 Revision :

OpenVL User Manual. Sarang Lakare 1. Jan 15, 2003 Revision : OpenVL User Manual Sarang Lakare 1 Jan 15, 2003 Revision : 1.8 1 lsarang@cs.sunysb.edu 2 Contents 1 Obtaining OpenVL 5 1.1 Understanding the version numbers............................ 5 1.2 Downloading........................................

More information

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe OBJECT ORIENTED PROGRAMMING USING C++ CSCI 5448- Object Oriented Analysis and Design By Manali Torpe Fundamentals of OOP Class Object Encapsulation Abstraction Inheritance Polymorphism Reusability C++

More information

Kernel Korner Hot Plug

Kernel Korner Hot Plug Kernel Korner Hot Plug Greg describes the new framework in the Linux kernel for supporting USB and other hot-pluggable devices. by Greg Kroah-Hartman Hot-pluggable devices have been created to solve a

More information

Introduction to pthreads

Introduction to pthreads CS 220: Introduction to Parallel Computing Introduction to pthreads Lecture 25 Threads In computing, a thread is the smallest schedulable unit of execution Your operating system has a scheduler that decides

More information

SERIOUS ABOUT SOFTWARE. Qt Core features. Timo Strömmer, May 26,

SERIOUS ABOUT SOFTWARE. Qt Core features. Timo Strömmer, May 26, SERIOUS ABOUT SOFTWARE Qt Core features Timo Strömmer, May 26, 2010 1 Contents C++ refresher Core features Object model Signals & slots Event loop Shared data Strings Containers Private implementation

More information

PROCESS MANAGEMENT Operating Systems Design Euiseong Seo

PROCESS MANAGEMENT Operating Systems Design Euiseong Seo PROCESS MANAGEMENT 2016 Operating Systems Design Euiseong Seo (euiseong@skku.edu) Definition A process is a program in execution Context Resources Specifically, Register file state Address space File and

More information

Chapter 1 - Introduction. September 8, 2016

Chapter 1 - Introduction. September 8, 2016 Chapter 1 - Introduction September 8, 2016 Introduction Overview of Linux/Unix Shells Commands: built-in, aliases, program invocations, alternation and iteration Finding more information: man, info Help

More information

CS 1550 Project 3: File Systems Directories Due: Sunday, July 22, 2012, 11:59pm Completed Due: Sunday, July 29, 2012, 11:59pm

CS 1550 Project 3: File Systems Directories Due: Sunday, July 22, 2012, 11:59pm Completed Due: Sunday, July 29, 2012, 11:59pm CS 1550 Project 3: File Systems Directories Due: Sunday, July 22, 2012, 11:59pm Completed Due: Sunday, July 29, 2012, 11:59pm Description FUSE (http://fuse.sourceforge.net/) is a Linux kernel extension

More information

CS 104 (Spring 2014) Final Exam 05/09/2014

CS 104 (Spring 2014) Final Exam 05/09/2014 CS 104 (Spring 2014) Final Exam 05/09/2014 G o o d L u c k Your Name, USC username, and Student ID: This exam has 8 pages and 8 questions. If yours does not, please contact us immediately. Please read

More information

OS Lab Tutorial 1. Spawning processes Shared memory

OS Lab Tutorial 1. Spawning processes Shared memory OS Lab Tutorial 1 Spawning processes Shared memory The Spawn exec() family fork() The exec() Functions: Out with the old, in with the new The exec() functions all replace the current program running within

More information

CS 378 (Spring 2003)

CS 378 (Spring 2003) Department of Computer Sciences THE UNIVERSITY OF TEXAS AT AUSTIN CS 378 (Spring 2003) Linux Kernel Programming Yongguang Zhang (ygz@cs.utexas.edu) Copyright 2003, Yongguang Zhang This Lecture Device Driver

More information

Any of the descriptors in the set {1, 4} have an exception condition pending

Any of the descriptors in the set {1, 4} have an exception condition pending Page 1 of 6 6.3 select Function This function allows the process to instruct the kernel to wait for any one of multiple events to occur and to wake up the process only when one or more of these events

More information