5 #include <minix/callnr.h>
6 #include <minix/endpoint.h>
8 #include <sys/select.h>
13 #include <minix/vfsif.h>
17 /*===========================================================================*
19 *===========================================================================*/
20 PUBLIC
int fs_pipe(void)
24 /* Get caller's user and group id from the request */
25 caller_uid
= fs_m_in
.REQ_UID
;
26 caller_gid
= fs_m_in
.REQ_GID
;
28 /* Try to allocate the inode */
29 if ( (rip
= alloc_inode(fs_dev
, I_REGULAR
) ) == NIL_INODE
) {
33 /* !!! already checked in alloc_inode
34 if (read_only(rip) != OK)
35 panic(__FILE__,"pipe device is read only", NO_NUM);
38 /* Fill in the fields of the inode */
40 rip
->i_mode
&= ~I_REGULAR
;
41 rip
->i_mode
|= I_NAMED_PIPE
; /* pipes and FIFOs have this bit set */
43 /* We'll need it twice, nothing can go wrong here */
45 rw_inode(rip
, WRITING
); /* mark inode as allocated */
46 rip
->i_update
= ATIME
| CTIME
| MTIME
;
48 /* Fill in the fields of the response message */
49 fs_m_out
.m_source
= fs_dev
; /* filled with FS endpoint by the system */
50 fs_m_out
.RES_INODE_NR
= rip
->i_num
;
51 fs_m_out
.RES_MODE
= rip
->i_mode
;
52 fs_m_out
.RES_INODE_INDEX
= (rip
- &inode
[0]) / sizeof(struct inode
);