Whamcloud - gitweb
- merge 0.7rc1 from b_devel to HEAD (20030612 merge point)
[fs/lustre-release.git] / lustre / portals / portals / lib-pid.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * lib/lib-pid.c
5  *
6  * Process identification routines
7  * Copyright (C) 2001-2003 Cluster File Systems, Inc.
8  * Copyright (C) 2001-2003 Cluster File Systems, Inc.
9  *
10  *
11  *   This file is part of Lustre, http://www.sf.net/projects/lustre/
12  *
13  *   Lustre is free software; you can redistribute it and/or
14  *   modify it under the terms of version 2 of the GNU General Public
15  *   License as published by the Free Software Foundation.
16  *
17  *   Lustre is distributed in the hope that it will be useful,
18  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
19  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  *   GNU General Public License for more details.
21  *
22  *   You should have received a copy of the GNU General Public License
23  *   along with Lustre; if not, write to the Free Software
24  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  */
26
27 /* This should be removed.  The NAL should have the PID information */
28 #define DEBUG_SUBSYSTEM S_PORTALS
29
30 #if defined (__KERNEL__)
31 #       include <linux/kernel.h>
32 extern int getpid(void);
33 #else
34 #       include <stdio.h>
35 #       include <unistd.h>
36 #endif
37 #include <portals/lib-p30.h>
38 #include <portals/arg-blocks.h>
39
40 int do_PtlGetId(nal_cb_t * nal, void *private, void *v_args, void *v_ret)
41 {
42         /*
43          * Incoming:
44          *      ptl_handle_ni_t handle_in
45          *
46          * Outgoing:
47          *      ptl_process_id_t        * id_out
48          *      ptl_id_t                * gsize_out
49          */
50
51         PtlGetId_out *ret = v_ret;
52         lib_ni_t *ni = &nal->ni;
53
54         ret->id_out.nid = ni->nid;
55         ret->id_out.pid = ni->pid;
56
57         return ret->rc = PTL_OK;
58 }