Professional Documents
Culture Documents
Systems Programming Using C (File Subsystem) : Intended Schedule
Systems Programming Using C (File Subsystem) : Intended Schedule
Systems Programming Using C (File Subsystem) : Intended Schedule
0
1
2
3
4
5
6
7
8
9
10
11
12
13
1.
Systems Programming using C
(File Subsystem)
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
46
Date
20.04.
27.04.
04.05.
11.05.
18.05.
25.05.
01.06.
08.06.
15.06.
22.06.
29.06.
06.07.
13.07.
20.07.
27.07.
12.10.
Lecture
Introduction to Operating Systems
Systems Programming using C (File Subsystem)
Systems Programming using C (Process Control)
Processes Scheduling
Process Synchronization
Inter Process Communication
Pngstmontag
Input / Output
Memory Management
Filesystems
Hand out
Submission
Course registration
1. Assignment
2. Assignment
1. Assignment
3. Assignment
2. Assignment
4. Assignment
3. Assignment
5. Assignment
4. Assignment
6. Assignment
5. Assignment
7. Assignment
6. Assignment
8. Assignment
7. Assignment
9. Assignment
8. Assignment
10. Assignment
9. Assignment
10. Assignment
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
47
Last lecture: All operating system provide services for programs they run.
48
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
49
System calls
*
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
50
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
51
!"#$%"&''('#")"
*+%,-.('#")-/
UNIX system
architecture (System V)
!"+5#<"$=$;6$1))"
:$;6$1))&%&A%;#?"D
-."#&'"("%
!"#$"%&'"("%
.('#")15E$5E4.>?+%##'#"AA"-8.3.4"5&8*%%&0$4"#/*8"9
B+#"$4:$;<"''4
C;))5+%D1#%;+
8;<=9
71#"%4.5&'('#")-8/0%"&.12.3.4"59
:5EE"$5+6
821//"#&8*89"9
Files
F"%>?"+-889*#*84"#9
:$;<"'''#"5"$5+6'4
.5&'('#")-86#78"..
87$4#7%&.12.3.4"59
!A;>D-82%78>9
G"$H#"#$"%&"$-82"@%>"-2$%@"$9
:$;<"'';$4
<5#"%A5+6
8.89"+1%0$:9
Processes
.="%>?"$4
@"$31A#5+6
85"57#3
5*$*:"5"$49
01$231$"4.#"5"$5+6
!"#$"%&'"("%
)*#+,*#"&'"("%
01$231$"
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
52
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
53
System Interface
Standardization
54
Standardization of UNIX
55
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
1978
1979
1980
1980
1994
1995
1992
1986
1989
1988
1990
2000
1989
1990
1989
1991
1986
1990
1995
1992
2007
1994
1991
1989
1989
1979
1988
1991
1991
1992
1978
1986
1988
1983
1987
1984
1999
2000
1995
1989
2005
1995
2003
1984
1993
2003
1977
2004
1993
2006
1986
2001
2005
1987
1BSD
2BSD
3BSD
4BSD
4.4BSD Lite 1
4.4BSD Lite 2
386 BSD
A/UX
Acorn RISC iX
Acorn RISC Unix
AIX
AIX 5L
AIX PS/2
AIX/370
AIX/6000
AIX/ESA
AIX/RT
AMiX
AOS Lite
AOS Reno
AppleTV
ArchBSD
ASV
Atari Unix
BOS
BRL Unix
BSD Net/1
BSD Net/2
BSD/386
BSD/OS
CB Unix
Chorus
Chorus/MiX
Coherent
CTIX
CXOS
Darwin
Debian GNU/Hurd
DEC OSF/1 ACP
Dell Unix
DesktopBSD
Digital Unix
DragonFly BSD
Dynix
Dynix/ptx
ekkoBSD
Eunice
FireFly BSD
FreeBSD
FreeDarwin
GNU
GNU-Darwin
Gnuppix GNU/Hurd-L4
HPBSD
1983
2000
1991
1988
1985
1985
1978
2007
2007
1983
1986
1991
1994
1977
1999
1999
1985
1974
2002
1977
1984
2005
2000
1985
2002
1996
1998
1988
1983
1993
1993
1988
1987
1994
2001
1995
2003
1995
2005
1996
1996
1997
1990
2005
1982
1986
1982
2007
1977
1974
1984
2001
1996
1981
HP-UX
HP-UX 11i
HP-UX BLS
IBM AOS
IBM IX/370
Interactive 386/ix
Interactive IS
iPhone OS X
iPod OS X
IRIS GL2
IRIX
Linux
Lites
LSX
Mac OS X
Mac OS X Server
Mach
MERT
MicroBSD
Mini Unix
Minix
Minix 3
Minix-VMD
MIPS OS RISC/os
MirBSD
Mk Linux
Monterey
more/BSD
mt Xinu
MVS/ESA OpenEdition
NetBSD
NeXTSTEP
NonStop-UX
Open Desktop
Open UNIX 8
OpenBSD
OpenDarwin
OpenServer 5
OpenSolaris
OPENSTEP
OS/390 OpenEdition
OS/390 Unix
OSF/1
PC-BSD
PC/IX
Plan 9
Plurix
PureDarwin
PWB
PWB/UNIX
QNX
QNX RTOS
QNX/Neutrino
QUNIX
1997
1997
1991
1977
1994
2002
1984
1987
2001
2004
1983
1995
1990
1992
1982
1982
2004
1999
1995
1998
1991
1977
1981
1980
1979
1988
1984
1982
1986
1996
2002
1993
1969
1981
1979
1991
1981
1982
1983
1984
1986
1988
1985
1986
1971
1993
1998
1976
1977
1982
1980
1984
1998
2001
ReliantUnix
Rhapsody
RISC iX
RT
SCO UNIX
SCO UnixWare 7
SCO Xenix
SCO Xenix System V/386
Security-Enhanced Linux
Silver OS
Sinix
Sinix ReliantUnix
Solaris 1
Solaris 2
SPIX
SunOS
Triance OS
Tru64 Unix
Trusted IRIX/B
Trusted Solaris
Trusted Xenix
TS
Tunis
UCLA Locus
UCLA Secure Unix
Ultrix
Ultrix 32M
Ultrix-11
Unicos
Unicos/mk
Unicos/mp
Unicox-max
UNICS
UniSoft UniPlus
UNIX 32V
UNIX Interactive
UNIX System III
UNIX System IV
UNIX System V
UNIX System V Release 2
UNIX System V Release 3
UNIX System V Release 4
UNIX System V/286
UNIX System V/386
UNIX Time-Sharing System
UnixWare
UnixWare 7
UNSW
USG
Venix
Xenix OS
Xinu
xMach
z/OS Unix System Services
56
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
57
5 http://www.opengroup.org/overview/members/membership_list.htm
6 http://www.unix.org/version3/
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
58
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
59
File Subsystem
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
Next we will describe some UNIX system calls for input and
output, and show an example how parts of the standard
library can be implemented with them.
60
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
61
!"#$%"&''('#")"
*+%,-.('#")-/
UNIX system
architecture (System V)
!"+5#<"$=$;6$1))"
:$;6$1))&%&A%;#?"D
-."#&'"("%
!"#$"%&'"("%
.('#")15E$5E4.>?+%##'#"AA"-8.3.4"5&8*%%&0$4"#/*8"9
B+#"$4:$;<"''4
C;))5+%D1#%;+
8;<=9
71#"%4.5&'('#")-8/0%"&.12.3.4"59
:5EE"$5+6
821//"#&8*89"9
Files
F"%>?"+-889*#*84"#9
:$;<"'''#"5"$5+6'4
.5&'('#")-86#78"..
87$4#7%&.12.3.4"59
:$;<"'';$4
<5#"%A5+6
8.89"+1%0$:9
Processes
.="%>?"$4
@"$31A#5+6
85"57#3
5*$*:"5"$49
!A;>D-82%78>9
G"$H#"#$"%&"$-82"@%>"-2$%@"$9
01$231$"4.#"5"$5+6
!"#$"%&'"("%
)*#+,*#"&'"("%
01$231$"
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
!"#$%&'()*&+,*(-.)/
62
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
012'&345
63
Unbuffered I/O
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
64
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
65
Everything is a file
66
Everything is a file
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
67
File Descriptor
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
68
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
69
line buffered
The program does not known where its input comes from nor
where its output goes, as long as it uses le 0 for input and 1
and 2 for output.
unbuffered
* POSIX.1 replaces the magic numbers 0, 1, and 2 with STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO (unistd.h)
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
70
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
71
Read andread(2)ing
Write a File and write(2)ing a file
Open a file
!
!
!
!
Input and output uses the read and write system calls.
Those are accessed from C programs through two identically
named functions: read(2) and write(2).
For both the first argument is a file descriptor.
Second argument is a pointer to a buffer in the program
where the data is to go to or come from.
Third argument is the number of bytes to be transferred.
to create it rst
or discard its previous contents.
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
72
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
390
73
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
74
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
75
Unbuffered I/O
routines
76
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
77
Open(2)ing a file
Open A File
to open(2)
Flags ForFlags
The open(2)
Function a file
O RDONLY
O WRONLY
O RDWR
int
open ( const char * path , int flags , mode_t mode );
!
!
Table: One and only one of these three constants must be specified.29
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
375
But . . .
29
Most implementations define O RDONLY as 0, O WRONLY as 1, and O RDWR as
2, for compatibility with older programs.
78
Creating Creation
New Files of new files
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
376
79
More
toopen(2)
open(2)
a file
Even More
Flagsflags
For The
Function
Following constants are optional flags to open(2):
O
O
O
O
O
O
O
O
int
creat ( const char * path , mode_t mode );
APPEND
CREAT
EXCL
TRUNC
NONBLOCK
SYNC
RSYNC
DSYNC
O TRUNC options now provided by open, a separate creat function is no longer needed:
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
377
80
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
378
81
Close(2)ing time
Close A File
lseek(2):
Reposition
file offset
lseek - Reposition
Read/Write
File Offset
off_t
lseek ( int fildes , off_t offset , int whence );
int
close ( int d );
Releases any record locks the process may have on the file.
!
!
379
82
30
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
381
83
383
85
offset (re-)position
offset is set to offset bytes from the beginning of file.
files offset is set to its current value plus offset.30
files offset is set to the size of the file plus offset.30
lseek will fail and the file pointer will remain unchanged if:
off_t
lseek ( int fildes , off_t offset , int whence );
Errors
& Current
determine
Error Indication
And
Offsetcurrent offset
Offset interpretation
Offset Interpretation
whence
SEEK SET
SEEK CUR
SEEK END
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
382
84
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
Read andread(2)ing
Write a File and write(2)ing a file
Input and output uses the read and write system calls.
Those are accessed from C programs through two identically
named functions: read(2) and write(2).
For both the first argument is a file descriptor.
Second argument is a pointer to a buffer in the program
where the data is to go to or come from.
Third argument is the number of bytes to be transferred.
int
main ( void )
{
if ( lseek ( STDIN_FILENO , 0 , SEEK_SET ) == -1)
err ( errno , " can ! not ! seek ! [% d ]. " , errno );
else
printf ( " seek ! OK .\ n " );
return (0);
}
!
!
!
/* Illegal seek */
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
384
86
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
390
87
Example:
Low-Level File Copy
File Copying,
v4
/* cp : copy f1 to f2 ( file copy ) */
int
main ( int argc , char * argv [])
{
int f1 , f2 ;
ssize_t n ;
char buf [ BUFSIZ ];
Standard I/O
if ( argc != 3)
error ( " Usage : cp from to " );
if (( f1 = open ( argv [1] , O_RDONLY , 0)) == -1)
error ( " can t open % s " , argv [1]);
if (( f2 = creat ( argv [2] , PERMS )) == -1)
error ( " can t create %s , mode %03 o " , argv [2] , PERMS );
while (( n = read ( f1 , buf , BUFSIZ )) > 0)
if ( write ( f2 , buf , n ) != n )
error ( " write error on file % s " , argv [2]);
return (0);
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
395
88
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
89
!"#$%"&''('#")"
*+%,-.('#")-/
UNIX system
architecture (System V)
!"+5#<"$=$;6$1))"
:$;6$1))&%&A%;#?"D
-."#&'"("%
!"#$"%&'"("%
.('#")15E$5E4.>?+%##'#"AA"-8.3.4"5&8*%%&0$4"#/*8"9
B+#"$4:$;<"''4
C;))5+%D1#%;+
8;<=9
71#"%4.5&'('#")-8/0%"&.12.3.4"59
:5EE"$5+6
821//"#&8*89"9
Files
F"%>?"+-889*#*84"#9
:$;<"'''#"5"$5+6'4
.5&'('#")-86#78"..
87$4#7%&.12.3.4"59
!A;>D-82%78>9
G"$H#"#$"%&"$-82"@%>"-2$%@"$9
:$;<"'';$4
<5#"%A5+6
8.89"+1%0$:9
Processes
.="%>?"$4
@"$31A#5+6
85"57#3
5*$*:"5"$49
01$231$"4.#"5"$5+6
!"#$"%&'"("%
)*#+,*#"&'"("%
01$231$"
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
!"#$%&'()*&+,*(-.)/
90
Unbuffered
The Standard
I/O Libraryvs. standard I/O
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
012'&345
An error flag.
!
!
Ease of use.
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
449
93
91
FILE Object
The FILEThe
object
448
Incidental Remark
447
92
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
BufferingAutomatic Buffering
The standard I/O library provides buffering
!
Buffering
Fully buffered
Line buffered
Unbuffered
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
452
94
Fully
(block)
Fully (block)
buffered
I/O buffered I/O
Actual I/O takes place when the standard I/O buffer is filled.
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
95
LineI/O
buffered I/O
Line buffered
Line buffered I/O provided by the standard I/O library:
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
453
96
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
454
97
Unbuffered
I/O
Unbuffered
I/O
ISO C Requirements
buffering requirements
ISO C Buffering
ISO C requires the following buffering characteristics:
Unbuffered I/O:
!
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
455
98
Turn On
buffering
Turn Buffering
and Off on and off
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
456
99
458
101
Altering
buffer behaviour
Alter Buffering
Behaviour
# include < stdio .h >
int
/* 0 if OK else EOF ( but stream is still functional ) */
setvbuf ( FILE * stream , char * buf , int mode , size_t size );
void
setbuf ( FILE * stream , char * buf );
!
!
May only be used after sucessful open and before first I/O.
!
!
33
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
457
100
buf and size can optionally specify a buffer and its size.
If buf is NULL the system chooses an apt size33 .
System-dependent:
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
mode
setbuf
IOFBF
setvbuf
IOLBF
IONBF
buf
Type of buffering
nonnull
NULL
nonnull
NULL
nonnull
NULL
(ignored)
size
length
size
length
Standard I/O
routines
fully buffered
line buffered
unbuffered
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
103
!
If stream
is NULL,
Opening
a Stream
to fopen(3)
a stream
Modes toModes
Open a Standard
I/O Stream
459
FILE *
fopen ( const char * path , const char * mode );
mode
r or rb
w or wb
a or ab
r+ or r+b or rb+
w+ or w+b or wb+
a+ or a+b or ab+
FILE *
freopen ( const char * path , const char * mode , FILE * stream );
FILE * /* all : fpointer if OK , NULL on failure with errno */
fdopen ( int fildes , const char * mode );
!
!
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
460
104
Description
open for reading
truncate to 0 length or create for writing
append; open for writing at end of file, or create for writing
open for reading and writing
truncate to 0 length or create for reading and writing
open or create for reading and writing at end of file
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
461
105
Function
mode
setbuf
Remarks
on fopen(3)
Final Remarks
on Opening
a Stream
r
x
x
x
x
x
x
r+
x
x
x
Type of buffering
fflush(3) a stream
IOFBF
setvbuf
buf
nonnull
NULL
w+
IONBF
a+
x
x
x
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
size
length
size
length
fully buffered
line buffered
unbuffered
x
x
x
IOLBF
nonnull
NULL
nonnull
NULL
(ignored)
467
106
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
107
Reading and
Writingand
a Stream
Reading
writing a stream
stream
Closing afclose(3)
stream with a
fclose(3)
int
/* 0 if OK , else EOF / errno ( no further access ) */
fclose ( FILE * stream );
!
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
468
108
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
469
109
Character-at-a-time
Character-at-a-time
Input Functionsinput functions
# include < stdio .h >
int
fgetc ( FILE * stream );
int
getc ( FILE * stream );
Character-at-a-time I/O
*EOF
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
110
Push
back characters
Push-Back
Characters
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
111
473
113
Character-at-a-time
output functions
Character-at-a-time
Output Functions
int
/* c if OK , EOF on failure */
ungetc ( int c , FILE * stream );
int
fputc ( int c , FILE * stream );
int
putc ( int c , FILE * stream );
int
/* All : c if OK , EOF / errno on failure */
putchar ( int c );
Pushing back EOF will fail and the stream remains unchanged.
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
470
472
112
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
Line-at-a-time
input functions
Line-at-a-time
Input Functions
# include < stdio .h >
char *
fgets ( char * str , int size , FILE * stream );
char * /* should NEVER be used - > unknown buffer size */
gets ( char * str );
Line-at-a-time I/O
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
114
str specifies the address of the buffer to read the line into.
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
474
115
Line-at-a-time
output functions
Line-at-a-time
Output Functions
# include < stdio .h >
int
/* 0 on success and EOF on error */
fputs ( const char * str , FILE * stream );
Direct I/O
int
puts ( const char * str );
/* >=0 on success and EOF or error */
!
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
475
116
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
117
Binary I/O
Binary I/O
Reading
Binary I/O
Functionsand writing using binary I/O
# include < stdio .h >
size_t
fread ( void * ptr , size_t size ,
size_t nmemb , FILE * stream );
!
!
size_t
fwrite ( const void * ptr , size_t size ,
size_t nmemb , FILE * stream );
/* Return number of objects read or written */
!
!
37
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
476
118
Writinganan
array
Binary I/OWrite
Array
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
119
479
121
477
Writinga aStructure
structure
Binary I/OWrite
478
120
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
Problems
binary
Fundamental
Problemswith
with Binary
I/OI/O
Positioning
a stream
Positioning
a Stream
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
They work similar to lseek(2) and the whence options (SEEK SET
etc.) are the same.
480
122
Check
stream status
Check Stream
Status
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
481
123
482
125
a file descriptor
ObtainingObtaining
a File Descriptor
int
ferror ( FILE * stream );
int
/* file descriptor assoc . with the stream */
fileno ( FILE * stream );
int
clearerr ( FILE * stream );
!
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
471
124
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
Standard I/O
Example
Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term 2009
126
Review
On slide: I/O system calls - Tracing hello world
write(2) is invoked without previous call to open(2). How so?
Why does the following code yield exit status 13?*
128
127