diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2010-12-02 00:19:43 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2010-12-02 00:19:43 +0300 |
commit | 8502b9f40ff8fa15e12fc876079360dcc45a7666 (patch) | |
tree | dda0daadd431761651ff8872bf7bb634db7486ec /accel-pptpd | |
parent | dce11f592d17084aa5ba0bd9e33d308291c02921 (diff) | |
download | accel-ppp-8502b9f40ff8fa15e12fc876079360dcc45a7666.tar.gz accel-ppp-8502b9f40ff8fa15e12fc876079360dcc45a7666.zip |
ppp: updated session generation procesdure for 32-bit systems
Diffstat (limited to 'accel-pptpd')
-rw-r--r-- | accel-pptpd/ppp/ppp.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/accel-pptpd/ppp/ppp.c b/accel-pptpd/ppp/ppp.c index a9c6eea2..95e1a869 100644 --- a/accel-pptpd/ppp/ppp.c +++ b/accel-pptpd/ppp/ppp.c @@ -31,6 +31,10 @@ static LIST_HEAD(layers); int __export sock_fd; static unsigned long long seq; +#if __WORDSIZE == 32 +static spinlock_t seq_lock; +#endif + struct ppp_stat_t ppp_stat; @@ -69,7 +73,13 @@ static void generate_sessionid(struct ppp_t *ppp) { unsigned long long sid; +#if __WORDSIZE == 32 + spin_lock(&seq_lock); + sid = ++seq; + spin_unlock(&seq_lock); +#else sid = __sync_add_and_fetch(&seq, 1); +#endif sprintf(ppp->sessionid, "%016llx", sid); } |