Use a wrapper for the link syscall that does name translations.

PR: 12749
Submitted by: Boris Nikolaus <boris@cs.tu-berlin.de>
This commit is contained in:
marcel 1999-08-12 19:53:33 +00:00
parent 0fdfbcb26f
commit 3e18cc5fc9
7 changed files with 54 additions and 11 deletions

View File

@ -1,4 +1,4 @@
$Id: syscalls.master,v 1.16 1998/12/30 20:58:28 sos Exp $
$Id: syscalls.master,v 1.17 1999/08/11 13:29:48 marcel Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
; System call name/number master file (or rather, slave, from LINUX).
@ -40,7 +40,7 @@
6 NOPROTO LINUX { int close(int fd); }
7 STD LINUX { int linux_waitpid(int pid, int *status, int options);}
8 STD LINUX { int linux_creat(char *path, int mode); }
9 NOPROTO LINUX { int link(char *path, char *link); }
9 STD LINUX { int linux_link(char *path, char *to); }
10 STD LINUX { int linux_unlink(char *path); }
11 STD LINUX { int linux_execve(char *path, char **argp, char **envp); }
12 STD LINUX { int linux_chdir(char *path); }

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_file.c,v 1.26 1999/05/11 19:54:19 phk Exp $
* $Id: linux_file.c,v 1.27 1999/07/18 14:31:01 phk Exp $
*/
#include "opt_compat.h"
@ -827,3 +827,22 @@ linux_truncate(struct proc *p, struct linux_truncate_args *args)
return truncate(p, &bsd);
}
int
linux_link(struct proc *p, struct linux_link_args *args)
{
struct link_args bsd;
caddr_t sg;
sg = stackgap_init();
CHECKALTEXIST(p, &sg, args->path);
CHECKALTCREAT(p, &sg, args->to);
#ifdef DEBUG
printf("Linux-emul(%d): link(%s, %s)\n", p->p_pid, args->path, args->to);
#endif
bsd.path = args->path;
bsd.link = args->to;
return link(p, &bsd);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_file.c,v 1.26 1999/05/11 19:54:19 phk Exp $
* $Id: linux_file.c,v 1.27 1999/07/18 14:31:01 phk Exp $
*/
#include "opt_compat.h"
@ -827,3 +827,22 @@ linux_truncate(struct proc *p, struct linux_truncate_args *args)
return truncate(p, &bsd);
}
int
linux_link(struct proc *p, struct linux_link_args *args)
{
struct link_args bsd;
caddr_t sg;
sg = stackgap_init();
CHECKALTEXIST(p, &sg, args->path);
CHECKALTCREAT(p, &sg, args->to);
#ifdef DEBUG
printf("Linux-emul(%d): link(%s, %s)\n", p->p_pid, args->path, args->to);
#endif
bsd.path = args->path;
bsd.link = args->to;
return link(p, &bsd);
}

View File

@ -2,7 +2,7 @@
* System call prototypes.
*
* DO NOT EDIT-- this file is automatically generated.
* created from Id: syscalls.master,v 1.17 1999/08/11 13:29:48 marcel Exp
* created from Id: syscalls.master,v 1.18 1999/08/12 19:51:03 marcel Exp
*/
#ifndef _LINUX_SYSPROTO_H_
@ -35,6 +35,10 @@ struct linux_creat_args {
char * path; char path_[PAD_(char *)];
int mode; char mode_[PAD_(int)];
};
struct linux_link_args {
char * path; char path_[PAD_(char *)];
char * to; char to_[PAD_(char *)];
};
struct linux_unlink_args {
char * path; char path_[PAD_(char *)];
};
@ -400,6 +404,7 @@ int linux_fork __P((struct proc *, struct linux_fork_args *));
int linux_open __P((struct proc *, struct linux_open_args *));
int linux_waitpid __P((struct proc *, struct linux_waitpid_args *));
int linux_creat __P((struct proc *, struct linux_creat_args *));
int linux_link __P((struct proc *, struct linux_link_args *));
int linux_unlink __P((struct proc *, struct linux_unlink_args *));
int linux_execve __P((struct proc *, struct linux_execve_args *));
int linux_chdir __P((struct proc *, struct linux_chdir_args *));

View File

@ -2,7 +2,7 @@
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
* created from Id: syscalls.master,v 1.17 1999/08/11 13:29:48 marcel Exp
* created from Id: syscalls.master,v 1.18 1999/08/12 19:51:03 marcel Exp
*/
#define LINUX_SYS_linux_setup 0
@ -14,7 +14,7 @@
#define LINUX_SYS_close 6
#define LINUX_SYS_linux_waitpid 7
#define LINUX_SYS_linux_creat 8
#define LINUX_SYS_link 9
#define LINUX_SYS_linux_link 9
#define LINUX_SYS_linux_unlink 10
#define LINUX_SYS_linux_execve 11
#define LINUX_SYS_linux_chdir 12

View File

@ -2,7 +2,7 @@
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
* created from Id: syscalls.master,v 1.17 1999/08/11 13:29:48 marcel Exp
* created from Id: syscalls.master,v 1.18 1999/08/12 19:51:03 marcel Exp
*/
#include "opt_compat.h"
@ -23,7 +23,7 @@ struct sysent linux_sysent[] = {
{ 1, (sy_call_t *)close }, /* 6 = close */
{ 3, (sy_call_t *)linux_waitpid }, /* 7 = linux_waitpid */
{ 2, (sy_call_t *)linux_creat }, /* 8 = linux_creat */
{ 2, (sy_call_t *)link }, /* 9 = link */
{ 2, (sy_call_t *)linux_link }, /* 9 = linux_link */
{ 1, (sy_call_t *)linux_unlink }, /* 10 = linux_unlink */
{ 3, (sy_call_t *)linux_execve }, /* 11 = linux_execve */
{ 1, (sy_call_t *)linux_chdir }, /* 12 = linux_chdir */

View File

@ -1,4 +1,4 @@
$Id: syscalls.master,v 1.16 1998/12/30 20:58:28 sos Exp $
$Id: syscalls.master,v 1.17 1999/08/11 13:29:48 marcel Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
; System call name/number master file (or rather, slave, from LINUX).
@ -40,7 +40,7 @@
6 NOPROTO LINUX { int close(int fd); }
7 STD LINUX { int linux_waitpid(int pid, int *status, int options);}
8 STD LINUX { int linux_creat(char *path, int mode); }
9 NOPROTO LINUX { int link(char *path, char *link); }
9 STD LINUX { int linux_link(char *path, char *to); }
10 STD LINUX { int linux_unlink(char *path); }
11 STD LINUX { int linux_execve(char *path, char **argp, char **envp); }
12 STD LINUX { int linux_chdir(char *path); }