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 #include "nscd_db.h" 27cb5caa98Sdjl 28*e37190e5Smichen static nscd_seq_num_t acc_seq = 1; 29*e37190e5Smichen static mutex_t seq_mutex = DEFAULTMUTEX; 30*e37190e5Smichen static nscd_cookie_num_t cookie_num = 1234; 31*e37190e5Smichen static mutex_t cookie_mutex = DEFAULTMUTEX; 32cb5caa98Sdjl 33cb5caa98Sdjl nscd_seq_num_t _nscd_get_seq_num()34cb5caa98Sdjl_nscd_get_seq_num() 35cb5caa98Sdjl { 36cb5caa98Sdjl nscd_seq_num_t seq_num; 37cb5caa98Sdjl 38cb5caa98Sdjl (void) mutex_lock(&seq_mutex); 39cb5caa98Sdjl seq_num = acc_seq; 40*e37190e5Smichen acc_seq++; 41cb5caa98Sdjl (void) mutex_unlock(&seq_mutex); 42cb5caa98Sdjl 43cb5caa98Sdjl return (seq_num); 44cb5caa98Sdjl } 45cb5caa98Sdjl 46*e37190e5Smichen nscd_cookie_num_t _nscd_get_cookie_num()47*e37190e5Smichen_nscd_get_cookie_num() 48cb5caa98Sdjl { 49*e37190e5Smichen nscd_cookie_num_t ret; 50cb5caa98Sdjl 51cb5caa98Sdjl (void) mutex_lock(&cookie_mutex); 52*e37190e5Smichen ret = cookie_num; 53*e37190e5Smichen cookie_num++; 54cb5caa98Sdjl (void) mutex_unlock(&cookie_mutex); 55cb5caa98Sdjl 56cb5caa98Sdjl return (ret); 57cb5caa98Sdjl } 58