Write a program to determine the size of a disk device or partition using only read(2) and lseek(2). Hint: aread of a disk device at end-of-?le returns 0, while a read past end-of-?le will usually fail
What will be an ideal response?
Devices areone area that the Single UNIX Speci?cation does not cover,and differences occur frequently among systems. For example, Mac OS X 10.6.8 behaves differently in that some reads past end-of-?le will succeed (apparently ones that areatmultiples of 4KB). Another difference is that some platforms will validate the seek offset against the size of the device, while other platforms do not. Although some platforms provide ioctl commands to return the size of a disk device, these arenot portable. Amoreportable solution is shown in Figure4 . One common attribute that all platforms enforce is that disk access is based on blocks. If we’rereading from the character device interface, the sector size is the smallest amount of data that can be read from or written to a disk device. Additionally,the starting offset for the read or write must be an integral multiple of the sector size. The block interface can hide these restrictions from applications, but this is not universally supported. The most portable behavior for applications is to restrict disk I/O to multiples of the sector size, with the starting offset aligned to a sector boundary
You might also like to view...
?A _____ chart displays complex task patterns and relationships.
A. ?Gantt B. ?Pareto C. ?Program Evaluation Review Technique (PERT) D. ?Scatter
Charts can either be embedded in a worksheet or placed in a separate _______
a. worksheet b. dialog box c. chart sheet d. range
InDesign's _______________ panel offers a number of built-in animations that you can use to create motion in your presentation.
Fill in the blank(s) with the appropriate word(s).
Case Based Critical ThinkingCase 1Kate wants to add some drama to a site that advertises the services of a special effects make-up artist who specializes in horror and monster make-up. She decides to add some rollover images that show before and after photos of actors who have been turned into monsters by the artist. How will Kate add the rollover images to the page?
A. She will choose Place Images from the Assets menu. B. She will select the region she has made for the rollover image, and then import it using the Import Image command. C. She will use the Rollover Image command on the Images menu in the Common category. D. She will click and drag the selected images to the Rollover Images library.