From: Frank Lahm Date: Mon, 7 Feb 2011 11:36:52 +0000 (+0100) Subject: Start locking using Berkeley db X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=commitdiff_plain;h=d82952695132e6dc2de60655de1dccb805e2f26b Start locking using Berkeley db --- diff --git a/configure.in b/configure.in index bd9febb1..81b02430 100644 --- a/configure.in +++ b/configure.in @@ -1333,6 +1333,7 @@ AC_OUTPUT([Makefile libatalk/cnid/tdb/Makefile libatalk/compat/Makefile libatalk/dsi/Makefile + libatalk/locking/Makefile libatalk/nbp/Makefile libatalk/netddp/Makefile libatalk/rpc/Makefile diff --git a/etc/afpd/afp_dsi.c b/etc/afpd/afp_dsi.c index 963a2912..37a817a8 100644 --- a/etc/afpd/afp_dsi.c +++ b/etc/afpd/afp_dsi.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "globals.h" #include "switch.h" diff --git a/etc/afpd/file.c b/etc/afpd/file.c index 70657706..266b5c75 100644 --- a/etc/afpd/file.c +++ b/etc/afpd/file.c @@ -1253,8 +1253,8 @@ int afp_copyfile(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, si if (ad_open(adp, s_path->u_name, ADFLAGS_DF | ADFLAGS_HF | ADFLAGS_NOHF, O_RDONLY, O_RDONLY) < 0) { return AFPERR_DENYCONF; } - denyreadset = (getforkmode(adp, ADEID_DFORK, AD_FILELOCK_DENY_RD) != 0 || - getforkmode(adp, ADEID_RFORK, AD_FILELOCK_DENY_RD) != 0 ); + denyreadset = (ad_testlock(adp, ADEID_DFORK, AD_FILELOCK_DENY_RD) != 0 || + ad_testlock(adp, ADEID_RFORK, AD_FILELOCK_DENY_RD) != 0 ); if (denyreadset) { retvalue = AFPERR_DENYCONF; diff --git a/etc/afpd/fork.c b/etc/afpd/fork.c index 889b7ac2..eb18fd33 100644 --- a/etc/afpd/fork.c +++ b/etc/afpd/fork.c @@ -96,7 +96,6 @@ static int getforkparams(struct ofork *ofork, u_int16_t bitmap, char *buf, size_ return getmetadata(vol, bitmap, &path, dir, buf, buflen, adp ); } -/* ---------------------------- */ static off_t get_off_t(char **ibuf, int is64) { u_int32_t temp; @@ -118,7 +117,6 @@ static off_t get_off_t(char **ibuf, int is64) return ret; } -/* ---------------------- */ static int set_off_t(off_t offset, char *rbuf, int is64) { u_int32_t temp; @@ -139,8 +137,6 @@ static int set_off_t(off_t offset, char *rbuf, int is64) return ret; } -/* ------------------------ - */ static int is_neg(int is64, off_t val) { if (val < 0 || (sizeof(off_t) == 8 && !is64 && (val & 0x80000000U))) @@ -155,22 +151,6 @@ static int sum_neg(int is64, off_t offset, off_t reqcount) return 0; } -/* ------------------------- - */ -static int setforkmode(struct adouble *adp, int eid, int ofrefnum, int what) -{ - return ad_lock(adp, eid, ADLOCK_RD | ADLOCK_FILELOCK, what, 1, ofrefnum); -} - -/* ------------------------- - */ -int getforkmode(struct adouble *adp, int eid, int what) -{ - return ad_testlock(adp, eid, what); -} - -/* ------------------------- - */ static int fork_setmode(struct adouble *adp, int eid, int access, int ofrefnum) { int ret; @@ -180,13 +160,13 @@ static int fork_setmode(struct adouble *adp, int eid, int access, int ofrefnum) int denywriteset; if (! (access & (OPENACC_WR | OPENACC_RD | OPENACC_DWR | OPENACC_DRD))) { - return setforkmode(adp, eid, ofrefnum, AD_FILELOCK_OPEN_NONE); + return ad_lock(adp, eid, ADLOCK_RD | ADLOCK_FILELOCK, AD_FILELOCK_OPEN_NONE, 1, ofrefnum); } if ((access & (OPENACC_RD | OPENACC_DRD))) { - if ((readset = getforkmode(adp, eid, AD_FILELOCK_OPEN_RD)) <0) + if ((readset = ad_testlock(adp, eid, AD_FILELOCK_OPEN_RD)) <0) return readset; - if ((denyreadset = getforkmode(adp, eid, AD_FILELOCK_DENY_RD)) <0) + if ((denyreadset = ad_testlock(adp, eid, AD_FILELOCK_DENY_RD)) <0) return denyreadset; if ((access & OPENACC_RD) && denyreadset) { @@ -201,21 +181,21 @@ static int fork_setmode(struct adouble *adp, int eid, int access, int ofrefnum) * true */ if ((access & OPENACC_RD)) { - ret = setforkmode(adp, eid, ofrefnum, AD_FILELOCK_OPEN_RD); + ret = ad_lock(adp, eid, ADLOCK_RD | ADLOCK_FILELOCK, AD_FILELOCK_OPEN_RD, 1, ofrefnum); if (ret) return ret; } if ((access & OPENACC_DRD)) { - ret = setforkmode(adp, eid, ofrefnum, AD_FILELOCK_DENY_RD); + ret = ad_lock(adp, eid, ADLOCK_RD | ADLOCK_FILELOCK, AD_FILELOCK_DENY_RD, 1, ofrefnum); if (ret) return ret; } } /* ------------same for writing -------------- */ if ((access & (OPENACC_WR | OPENACC_DWR))) { - if ((writeset = getforkmode(adp, eid, AD_FILELOCK_OPEN_WR)) <0) + if ((writeset = ad_testlock(adp, eid, AD_FILELOCK_OPEN_WR)) <0) return writeset; - if ((denywriteset = getforkmode(adp, eid, AD_FILELOCK_DENY_WR)) <0) + if ((denywriteset = ad_testlock(adp, eid, AD_FILELOCK_DENY_WR)) <0) return denywriteset; if ((access & OPENACC_WR) && denywriteset) { @@ -227,12 +207,12 @@ static int fork_setmode(struct adouble *adp, int eid, int access, int ofrefnum) return -1; } if ((access & OPENACC_WR)) { - ret = setforkmode(adp, eid, ofrefnum, AD_FILELOCK_OPEN_WR); + ret = ad_lock(adp, eid, ADLOCK_RD | ADLOCK_FILELOCK, AD_FILELOCK_OPEN_WR, 1, ofrefnum); if (ret) return ret; } if ((access & OPENACC_DWR)) { - ret = setforkmode(adp, eid, ofrefnum, AD_FILELOCK_DENY_WR); + ret = ad_lock(adp, eid, ADLOCK_RD | ADLOCK_FILELOCK, AD_FILELOCK_DENY_WR, 1, ofrefnum); if (ret) return ret; } diff --git a/etc/afpd/fork.h b/etc/afpd/fork.h index 151ffcf5..837cb98f 100644 --- a/etc/afpd/fork.h +++ b/etc/afpd/fork.h @@ -79,7 +79,6 @@ extern int of_fstatat(int dirfd, struct path *path); /* in fork.c */ extern int flushfork (struct ofork *); -extern int getforkmode (struct adouble *, int , int ); /* FP functions */ int afp_openfork (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); diff --git a/etc/afpd/main.c b/etc/afpd/main.c index 8c30392b..ff1f2a54 100644 --- a/etc/afpd/main.c +++ b/etc/afpd/main.c @@ -273,8 +273,12 @@ int main(int ac, char **av) /* Initialize */ cnid_init(); + if (locktable_init() != 0) + afp_exit(EXITERR_SYS); +#if 0 if (rpc_init("127.0.0.1", 4701) != 0) afp_exit(EXITERR_SYS); +#endif /* watch atp, dsi sockets and ipc parent/child file descriptor. */ if ((ipc = server_ipc_create())) { diff --git a/include/atalk/adouble.h b/include/atalk/adouble.h index eac8be14..b936b5dd 100644 --- a/include/atalk/adouble.h +++ b/include/atalk/adouble.h @@ -355,28 +355,13 @@ extern int ad_flush (struct adouble *); extern int ad_close (struct adouble *, int); /* ad_lock.c */ -extern int ad_fcntl_lock (struct adouble *, const u_int32_t /*eid*/, - const int /*type*/, const off_t /*offset*/, - const off_t /*len*/, const int /*user*/); -extern void ad_fcntl_unlock (struct adouble *, const int /*user*/); -extern int ad_fcntl_tmplock (struct adouble *, const u_int32_t /*eid*/, - const int /*type*/, const off_t /*offset*/, - const off_t /*len*/, const int /*user*/); -extern int ad_testlock (struct adouble * /*adp*/, int /*eid*/, off_t /*off*/); - -extern u_int16_t ad_openforks (struct adouble * /*adp*/, u_int16_t); -extern int ad_excl_lock (struct adouble * /*adp*/, const u_int32_t /*eid*/); - -#if 0 -#define ad_lock ad_fcntl_lock -#define ad_tmplock ad_fcntl_tmplock -#define ad_unlock ad_fcntl_unlock -#endif - -#define ad_lock rpc_lock -#define ad_tmplock rpc_tmplock -#define ad_unlock rpc_unlock +extern int ad_testlock (struct adouble *adp, int eid, off_t off); +extern uint16_t ad_openforks(struct adouble *adp, uint16_t); +extern int ad_excl_lock (struct adouble *adp, uint32_t eid); +extern int ad_lock(struct adouble *, uint32_t eid, int type, off_t off, off_t len, int user); +extern void ad_unlock(struct adouble *, int user); +extern int ad_tmplock(struct adouble *, uint32_t eid, int type, off_t off, off_t len, int user); /* ad_open.c */ extern const char *oflags2logstr(int oflags); diff --git a/include/atalk/locking.h b/include/atalk/locking.h index e1c1303a..5c427c40 100644 --- a/include/atalk/locking.h +++ b/include/atalk/locking.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Frank Lahm + * Copyright (c) 2011 Frank Lahm * All Rights Reserved. See COPYRIGHT. */ @@ -13,18 +13,6 @@ #include #include -#include - -#include "event2/event.h" -#include "event2/http.h" -#include "event2/rpc.h" - -struct adouble; - -extern int rpc_init(const char *addr, unsigned short port); -extern int rpc_lock(struct adouble *, uint32_t eid, int type, off_t off, off_t len, int user); -extern void rpc_unlock(struct adouble *, int user); -extern int rpc_tmplock(struct adouble *, uint32_t eid, int type, off_t off, off_t len, int user); - +extern int locktable_init(void); #endif /* ATALK_LOCKING_H */ diff --git a/include/atalk/rpc.h b/include/atalk/rpc.h new file mode 100644 index 00000000..00a385db --- /dev/null +++ b/include/atalk/rpc.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2011 Frank Lahm + * All Rights Reserved. See COPYRIGHT. + */ + +#ifndef ATALK_RPC_H +#define ATALK_RPC_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include + +#include "event2/event.h" +#include "event2/http.h" +#include "event2/rpc.h" + +struct adouble; +extern int rpc_init(const char *addr, unsigned short port); +extern int rpc_lock(struct adouble *, uint32_t eid, int type, off_t off, off_t len, int user); +extern void rpc_unlock(struct adouble *, int user); +extern int rpc_tmplock(struct adouble *, uint32_t eid, int type, off_t off, off_t len, int user); + +#endif /* ATALK_RPC_H */ diff --git a/libatalk/Makefile.am b/libatalk/Makefile.am index 5e95bfcb..10dd59a0 100644 --- a/libatalk/Makefile.am +++ b/libatalk/Makefile.am @@ -2,7 +2,7 @@ # Makefile.am for libatalk/ # rpc should be first because it generates RPC headers included elsewhere -SUBDIRS = rpc acl adouble bstring compat cnid dsi tdb util unicode vfs +SUBDIRS = rpc acl adouble bstring compat cnid dsi locking tdb util unicode vfs lib_LTLIBRARIES = libatalk.la @@ -14,6 +14,7 @@ libatalk_la_LIBADD = \ bstring/libbstring.la \ compat/libcompat.la \ dsi/libdsi.la \ + locking/liblocking.la \ rpc/librpc.la \ tdb/libtdb.la \ unicode/libunicode.la \ @@ -27,6 +28,7 @@ libatalk_la_DEPENDENCIES = \ bstring/libbstring.la \ compat/libcompat.la \ dsi/libdsi.la \ + locking/liblocking.la \ rpc/librpc.la \ tdb/libtdb.la \ unicode/libunicode.la \ diff --git a/libatalk/adouble/ad_lock.c b/libatalk/adouble/ad_lock.c index 28b53b12..40ffd140 100644 --- a/libatalk/adouble/ad_lock.c +++ b/libatalk/adouble/ad_lock.c @@ -269,8 +269,8 @@ int start = off; } /* ------------------ */ -int ad_fcntl_lock(struct adouble *ad, const u_int32_t eid, const int locktype, - const off_t off, const off_t len, const int fork) +static int ad_fcntl_lock(struct adouble *ad, const u_int32_t eid, const int locktype, + const off_t off, const off_t len, const int fork) { #if 0 struct flock lock; @@ -457,6 +457,94 @@ static int testlock(struct ad_fd *adf, off_t off, off_t len) return 0; } + +/* ------------------------- +*/ +static int ad_fcntl_tmplock(struct adouble *ad, const u_int32_t eid, const int locktype, + const off_t off, const off_t len, const int fork) +{ + struct flock lock; + struct ad_fd *adf; + int err; + int type; + + lock.l_start = off; + type = locktype; + if (eid == ADEID_DFORK) { + adf = &ad->ad_data_fork; + } else { + /* FIXME META */ + adf = &ad->ad_resource_fork; + if (adf->adf_fd == -1) { + /* there's no resource fork. return success */ + return 0; + } + /* if ADLOCK_FILELOCK we want a lock from offset 0 + * it's used when deleting a file: + * in open we put read locks on meta datas + * in delete a write locks on the whole file + * so if the file is open by somebody else it fails + */ + if (!(type & ADLOCK_FILELOCK)) + lock.l_start += ad_getentryoff(ad, eid); + } + + if (!(adf->adf_flags & O_RDWR) && (type & ADLOCK_WR)) { + type = (type & ~ADLOCK_WR) | ADLOCK_RD; + } + + lock.l_type = XLATE_FCNTL_LOCK(type & ADLOCK_MASK); + lock.l_whence = SEEK_SET; + lock.l_len = len; + + /* see if it's locked by another fork. */ + if (fork && adf_findxlock(adf, fork, ADLOCK_WR | + ((type & ADLOCK_WR) ? ADLOCK_RD : 0), + lock.l_start, lock.l_len) > -1) { + errno = EACCES; + return -1; + } + + /* okay, we might have ranges byte-locked. we need to make sure that + * we restore the appropriate ranges once we're done. so, we check + * for overlap on an unlock and relock. + * XXX: in the future, all the byte locks will be sorted and contiguous. + * we just want to upgrade all the locks and then downgrade them + * here. */ + if (!adf->adf_excl) { + err = set_lock(adf->adf_fd, F_SETLK, &lock); + } + else { + err = 0; + } + if (!err && (lock.l_type == F_UNLCK)) + adf_relockrange(adf, adf->adf_fd, lock.l_start, len); + + return err; +} + +/* --------------------- */ +static void ad_fcntl_unlock(struct adouble *ad, const int fork) +{ + if (ad_data_fileno(ad) != -1) { + adf_unlock(&ad->ad_data_fork, fork); + } + if (ad_reso_fileno(ad) != -1) { + adf_unlock(&ad->ad_resource_fork, fork); + } + + if (ad->ad_flags != AD_VERSION_EA) { + return; + } + if (ad_meta_fileno(ad) != -1) { + adf_unlock(&ad->ad_metadata_fork, fork); + } +} + +/****************************************************************************** + * Public functions + ******************************************************************************/ + /* --------------- */ int ad_testlock(struct adouble *ad, int eid, const off_t off) { @@ -491,7 +579,7 @@ int ad_testlock(struct adouble *ad, int eid, const off_t off) - there's no locks held by another process (clients) - or we already know the answer and don't need to test. */ -u_int16_t ad_openforks(struct adouble *ad, u_int16_t attrbits) +uint16_t ad_openforks(struct adouble *ad, u_int16_t attrbits) { return 0; #if 0 @@ -549,74 +637,6 @@ u_int16_t ad_openforks(struct adouble *ad, u_int16_t attrbits) #endif } -/* ------------------------- -*/ -int ad_fcntl_tmplock(struct adouble *ad, const u_int32_t eid, const int locktype, - const off_t off, const off_t len, const int fork) -{ - return 0; -#if 0 - struct flock lock; - struct ad_fd *adf; - int err; - int type; - - lock.l_start = off; - type = locktype; - if (eid == ADEID_DFORK) { - adf = &ad->ad_data_fork; - } else { - /* FIXME META */ - adf = &ad->ad_resource_fork; - if (adf->adf_fd == -1) { - /* there's no resource fork. return success */ - return 0; - } - /* if ADLOCK_FILELOCK we want a lock from offset 0 - * it's used when deleting a file: - * in open we put read locks on meta datas - * in delete a write locks on the whole file - * so if the file is open by somebody else it fails - */ - if (!(type & ADLOCK_FILELOCK)) - lock.l_start += ad_getentryoff(ad, eid); - } - - if (!(adf->adf_flags & O_RDWR) && (type & ADLOCK_WR)) { - type = (type & ~ADLOCK_WR) | ADLOCK_RD; - } - - lock.l_type = XLATE_FCNTL_LOCK(type & ADLOCK_MASK); - lock.l_whence = SEEK_SET; - lock.l_len = len; - - /* see if it's locked by another fork. */ - if (fork && adf_findxlock(adf, fork, ADLOCK_WR | - ((type & ADLOCK_WR) ? ADLOCK_RD : 0), - lock.l_start, lock.l_len) > -1) { - errno = EACCES; - return -1; - } - - /* okay, we might have ranges byte-locked. we need to make sure that - * we restore the appropriate ranges once we're done. so, we check - * for overlap on an unlock and relock. - * XXX: in the future, all the byte locks will be sorted and contiguous. - * we just want to upgrade all the locks and then downgrade them - * here. */ - if (!adf->adf_excl) { - err = set_lock(adf->adf_fd, F_SETLK, &lock); - } - else { - err = 0; - } - if (!err && (lock.l_type == F_UNLCK)) - adf_relockrange(adf, adf->adf_fd, lock.l_start, len); - - return err; -#endif -} - /* ------------------------- the fork is opened in Read Write, Deny Read, Deny Write mode lock the whole file once @@ -648,23 +668,17 @@ int ad_excl_lock(struct adouble *ad, const u_int32_t eid) #endif } -/* --------------------- */ -void ad_fcntl_unlock(struct adouble *ad, const int fork) +int ad_lock(struct adouble *ad, uint32_t eid, int type, off_t off, off_t len, int user) { - return; -#if 0 - if (ad_data_fileno(ad) != -1) { - adf_unlock(&ad->ad_data_fork, fork); - } - if (ad_reso_fileno(ad) != -1) { - adf_unlock(&ad->ad_resource_fork, fork); - } + return 0; +} - if (ad->ad_flags != AD_VERSION_EA) { +void ad_unlock(struct adouble *ad, int user) +{ return; - } - if (ad_meta_fileno(ad) != -1) { - adf_unlock(&ad->ad_metadata_fork, fork); - } -#endif +} + +int ad_tmplock(struct adouble *ad, uint32_t eid, int type, off_t off, off_t len, int user) +{ + return 0; } diff --git a/libatalk/adouble/ad_open.c b/libatalk/adouble/ad_open.c index 00b0ad24..8c472320 100644 --- a/libatalk/adouble/ad_open.c +++ b/libatalk/adouble/ad_open.c @@ -49,6 +49,7 @@ #include #include #include +#include #include "ad_lock.h" diff --git a/libatalk/locking/.gitignore b/libatalk/locking/.gitignore new file mode 100644 index 00000000..604ff3c0 --- /dev/null +++ b/libatalk/locking/.gitignore @@ -0,0 +1,7 @@ +Makefile +Makefile.in +*.lo +*.la +.deps +.libs + diff --git a/libatalk/locking/Makefile.am b/libatalk/locking/Makefile.am new file mode 100644 index 00000000..8d2fda63 --- /dev/null +++ b/libatalk/locking/Makefile.am @@ -0,0 +1,5 @@ +# Makefile.am for libatalk/locking/ + +noinst_LTLIBRARIES = liblocking.la + +liblocking_la_SOURCES = locking.c diff --git a/libatalk/locking/locking.c b/libatalk/locking/locking.c new file mode 100644 index 00000000..c19f27cd --- /dev/null +++ b/libatalk/locking/locking.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2011 Frank Lahm + * All Rights Reserved. See COPYRIGHT. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#define AFP_LOCKTABLE_SIZE (8*1024*1024) + +/* + * Struct for building the the main database of file locks. + * vid + cnid build the primary key for database access. + */ +struct afp_lock { + /* Keys */ + uint32_t vid; + cnid_t cnid; + + /* Refcounting access and deny modes */ + uint16_t amode_r; + uint16_t amode_w; + uint16_t dmode_r; + uint16_t dmode_w; +}; + +/* + * Structure for building a table which provides the way to find locks by pid + */ +struct pid_lock { + /* Key */ + pid_t pid; + + /* Key for afp_lock */ + uint32_t vid; + cnid_t cnid; +}; + +/*************************************************************************** + * Public functios + ***************************************************************************/ + +int locktable_init(void) +{ + EC_INIT; + + +EC_CLEANUP: + EC_EXIT; +} + diff --git a/libatalk/rpc/locking.c b/libatalk/rpc/locking.c index ce43520a..62a1b227 100644 --- a/libatalk/rpc/locking.c +++ b/libatalk/rpc/locking.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Frank Lahm + * Copyright (c) 2011 Frank Lahm * All Rights Reserved. See COPYRIGHT. */ @@ -12,6 +12,11 @@ #include #include #include +#include + +#include +#include +#include #include "event2/event-config.h" @@ -28,6 +33,7 @@ #include #include #include +#include EVRPC_HEADER(lock_msg, lock_req, lock_rep) EVRPC_GENERATE(lock_msg, lock_req, lock_rep) @@ -52,7 +58,7 @@ done: event_base_loopexit(ev_base, NULL); } -static void rpc_dummy(const char *name) +static int rpc_dummy(const char *name) { struct lock *lock = NULL; struct lock_req *lock_req = NULL; @@ -94,6 +100,7 @@ int rpc_tmplock(struct adouble *ad, uint32_t eid, int type, off_t off, off_t len int rpc_init(const char *addr, unsigned short port) { EC_INIT; + struct evhttp_connection *evcon; EC_NULL_LOG(ev_base = event_init()); diff --git a/libatalk/util/Makefile.am b/libatalk/util/Makefile.am index 0afd6fc8..9b5938f8 100644 --- a/libatalk/util/Makefile.am +++ b/libatalk/util/Makefile.am @@ -1,5 +1,7 @@ # Makefile.am for libatalk/util/ +pkgconfdir = @PKGCONFDIR@ + noinst_LTLIBRARIES = libutil.la libutil_la_SOURCES = \ @@ -17,5 +19,7 @@ libutil_la_SOURCES = \ server_lock.c \ socket.c \ strdicasecmp.c \ - volinfo.c \ + volinfo.c \ unix.c + +libutil_la_CFLAGS = -D_PATH_AFPDCONF=\"$(pkgconfdir)/afpd.conf\" \ No newline at end of file diff --git a/libatalk/util/server_ipc.c b/libatalk/util/server_ipc.c index 289197fb..45230a29 100644 --- a/libatalk/util/server_ipc.c +++ b/libatalk/util/server_ipc.c @@ -1,10 +1,5 @@ /* - * $Id: server_ipc.c,v 1.4 2010-01-21 14:14:49 didg Exp $ - * * All rights reserved. See COPYRIGHT. - * - * - * ipc between parent and children. */ #ifdef HAVE_CONFIG_H @@ -12,12 +7,13 @@ #endif #include -#ifdef HAVE_UNISTD_H #include -#endif #include #include #include +#include +#include +#include #include #include @@ -207,4 +203,3 @@ int server_ipc_write( u_int16_t command, int len, void *msg) LOG (log_debug, logtype_afpd, "ipc_write: command: %u, pid: %u, msglen: %u", command, pid, len); return write(pipe_fd[1], block, len+IPC_HEADERLEN ); } - diff --git a/libatalk/util/volinfo.c b/libatalk/util/volinfo.c index ef7847a3..9096412d 100644 --- a/libatalk/util/volinfo.c +++ b/libatalk/util/volinfo.c @@ -35,6 +35,7 @@ #include #include #include +#include #ifdef CNID_DB #include #endif /* CNID_DB*/