Describe how mkstemp(3) is able to create and open a new ?le (one that doesn’t yet exist) without creating a timing window that allows another process to create the ?le between the time that mkstemp decides on a name and the time that it creates the ?le.

What will be an ideal response?


The mkstemp function selects a random string for use in the caller’s template, then calls open(2) with the name based on the randomized string and the open ?ags set to O_RDWR|O_CREAT|O_EXCL.Ifthe ?le exists, then the open will fail because of the O_EXCL ?ag. Then mkstemp will try a new name. Otherwise, the ?le is created atomically because of the combination of the O_CREATandO_EXCL?ags

Computer Science & Information Technology

You might also like to view...

PowerPoint applies animation effects in the order you created them.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Which of the following are correct? Why are the others incorrect?

When a function having an array formal parameter is called, the formal array parameter … a) names a copy of the array argument. b) refers to exactly the same array as the calling program c) is passed the address of the argument, and the function needs further information about the array size to safely use an array parameter d) refers to the array using a name that is always different from the calling program's argument.

Computer Science & Information Technology

____ can be especially helpful when creating a frame-by-frame animation where you need to compare the current frame's contents to the previous frame's contents.

A. Onion skinning B. Timelines C. Scrubbing D. Reframing

Computer Science & Information Technology

Buttons where one click turns a feature off and another click turns it on, are called ________ buttons

A) switch B) option C) toggle D) on/off

Computer Science & Information Technology