%% build.tex
%%
-%% Copyright (C) 1999-2018 Simone Piccardi. Permission is granted to copy,
+%% Copyright (C) 1999-2019 Simone Piccardi. Permission is granted to copy,
%% distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% errors.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% fileadv.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% filedir.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
% TODO (bassa priorità) scrivere delle funzioni (getfsent e getmntent &C)
% TODO (bassa priorità) documentare ? swapon e swapoff (man 2 ...)
+% TODO con il 5.2 è stata introdotta una serie di nuove syscall per montare un
+% filesystem, vedi https://lwn.net/Articles/759499/ e
+% https://git.kernel.org/linus/f1b5618e013a
\section{La gestione di file e directory}
%% fileio.tex (merge fileunix.tex - filestd.tex)
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% gapil.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.3 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
\begin{quote}
- Copyright \copyright\ 2000-2018 Simone Piccardi. Permission is granted to
+ Copyright \copyright\ 2000-2019 Simone Piccardi. Permission is granted to
copy, distribute and/or modify this document under the terms of the GNU Free
Documentation License, Version 1.3 or any later version published by the
Free Software Foundation; with the Invariant Sections being ``Un preambolo''
%% intro.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% ipc.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% macro.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% netlayer.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% network.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% othersock.tex
%%
-%% Copyright (C) 2004-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2004-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% preambolo.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% pref.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
\func{sys\_clone} riprende, come per \func{fork}, da dopo l'esecuzione della
stessa.
+% TODO trattare anche clone3 (vedi https://lwn.net/Articles/792628/), aggiunta
+% con il kernel 5.3
+
La necessità di avere uno \textit{stack} alternativo c'è solo quando si
intende creare un \textit{thread}, in tal caso infatti il nuovo \textit{task}
vede esattamente la stessa memoria del \textit{task}
\item[\constd{CLONE\_PARENT\_SETTID}]
\item[\constd{CLONE\_PID}]
+% TODO trattare CLONE_PIDFD introdotto con il kernel 5.2, vedi
+% https://lwn.net/Articles/787963/ e anche https://lwn.net/Articles/789023/
+
\item[\constd{CLONE\_PTRACE}] se questo flag viene impostato ed il processo
chiamante viene tracciato (vedi sez.~\ref{sec:process_ptrace}) anche il
figlio viene tracciato.
\label{sec:process_special}
+% TODO: trattare userfaultfd, introdotta con il 4.23, vedi
+% http://man7.org/linux/man-pages/man2/userfaultfd.2.html
+
+% TODO: trattare process_vm_readv/process_vm_writev introdotte con il kernel
+% 3.2, vedi http://man7.org/linux/man-pages/man2/process_vm_readv.2.html e i
+% precedenti tentativi https://lwn.net/Articles/405346/
+
\subsection{La gestione delle operazioni in virgola mobile}
\label{sec:process_fenv}
%% process.tex
%%
-%% Copyright (C) 2000-2018 by Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 by Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% prochand.tex
%%
-%% Copyright (C) 2000-2018 by Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 by Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% ringraziamenti.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% session.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% signal.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
% usare un PID, vedi anche https://lwn.net/Articles/773459/,
% https://git.kernel.org/linus/3eb39f47934f
+% TODO c'è pure pidfd_open() (vedi https://lwn.net/Articles/789023/) per
+% ottere un pid fd pollabile aggiunta con il kernel 5.3
\subsection{Le funzioni di allarme ed i \textit{timer}}
\label{sec:sig_alarm_abort}
segnali non descritte finora, relative agli aspetti meno utilizzati e più
``\textsl{esoterici}'' della interfaccia.
+% TODO: trattare (qui?) pidfd_send_signal() introdotta con il kernel 5.1 vedi
+% https://lwn.net/Articles/784831/ e https://lwn.net/Articles/773459/
+
La prima di queste funzioni è la funzione di sistema \funcd{sigpending},
anch'essa introdotta dallo standard POSIX.1, il suo prototipo è:
%% sockadv.tex
%%
-%% Copyright (C) 2004-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2004-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% sockctrl.tex
%%
-%% Copyright (C) 2004-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2004-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Prefazione",
%% socket.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
#include <stdio.h> /* standard I/O library */
#include <string.h> /* C strings library */
#include <fcntl.h> /* file control functions */
-
+#include <sys/file.h>
/* user defined header */
#include "macros.h" /* some useful macros */
#include <fcntl.h> /* file control functions */
#include <string.h> /* C strings library */
#include <limits.h> /* system limits constants, types and functions */
+#include <sys/stat.h>
#include "macros.h"
* Mutex handling Functions
*/
/* Function MutexCreate: create a mutex. See Mutex.c */
-inline int MutexCreate(key_t ipc_key);
+int MutexCreate(key_t ipc_key);
/* Function MutexFind: get the mutex ID given fomr IPC key. See Mutex.c */
-inline int MutexFind(key_t ipc_key);
+int MutexFind(key_t ipc_key);
/* Function MutexRead: read the current value of the mutex. See Mutex.c */
-inline int MutexRead(int sem_id);
+int MutexRead(int sem_id);
/* Function MutexLock: to lock a mutex/semaphore. See Mutex.c */
-inline int MutexLock(int sem_id);
+int MutexLock(int sem_id);
/* Function MutexUnlock: to unlock a mutex/semaphore. See Mutex.c */
-inline int MutexUnlock(int sem_id);
+int MutexUnlock(int sem_id);
/* Function MutexRemove: remove the mutex/semphore. See Mutex.c */
-inline int MutexRemove(int sem_id);
+int MutexRemove(int sem_id);
/* Function CreateMutex: create a mutex (using file locking). See Mutex.c */
-inline int CreateMutex(const char *path_name);
+int CreateMutex(const char *path_name);
/* Function UnlockMutex: find a mutex (using file locking). See Mutex.c */
-inline int FindMutex(const char *path_name);
+int FindMutex(const char *path_name);
/* Function LockMutex: acquire a mutex (using file locking). See Mutex.c */
-inline int LockMutex(int fd);
+int LockMutex(int fd);
/* Function UnlockMutex: release a mutex (using file locking). See Mutex.c */
-inline int UnlockMutex(int fd);
+int UnlockMutex(int fd);
/* Function ReadMutex: read a mutex (using file locking). See Mutex.c */
-inline int ReadMutex(int fd);
+int ReadMutex(int fd);
/* Function RemoveMutex: remove a mutex (using file locking). See Mutex.c */
-inline int RemoveMutex(const char *path_name);
+int RemoveMutex(const char *path_name);
/*
* Lock files function: to create and destroy lock files
*/
/* Function LockFile: create a lock file. See FileLock.c */
-inline int LockFile(const char* path_name);
+int LockFile(const char* path_name);
/* Function UnlockFile: remove a lock file. See FileLock.c */
-inline int UnlockFile(const char* path_name);
+int UnlockFile(const char* path_name);
/*
* Signal Handling Functions
*/
all: $(FINAL) $(LIB)
dirmonitor: DirMonitor.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@ $(CFLAGJ) -lrt
readmon: ReadMonitor.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@ $(CFLAGJ) -lrt
myls: myls.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@ $(CFLAGJ) -lrt
mylschroot: mylschroot.c
$(CC) --static $^ dir_scan.o -o $@
$(CC) $^ -o $@
mqfortune: MQFortuneClient.c FortuneParse.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@ $(CFLAGJ)
mqfortuned: MQFortuneServer.c FortuneParse.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@ $(CFLAGJ) -lrt
fortune: FortuneClient.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@
fortuned: FortuneServer.c FortuneParse.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@ $(CFLAGJ) -lrt
message_setter: message_setter.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@ $(CFLAGJ) -lrt
message_getter: message_getter.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@ $(CFLAGJ) -lrt -lpthread
barcode: BarCode.c
$(CC) $^ -o $@
$(CC) $^ -o $@
getparam: getparam.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@
testfopen: test_fopen.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@
testren: TestRen.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@
forktest: fork_test.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@ $(CFLAGJ) -lrt
errcode: ErrCode.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@
uecho: UDP_echo.c
- $(CC) $(CFLAGJ) $(CFLAGS) $^ -o $@
+ $(CC) $(CFLAGS) $^ -o $@ $(CFLAGJ)
techo: TCP_echo.c
- $(CC) $(CFLAGJ) $(CFLAGS) $^ -o $@
+ $(CC) $(CFLAGS) $^ -o $@ $(CFLAGJ) -lrt
echod: TCP_echod.c
- $(CC) $(CFLAGJ) $(CFLAGS) $^ -o $@
+ $(CC) $(CFLAGS) $^ -o $@ $(CFLAGJ) -lrt
sechod: select_echod.c
- $(CC) $(CFLAGJ) $(CFLAGS) $^ -o $@
+ $(CC) $(CFLAGS) $^ -o $@ $(CFLAGJ) -lrt
pechod: poll_echod.c
- $(CC) $(CFLAGJ) $(CFLAGS) $^ -o $@
+ $(CC) $(CFLAGS) $^ -o $@ $(CFLAGJ) -lrt
daytimed: UDP_daytimed.c # TCP_cunc_daytimed.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@
iterdaytimed: TCP_iter_daytimed.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@
daytime: UDP_daytime.c # TCP_daytime.c
- $(CC) $(CFLAGJ) $(CFLAGS) $^ -o $@
+ $(CC) $(CFLAGS) $^ -o $@
ipctestid: IPCTestId.c
- $(CC) $^ -o $@
+ $(CC) $^ -o $@
writeshm: WriteShm.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@ $(CFLAGJ) -lrt
mygetaddr: mygetaddr.c
- $(CC) $(CFLAGJ) $^ -o $@
+ $(CC) $^ -o $@
endtest: endtest.c
-readshm: ReadShm.c
- $(CC) $(CFLAGJ) $^ -o $@
+#readshm: ReadShm.c
+# $(CC) $^ -o $@
wwwd: wwwd.c
- $(CC) $(CFLAGJ) $(CFLAGS) $^ -o $@
+ $(CC) $(CFLAGS) $^ -o $@ $(CFLAGJ) -lrt
acctctrl: AcctCtrl.c
$(CC) $(CFLAGS) $^ -o $@
usage();
}
for (i=0; i<=4; i++) {
- printf("Response for %s is %ld, values is %ld\n", names[i],
- sysconf(argument[i]), values[i]);
+ printf("Response for %s is %ld, values is %ld\n",sc_names[i],
+ sysconf(sc_argument[i]), values[i]);
}
return 0;
}
* routine to print usage info and exit
*/
void usage(void) {
- printf("Program testlinkat : test fopen for a file \n");
+ printf("Program testlinkat : test linkat for a file \n");
printf("Usage:\n");
- printf(" testfopen [-h] file mode \n");
+ printf(" testlinkat [-h] file mode \n");
printf(" -h print this help\n");
+ printf(" -w [N] wait N seconds\n");
+ printf(" -f [file] use file as source\n");
exit(1);
}
%% system.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% tcpsock.tex
%%
-%% Copyright (C) 2000-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2000-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% thread.tex
%%
-%% Copyright (C) 2007-2018 Simone Piccardi. Permission is granted to
+%% Copyright (C) 2007-2019 Simone Piccardi. Permission is granted to
%% copy, distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",
%% tcpprot.tex
%%
-%% Copyright (C) 2002-2018 Simone Piccardi. Permission is granted to copy,
+%% Copyright (C) 2002-2019 Simone Piccardi. Permission is granted to copy,
%% distribute and/or modify this document under the terms of the GNU Free
%% Documentation License, Version 1.1 or any later version published by the
%% Free Software Foundation; with the Invariant Sections being "Un preambolo",