Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
shmticklib.c
Package: sendmail.8.10.0.Beta10.tar.Z [view]
Upload User: xu_441
Upload Date: 2007-01-04
Package Size: 1640k
Code Size: 2k
Category:
Email Client
Development Platform:
Unix_Linux
- /*
- * Copyright (c) 1999 Sendmail, Inc. and its suppliers.
- * All rights reserved.
- *
- * By using this file, you agree to the terms and conditions set
- * forth in the LICENSE file which can be found at the top level of
- * the sendmail distribution.
- *
- * Contributed by Exactis.com, Inc.
- *
- */
- #ifndef lint
- static char id[] = "@(#)$Id: shmticklib.c,v 8.4 1999/11/23 07:22:28 gshapiro Exp $";
- #endif /* ! lint */
- #if _FFR_SHM_STATUS
- # include <stdio.h>
- # include <sys/types.h>
- # include <sys/ipc.h>
- # include <sys/shm.h>
- # include "statusd_shm.h"
- /*
- ** SHMTICK -- increment a shared memory variable
- **
- ** Parameters:
- ** inc_me -- identity of shared memory segment
- ** what -- which variable to increment
- **
- ** Returns:
- ** none
- */
- void
- shmtick(inc_me, what)
- int inc_me;
- int what;
- {
- static int shmid = -1;
- static STATUSD_SHM *sp = (STATUSD_SHM *)-1;
- static unsigned int cookie = 0;
- if (shmid < 0)
- {
- int size = sizeof(STATUSD_SHM);
- shmid = shmget(STATUSD_SHM_KEY, size, 0);
- if (shmid < 0)
- return;
- }
- if ((unsigned long *)sp == (unsigned long *)-1)
- {
- sp = (STATUSD_SHM *)shmat(shmid, NULL, 0);
- if ((unsigned long *)sp == (unsigned long *)-1)
- return;
- }
- if (sp->magic != STATUSD_MAGIC)
- {
- /*
- ** possible race condition, wait for
- ** statusd to initialize.
- */
- return;
- }
- if (what >= STATUSD_LONGS)
- what = STATUSD_LONGS - 1;
- if (inc_me >= STATUSD_LONGS)
- inc_me = STATUSD_LONGS - 1;
- if (sp->ul[STATUSD_COOKIE] != cookie)
- {
- cookie = sp->ul[STATUSD_COOKIE];
- ++(sp->ul[inc_me]);
- }
- ++(sp->ul[what]);
- }
- #endif /* _FFR_SHM_STATUS */