\textbf{Valore} & \textbf{Tipo di file} \\
\hline
\hline
- \const{DT\_UNKNOWN} & tipo sconosciuto\\
- \const{DT\_REG} & file normale\\
- \const{DT\_DIR} & directory\\
- \const{DT\_FIFO} & fifo\\
- \const{DT\_SOCK} & socket\\
- \const{DT\_CHR} & dispositivo a caratteri\\
- \const{DT\_BLK} & dispositivo a blocchi\\
+ \const{DT\_UNKNOWN} & Tipo sconosciuto.\\
+ \const{DT\_REG} & File normale.\\
+ \const{DT\_DIR} & Directory.\\
+ \const{DT\_FIFO} & Fifo.\\
+ \const{DT\_SOCK} & Socket.\\
+ \const{DT\_CHR} & Dispositivo a caratteri.\\
+ \const{DT\_BLK} & Dispositivo a blocchi.\\
\hline
\end{tabular}
\caption{Costanti che indicano i vari tipi di file nel campo \var{d\_type}
\textbf{Macro} & \textbf{Tipo del file} \\
\hline
\hline
- \macro{S\_ISREG(m)} & file regolare \\
- \macro{S\_ISDIR(m)} & directory \\
- \macro{S\_ISCHR(m)} & dispositivo a caratteri \\
- \macro{S\_ISBLK(m)} & dispositivo a blocchi\\
- \macro{S\_ISFIFO(m)} & fifo \\
- \macro{S\_ISLNK(m)} & link simbolico \\
- \macro{S\_ISSOCK(m)} & socket \\
+ \macro{S\_ISREG(m)} & File normale.\\
+ \macro{S\_ISDIR(m)} & Directory.\\
+ \macro{S\_ISCHR(m)} & Dispositivo a caratteri.\\
+ \macro{S\_ISBLK(m)} & Dispositivo a blocchi.\\
+ \macro{S\_ISFIFO(m)} & Fifo.\\
+ \macro{S\_ISLNK(m)} & Link simbolico.\\
+ \macro{S\_ISSOCK(m)} & Socket.\\
\hline
\end{tabular}
\caption{Macro per i tipi di file (definite in \texttt{sys/stat.h}).}
\textbf{Flag} & \textbf{Valore} & \textbf{Significato} \\
\hline
\hline
- \const{S\_IFMT} & 0170000 & maschera per i bit del tipo di file \\
- \const{S\_IFSOCK} & 0140000 & socket \\
- \const{S\_IFLNK} & 0120000 & link simbolico \\
- \const{S\_IFREG} & 0100000 & file regolare \\
- \const{S\_IFBLK} & 0060000 & dispositivo a blocchi \\
- \const{S\_IFDIR} & 0040000 & directory \\
- \const{S\_IFCHR} & 0020000 & dispositivo a caratteri \\
- \const{S\_IFIFO} & 0010000 & fifo \\
+ \const{S\_IFMT} & 0170000 & Maschera per i bit del tipo di file.\\
+ \const{S\_IFSOCK} & 0140000 & Socket.\\
+ \const{S\_IFLNK} & 0120000 & Link simbolico.\\
+ \const{S\_IFREG} & 0100000 & File regolare.\\
+ \const{S\_IFBLK} & 0060000 & Dispositivo a blocchi.\\
+ \const{S\_IFDIR} & 0040000 & Directory.\\
+ \const{S\_IFCHR} & 0020000 & Dispositivo a caratteri.\\
+ \const{S\_IFIFO} & 0010000 & Fifo.\\
\hline
- \const{S\_ISUID} & 0004000 & set UID bit \itindex{suid~bit} \\
- \const{S\_ISGID} & 0002000 & set GID bit \itindex{sgid~bit} \\
- \const{S\_ISVTX} & 0001000 & sticky bit \itindex{sticky~bit}\\
+ \const{S\_ISUID} & 0004000 & Set UID bit \itindex{suid~bit}.\\
+ \const{S\_ISGID} & 0002000 & Set GID bit \itindex{sgid~bit}.\\
+ \const{S\_ISVTX} & 0001000 & Sticky bit \itindex{sticky~bit}.\\
\hline
-% \const{S\_IRWXU} & 00700 & bitmask per i permessi del proprietario \\
- \const{S\_IRUSR} & 00400 & il proprietario ha permesso di lettura \\
- \const{S\_IWUSR} & 00200 & il proprietario ha permesso di scrittura \\
- \const{S\_IXUSR} & 00100 & il proprietario ha permesso di esecuzione\\
+% \const{S\_IRWXU} & 00700 & Bitmask per i permessi del proprietario.\\
+ \const{S\_IRUSR} & 00400 & Il proprietario ha permesso di lettura.\\
+ \const{S\_IWUSR} & 00200 & Il proprietario ha permesso di scrittura.\\
+ \const{S\_IXUSR} & 00100 & Il proprietario ha permesso di esecuzione.\\
\hline
-% \const{S\_IRWXG} & 00070 & bitmask per i permessi del gruppo \\
- \const{S\_IRGRP} & 00040 & il gruppo ha permesso di lettura \\
- \const{S\_IWGRP} & 00020 & il gruppo ha permesso di scrittura \\
- \const{S\_IXGRP} & 00010 & il gruppo ha permesso di esecuzione \\
+% \const{S\_IRWXG} & 00070 & Bitmask per i permessi del gruppo.\\
+ \const{S\_IRGRP} & 00040 & Il gruppo ha permesso di lettura.\\
+ \const{S\_IWGRP} & 00020 & Il gruppo ha permesso di scrittura.\\
+ \const{S\_IXGRP} & 00010 & Il gruppo ha permesso di esecuzione.\\
\hline
-% \const{S\_IRWXO} & 00007 & bitmask per i permessi di tutti gli altri\\
- \const{S\_IROTH} & 00004 & gli altri hanno permesso di lettura \\
- \const{S\_IWOTH} & 00002 & gli altri hanno permesso di esecuzione \\
- \const{S\_IXOTH} & 00001 & gli altri hanno permesso di esecuzione \\
+% \const{S\_IRWXO} & 00007 & Bitmask per i permessi di tutti gli altri\\
+ \const{S\_IROTH} & 00004 & Gli altri hanno permesso di lettura.\\
+ \const{S\_IWOTH} & 00002 & Gli altri hanno permesso di esecuzione.\\
+ \const{S\_IXOTH} & 00001 & Gli altri hanno permesso di esecuzione.\\
\hline
\end{tabular}
\caption{Costanti per l'identificazione dei vari bit che compongono il campo
& \textbf{Opzione di \cmd{ls}} \\
\hline
\hline
- \var{st\_atime}& ultimo accesso ai dati del file &\func{read},
- \func{utime} & \cmd{-u}\\
- \var{st\_mtime}& ultima modifica ai dati del file &\func{write},
- \func{utime} & default\\
- \var{st\_ctime}& ultima modifica ai dati dell'inode&\func{chmod},
- \func{utime} & \cmd{-c} \\
+ \var{st\_atime}& ultimo accesso ai dati del file &
+ \func{read}, \func{utime} & \cmd{-u}\\
+ \var{st\_mtime}& ultima modifica ai dati del file &
+ \func{write}, \func{utime} & default\\
+ \var{st\_ctime}& ultima modifica ai dati dell'inode &
+ \func{chmod}, \func{utime} & \cmd{-c}\\
\hline
\end{tabular}
\caption{I tre tempi associati a ciascun file.}
\hline
\hline
\func{chmod}, \func{fchmod}
- & -- & -- &$\bullet$& -- & -- & -- & \\
+ & -- & -- &$\bullet$& -- & -- & -- &\\
\func{chown}, \func{fchown}
- & -- & -- &$\bullet$& -- & -- & -- & \\
+ & -- & -- &$\bullet$& -- & -- & -- &\\
\func{creat}
- &$\bullet$&$\bullet$&$\bullet$& -- &$\bullet$&$\bullet$& con
- \const{O\_CREATE} \\ \func{creat}
- & -- &$\bullet$&$\bullet$& -- &$\bullet$&$\bullet$&
- con \const{O\_TRUNC} \\ \func{exec}
- &$\bullet$& -- & -- & -- & -- & -- & \\
+ &$\bullet$&$\bullet$&$\bullet$& -- &$\bullet$&$\bullet$&
+ con \const{O\_CREATE} \\
+ \func{creat}
+ & -- &$\bullet$&$\bullet$& -- &$\bullet$&$\bullet$&
+ con \const{O\_TRUNC} \\
+ \func{exec}
+ &$\bullet$& -- & -- & -- & -- & -- &\\
\func{lchown}
- & -- & -- &$\bullet$& -- & -- & -- & \\
+ & -- & -- &$\bullet$& -- & -- & -- &\\
\func{link}
- & -- & -- &$\bullet$& -- &$\bullet$&$\bullet$& \\
+ & -- & -- &$\bullet$& -- &$\bullet$&$\bullet$&\\
\func{mkdir}
- &$\bullet$&$\bullet$&$\bullet$& -- &$\bullet$&$\bullet$& \\
+ &$\bullet$&$\bullet$&$\bullet$& -- &$\bullet$&$\bullet$&\\
\func{mkfifo}
- &$\bullet$&$\bullet$&$\bullet$& -- &$\bullet$&$\bullet$& \\
+ &$\bullet$&$\bullet$&$\bullet$& -- &$\bullet$&$\bullet$&\\
+ \func{open}
+ &$\bullet$&$\bullet$&$\bullet$& -- &$\bullet$&$\bullet$&
+ con \const{O\_CREATE} \\
\func{open}
- &$\bullet$&$\bullet$&$\bullet$& -- &$\bullet$&$\bullet$& con
- \const{O\_CREATE} \\ \func{open}
- & -- &$\bullet$&$\bullet$& -- & -- & -- & con
- \const{O\_TRUNC} \\ \func{pipe}
- &$\bullet$&$\bullet$&$\bullet$& -- & -- & -- & \\
+ & -- &$\bullet$&$\bullet$& -- & -- & -- &
+ con \const{O\_TRUNC} \\
+ \func{pipe}
+ &$\bullet$&$\bullet$&$\bullet$& -- & -- & -- &\\
\func{read}
- &$\bullet$& -- & -- & -- & -- & -- & \\
+ &$\bullet$& -- & -- & -- & -- & -- &\\
+ \func{remove}
+ & -- & -- &$\bullet$& -- &$\bullet$&$\bullet$&
+ se esegue \func{unlink}\\
\func{remove}
- & -- & -- &$\bullet$& -- &$\bullet$&$\bullet$& se esegue
- \func{unlink}\\ \func{remove}
- & -- & -- & -- & -- &$\bullet$&$\bullet$& se esegue
- \func{rmdir}\\ \func{rename}
- & -- & -- &$\bullet$& -- &$\bullet$&$\bullet$& per entrambi
- gli argomenti\\ \func{rmdir}
- & -- & -- & -- & -- &$\bullet$&$\bullet$& \\
+ & -- & -- & -- & -- &$\bullet$&$\bullet$&
+ se esegue \func{rmdir}\\
+ \func{rename}
+ & -- & -- &$\bullet$& -- &$\bullet$&$\bullet$&
+ per entrambi gli argomenti\\
+ \func{rmdir}
+ & -- & -- & -- & -- &$\bullet$&$\bullet$&\\
\func{truncate}, \func{ftruncate}
- & -- &$\bullet$&$\bullet$& -- & -- & -- & \\
+ & -- &$\bullet$&$\bullet$& -- & -- & -- &\\
\func{unlink}
- & -- & -- &$\bullet$& -- &$\bullet$&$\bullet$& \\
+ & -- & -- &$\bullet$& -- &$\bullet$&$\bullet$&\\
\func{utime}
- &$\bullet$&$\bullet$&$\bullet$& -- & -- & -- & \\
+ &$\bullet$&$\bullet$&$\bullet$& -- & -- & -- &\\
\func{write}
- & -- &$\bullet$&$\bullet$& -- & -- & -- & \\
+ & -- &$\bullet$&$\bullet$& -- & -- & -- &\\
\hline
\end{tabular}
\caption{Prospetto dei cambiamenti effettuati sui tempi di ultimo
\textbf{\var{st\_mode}} bit & \textbf{Significato} \\
\hline
\hline
- \const{S\_IRUSR} & \textit{user-read}, l'utente può leggere \\
- \const{S\_IWUSR} & \textit{user-write}, l'utente può scrivere \\
- \const{S\_IXUSR} & \textit{user-execute}, l'utente può eseguire \\
- \hline
- \const{S\_IRGRP} & \textit{group-read}, il gruppo può leggere \\
- \const{S\_IWGRP} & \textit{group-write}, il gruppo può scrivere \\
- \const{S\_IXGRP} & \textit{group-execute}, il gruppo può eseguire\\
- \hline
- \const{S\_IROTH} & \textit{other-read}, tutti possono leggere \\
- \const{S\_IWOTH} & \textit{other-write}, tutti possono scrivere \\
- \const{S\_IXOTH} & \textit{other-execute}, tutti possono eseguire\\
+ \const{S\_IRUSR} & \textit{user-read}, l'utente può leggere.\\
+ \const{S\_IWUSR} & \textit{user-write}, l'utente può scrivere.\\
+ \const{S\_IXUSR} & \textit{user-execute}, l'utente può eseguire.\\
+ \hline
+ \const{S\_IRGRP} & \textit{group-read}, il gruppo può leggere.\\
+ \const{S\_IWGRP} & \textit{group-write}, il gruppo può scrivere.\\
+ \const{S\_IXGRP} & \textit{group-execute}, il gruppo può eseguire.\\
+ \hline
+ \const{S\_IROTH} & \textit{other-read}, tutti possono leggere.\\
+ \const{S\_IWOTH} & \textit{other-write}, tutti possono scrivere.\\
+ \const{S\_IXOTH} & \textit{other-execute}, tutti possono eseguire.\\
\hline
\end{tabular}
\caption{I bit dei permessi di accesso ai file, come definiti in
\textbf{\param{mode}} & \textbf{Significato} \\
\hline
\hline
- \const{R\_OK} & verifica il permesso di lettura \\
- \const{W\_OK} & verifica il permesso di scritture \\
- \const{X\_OK} & verifica il permesso di esecuzione \\
- \const{F\_OK} & verifica l'esistenza del file \\
+ \const{R\_OK} & Verifica il permesso di lettura. \\
+ \const{W\_OK} & Verifica il permesso di scrittura. \\
+ \const{X\_OK} & Verifica il permesso di esecuzione. \\
+ \const{F\_OK} & Verifica l'esistenza del file. \\
\hline
\end{tabular}
\caption{Valori possibile per l'argomento \param{mode} della funzione
\textbf{\param{mode}} & \textbf{Valore} & \textbf{Significato} \\
\hline
\hline
- \const{S\_ISUID} & 04000 & set user ID \itindex{suid~bit} \\
- \const{S\_ISGID} & 02000 & set group ID \itindex{sgid~bit}\\
- \const{S\_ISVTX} & 01000 & sticky bit \itindex{sticky~bit}\\
+ \const{S\_ISUID} & 04000 & Set user ID \itindex{suid~bit}.\\
+ \const{S\_ISGID} & 02000 & Set group ID \itindex{sgid~bit}.\\
+ \const{S\_ISVTX} & 01000 & Sticky bit \itindex{sticky~bit}.\\
\hline
- \const{S\_IRWXU} & 00700 & l'utente ha tutti i permessi \\
- \const{S\_IRUSR} & 00400 & l'utente ha il permesso di lettura \\
- \const{S\_IWUSR} & 00200 & l'utente ha il permesso di scrittura \\
- \const{S\_IXUSR} & 00100 & l'utente ha il permesso di esecuzione \\
+ \const{S\_IRWXU} & 00700 & L'utente ha tutti i permessi.\\
+ \const{S\_IRUSR} & 00400 & L'utente ha il permesso di lettura.\\
+ \const{S\_IWUSR} & 00200 & L'utente ha il permesso di scrittura.\\
+ \const{S\_IXUSR} & 00100 & L'utente ha il permesso di esecuzione.\\
\hline
- \const{S\_IRWXG} & 00070 & il gruppo ha tutti i permessi \\
- \const{S\_IRGRP} & 00040 & il gruppo ha il permesso di lettura \\
- \const{S\_IWGRP} & 00020 & il gruppo ha il permesso di scrittura \\
- \const{S\_IXGRP} & 00010 & il gruppo ha il permesso di esecuzione \\
+ \const{S\_IRWXG} & 00070 & Il gruppo ha tutti i permessi.\\
+ \const{S\_IRGRP} & 00040 & Il gruppo ha il permesso di lettura.\\
+ \const{S\_IWGRP} & 00020 & Il gruppo ha il permesso di scrittura.\\
+ \const{S\_IXGRP} & 00010 & Il gruppo ha il permesso di esecuzione.\\
\hline
- \const{S\_IRWXO} & 00007 & gli altri hanno tutti i permessi \\
- \const{S\_IROTH} & 00004 & gli altri hanno il permesso di lettura \\
- \const{S\_IWOTH} & 00002 & gli altri hanno il permesso di scrittura \\
- \const{S\_IXOTH} & 00001 & gli altri hanno il permesso di esecuzione \\
+ \const{S\_IRWXO} & 00007 & Gli altri hanno tutti i permessi.\\
+ \const{S\_IROTH} & 00004 & Gli altri hanno il permesso di lettura.\\
+ \const{S\_IWOTH} & 00002 & Gli altri hanno il permesso di scrittura.\\
+ \const{S\_IXOTH} & 00001 & Gli altri hanno il permesso di esecuzione.\\
\hline
\end{tabular}
\caption{Valori delle costanti usate per indicare i vari bit di
Per risolvere questo problema alcuni sistemi unix-like (e fra questi anche
Linux) hanno introdotto un meccanismo generico che consenta di associare delle
informazioni ai singoli file,\footnote{l'uso più comune è quello della ACL,
- che tratteremo a breve, ma si possono inserire anche altre informazioni.}
-detto \textit{Extended Attributes}. Gli \textsl{attributi estesi} non sono
-altro che delle coppie nome/valore che sono associate permanentemente ad un
-oggetto sul filesystem, analoghi di quello che sono le variabili di ambiente
-(vedi sez.~\ref{sec:proc_environ}) per un processo.
+ che tratteremo nella prossimaa sezione, ma si possono inserire anche altre
+ informazioni.} detto \textit{Extended Attributes}. Gli \textsl{attributi
+ estesi} non sono altro che delle coppie nome/valore che sono associate
+permanentemente ad un oggetto sul filesystem, analoghi di quello che sono le
+variabili di ambiente (vedi sez.~\ref{sec:proc_environ}) per un processo.
Altri sistemi (come Solaris, MacOS e Windows) hanno adottato un meccanismo
diverso in cui ad un file sono associati diversi flussi di dati, su cui
Normalmente la directory radice di un processo coincide anche con la radice
del filesystem usata dal kernel, e dato che il suo valore viene ereditato dal
padre da ogni processo figlio, in generale i processi risolvono i
-\itindsub{pathname}{assoluto}\textit{pathname} assoluti a partire sempre dalla
-stessa directory, che corrisponde alla \file{/} del sistema.
+\itindsub{pathname}{assoluto} \textit{pathname} assoluti a partire sempre
+dalla stessa directory, che corrisponde alla radice del sistema.
In certe situazioni però, per motivi di sicurezza, è utile poter impedire che
un processo possa accedere a tutto il filesystem; per far questo si può
replicare all'interno della \textit{chroot jail} tutti i file (in genere
programmi e librerie) di cui il server potrebbe avere bisogno.
+
+
+
+
+
+
% LocalWords: sez like filesystem unlink MacOS Windows VMS inode kernel unistd
% LocalWords: un'etichetta int const char oldpath newpath errno EXDEV EPERM st
% LocalWords: EEXIST EMLINK EACCES ENAMETOOLONG ENOTDIR EFAULT ENOMEM EROFS ls