1cb5caa98Sdjl /* 2cb5caa98Sdjl * CDDL HEADER START 3cb5caa98Sdjl * 4cb5caa98Sdjl * The contents of this file are subject to the terms of the 5cb5caa98Sdjl * Common Development and Distribution License (the "License"). 6cb5caa98Sdjl * You may not use this file except in compliance with the License. 7cb5caa98Sdjl * 8cb5caa98Sdjl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9cb5caa98Sdjl * or http://www.opensolaris.org/os/licensing. 10cb5caa98Sdjl * See the License for the specific language governing permissions 11cb5caa98Sdjl * and limitations under the License. 12cb5caa98Sdjl * 13cb5caa98Sdjl * When distributing Covered Code, include this CDDL HEADER in each 14cb5caa98Sdjl * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15cb5caa98Sdjl * If applicable, add the following below this CDDL HEADER, with the 16cb5caa98Sdjl * fields enclosed by brackets "[]" replaced with your own identifying 17cb5caa98Sdjl * information: Portions Copyright [yyyy] [name of copyright owner] 18cb5caa98Sdjl * 19cb5caa98Sdjl * CDDL HEADER END 20cb5caa98Sdjl */ 21cb5caa98Sdjl /* 22cb5caa98Sdjl * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23cb5caa98Sdjl * Use is subject to license terms. 24cb5caa98Sdjl */ 25cb5caa98Sdjl 26cb5caa98Sdjl #pragma ident "%Z%%M% %I% %E% SMI" 27cb5caa98Sdjl 28cb5caa98Sdjl #include "nscd_db.h" 29cb5caa98Sdjl 30cb5caa98Sdjl static nscd_seq_num_t acc_seq = 1; 31cb5caa98Sdjl static mutex_t seq_mutex = DEFAULTMUTEX; 32*e37190e5Smichen static nscd_cookie_num_t cookie_num = 1234; 33cb5caa98Sdjl static mutex_t cookie_mutex = DEFAULTMUTEX; 34cb5caa98Sdjl 35cb5caa98Sdjl nscd_seq_num_t _nscd_get_seq_num()36cb5caa98Sdjl_nscd_get_seq_num() 37cb5caa98Sdjl { 38cb5caa98Sdjl nscd_seq_num_t seq_num; 39cb5caa98Sdjl 40cb5caa98Sdjl (void) mutex_lock(&seq_mutex); 41cb5caa98Sdjl seq_num = acc_seq; 42*e37190e5Smichen acc_seq++; 43cb5caa98Sdjl (void) mutex_unlock(&seq_mutex); 44cb5caa98Sdjl 45cb5caa98Sdjl return (seq_num); 46cb5caa98Sdjl } 47cb5caa98Sdjl 48*e37190e5Smichen nscd_cookie_num_t _nscd_get_cookie_num()49*e37190e5Smichen_nscd_get_cookie_num() 50cb5caa98Sdjl { 51*e37190e5Smichen nscd_cookie_num_t ret; 52cb5caa98Sdjl 53cb5caa98Sdjl (void) mutex_lock(&cookie_mutex); 54*e37190e5Smichen ret = cookie_num; 55*e37190e5Smichen cookie_num++; 56cb5caa98Sdjl (void) mutex_unlock(&cookie_mutex); 57cb5caa98Sdjl 58cb5caa98Sdjl return (ret); 59cb5caa98Sdjl } 60