1.
:NDWDORJX]QDMGXMHVLSOLN0DNHILOHLSOLNL]NRGHPGLFWFSOFHQFSSGHFPDNHILOH1DSLVDüGRMDNLFK
SROHFHUR]ZLQLHVLPDNHILOHZZ\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áXJLZDQRVLDGUHVDPLFKRüSRODRSLVXMZVND(QLNLDOHSRVáX*RQRVLQD]ZDPLRGSRZLHGQLFKZSLVyZ
3U]\NáDGRZRSROHGBSDUHQWGODZSLVXRQD]ZLH$ZVND]XMHQDZSLVRQD]ZLH-3XVWHPLHMVFDR]QDF]DMEUDN
ZVND(QLND1DOH*\QDU\VRZDüRSLVDQZWDEHOLKLHUDUFKLSOLNyZ
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]HGVWDZLRQRKLHUDUFKLSOLNyZZV\VWHPLH(;7RERNQD]ZSRGDQRZQDZLDVDFK
RGSRZLDGDMFHZSLVRPL-Z]á\:SLV\WHVWGLFWLGRFWRNDWDORJLSR]RVWDáHZSLV\WRSOLNL]Z\NáH1DOH*\
X]XSHáQLüWDEHORSLVXMF]DZDUWRüNDWDORJXWHVWSRXVXQLFLXSOLNXSOFXVXQLFLHÄ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
RSVBWHVWRSVBWHVWRSVBWHVWDQDVWSQLH]DLQLFMDOL]RZDQRMHDGUHVDPLRGSRZLHGQLFKIXQNFMLREVáXJL
XU]G]H3U]HGVWDZLRQRIXQNFMLQLFMDOL]DFMLVWHURZQLNDWHVWBLQLWBPRGXOHRUD]IUDJPHQWIXQNFMLRWZLHUDQLD
XU]G]HQLDWHVWBRSHQZVSyOQHMGODZV]\VWNLFKWU]HFKXU]G]H8]XSHáQLüIXQNFMWHVWBRSHQWDN*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\PNDWDORJXGRSOLNXDRXW1DVWSQLHZW\PVDP\PNDWDORJXXUXFKRPLRQRSURJUDPSRGDMF
DUJXPHQW\SROHFHQLHPDRXWDEFG:Z\QLNXZ\NRQDQLDVLSURJUDPXQDHNUDQLHSRMDZLáVLQDSLV
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