From: sanket Date: Sat, 17 Apr 2010 14:14:25 +0000 (+0530) Subject: Adding osi_procname macro to different platforms X-Git-Tag: openafs-devel-1_5_74_1~10 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=2a8c554a4553c32359cecf268fd12029c9d6d85d Adding osi_procname macro to different platforms osi_procname(procname, size) is added to different platforms to obtain the processname in the string procname( preallocated ) with size size Change-Id: Iab8fed3e99839cee7c07a2de6144af9b09af3a57 Change-Id: Ib4e45564ae942e74c331444969a462427f5e7cf3 Reviewed-on: http://gerrit.openafs.org/1771 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/afs/AIX/osi_machdep.h b/src/afs/AIX/osi_machdep.h index 27f1e51..878bca6 100644 --- a/src/afs/AIX/osi_machdep.h +++ b/src/afs/AIX/osi_machdep.h @@ -80,4 +80,6 @@ extern simple_lock_data afs_global_lock; mutex_init(&afs_global_lock, "afs_global_lock", MUTEX_DEFAULT, NULL) #endif +#define osi_procname(procname, size) strncpy(procname, curproc->pi_comm, size) + #endif /* _OSI_MACHDEP_H_ */ diff --git a/src/afs/DARWIN/osi_machdep.h b/src/afs/DARWIN/osi_machdep.h index 31b6763..9e8a30f 100644 --- a/src/afs/DARWIN/osi_machdep.h +++ b/src/afs/DARWIN/osi_machdep.h @@ -251,4 +251,10 @@ extern int (**afs_vnodeop_p) (); # define SetAfsVnode(v) /* nothing; done in getnewvnode() */ #endif +#ifdef AFS_DARWIN80_ENV +#define osi_procname(procname, size) proc_selfname(procname, size) +#else +#define osi_procname(procname, size) strncpy(procname, curproc->p_comm, size) +#endif + #endif /* _OSI_MACHDEP_H_ */ diff --git a/src/afs/HPUX/osi_machdep.h b/src/afs/HPUX/osi_machdep.h index bbee67f..4b72209 100644 --- a/src/afs/HPUX/osi_machdep.h +++ b/src/afs/HPUX/osi_machdep.h @@ -119,4 +119,6 @@ extern caddr_t kmem_alloc(); #include #endif +#define osi_procname(procname, size) strncpy(procname, u.u_comm, size) + #endif /* _OSI_MACHDEP_H_ */ diff --git a/src/afs/IRIX/osi_machdep.h b/src/afs/IRIX/osi_machdep.h index 991146a..ba6432b 100644 --- a/src/afs/IRIX/osi_machdep.h +++ b/src/afs/IRIX/osi_machdep.h @@ -391,7 +391,7 @@ extern long afs_global_owner; #define OSI_VFS_CONVERT(V) struct vfs * V = (struct vfs*)bhvtovfs(bhv_##V) #endif /* AFS_SGI64_ENV */ - +#define osi_procname(procname, size) strncpy(procname, proc_name(curproc()), size) #endif /* _OSI_MACHDEP_H_ */ diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index f807ae2..f1dd158 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -364,4 +364,6 @@ do { \ #endif #endif +#define osi_procname(procname, size) strncpy(procname, current->comm, size) + #endif /* OSI_MACHDEP_H_ */ diff --git a/src/afs/LINUX24/osi_machdep.h b/src/afs/LINUX24/osi_machdep.h index 0f2de98..b448050 100644 --- a/src/afs/LINUX24/osi_machdep.h +++ b/src/afs/LINUX24/osi_machdep.h @@ -341,4 +341,6 @@ do { \ #endif #endif +#define osi_procname(procname, size) strncpy(procname, current->comm, size) + #endif /* OSI_MACHDEP_H_ */ diff --git a/src/afs/NBSD/osi_machdep.h b/src/afs/NBSD/osi_machdep.h index 6a2b4e7..8dc69c1 100644 --- a/src/afs/NBSD/osi_machdep.h +++ b/src/afs/NBSD/osi_machdep.h @@ -99,4 +99,6 @@ extern int (**afs_vnodeop_p) (); #define IsAfsVnode(v) ((v)->v_op == afs_vnodeop_p) #define SetAfsVnode(v) /* nothing; done in getnewvnode() */ +#define osi_procname(procname, size) strncpy(procname, curproc->p_comm, size) + #endif /* _OSI_MACHDEP_H_ */ diff --git a/src/afs/OBSD/osi_machdep.h b/src/afs/OBSD/osi_machdep.h index e1b9000..007fe41 100644 --- a/src/afs/OBSD/osi_machdep.h +++ b/src/afs/OBSD/osi_machdep.h @@ -242,4 +242,6 @@ extern int (**afs_vnodeop_p) (); #define IsAfsVnode(v) ((v)->v_op == afs_vnodeop_p) #define SetAfsVnode(v) /* nothing; done in getnewvnode() */ +#define osi_procname(procname, size) strncpy(procname, curproc->p_comm, size) + #endif /* _OSI_MACHDEP_H_ */ diff --git a/src/afs/SOLARIS/osi_machdep.h b/src/afs/SOLARIS/osi_machdep.h index 2400cc0..1e17748 100644 --- a/src/afs/SOLARIS/osi_machdep.h +++ b/src/afs/SOLARIS/osi_machdep.h @@ -127,4 +127,7 @@ struct afs_ifinfo { int metric; ipaddr_t dstaddr; }; + +#define osi_procname(procname, size) strncpy(procname, PTOU(ttoproc(curthread))->u_comm, size) + #endif /* _OSI_MACHDEP_H_ */ diff --git a/src/afs/UKERNEL/osi_machdep.h b/src/afs/UKERNEL/osi_machdep.h index 3da01db..8e2e5a4 100644 --- a/src/afs/UKERNEL/osi_machdep.h +++ b/src/afs/UKERNEL/osi_machdep.h @@ -87,4 +87,5 @@ extern int afs_suser(void *credp); #define getuerror(erval) get_user_struct()->u_error #define osi_curcred() get_user_struct()->u_cred +#define osi_procname(procname, size) strncpy(procname, "(unknown)", size) #endif /* _OSI_MACHDEP_H_ */