summaryrefslogtreecommitdiff
path: root/source3/libsmb/smb_share_modes.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-10-28 20:36:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:14 -0500
commita04dd5f4ad14b58664060411dcaeef8a935d3bd8 (patch)
tree585e32bb15842a6046a38bcdb59ac4454b652a50 /source3/libsmb/smb_share_modes.c
parente47e12131794ed387297c733f8cccf340780fa56 (diff)
downloadsamba-a04dd5f4ad14b58664060411dcaeef8a935d3bd8.tar.gz
samba-a04dd5f4ad14b58664060411dcaeef8a935d3bd8.tar.bz2
samba-a04dd5f4ad14b58664060411dcaeef8a935d3bd8.zip
r11379: Remove external dependencies from sharemodes library.
Jeremy. (This used to be commit 7fb05872612c9e1816ac24d25a020073e3b41950)
Diffstat (limited to 'source3/libsmb/smb_share_modes.c')
-rw-r--r--source3/libsmb/smb_share_modes.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c
index 7659d1cd6e..40ccf15f94 100644
--- a/source3/libsmb/smb_share_modes.c
+++ b/source3/libsmb/smb_share_modes.c
@@ -3,6 +3,12 @@
Used by non-Samba products needing access to the Samba share mode db.
Copyright (C) Jeremy Allison 2005.
+
+ sharemodes_procid functions (C) Copyright (C) Volker Lendecke 2005
+
+ ** NOTE! The following LGPL license applies to this module only.
+ ** This does NOT imply that all of Samba is released
+ ** under the LGPL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -27,6 +33,16 @@
#undef malloc
#endif
+static BOOL sharemodes_procid_equal(const struct process_id *p1, const struct process_id *p2)
+{
+ return (p1->pid == p2->pid);
+}
+
+static pid_t sharemodes_procid_to_pid(const struct process_id *proc)
+{
+ return proc->pid;
+}
+
/*
* open/close sharemode database.
*/
@@ -122,7 +138,7 @@ struct locking_data {
static int share_mode_entry_equal(const struct smb_share_mode_entry *e_entry, const struct share_mode_entry *entry)
{
- return (procid_equal(&e_entry->pid, &entry->pid) &&
+ return (sharemodes_procid_equal(&e_entry->pid, &entry->pid) &&
e_entry->file_id == (uint32_t)entry->share_file_id &&
e_entry->open_time.tv_sec == entry->time.tv_sec &&
e_entry->open_time.tv_usec == entry->time.tv_usec &&
@@ -202,7 +218,7 @@ int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx,
struct process_id pid = share->pid;
/* Check this process really exists. */
- if (kill(procid_to_pid(&pid), 0) == -1 && (errno == ESRCH)) {
+ if (kill(sharemodes_procid_to_pid(&pid), 0) == -1 && (errno == ESRCH)) {
continue; /* No longer exists. */
}
@@ -372,7 +388,7 @@ int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx,
struct process_id pid = share->pid;
/* Check this process really exists. */
- if (kill(procid_to_pid(&pid), 0) == -1 && (errno == ESRCH)) {
+ if (kill(sharemodes_procid_to_pid(&pid), 0) == -1 && (errno == ESRCH)) {
continue; /* No longer exists. */
}
@@ -447,7 +463,7 @@ int smb_change_share_mode_entry(struct smbdb_ctx *db_ctx,
struct process_id pid = share->pid;
/* Check this process really exists. */
- if (kill(procid_to_pid(&pid), 0) == -1 && (errno == ESRCH)) {
+ if (kill(sharemodes_procid_to_pid(&pid), 0) == -1 && (errno == ESRCH)) {
continue; /* No longer exists. */
}