1.
:NDWDORJX]QDMGXMHVL SOLN0DNHILOHLSOLNL]NRGHPGLFWFSOFHQFSSGHFPDNHILOH1DSLVDüGRMDNLFK
SROHFHUR]ZLQLHVL
PDNHILOHZZ\QLNXSRGDQLDSROHFHQLDPDNHZGDQ\PNDWDORJXNROHMQHNRPSLODFMHL
konsolidacje)
Makefile
cc = gcc
cflags = -D DEBUG –g Wall
lflags = -g
unsorted = ${patsubst %.c, %.o, ${ wildcard *.c}}
sorted = ${sort ${unsorted}}
indeks : ${sorted}
${cc} ${lflags} $^ -o $@
%.o : %.c
${cc} –c ${cflags} $<
2. W kolejnych wierszach tabeli przedstawiono wpisy w katalogu VFS (wybrane pola struktury dentry). Tabela
dotyczy 13 wpisów o nazwach od A do M (pierwsza kolumna). W kolejnych kolumnach dla uproszczenia nie
SRVáXJLZDQRVL DGUHVDPLFKRüSRODRSLVXMZVND(QLNLDOHSRVáX*RQRVL QD]ZDPLRGSRZLHGQLFKZSLVyZ
3U]\NáDGRZRSROHGBSDUHQWGODZSLVXRQD]ZLH$ZVND]XMHQDZSLVRQD]ZLH-3XVWHPLHMVFDR]QDF]DMEUDN
ZVND(QLND1DOH*\QDU\VRZDüRSLVDQZWDEHOLKLHUDUFKL SOLNyZ
D_hash
D_name
D_parent
next
Prev
D_child
D_subdirs
A
B
L
F
B
B
A
C
B
E
M
D
I
E
B
G
F
A
I
G
B
H
I
D
I
A
H
J
K
K
C
L
M
J
L
B
K
C
M
C
K
K
3.
QDU\VXQNXSU]HGVWDZLRQRKLHUDUFKL SOLNyZZV\VWHPLH(;7RERNQD]ZSRGDQRZQDZLDVDFK
RGSRZLDGDMFHZSLVRPL-Z ]á\:SLV\WHVWGLFWLGRFWRNDWDORJLSR]RVWDáHZSLV\WRSOLNL]Z\NáH1DOH*\
X]XSHáQLüWDEHO RSLVXMF]DZDUWRüNDWDORJXWHVWSRXVXQL FLXSOLNXSOFXVXQL FLHÄV]\ENLH´– bez
SU]HEXGRZDQLDFDáHJRNDWDORJX.D*G\NROHMQ\ZLHUV]RSLVXMHSRMHG\QF]\ZSLVVWUXNWXUDH[WBGLHBHQWHU\B
inode
Rec_len
Name_len File_type
Name
Test [203]
|--- dict [466]
|---doc [550]
| |--- info [591]
|-dict.c [557]
|-pl.c [558]
|-en.cpp [560]
|-de.c[563]
4. Napisano sterow
QLN]QDNRZ\GODWU]HFKXU]G]HRQD]ZLH7(67QXPHU]HJáyZQ\PLQXPHUDFK
SRGU] GQ\FKL'ODND*GHJR]QLFK]DGHNODURZDQR]PLHQQHW\SXILOHBRSHUDWLRQVRGSRZLHGQLR
RSVBWHVWRSVBWHVWRSVBWHVWDQDVW SQLH]DLQLFMDOL]RZDQRMHDGUHVDPLRGSRZLHGQLFKIXQNFMLREVáXJL
XU]G]H3U]HGVWDZLRQRIXQNFM LQLFMDOL]DFMLVWHURZQLNDWHVWBLQLWBPRGXOHRUD]IUDJPHQWIXQNFMLRWZLHUDQLD
XU]G]HQLDWHVWBRSHQZVSyOQHMGODZV]\VWNLFKWU]HFKXU]G]H8]XSHáQLüIXQNFM WHVWBRSHQWDN*HE\
XVWDZLDáDRQDRGSRZLHGQL]HVWDZIXQNFMLGODRWZLHUDQHJRSOLNXQDSRGVWDZLHQXPHUXSRGU] GQHJR
...
static int test_init_module( void)
{
if (register_chrdev( 80, „TEST”, &ops test0))
{
printk( KERN_WARNING „register_chrdev error\n”);
return –EIO;
}
else
{
printk( KERN_WARNING „ok\n”);
return 0;
}
}
...
test_open( struct inode* ino, struct file* filep)
{
Return 0;
}
...
5.
:SOLNXWPSWHVWSURFF]DSLVDQRNRGSURJUDPXSU]HGVWDZLRQHJRSRQL*HM3URJUDPVNRPSLORZDQRZW\P
VDP\PNDWDORJXGRSOLNXDRXW1DVW SQLHZW\PVDP\PNDWDORJXXUXFKRPLRQRSURJUDPSRGDMF
DUJXPHQW\SROHFHQLHPDRXWDEFG:Z\QLNXZ\NRQDQLDVL
SURJUDPXQDHNUDQLHSRMDZLáVL
QDSLV
22593 3 4
/tmp/protest.c
#include <unistd.h>
#include <fcntl.h>
int main ( int argc, char *argv)
{
int p, c, x;
p = getpid();
c = open( „a.out”, O_RDONLY);
x = open( „testproc.c”, O_RDONLY);
printf( „%d %d %d”, p, c, x);
sleep(60);
return 0;
}
1DOH*\X]XSHáQLüSRQL*V]WDEHOHRSLVXMFZ\EUDQHHOHPHQW\V\VWHPXSURFGODRSLVDQHJRZF]HQLHMSURFHVX
1D]ZDSRGNDWDORJX]DZLHUDMFHJRRSLVSURFHVX
=DZDUWRüRGSRZLHGQLHJRSOLNXFPGOLQH
=DZDUWRüRGSRZLHGQLHJRSOLNXFZG
=DZDUWRüRGSRZLHGQLHJRSOLNXH[H
=DZDUWRüRGSRZLHGQLHJRSOLNXIG
=DZDUWRüRGSRZLHGQLHJRSOLNXIG
=DZDUWRüRGSRZLHGQLHgo pliku fd/4