Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143395643
D3039.id6821.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D3039.id6821.diff
View Options
Index: sys/kern/init_sysent.c
===================================================================
--- sys/kern/init_sysent.c
+++ sys/kern/init_sysent.c
@@ -174,7 +174,7 @@
{ AS(flock_args), (sy_call_t *)sys_flock, AUE_FLOCK, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 131 = flock */
{ AS(mkfifo_args), (sy_call_t *)sys_mkfifo, AUE_MKFIFO, NULL, 0, 0, 0, SY_THR_STATIC }, /* 132 = mkfifo */
{ AS(sendto_args), (sy_call_t *)sys_sendto, AUE_SENDTO, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 133 = sendto */
- { AS(shutdown_args), (sy_call_t *)sys_shutdown, AUE_SHUTDOWN, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 134 = shutdown */
+ { AS(oshutdown_args), (sy_call_t *)sys_oshutdown, AUE_SHUTDOWN, NULL, 0, 0, 0, SY_THR_STATIC }, /* 134 = oshutdown */
{ AS(socketpair_args), (sy_call_t *)sys_socketpair, AUE_SOCKETPAIR, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 135 = socketpair */
{ AS(mkdir_args), (sy_call_t *)sys_mkdir, AUE_MKDIR, NULL, 0, 0, 0, SY_THR_STATIC }, /* 136 = mkdir */
{ AS(rmdir_args), (sy_call_t *)sys_rmdir, AUE_RMDIR, NULL, 0, 0, 0, SY_THR_STATIC }, /* 137 = rmdir */
@@ -588,4 +588,5 @@
{ AS(ppoll_args), (sy_call_t *)sys_ppoll, AUE_POLL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 545 = ppoll */
{ AS(futimens_args), (sy_call_t *)sys_futimens, AUE_FUTIMES, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 546 = futimens */
{ AS(utimensat_args), (sy_call_t *)sys_utimensat, AUE_FUTIMESAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 547 = utimensat */
+ { AS(shutdown_args), (sy_call_t *)sys_shutdown, AUE_SHUTDOWN, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 548 = shutdown */
};
Index: sys/kern/syscalls.c
===================================================================
--- sys/kern/syscalls.c
+++ sys/kern/syscalls.c
@@ -141,7 +141,7 @@
"flock", /* 131 = flock */
"mkfifo", /* 132 = mkfifo */
"sendto", /* 133 = sendto */
- "shutdown", /* 134 = shutdown */
+ "oshutdown", /* 134 = oshutdown */
"socketpair", /* 135 = socketpair */
"mkdir", /* 136 = mkdir */
"rmdir", /* 137 = rmdir */
@@ -555,4 +555,5 @@
"ppoll", /* 545 = ppoll */
"futimens", /* 546 = futimens */
"utimensat", /* 547 = utimensat */
+ "shutdown", /* 548 = shutdown */
};
Index: sys/kern/syscalls.master
===================================================================
--- sys/kern/syscalls.master
+++ sys/kern/syscalls.master
@@ -273,7 +273,7 @@
132 AUE_MKFIFO STD { int mkfifo(char *path, int mode); }
133 AUE_SENDTO STD { int sendto(int s, caddr_t buf, size_t len, \
int flags, caddr_t to, int tolen); }
-134 AUE_SHUTDOWN STD { int shutdown(int s, int how); }
+134 AUE_SHUTDOWN STD { int oshutdown(int s, int how); }
135 AUE_SOCKETPAIR STD { int socketpair(int domain, int type, \
int protocol, int *rsv); }
136 AUE_MKDIR STD { int mkdir(char *path, int mode); }
@@ -988,5 +988,6 @@
547 AUE_FUTIMESAT STD { int utimensat(int fd, \
char *path, \
struct timespec *times, int flag); }
+548 AUE_SHUTDOWN STD { int shutdown(int s, int how); }
; Please copy any additions and changes to the following compatability tables:
; sys/compat/freebsd32/syscalls.master
Index: sys/kern/systrace_args.c
===================================================================
--- sys/kern/systrace_args.c
+++ sys/kern/systrace_args.c
@@ -766,9 +766,9 @@
*n_args = 6;
break;
}
- /* shutdown */
+ /* oshutdown */
case 134: {
- struct shutdown_args *p = params;
+ struct oshutdown_args *p = params;
iarg[0] = p->s; /* int */
iarg[1] = p->how; /* int */
*n_args = 2;
@@ -3337,6 +3337,14 @@
*n_args = 4;
break;
}
+ /* shutdown */
+ case 548: {
+ struct shutdown_args *p = params;
+ iarg[0] = p->s; /* int */
+ iarg[1] = p->how; /* int */
+ *n_args = 2;
+ break;
+ }
default:
*n_args = 0;
break;
@@ -4554,7 +4562,7 @@
break;
};
break;
- /* shutdown */
+ /* oshutdown */
case 134:
switch(ndx) {
case 0:
@@ -8883,6 +8891,19 @@
break;
};
break;
+ /* shutdown */
+ case 548:
+ switch(ndx) {
+ case 0:
+ p = "int";
+ break;
+ case 1:
+ p = "int";
+ break;
+ default:
+ break;
+ };
+ break;
default:
break;
};
@@ -9330,7 +9351,7 @@
if (ndx == 0 || ndx == 1)
p = "int";
break;
- /* shutdown */
+ /* oshutdown */
case 134:
if (ndx == 0 || ndx == 1)
p = "int";
@@ -10806,6 +10827,11 @@
if (ndx == 0 || ndx == 1)
p = "int";
break;
+ /* shutdown */
+ case 548:
+ if (ndx == 0 || ndx == 1)
+ p = "int";
+ break;
default:
break;
};
Index: sys/kern/uipc_socket.c
===================================================================
--- sys/kern/uipc_socket.c
+++ sys/kern/uipc_socket.c
@@ -2334,6 +2334,9 @@
if (!(how == SHUT_RD || how == SHUT_WR || how == SHUT_RDWR))
return (EINVAL);
+ if ((so->so_state &
+ (SS_ISCONNECTED | SS_ISCONNECTING | SS_ISDISCONNECTING)) == 0)
+ return (ENOTCONN);
CURVNET_SET(so->so_vnet);
if (pr->pr_usrreqs->pru_flush != NULL)
Index: sys/kern/uipc_syscalls.c
===================================================================
--- sys/kern/uipc_syscalls.c
+++ sys/kern/uipc_syscalls.c
@@ -1363,6 +1363,25 @@
return (error);
}
+/*
+ * The old shutdown() system call did not return ENOTCONN, but 0 in case
+ * the socket was not connected. Some important programs like syslogd up
+ * to r279016, 2015-02-19, still depend on this behavior.
+ */
+int
+sys_oshutdown(struct thread *td, struct oshutdown_args *uap)
+{
+ struct shutdown_args nuap;
+ int error;
+
+ nuap.s = uap->s;
+ nuap.how = uap->how;
+ error = sys_shutdown(td, &nuap);
+ if (error == ENOTCONN)
+ error = 0;
+ return (error);
+}
+
/* ARGSUSED */
int
sys_shutdown(td, uap)
Index: sys/sys/syscall.h
===================================================================
--- sys/sys/syscall.h
+++ sys/sys/syscall.h
@@ -137,7 +137,7 @@
#define SYS_flock 131
#define SYS_mkfifo 132
#define SYS_sendto 133
-#define SYS_shutdown 134
+#define SYS_oshutdown 134
#define SYS_socketpair 135
#define SYS_mkdir 136
#define SYS_rmdir 137
@@ -465,4 +465,5 @@
#define SYS_ppoll 545
#define SYS_futimens 546
#define SYS_utimensat 547
-#define SYS_MAXSYSCALL 548
+#define SYS_shutdown 548
+#define SYS_MAXSYSCALL 549
Index: sys/sys/syscall.mk
===================================================================
--- sys/sys/syscall.mk
+++ sys/sys/syscall.mk
@@ -99,7 +99,7 @@
flock.o \
mkfifo.o \
sendto.o \
- shutdown.o \
+ oshutdown.o \
socketpair.o \
mkdir.o \
rmdir.o \
@@ -412,4 +412,5 @@
procctl.o \
ppoll.o \
futimens.o \
- utimensat.o
+ utimensat.o \
+ shutdown.o
Index: sys/sys/sysproto.h
===================================================================
--- sys/sys/sysproto.h
+++ sys/sys/sysproto.h
@@ -444,7 +444,7 @@
char to_l_[PADL_(caddr_t)]; caddr_t to; char to_r_[PADR_(caddr_t)];
char tolen_l_[PADL_(int)]; int tolen; char tolen_r_[PADR_(int)];
};
-struct shutdown_args {
+struct oshutdown_args {
char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
char how_l_[PADL_(int)]; int how; char how_r_[PADR_(int)];
};
@@ -1790,6 +1790,10 @@
char times_l_[PADL_(struct timespec *)]; struct timespec * times; char times_r_[PADR_(struct timespec *)];
char flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];
};
+struct shutdown_args {
+ char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];
+ char how_l_[PADL_(int)]; int how; char how_r_[PADR_(int)];
+};
int nosys(struct thread *, struct nosys_args *);
void sys_sys_exit(struct thread *, struct sys_exit_args *);
int sys_fork(struct thread *, struct fork_args *);
@@ -1885,7 +1889,7 @@
int sys_flock(struct thread *, struct flock_args *);
int sys_mkfifo(struct thread *, struct mkfifo_args *);
int sys_sendto(struct thread *, struct sendto_args *);
-int sys_shutdown(struct thread *, struct shutdown_args *);
+int sys_oshutdown(struct thread *, struct oshutdown_args *);
int sys_socketpair(struct thread *, struct socketpair_args *);
int sys_mkdir(struct thread *, struct mkdir_args *);
int sys_rmdir(struct thread *, struct rmdir_args *);
@@ -2178,6 +2182,7 @@
int sys_ppoll(struct thread *, struct ppoll_args *);
int sys_futimens(struct thread *, struct futimens_args *);
int sys_utimensat(struct thread *, struct utimensat_args *);
+int sys_shutdown(struct thread *, struct shutdown_args *);
#ifdef COMPAT_43
@@ -2611,7 +2616,7 @@
#define SYS_AUE_flock AUE_FLOCK
#define SYS_AUE_mkfifo AUE_MKFIFO
#define SYS_AUE_sendto AUE_SENDTO
-#define SYS_AUE_shutdown AUE_SHUTDOWN
+#define SYS_AUE_oshutdown AUE_SHUTDOWN
#define SYS_AUE_socketpair AUE_SOCKETPAIR
#define SYS_AUE_mkdir AUE_MKDIR
#define SYS_AUE_rmdir AUE_RMDIR
@@ -2931,6 +2936,7 @@
#define SYS_AUE_ppoll AUE_POLL
#define SYS_AUE_futimens AUE_FUTIMES
#define SYS_AUE_utimensat AUE_FUTIMESAT
+#define SYS_AUE_shutdown AUE_SHUTDOWN
#undef PAD_
#undef PADL_
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 30, 10:17 PM (7 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28104770
Default Alt Text
D3039.id6821.diff (8 KB)
Attached To
Mode
D3039: Make shutdown() return ENOTCONN as required by POSIX, part deux.
Attached
Detach File
Event Timeline
Log In to Comment