Added log utility and improved server
This commit is contained in:
@ -11,7 +11,7 @@ typedef struct struct_waiting {
|
||||
long fd; // client in attesa
|
||||
char *file; // file su cui si vuole acquisire la lock
|
||||
struct struct_waiting *next; // puntatore al prossimo elemento della lista
|
||||
} waitingT;
|
||||
} waiting_t;
|
||||
|
||||
/**
|
||||
* Apri o crea un nuovo file
|
||||
@ -36,25 +36,25 @@ void writeFile(char *filepath, size_t size, queueT *q, long fd_c, logT *logFileT
|
||||
void lockFile(char *filepath, queueT *q, long fd_c, logT *logFileT, pthread_mutex_t *lock, waitingT **waiting);
|
||||
|
||||
// Rilascia una Lock di un file
|
||||
void unlockFile(char *filepath, queueT *q, long fd_c, logT *logFileT, pthread_mutex_t *lock, waitingT **waiting);
|
||||
void unlockFile(char *filepath, queueT *q, long fd_c, logT *logFileT, pthread_mutex_t *lock, waiting_t **waiting);
|
||||
|
||||
// Chiudi un file
|
||||
void closeFile(char *filepath, queueT *q, long fd_c, logT *logFileT, pthread_mutex_t *lock, waitingT **waiting);
|
||||
void closeFile(char *filepath, queueT *q, long fd_c, logT *logFileT, pthread_mutex_t *lock, waiting_t **waiting);
|
||||
|
||||
// Rimuovi un file
|
||||
void removeFile(char *filepath, queueT *q, long fd_c, logT *logFileT, pthread_mutex_t *lock, waitingT **waiting);
|
||||
void removeFile(char *filepath, queueT *q, long fd_c, logT *logFileT, pthread_mutex_t *lock, waiting_t **waiting);
|
||||
|
||||
|
||||
// Funzione ausiliaria che invia un file al client
|
||||
int sendFile(fileT *f, long fd_c, logT *logFileT);
|
||||
|
||||
// Aggiunge una coppia client/file alla coda in attesa di ottenere una lock
|
||||
int addWaiting(waitingT **waiting, char *file, int fd);
|
||||
int addWaiting(waiting_t **waiting, char *file, int fd);
|
||||
|
||||
// Ottiene il primo client in attesa su una lock di un determinato file
|
||||
int removeFirstWaiting(waitingT **waiting, char *file);
|
||||
int removeFirstWaiting(waiting_t **waiting, char *file);
|
||||
|
||||
// Distrugge la lista d'attesa e ne libera la memoria
|
||||
void clearWaiting(waitingT **waiting);
|
||||
void clearWaiting(waiting_t **waiting);
|
||||
|
||||
#endif // _API_FILE
|
||||
|
||||
Reference in New Issue
Block a user